Search in sources :

Example 1 with TiledMultipleGriddedElevationModelLayerRenderer

use of com.revolsys.swing.map.layer.elevation.gridded.renderer.TiledMultipleGriddedElevationModelLayerRenderer in project com.revolsys.open by revolsys.

the class GriddedElevationModelLayer method factoryInit.

public static void factoryInit() {
    // Renderers
    MapObjectFactoryRegistry.newFactory("rasterizerGriddedElevationModelLayerRenderer", RasterizerGriddedElevationModelLayerRenderer::new);
    MapObjectFactoryRegistry.newFactory("multipleGriddedElevationModelLayerRenderer", MultipleGriddedElevationModelLayerRenderer::new);
    MapObjectFactoryRegistry.newFactory("tiledMultipleGriddedElevationModelLayerRenderer", TiledMultipleGriddedElevationModelLayerRenderer::new);
    // Layers
    MapObjectFactoryRegistry.newFactory("griddedElevationModelLayer", "Gridded Elevation Model Layer", GriddedElevationModelLayer::new);
    MapObjectFactoryRegistry.newFactory("tiledGriddedElevationModelLayer", "Tiled Gridded Elevation Model Layer", TiledGriddedElevationModelLayer::new);
    // Menus
    final EnableCheck enableCheck = RsSwingServiceInitializer.enableCheck(GriddedElevationModelReadFactory.class);
    menuItemPathAddLayer("gridded_dem", "Add Gridded Elevation Model Layer", "gridded_dem", GriddedElevationModelReadFactory.class);
    TreeNodes.addMenuItem(PathTreeNode.MENU, "gridded_dem", "Export Gridded Elevation Model", // 
    (final PathTreeNode node) -> actionExport(node)).setVisibleCheck(// 
    enableCheck).setIconName("gridded_dem", "save");
    TreeNodes.addMenuItem(PathTreeNode.MENU, "gridded_dem", "Zoom to Gridded Elevation Model", (final PathTreeNode node) -> actionZoomTo(node)).setVisibleCheck(// 
    enableCheck).setIconName("gridded_dem", "magnifier");
}
Also used : PathTreeNode(com.revolsys.swing.tree.node.file.PathTreeNode) MultipleGriddedElevationModelLayerRenderer(com.revolsys.swing.map.layer.elevation.gridded.renderer.MultipleGriddedElevationModelLayerRenderer) TiledMultipleGriddedElevationModelLayerRenderer(com.revolsys.swing.map.layer.elevation.gridded.renderer.TiledMultipleGriddedElevationModelLayerRenderer) TiledMultipleGriddedElevationModelLayerRenderer(com.revolsys.swing.map.layer.elevation.gridded.renderer.TiledMultipleGriddedElevationModelLayerRenderer) RasterizerGriddedElevationModelLayerRenderer(com.revolsys.swing.map.layer.elevation.gridded.renderer.RasterizerGriddedElevationModelLayerRenderer) EnableCheck(com.revolsys.swing.action.enablecheck.EnableCheck)

Example 2 with TiledMultipleGriddedElevationModelLayerRenderer

use of com.revolsys.swing.map.layer.elevation.gridded.renderer.TiledMultipleGriddedElevationModelLayerRenderer in project com.revolsys.open by revolsys.

the class TiledGriddedElevationModelLayer method getElevationModel.

protected GriddedElevationModel getElevationModel(final double x, final double y) {
    final TiledMultipleGriddedElevationModelLayerRenderer renderer = getRenderer();
    final int resolution = (int) renderer.getResolution();
    if (resolution > 0) {
        final int tileSize = resolution * this.tileSizePixels;
        final int tileX = (int) Math.floor(x / tileSize) * tileSize;
        final int tileY = (int) Math.floor(y / tileSize) * tileSize;
        final TiledGriddedElevationModelLayerTile tile = newTile(resolution, tileSize, tileX, tileY);
        final TiledGriddedElevationModelLayerTile cachedTile = renderer.getCachedTile(tile);
        if (cachedTile != null) {
            return cachedTile.getElevationModel();
        }
    }
    return null;
}
Also used : TiledMultipleGriddedElevationModelLayerRenderer(com.revolsys.swing.map.layer.elevation.gridded.renderer.TiledMultipleGriddedElevationModelLayerRenderer)

