use of com.revolsys.swing.map.layer.record.renderer.FilterMultipleRenderer in project com.revolsys.open by revolsys.
the class ArcGisRestServerRecordLayer method initRenderer.
private void initRenderer() {
final List<AbstractRecordLayerRenderer> renderers = new ArrayList<>();
final MapEx drawingInfo = this.layerDescription.getProperty("drawingInfo");
if (drawingInfo != null) {
final MapEx rendererProperties = drawingInfo.getValue("renderer");
if (rendererProperties != null) {
final String rendererType = rendererProperties.getString("type");
if ("simple".equals(rendererType)) {
final AbstractRecordLayerRenderer renderer = newSymbolRenderer(rendererProperties, "symbol");
if (renderer != null) {
renderers.add(renderer);
}
} else if ("uniqueValue".equals(rendererType)) {
final FilterMultipleRenderer filterRenderer = newUniqueValueRenderer(rendererProperties);
renderers.add(filterRenderer);
} else {
Logs.error(this, "Unsupported renderer=" + rendererType + "\n" + rendererProperties);
}
}
final List<MapEx> labellingInfo = drawingInfo.getValue("labelingInfo");
if (labellingInfo != null) {
final MultipleRecordRenderer labelRenderer = new MultipleRecordRenderer(this);
labelRenderer.setName("labels");
for (final MapEx labelProperties : labellingInfo) {
addTextRenderer(labelRenderer, labelProperties);
}
if (!labelRenderer.isEmpty()) {
renderers.add(labelRenderer);
}
}
}
if (renderers.isEmpty()) {
} else if (renderers.size() == 1) {
setRenderer(renderers.get(0));
} else {
setRenderer(new MultipleRecordRenderer(this, renderers));
}
}
use of com.revolsys.swing.map.layer.record.renderer.FilterMultipleRenderer in project com.revolsys.open by revolsys.
the class ArcGisRestServerRecordLayer method newUniqueValueRenderer.
@SuppressWarnings("unchecked")
private FilterMultipleRenderer newUniqueValueRenderer(final MapEx rendererProperties) {
final FilterMultipleRenderer filterRenderer = new FilterMultipleRenderer(this);
final String fieldName = rendererProperties.getString("field1");
filterRenderer.setName(fieldName);
for (final MapEx valueProperties : (List<MapEx>) rendererProperties.getValue("uniqueValueInfos")) {
final AbstractRecordLayerRenderer valueRenderer = newSymbolRenderer(valueProperties, "symbol");
if (valueRenderer != null) {
final String valueLabel = valueProperties.getString("label");
if (valueLabel != null) {
valueRenderer.setName(valueLabel);
}
final String value = valueProperties.getString("value");
if (value != null) {
final FieldDefinition fieldDefinition = getFieldDefinition(fieldName);
if (fieldDefinition.getDataType().isRequiresQuotes()) {
valueRenderer.setQueryFilter(fieldName + "='" + value + '\'');
} else {
valueRenderer.setQueryFilter(fieldName + " = " + value);
}
}
filterRenderer.addRenderer(valueRenderer);
}
}
final AbstractRecordLayerRenderer defaultRenderer = newSymbolRenderer(rendererProperties, "defaultSymbol");
if (defaultRenderer != null) {
final String defaultLabel = rendererProperties.getString("defaultLabel", "Default");
defaultRenderer.setName(defaultLabel);
filterRenderer.addRenderer(defaultRenderer);
}
return filterRenderer;
}
Aggregations