use of com.revolsys.swing.map.layer.record.renderer.MultipleRecordRenderer 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.MultipleRecordRenderer in project com.revolsys.open by revolsys.
the class AbstractRecordLayer method addRenderer.
@Override
public int addRenderer(final LayerRenderer<?> child, final int index) {
final AbstractRecordLayerRenderer oldRenderer = getRenderer();
AbstractMultipleRenderer rendererGroup;
if (oldRenderer instanceof AbstractMultipleRenderer) {
rendererGroup = (AbstractMultipleRenderer) oldRenderer;
} else {
final AbstractRecordLayer layer = oldRenderer.getLayer();
rendererGroup = new MultipleRecordRenderer(layer);
rendererGroup.addRenderer(oldRenderer);
setRenderer(rendererGroup);
}
if (index == 0) {
rendererGroup.addRenderer(0, (AbstractRecordLayerRenderer) child);
return 0;
} else {
rendererGroup.addRenderer((AbstractRecordLayerRenderer) child);
return rendererGroup.getRenderers().size() - 1;
}
}
Aggregations