Reads an ontological style description and formats it to GeoJSONCSS.
String formatGeometry |
( |
String |
geometrytype, |
|
|
StyleObject |
styleobj |
|
) |
| |
Formats a geometry according to a given geometrytype using information from a given styleobj.
- Parameters
-
geometrytype | the geometry |
styleobj | the styleobject to use for formatting |
- Returns
- the formatString to use for styling
Reimplemented from ResultStyleFormatter.
59 if(geometrytype.contains(
"Point")) {
61 if(styleobj.pointImage!=
null) {
62 JSONObject iconobj=
new JSONObject();
63 if(styleobj.pointImage.contains(
"svg")) {
64 iconobj.put(
"iconUrl",
"url('data:image/svg+xml;utf8,"+styleobj.pointImage+
"')");
65 }
else if(styleobj.pointImage.contains(
"http")) {
66 iconobj.put(
"iconUrl", styleobj.pointImage);
68 iconobj.put(
"iconUrl", styleobj.pointImage);
70 JSONArray size=
new JSONArray();
73 JSONArray anchor=
new JSONArray();
76 iconobj.put(
"iconSize",size);
77 iconobj.put(
"iconAnchor", anchor);
78 props.put(
"icon", iconobj);
80 System.out.println(props.toString());
81 return props.toString();
83 if(geometrytype.contains(
"LineString")) {
85 if(styleobj.lineStringImage!=
null) {
86 JSONObject iconobj=
new JSONObject();
87 if(styleobj.lineStringImage.contains(
"svg")) {
88 iconobj.put(
"iconUrl",
"url('data:image/svg+xml;utf8,"+styleobj.lineStringImage+
"')");
89 }
else if(styleobj.lineStringImage.contains(
"http")) {
90 iconobj.put(
"iconUrl", styleobj.lineStringImage);
92 iconobj.put(
"iconUrl", styleobj.lineStringImage);
94 JSONArray size=
new JSONArray();
97 JSONArray anchor=
new JSONArray();
100 iconobj.put(
"iconSize",size);
101 iconobj.put(
"iconAnchor", anchor);
102 props.put(
"icon", iconobj);
104 if(styleobj.hatch!=
null) {
106 props.put(
"hatch",hatch);
108 System.out.println(props);
109 return props.toString();
111 if(geometrytype.contains(
"Polygon")) {
113 if(styleobj.polygonImage!=
null) {
114 JSONObject iconobj=
new JSONObject();
115 if(styleobj.polygonImage.contains(
"svg")) {
116 iconobj.put(
"iconUrl",
"url('data:image/svg+xml;utf8,"+styleobj.polygonImage+
"')");
117 }
else if(styleobj.polygonImage.contains(
"http")) {
118 iconobj.put(
"iconUrl", styleobj.polygonImage);
120 iconobj.put(
"iconUrl", styleobj.polygonImage);
122 JSONArray size=
new JSONArray();
125 JSONArray anchor=
new JSONArray();
128 iconobj.put(
"iconSize",size);
129 iconobj.put(
"iconAnchor", anchor);
130 props.put(
"icon", iconobj);
132 if(styleobj.hatch!=
null) {
134 props.put(
"hatch",hatch);
136 System.out.println(props);
137 return props.toString();
JSONObject cssLiteralToJSON(String cssString)
Converts a CSS literal given in the ontology to a JSON representation.
Definition: GeoJSONCSSFormatter.java:32
References GeoJSONCSSFormatter.cssLiteralToJSON(), StyleObject.hatch, StyleObject.lineStringImage, StyleObject.lineStringStyle, StyleObject.pointImage, StyleObject.pointStyle, StyleObject.polygonImage, and StyleObject.polygonStyle.