private String[] getPolygons() { // Get polygons from the first product which is assumed to be maskProduct in BaseClassifier final ArrayList<String> geometryNames = new ArrayList<>(5); if (sourceProducts != null) { if (sourceProducts.length > 1) { final ProductNodeGroup<VectorDataNode> vectorDataNodes = sourceProducts[0].getVectorDataGroup(); for(int i=0; i< vectorDataNodes.getNodeCount(); ++i) { VectorDataNode node = vectorDataNodes.get(i); if(!node.getFeatureCollection().isEmpty()) { geometryNames.add(node.getName() + "::" + sourceProducts[0].getName()); } } } else { final ProductNodeGroup<VectorDataNode> vectorDataNodes = sourceProducts[0].getVectorDataGroup(); for(int i=0; i< vectorDataNodes.getNodeCount(); ++i) { VectorDataNode node = vectorDataNodes.get(i); if(!node.getFeatureCollection().isEmpty()) { geometryNames.add(node.getName()); } } } } return geometryNames.toArray(new String[geometryNames.size()]); }
/** * Performs the actual "export Mask Pixels" command. */ private void exportVectorDataNode() { SnapApp snapApp = SnapApp.getDefault(); if (vectorDataNode.getFeatureCollection().isEmpty()) { Dialogs.showInformation(Bundle.CTL_ExportGeometryAction_DialogTitle(), "The selected geometry is empty. Nothing to export.", null); return; } final File file = promptForFile(vectorDataNode.getName()); if (file == null) { return; } final SwingWorker<Exception, Object> swingWorker = new ExportVectorNodeSwingWorker(snapApp, vectorDataNode, file); UIUtils.setRootFrameWaitCursor(snapApp.getMainFrame()); snapApp.setStatusBarMessage("Exporting Geometry..."); swingWorker.execute(); }
if (vectorDataNode.getFeatureCollection().isEmpty()) { Dialogs.showError(dialogTitle, "The vector data was loaded successfully,\n" + "but no part is located within the scene boundaries."); /* I18N */