use of org.geotools.styling.Symbolizer in project sldeditor by robward-scisys.
the class SimpleLineSymbol method convert.
/* (non-Javadoc)
* @see com.sldeditor.convert.esri.symbols.EsriSymbolInterface#convert(org.geotools.styling.Rule, com.google.gson.JsonElement, java.lang.String, int)
*/
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if (element == null)
return;
if (rule == null)
return;
JsonObject obj = element.getAsJsonObject();
@SuppressWarnings("unused") int style = getInt(obj, CommonSymbolKeys.STYLE);
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 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 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 SimpleFillSymbol method convert.
/* (non-Javadoc)
* @see com.sldeditor.convert.esri.symbols.EsriSymbolInterface#convert(org.geotools.styling.Rule, com.google.gson.JsonElement, java.lang.String, int)
*/
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if (element == null)
return;
if (rule == null)
return;
JsonObject obj = element.getAsJsonObject();
@SuppressWarnings("unused") int style = getInt(obj, CommonSymbolKeys.STYLE);
List<Symbolizer> symbolizerList = rule.symbolizers();
JsonElement jsonOutlineElement = obj.get(SimpleFillSymbolKeys.OUTLINE);
List<Stroke> strokeList = SymbolManager.getInstance().getStrokeList(jsonOutlineElement);
Stroke stroke = null;
if (strokeList != null) {
if (!strokeList.isEmpty()) {
stroke = strokeList.get(0);
}
}
Expression fillColour = getColour(obj.get(SimpleFillSymbolKeys.FILL_COLOUR));
Fill fill = null;
if (fillColour != null) {
fill = styleFactory.createFill(fillColour, getTransparency(transparency));
}
PolygonSymbolizer polygonSymbolizer = styleFactory.createPolygonSymbolizer(stroke, fill, null);
symbolizerList.add(polygonSymbolizer);
}
Aggregations