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");
}
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);
}
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");
}
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");
}
Aggregations