use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class CartographicLineSymbol method convert.
/**
* Convert.
*
* @param rule the rule
* @param element the element
* @param layerName the layer name
* @param transparency the transparency
*/
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if (rule == null)
return;
if (element == null)
return;
JsonObject obj = element.getAsJsonObject();
List<Symbolizer> symbolizerList = rule.symbolizers();
List<Stroke> strokeList = convert(obj);
Stroke stroke = null;
if (!strokeList.isEmpty()) {
stroke = strokeList.get(0);
}
LineSymbolizer lineSymbolizer = styleFactory.createLineSymbolizer(stroke, null);
symbolizerList.add(lineSymbolizer);
}
use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class MultiLayerFillSymbol method convert.
/* (non-Javadoc)
* @see com.sldeditor.convert.esri.symbols.EsriSymbolInterface#convert(Rule, JsonElement)
*/
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if (rule == null)
return;
if (element == null)
return;
JsonArray layerArray = element.getAsJsonArray();
List<Symbolizer> symbolizerList = rule.symbolizers();
if (layerArray.size() > 0) {
for (int index = 0; index < layerArray.size(); index++) {
JsonObject obj = layerArray.get(index).getAsJsonObject();
// Handle fills
List<Symbolizer> createdSymbolizerList = SymbolManager.getInstance().getFillSymbol(layerName, obj.get(MultiLayerFillSymbolKeys.FILL), transparency);
if (symbolizerList != null) {
symbolizerList.addAll(createdSymbolizerList);
}
// Handle strokes
JsonElement jsonOutlineElement = obj.get(MultiLayerFillSymbolKeys.OUTLINE);
List<Stroke> strokeList = SymbolManager.getInstance().getStrokeList(jsonOutlineElement);
if (strokeList != null) {
List<Symbolizer> createdLineSymbolizerList = new ArrayList<Symbolizer>();
for (Stroke stroke : strokeList) {
LineSymbolizer lineSymbol = styleFactory.createLineSymbolizer();
lineSymbol.setStroke(stroke);
createdLineSymbolizerList.add(lineSymbol);
}
symbolizerList.addAll(createdLineSymbolizerList);
}
}
}
}
use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class MultiLayerLineSymbol method convert.
/**
* Convert.
*
* @param rule the rule
* @param element the element
* @param layerName the layer name
* @param transparency the transparency
*/
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if (rule == null)
return;
if (element == null)
return;
JsonArray layerArray = element.getAsJsonArray();
List<Symbolizer> symbolizerList = rule.symbolizers();
if (layerArray.size() > 0) {
for (int index = 0; index < layerArray.size(); index++) {
JsonObject obj = layerArray.get(index).getAsJsonObject();
List<Stroke> strokeList = null;
JsonElement jsonOutlineElement = obj.get(MultiLayerLineSymbolKeys.LINE);
strokeList = SymbolManager.getInstance().getStrokeList(jsonOutlineElement);
if (strokeList != null) {
for (Stroke stroke : strokeList) {
LineSymbolizer lineSymbolizer = styleFactory.createLineSymbolizer(stroke, null);
symbolizerList.add(lineSymbolizer);
}
}
}
}
}
use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class MultiLayerMarkerSymbol method convert.
/**
* Convert.
*
* @param rule the rule
* @param element the element
* @param layerName the layer name
* @param transparency the transparency
*/
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if (rule == null)
return;
if (element == null)
return;
JsonArray layerArray = element.getAsJsonArray();
List<Symbolizer> symbolizerList = rule.symbolizers();
if (layerArray.size() > 0) {
for (int index = 0; index < layerArray.size(); index++) {
JsonObject obj = layerArray.get(index).getAsJsonObject();
JsonElement jsonElement = obj.get(MultiLayerMarkerSymbolKeys.MARKER);
if (jsonElement != null) {
JsonObject asJsonObject = jsonElement.getAsJsonObject();
if (asJsonObject != null) {
List<Graphic> markerList = SymbolManager.getInstance().getMarkerList(asJsonObject);
if (markerList != null) {
for (Graphic marker : markerList) {
PointSymbolizer pointSymbolizer = styleFactory.createPointSymbolizer(marker, null);
symbolizerList.add(pointSymbolizer);
}
}
}
}
}
}
}
use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class PictureFillSymbol method convertToFill.
/* (non-Javadoc)
* @see com.sldeditor.convert.esri.symbols.EsriFillSymbolInterface#convertToFill(java.lang.String, com.google.gson.JsonElement, int)
*/
@Override
public List<Symbolizer> convertToFill(String layerName, JsonElement element, int transparency) {
if (element == null)
return null;
JsonObject obj = element.getAsJsonObject();
List<Symbolizer> symbolizerList = new ArrayList<Symbolizer>();
Fill fill = getFill(layerName, obj, transparency);
PolygonSymbolizer polygon = styleFactory.createPolygonSymbolizer();
polygon.setStroke(null);
polygon.setFill(fill);
symbolizerList.add(polygon);
return symbolizerList;
}
Aggregations