Search in sources :

Example 1 with GeometryStyleRenderer

use of com.revolsys.swing.map.layer.record.renderer.GeometryStyleRenderer in project com.revolsys.open by revolsys.

the class LayerGroup method openFile.

public int openFile(int index, final URL url) {
    final String urlString = url.toString();
    final Map<String, Object> properties = new HashMap<>();
    properties.put("url", urlString);
    String name = UrlUtil.getFileBaseName(url);
    name = FileUtil.fromSafeName(name);
    properties.put("name", name);
    Layer layer;
    if (IoFactory.hasFactory(TriangulatedIrregularNetworkReadFactory.class, url)) {
        layer = new TriangulatedIrregularNetworkLayer(properties);
    } else if (IoFactory.hasFactory(GriddedElevationModelReadFactory.class, url)) {
        layer = new GriddedElevationModelLayer(properties);
    } else if (IoFactory.hasFactory(GeoreferencedImageReadFactory.class, url)) {
        layer = new GeoreferencedImageLayer(properties);
    } else if (IoFactory.hasFactory(PointCloudReadFactory.class, url)) {
        layer = new PointCloudLayer(properties);
    } else if (IoFactory.hasFactory(RecordReaderFactory.class, url)) {
        final FileRecordLayer recordLayer = new FileRecordLayer(properties);
        final GeometryStyleRenderer renderer = recordLayer.getRenderer();
        renderer.setStyle(GeometryStyle.newStyle());
        layer = recordLayer;
    } else {
        layer = null;
    }
    if (layer != null) {
        layer.setProperty("showTableView", isShowNewLayerTableView());
        if (index == -1) {
            addLayer(layer);
        } else {
            addLayer(index++, layer);
        }
    }
    return index;
}
Also used : HashMap(java.util.HashMap) FileRecordLayer(com.revolsys.swing.map.layer.record.FileRecordLayer) FileRecordLayer(com.revolsys.swing.map.layer.record.FileRecordLayer) TriangulatedIrregularNetworkLayer(com.revolsys.swing.map.layer.elevation.tin.TriangulatedIrregularNetworkLayer) PointCloudLayer(com.revolsys.swing.map.layer.pointcloud.PointCloudLayer) GriddedElevationModelLayer(com.revolsys.swing.map.layer.elevation.gridded.GriddedElevationModelLayer) GeoreferencedImageLayer(com.revolsys.swing.map.layer.raster.GeoreferencedImageLayer) GeoreferencedImageLayer(com.revolsys.swing.map.layer.raster.GeoreferencedImageLayer) PointCloudLayer(com.revolsys.swing.map.layer.pointcloud.PointCloudLayer) GeometryStyleRenderer(com.revolsys.swing.map.layer.record.renderer.GeometryStyleRenderer) TriangulatedIrregularNetworkLayer(com.revolsys.swing.map.layer.elevation.tin.TriangulatedIrregularNetworkLayer) GriddedElevationModelReadFactory(com.revolsys.elevation.gridded.GriddedElevationModelReadFactory) GriddedElevationModelLayer(com.revolsys.swing.map.layer.elevation.gridded.GriddedElevationModelLayer) PointCloudReadFactory(com.revolsys.elevation.cloud.PointCloudReadFactory)

Example 2 with GeometryStyleRenderer

use of com.revolsys.swing.map.layer.record.renderer.GeometryStyleRenderer in project com.revolsys.open by revolsys.

the class LayerGroup method openFile.

public int openFile(final Class<? extends IoFactory> factoryClass, int index, final URL url) {
    final String urlString = url.toString();
    final Map<String, Object> properties = new HashMap<>();
    properties.put("url", urlString);
    String name = UrlUtil.getFileBaseName(url);
    name = FileUtil.fromSafeName(name);
    properties.put("name", name);
    Layer layer;
    if (factoryClass == TriangulatedIrregularNetworkReadFactory.class) {
        layer = new TriangulatedIrregularNetworkLayer(properties);
    } else if (factoryClass == GriddedElevationModelReadFactory.class) {
        layer = new GriddedElevationModelLayer(properties);
    } else if (factoryClass == GeoreferencedImageReadFactory.class) {
        layer = new GeoreferencedImageLayer(properties);
    } else if (factoryClass == PointCloudReadFactory.class) {
        layer = new PointCloudLayer(properties);
    } else if (factoryClass == RecordReaderFactory.class) {
        final FileRecordLayer recordLayer = new FileRecordLayer(properties);
        final GeometryStyleRenderer renderer = recordLayer.getRenderer();
        renderer.setStyle(GeometryStyle.newStyle());
        layer = recordLayer;
    } else {
        layer = null;
    }
    if (layer != null) {
        layer.setProperty("showTableView", isShowNewLayerTableView());
        if (index == -1) {
            addLayer(layer);
        } else {
            addLayer(index++, layer);
        }
    }
    return index;
}
Also used : HashMap(java.util.HashMap) FileRecordLayer(com.revolsys.swing.map.layer.record.FileRecordLayer) FileRecordLayer(com.revolsys.swing.map.layer.record.FileRecordLayer) TriangulatedIrregularNetworkLayer(com.revolsys.swing.map.layer.elevation.tin.TriangulatedIrregularNetworkLayer) PointCloudLayer(com.revolsys.swing.map.layer.pointcloud.PointCloudLayer) GriddedElevationModelLayer(com.revolsys.swing.map.layer.elevation.gridded.GriddedElevationModelLayer) GeoreferencedImageLayer(com.revolsys.swing.map.layer.raster.GeoreferencedImageLayer) GeoreferencedImageLayer(com.revolsys.swing.map.layer.raster.GeoreferencedImageLayer) PointCloudLayer(com.revolsys.swing.map.layer.pointcloud.PointCloudLayer) GeometryStyleRenderer(com.revolsys.swing.map.layer.record.renderer.GeometryStyleRenderer) TriangulatedIrregularNetworkLayer(com.revolsys.swing.map.layer.elevation.tin.TriangulatedIrregularNetworkLayer) GriddedElevationModelReadFactory(com.revolsys.elevation.gridded.GriddedElevationModelReadFactory) GriddedElevationModelLayer(com.revolsys.swing.map.layer.elevation.gridded.GriddedElevationModelLayer) PointCloudReadFactory(com.revolsys.elevation.cloud.PointCloudReadFactory)

