Search in sources :

Example 1 with MultipleRecordRenderer

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));
    }
}
Also used : AbstractRecordLayerRenderer(com.revolsys.swing.map.layer.record.renderer.AbstractRecordLayerRenderer) MapEx(com.revolsys.collection.map.MapEx) MultipleRecordRenderer(com.revolsys.swing.map.layer.record.renderer.MultipleRecordRenderer) ArrayList(java.util.ArrayList) FilterMultipleRenderer(com.revolsys.swing.map.layer.record.renderer.FilterMultipleRenderer)

Example 2 with MultipleRecordRenderer

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;
    }
}
Also used : AbstractRecordLayerRenderer(com.revolsys.swing.map.layer.record.renderer.AbstractRecordLayerRenderer) AbstractMultipleRenderer(com.revolsys.swing.map.layer.record.renderer.AbstractMultipleRenderer) MultipleRecordRenderer(com.revolsys.swing.map.layer.record.renderer.MultipleRecordRenderer)

Aggregations

AbstractRecordLayerRenderer (com.revolsys.swing.map.layer.record.renderer.AbstractRecordLayerRenderer)2 MultipleRecordRenderer (com.revolsys.swing.map.layer.record.renderer.MultipleRecordRenderer)2 MapEx (com.revolsys.collection.map.MapEx)1 AbstractMultipleRenderer (com.revolsys.swing.map.layer.record.renderer.AbstractMultipleRenderer)1 FilterMultipleRenderer (com.revolsys.swing.map.layer.record.renderer.FilterMultipleRenderer)1 ArrayList (java.util.ArrayList)1