Search in sources :

Example 1 with PathTreeNode

use of com.revolsys.swing.tree.node.file.PathTreeNode 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 PathTreeNode

use of com.revolsys.swing.tree.node.file.PathTreeNode in project com.revolsys.open by revolsys.

the class RecordStoreConnectionTrees method addLayer.

private static void addLayer(final RecordDefinitionImpl recordDefinition) {
    final PathName typePath = recordDefinition.getPathName();
    final RecordStore recordStore = recordDefinition.getRecordStore();
    final Map<String, Object> connection = recordStore.getConnectionProperties();
    final Map<String, Object> layerConfig = new LinkedHashMap<>();
    MapObjectFactory.setType(layerConfig, "recordStoreLayer");
    layerConfig.put("name", recordDefinition.getName());
    layerConfig.put("connection", connection);
    layerConfig.put("typePath", typePath);
    layerConfig.put("showTableView", AbstractLayer.isShowNewLayerTableView());
    final LinkedList<String> path = new LinkedList<>();
    {
        BaseTreeNode node = BaseTree.getMenuNode();
        node = node.getParent();
        while (node != null) {
            final Object nodeValue = node.getUserObject();
            String nodeName = node.getName();
            if (node instanceof PathTreeNode) {
                nodeName = FileUtil.getBaseName(nodeName);
            }
            if (nodeValue instanceof RecordStoreSchemaElement) {
                path.addFirst(nodeName);
                node = node.getParent();
            } else {
                path.addFirst(nodeName);
                node = null;
            }
        }
    }
    final AbstractLayer layer = new RecordStoreLayer(layerConfig);
    LayerGroup layerGroup = Project.get();
    for (final String name : path) {
        try {
            layerGroup = layerGroup.addLayerGroup(name);
        } catch (final IllegalArgumentException e) {
            int i = 1;
            while (layerGroup.hasLayerWithSameName(null, name + i)) {
                i++;
            }
            layerGroup = layerGroup.addLayerGroup(name + i);
        }
    }
    layerGroup.addLayer(layer);
}
Also used : RecordStoreLayer(com.revolsys.swing.map.layer.record.RecordStoreLayer) AbstractLayer(com.revolsys.swing.map.layer.AbstractLayer) LayerGroup(com.revolsys.swing.map.layer.LayerGroup) LinkedList(java.util.LinkedList) LinkedHashMap(java.util.LinkedHashMap) PathTreeNode(com.revolsys.swing.tree.node.file.PathTreeNode) RecordStore(com.revolsys.record.schema.RecordStore) BaseTreeNode(com.revolsys.swing.tree.BaseTreeNode) PathName(com.revolsys.io.PathName) RecordStoreSchemaElement(com.revolsys.record.schema.RecordStoreSchemaElement)

Example 3 with PathTreeNode

use of com.revolsys.swing.tree.node.file.PathTreeNode in project com.revolsys.open by revolsys.

the class PointCloudLayer method factoryInit.

public static void factoryInit() {
    MapObjectFactoryRegistry.newFactory("pointCloudLayer", "Point Cloud Layer", PointCloudLayer::new);
    // TODO Need to handle memory and rendering better
    // addIoFactoryMenuItem("pointCloud", "Add Point Cloud Layer", "point_cloud",
    // PointCloudReadFactory.class);
    final EnableCheck enableCheck = RsSwingServiceInitializer.enableCheck(PointCloudReadFactory.class);
    TreeNodes.addMenuItem(PathTreeNode.MENU, "point_cloud", "Zoom to Point Cloud", (final PathTreeNode node) -> actionZoomTo(node)).setVisibleCheck(// 
    enableCheck).setIconName("point_cloud", "magnifier");
}
Also used : PathTreeNode(com.revolsys.swing.tree.node.file.PathTreeNode) EnableCheck(com.revolsys.swing.action.enablecheck.EnableCheck)

Example 4 with PathTreeNode

use of com.revolsys.swing.tree.node.file.PathTreeNode in project com.revolsys.open by revolsys.

the class AbstractLayer method menuItemPathAddLayer.

public static void menuItemPathAddLayer(final String menuGroup, final String menuName, final String iconName, final Class<? extends IoFactory> factoryClass) {
    final EnableCheck enableCheck = RsSwingServiceInitializer.enableCheck(factoryClass);
    TreeNodes.addMenuItem(PathTreeNode.MENU, menuGroup, menuName, (final PathTreeNode node) -> {
        final URL url = node.getUrl();
        final Project project = Project.get();
        project.openFile(url);
    }).setVisibleCheck(// 
    enableCheck).setIconName(iconName, "add");
}
Also used : PathTreeNode(com.revolsys.swing.tree.node.file.PathTreeNode) EnableCheck(com.revolsys.swing.action.enablecheck.EnableCheck) URL(java.net.URL)

Aggregations

PathTreeNode (com.revolsys.swing.tree.node.file.PathTreeNode)4 EnableCheck (com.revolsys.swing.action.enablecheck.EnableCheck)3 PathName (com.revolsys.io.PathName)1 RecordStore (com.revolsys.record.schema.RecordStore)1 RecordStoreSchemaElement (com.revolsys.record.schema.RecordStoreSchemaElement)1 AbstractLayer (com.revolsys.swing.map.layer.AbstractLayer)1 LayerGroup (com.revolsys.swing.map.layer.LayerGroup)1 MultipleGriddedElevationModelLayerRenderer (com.revolsys.swing.map.layer.elevation.gridded.renderer.MultipleGriddedElevationModelLayerRenderer)1 RasterizerGriddedElevationModelLayerRenderer (com.revolsys.swing.map.layer.elevation.gridded.renderer.RasterizerGriddedElevationModelLayerRenderer)1 TiledMultipleGriddedElevationModelLayerRenderer (com.revolsys.swing.map.layer.elevation.gridded.renderer.TiledMultipleGriddedElevationModelLayerRenderer)1 RecordStoreLayer (com.revolsys.swing.map.layer.record.RecordStoreLayer)1 BaseTreeNode (com.revolsys.swing.tree.BaseTreeNode)1 URL (java.net.URL)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedList (java.util.LinkedList)1