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.
98 if(geometrytype.contains(
"Point")) {
100 if(styleobj.pointImage!=
null) {
101 JSONObject iconobj=
new JSONObject();
102 if(styleobj.pointImage.contains(
"svg")) {
103 iconobj.put(
"iconUrl",
"url('data:image/svg+xml;utf8,"+styleobj.pointImage+
"')");
104 }
else if(styleobj.pointImage.contains(
"http")) {
105 iconobj.put(
"iconUrl", styleobj.pointImage);
107 iconobj.put(
"iconUrl", styleobj.pointImage);
109 JSONArray size=
new JSONArray();
112 JSONArray anchor=
new JSONArray();
115 iconobj.put(
"iconSize",size);
116 iconobj.put(
"iconAnchor", anchor);
117 props.put(
"icon", iconobj);
119 System.out.println(props.toString());
120 return props.toString();
122 if(geometrytype.contains(
"LineString")) {
124 if(styleobj.lineStringImage!=
null) {
125 JSONObject iconobj=
new JSONObject();
126 if(styleobj.lineStringImage.contains(
"svg")) {
127 iconobj.put(
"iconUrl",
"url('data:image/svg+xml;utf8,"+styleobj.lineStringImage+
"')");
128 }
else if(styleobj.lineStringImage.contains(
"http")) {
129 iconobj.put(
"iconUrl", styleobj.lineStringImage);
131 iconobj.put(
"iconUrl", styleobj.lineStringImage);
133 JSONArray size=
new JSONArray();
136 JSONArray anchor=
new JSONArray();
139 iconobj.put(
"iconSize",size);
140 iconobj.put(
"iconAnchor", anchor);
141 props.put(
"icon", iconobj);
143 if(styleobj.hatch!=
null) {
145 props.put(
"hatch",hatch);
147 System.out.println(props);
148 return props.toString();
150 if(geometrytype.contains(
"Polygon")) {
152 if(styleobj.polygonImage!=
null) {
153 JSONObject iconobj=
new JSONObject();
154 if(styleobj.polygonImage.contains(
"svg")) {
155 iconobj.put(
"iconUrl",
"url('data:image/svg+xml;utf8,"+styleobj.polygonImage+
"')");
156 }
else if(styleobj.polygonImage.contains(
"http")) {
157 iconobj.put(
"iconUrl", styleobj.polygonImage);
159 iconobj.put(
"iconUrl", styleobj.polygonImage);
161 JSONArray size=
new JSONArray();
164 JSONArray anchor=
new JSONArray();
167 iconobj.put(
"iconSize",size);
168 iconobj.put(
"iconAnchor", anchor);
169 props.put(
"icon", iconobj);
171 if(styleobj.hatch!=
null) {
173 props.put(
"hatch",hatch);
175 System.out.println(props);
176 return props.toString();
JSONObject cssLiteralToJSON(String cssString)
Converts a CSS literal given in the ontology to a JSON representation.
Definition: GeoJSONCSSFormatter.java:46
References GeoJSONCSSFormatter.cssLiteralToJSON(), StyleObject.hatch, StyleObject.lineStringImage, StyleObject.lineStringStyle, StyleObject.pointImage, StyleObject.pointStyle, StyleObject.polygonImage, and StyleObject.polygonStyle.
Referenced by GeoJSONCSSFormatter.formatForWebView(), and AbstractGeoJSONWriter.prepareGeoJSONString().