if (properties.containsKey(ProductNode.PROPERTY_NAME_DESCRIPTION)) { featureType.getUserData().put(ProductNode.PROPERTY_NAME_DESCRIPTION, properties.get(ProductNode.PROPERTY_NAME_DESCRIPTION)); vectorDataNode.setDescription(properties.get(ProductNode.PROPERTY_NAME_DESCRIPTION));
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; }
@Test public void testProperties() throws Exception { VectorDataNode vectorDataNode = new VectorDataNode("aName", Placemark.createGeometryFeatureType()); vectorDataNode.setDescription("Contains a set of pins"); vectorDataNode.setDefaultStyleCss("stroke:#ff0000"); VectorDataNodeWriter vectorDataNodeWriter = new VectorDataNodeWriter(); File tempFile = File.createTempFile("VectorDataNodeWriterTest_testProperties", "csv"); tempFile.deleteOnExit(); vectorDataNodeWriter.write(vectorDataNode, tempFile); FileReader fileReader = new FileReader(tempFile); LineNumberReader lineNumberReader = new LineNumberReader(fileReader); String firstLine = lineNumberReader.readLine(); assertNotNull(firstLine); assertEquals("#description=Contains a set of pins", firstLine); String secondLine = lineNumberReader.readLine(); assertNotNull(secondLine); assertEquals("#defaultCSS=stroke:#ff0000", secondLine); VectorDataNode vectorDataNode2 = VectorDataNodeReader.read("mem", new FileReader(tempFile), createDummyProduct(), new FeatureUtils.FeatureCrsProvider() { @Override public CoordinateReferenceSystem getFeatureCrs(Product product) { return DefaultGeographicCRS.WGS84; } }, placemarkDescriptorProvider, DefaultGeographicCRS.WGS84, VectorDataNodeIO.DEFAULT_DELIMITER_CHAR, ProgressMonitor.NULL); assertNotNull(vectorDataNode2); assertEquals(vectorDataNode.getDescription(), vectorDataNode2.getDescription()); assertEquals(vectorDataNode.getDefaultStyleCss(), vectorDataNode2.getDefaultStyleCss()); }
public static VectorDataNode createDefaultVectorDataNode(Product product, String name, String description) { CoordinateReferenceSystem modelCrs = ImageManager.getModelCrs(product.getGeoCoding()); SimpleFeatureType type = PlainFeatureFactory.createDefaultFeatureType(modelCrs); VectorDataNode vectorDataNode = new VectorDataNode(name, type); vectorDataNode.setDescription(description); product.getVectorDataGroup().add(vectorDataNode); vectorDataNode.getPlacemarkGroup(); final ProductSceneView sceneView = VisatApp.getApp().getSelectedProductSceneView(); if (sceneView != null) { VisatApp.getApp().getProductTree().expand(vectorDataNode); sceneView.selectVectorDataLayer(vectorDataNode); final LayerFilter nodeFilter = VectorDataLayerFilterFactory.createNodeFilter(vectorDataNode); Layer vectorDataLayer = LayerUtils.getChildLayer(sceneView.getRootLayer(), LayerUtils.SEARCH_DEEP, nodeFilter); if (vectorDataLayer != null) { vectorDataLayer.setVisible(true); } } return vectorDataNode; }
targetVDN.getFeatureCollection().addAll(featureCollection); targetVDN.setDefaultStyleCss(sourceVDN.getDefaultStyleCss()); targetVDN.setDescription(sourceVDN.getDescription()); targetVDN.getFeatureCollection().addAll(featureCollection); targetVDN.setDefaultStyleCss(sourceVDN.getDefaultStyleCss()); targetVDN.setDescription(sourceVDN.getDescription());