Reads an ontological style description and formats it according to the mapbox simple style specification.
More...
Reads an ontological style description and formats it according to the mapbox simple style specification.
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.
60 if(geometrytype.contains(
"Point")) {
62 if(styleobj.pointImage!=
null) {
63 JSONObject iconobj=
new JSONObject();
64 if(styleobj.pointImage.contains(
"svg")) {
65 iconobj.put(
"iconUrl",
"url('data:image/svg+xml;utf8,"+styleobj.pointImage+
"')");
66 }
else if(styleobj.pointImage.contains(
"http")) {
67 iconobj.put(
"iconUrl", styleobj.pointImage);
69 iconobj.put(
"iconUrl", styleobj.pointImage);
71 JSONArray size=
new JSONArray();
74 JSONArray anchor=
new JSONArray();
77 iconobj.put(
"iconSize",size);
78 iconobj.put(
"iconAnchor", anchor);
79 props.put(
"icon", iconobj);
81 System.out.println(props.toString());
82 return props.toString();
84 if(geometrytype.contains(
"LineString")) {
86 if(styleobj.lineStringImage!=
null) {
87 JSONObject iconobj=
new JSONObject();
88 if(styleobj.lineStringImage.contains(
"svg")) {
89 iconobj.put(
"iconUrl",
"url('data:image/svg+xml;utf8,"+styleobj.lineStringImage+
"')");
90 }
else if(styleobj.lineStringImage.contains(
"http")) {
91 iconobj.put(
"iconUrl", styleobj.lineStringImage);
93 iconobj.put(
"iconUrl", styleobj.lineStringImage);
95 JSONArray size=
new JSONArray();
98 JSONArray anchor=
new JSONArray();
101 iconobj.put(
"iconSize",size);
102 iconobj.put(
"iconAnchor", anchor);
103 props.put(
"icon", iconobj);
105 if(styleobj.hatch!=
null) {
107 props.put(
"hatch",hatch);
109 System.out.println(props);
110 return props.toString();
112 if(geometrytype.contains(
"Polygon")) {
114 if(styleobj.polygonImage!=
null) {
115 JSONObject iconobj=
new JSONObject();
116 if(styleobj.polygonImage.contains(
"svg")) {
117 iconobj.put(
"iconUrl",
"url('data:image/svg+xml;utf8,"+styleobj.polygonImage+
"')");
118 }
else if(styleobj.polygonImage.contains(
"http")) {
119 iconobj.put(
"iconUrl", styleobj.polygonImage);
121 iconobj.put(
"iconUrl", styleobj.polygonImage);
123 JSONArray size=
new JSONArray();
126 JSONArray anchor=
new JSONArray();
129 iconobj.put(
"iconSize",size);
130 iconobj.put(
"iconAnchor", anchor);
131 props.put(
"icon", iconobj);
133 if(styleobj.hatch!=
null) {
135 props.put(
"hatch",hatch);
137 System.out.println(props);
138 return props.toString();
JSONObject cssLiteralToJSON(String cssString)
Converts a CSS literal given in the ontology to a JSON representation.
Definition: SimpleStyleFormatter.java:27
References SimpleStyleFormatter.cssLiteralToJSON(), StyleObject.hatch, StyleObject.lineStringImage, StyleObject.lineStringStyle, StyleObject.pointImage, StyleObject.pointStyle, StyleObject.polygonImage, and StyleObject.polygonStyle.