private static VectorDataNode createVectorDataNode(FeatureStatisticsWriter featureStatisticsWriter, VectorDataNode originalVDN) { final SimpleFeatureType updatedFeatureType = featureStatisticsWriter.getUpdatedFeatureType(); final List<SimpleFeature> features = featureStatisticsWriter.getFeatures(); final ListFeatureCollection featureCollection = new ListFeatureCollection(updatedFeatureType, features); final PlacemarkDescriptor placemarkDescriptor = originalVDN.getPlacemarkDescriptor(); final VectorDataNode vectorDataNode = new VectorDataNode(originalVDN.getName(), featureCollection, placemarkDescriptor); vectorDataNode.setPermanent(originalVDN.isPermanent()); vectorDataNode.setModified(true); vectorDataNode.setDescription(originalVDN.getDescription()); return vectorDataNode; }
public static VectorDataNode createDefaultVectorDataNode(Product product, String name, String description) { CoordinateReferenceSystem modelCrs = product.getSceneCRS(); SimpleFeatureType type = PlainFeatureFactory.createDefaultFeatureType(modelCrs); VectorDataNode vectorDataNode = new VectorDataNode(name, type); vectorDataNode.setDescription(description); product.getVectorDataGroup().add(vectorDataNode); vectorDataNode.getPlacemarkGroup(); String oldLayerId = selectVectorDataLayer(vectorDataNode); UndoRedo.Manager undoManager = SnapApp.getDefault().getUndoManager(product); if (undoManager != null) { undoManager.addEdit(new UndoableVectorDataNodeInsertion(product, vectorDataNode, oldLayerId)); } return vectorDataNode; }
targetVectorDataNode.getFeatureCollection().addAll((FeatureCollection<?, ?>) targetCollection); targetVectorDataNode.setDefaultStyleCss(sourceVectorDataNode.getDefaultStyleCss()); targetVectorDataNode.setDescription(sourceVectorDataNode.getDescription()); targetVectorDataNode.setOwner(targetProduct); return targetVectorDataNode;