Example 3 with GeometryStyleRenderer

use of com.revolsys.swing.map.layer.record.renderer.GeometryStyleRenderer in project com.revolsys.open by revolsys.

the class ArcGisRestServerRecordLayer method newSimpleFillRenderer.

private AbstractRecordLayerRenderer newSimpleFillRenderer(final MapEx symbol) {
    final MapEx outline = symbol.getValue("outline");
    final GeometryStyle style;
    if (outline == null) {
        style = new GeometryStyle();
        style.setLineWidth(Quantities.getQuantity(0, CustomUnits.PIXEL));
    } else {
        style = newSimpleLineStyle(outline);
    }
    final Color fillColor = getColor(symbol);
    style.setPolygonFill(fillColor);
    return new GeometryStyleRenderer(this, style);
}
Also used : GeometryStyleRenderer(com.revolsys.swing.map.layer.record.renderer.GeometryStyleRenderer) GeometryStyle(com.revolsys.swing.map.layer.record.style.GeometryStyle) MapEx(com.revolsys.collection.map.MapEx) Color(java.awt.Color)

Example 4 with GeometryStyleRenderer

use of com.revolsys.swing.map.layer.record.renderer.GeometryStyleRenderer in project com.revolsys.open by revolsys.

the class AbstractRecordLayer method setProperties.

@Override
public void setProperties(final Map<String, ? extends Object> properties) {
    if (!properties.containsKey("style")) {
        final GeometryStyleRenderer renderer = getRenderer();
        if (renderer != null) {
            renderer.setStyle(GeometryStyle.newStyle());
        }
    }
    super.setProperties(properties);
    final Predicate<Record> predicate = AbstractRecordLayerRenderer.getFilter(this, properties);
    if (predicate instanceof RecordDefinitionSqlFilter) {
        final RecordDefinitionSqlFilter sqlFilter = (RecordDefinitionSqlFilter) predicate;
        setWhere(sqlFilter.getQuery());
    }
    if (this.fieldNamesSets.isEmpty()) {
        setFieldNamesSets(null);
    }
}
Also used : GeometryStyleRenderer(com.revolsys.swing.map.layer.record.renderer.GeometryStyleRenderer) ArrayRecord(com.revolsys.record.ArrayRecord) Record(com.revolsys.record.Record)

Aggregations

GeometryStyleRenderer (com.revolsys.swing.map.layer.record.renderer.GeometryStyleRenderer)4 PointCloudReadFactory (com.revolsys.elevation.cloud.PointCloudReadFactory)2 GriddedElevationModelReadFactory (com.revolsys.elevation.gridded.GriddedElevationModelReadFactory)2 GriddedElevationModelLayer (com.revolsys.swing.map.layer.elevation.gridded.GriddedElevationModelLayer)2 TriangulatedIrregularNetworkLayer (com.revolsys.swing.map.layer.elevation.tin.TriangulatedIrregularNetworkLayer)2 PointCloudLayer (com.revolsys.swing.map.layer.pointcloud.PointCloudLayer)2 GeoreferencedImageLayer (com.revolsys.swing.map.layer.raster.GeoreferencedImageLayer)2 FileRecordLayer (com.revolsys.swing.map.layer.record.FileRecordLayer)2 HashMap (java.util.HashMap)2 MapEx (com.revolsys.collection.map.MapEx)1 ArrayRecord (com.revolsys.record.ArrayRecord)1 Record (com.revolsys.record.Record)1 GeometryStyle (com.revolsys.swing.map.layer.record.style.GeometryStyle)1 Color (java.awt.Color)1