use of com.sldeditor.exportdata.esri.label.EsriLabelRendererInterface in project sldeditor by robward-scisys.
the class MXDParser method processLabelRenderer.
/**
* Gets the label renderer.
*
* @param sld the sld
* @param labelRenderArrayElement the label render array element
* @param transparency the transparency
*/
private void processLabelRenderer(StyledLayerDescriptor sld, JsonArray labelRenderArrayElement, int transparency) {
if (sld != null) {
if (labelRenderArrayElement != null) {
List<StyledLayer> styledLayers = sld.layers();
if (!styledLayers.isEmpty()) {
if (styledLayers.get(0) instanceof NamedLayer) {
NamedLayer namedLayer = (NamedLayer) styledLayers.get(0);
List<Style> styleList = namedLayer.styles();
if (!styleList.isEmpty()) {
List<FeatureTypeStyle> ftsList = styleList.get(0).featureTypeStyles();
if (!ftsList.isEmpty()) {
List<Rule> ruleList = ftsList.get(0).rules();
List<Rule> newLabelRuleList = new ArrayList<Rule>();
for (int index = 0; index < labelRenderArrayElement.size(); index++) {
JsonElement labelRenderElement = labelRenderArrayElement.get(index);
JsonObject renderer = labelRenderElement.getAsJsonObject();
boolean found = false;
for (String labelRendererType : labelRendererMap.keySet()) {
JsonElement obj = renderer.get(labelRendererType);
if (obj != null) {
EsriLabelRendererInterface esriLabelRenderer = labelRendererMap.get(labelRendererType);
if (esriLabelRenderer != null) {
for (Rule rule : ruleList) {
esriLabelRenderer.convert(newLabelRuleList, rule, obj, transparency);
}
}
found = true;
break;
}
}
if (!found) {
ConsoleManager.getInstance().error(this, "Unsupported label renderer : " + SymbolUtils.extractName(labelRenderElement));
}
}
ruleList.addAll(newLabelRuleList);
}
}
}
}
}
}
}
Aggregations