Example 3 with TiledMultipleGriddedElevationModelLayerRenderer

use of com.revolsys.swing.map.layer.elevation.gridded.renderer.TiledMultipleGriddedElevationModelLayerRenderer in project com.revolsys.open by revolsys.

the class TiledGriddedElevationModelLayer method setStyle.

@SuppressWarnings("unchecked")
public void setStyle(Object style) {
    if (style instanceof Map) {
        final Map<String, Object> map = (Map<String, Object>) style;
        style = MapObjectFactory.toObject(map);
    }
    if (style instanceof TiledMultipleGriddedElevationModelLayerRenderer) {
        final TiledMultipleGriddedElevationModelLayerRenderer renderer = (TiledMultipleGriddedElevationModelLayerRenderer) style;
        setRenderer(renderer);
    } else if (style instanceof RasterizerGriddedElevationModelLayerRenderer) {
        final TiledMultipleGriddedElevationModelLayerRenderer renderer = new TiledMultipleGriddedElevationModelLayerRenderer(this, (RasterizerGriddedElevationModelLayerRenderer) style);
        setRenderer(renderer);
    } else {
        Logs.error(this, "Cannot create renderer for: " + style);
    }
}
Also used : TiledMultipleGriddedElevationModelLayerRenderer(com.revolsys.swing.map.layer.elevation.gridded.renderer.TiledMultipleGriddedElevationModelLayerRenderer) RasterizerGriddedElevationModelLayerRenderer(com.revolsys.swing.map.layer.elevation.gridded.renderer.RasterizerGriddedElevationModelLayerRenderer) Map(java.util.Map)

Example 4 with TiledMultipleGriddedElevationModelLayerRenderer

use of com.revolsys.swing.map.layer.elevation.gridded.renderer.TiledMultipleGriddedElevationModelLayerRenderer in project com.revolsys.open by revolsys.

the class TiledGriddedElevationModelLayer method setGeometryFactoryDo.

@Override
public GeometryFactory setGeometryFactoryDo(final GeometryFactory geometryFactory) {
    if (geometryFactory != null) {
        GeometryFactory geometryFactory3d;
        if (geometryFactory.getAxisCount() == 2) {
            final double scaleX = geometryFactory.getScaleX();
            final double scaleY = geometryFactory.getScaleY();
            final double[] scales = { scaleX, scaleY, 1000.0 };
            geometryFactory3d = geometryFactory.convertAxisCountAndScales(3, scales);
        } else {
            geometryFactory3d = geometryFactory.convertAxisCount(3);
        }
        this.scaleZ = geometryFactory3d.getScaleZ();
        final GeometryFactory newGeometryFactory = super.setGeometryFactoryDo(geometryFactory3d);
        setBoundingBox(newGeometryFactory.getCoordinateSystem().getAreaBoundingBox());
        final TiledMultipleGriddedElevationModelLayerRenderer renderer = getRenderer();
        if (renderer != null) {
            renderer.updateBoundingBox();
        }
        return newGeometryFactory;
    }
    return super.getGeometryFactory();
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) TiledMultipleGriddedElevationModelLayerRenderer(com.revolsys.swing.map.layer.elevation.gridded.renderer.TiledMultipleGriddedElevationModelLayerRenderer)

Aggregations

TiledMultipleGriddedElevationModelLayerRenderer (com.revolsys.swing.map.layer.elevation.gridded.renderer.TiledMultipleGriddedElevationModelLayerRenderer)4 RasterizerGriddedElevationModelLayerRenderer (com.revolsys.swing.map.layer.elevation.gridded.renderer.RasterizerGriddedElevationModelLayerRenderer)2 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)1 EnableCheck (com.revolsys.swing.action.enablecheck.EnableCheck)1 MultipleGriddedElevationModelLayerRenderer (com.revolsys.swing.map.layer.elevation.gridded.renderer.MultipleGriddedElevationModelLayerRenderer)1 PathTreeNode (com.revolsys.swing.tree.node.file.PathTreeNode)1 Map (java.util.Map)1