/** * Constructs a new vector data node for the given feature collection. * * @param name The node name. * @param featureCollection A feature collection. * @throws IllegalArgumentException if the given name is not a valid node identifier */ public VectorDataNode(String name, FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection) { this(name, featureCollection, getPlacemarkDescriptor(featureCollection.getSchema())); }
/** * Constructs a new vector data node for the given feature collection. * * @param name The node name. * @param featureType The feature type. * @throws IllegalArgumentException if the given name is not a valid node identifier */ public VectorDataNode(String name, SimpleFeatureType featureType) { this(name, new DefaultFeatureCollection(name, featureType), getPlacemarkDescriptor(featureType)); }
@Override public PlacemarkGroup getPlacemarkGroup(Product product) { final VectorDataNode[] nodes = product.getVectorDataGroup().toArray(new VectorDataNode[0]); for (VectorDataNode node : nodes) { if (node.getPlacemarkDescriptor() == this) { return node.getPlacemarkGroup(); } } return null; }
if (placemark == null) { _add(vectorDataNode.getPlacemarkDescriptor().createPlacemark(feature));
private String getInfoText(VectorDataNode vectorDataNode, SimpleFeature feature) { final String infoText; if (vectorDataNode != null) { infoText = String.format("<html>" + "Vector data node: <b>%s</b> with %d feature(s)<br>" + "Feature type: <b>%s (%s)</b><br>" + "Geometry attribute: <b>%s</b><br>" + "<br>" + "%s<br>" + "</html>", vectorDataNode.getName(), vectorDataNode.getFeatureCollection().size(), vectorDataNode.getFeatureType().getTypeName(), vectorDataNode.getPlacemarkDescriptor().getClass().getSimpleName(), vectorDataNode.getFeatureType().getGeometryDescriptor().getLocalName(), feature != null ? String.format("Selected feature <b>%s</b>:", feature.getID()) : "No feature selected."); infoLabel.setText(infoText); } else { infoText = NO_SELECTION_TEXT; // infoText = getSelectionDebugText(selectionContext, selectedValue); } return infoText; }
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; }
private static void testVectorData(VectorDataNode vectorDataNode, String expectedName, SimpleFeatureType expectedType) { assertNotNull(vectorDataNode.getPlacemarkDescriptor()); assertEquals(expectedName, vectorDataNode.getName()); assertNotNull(vectorDataNode.getFeatureCollection()); assertSame(expectedType, vectorDataNode.getFeatureType()); assertSame(expectedType, vectorDataNode.getFeatureCollection().getSchema()); }
@Test public void testInitialGcpVectorDataNodeState() throws Exception { final Product p = new Product("n", "t", 1, 1); assertNotNull(p.getGcpGroup()); final VectorDataNode node = p.getVectorDataGroup().get("ground_control_points"); assertNotNull(node); assertTrue(node.getPlacemarkDescriptor() instanceof GcpDescriptor); assertSame(p.getGcpGroup(), p.getGcpGroup()); assertSame(p.getGcpGroup(), node.getPlacemarkGroup()); assertTrue(node.getFeatureCollection().isEmpty()); assertEquals(0, node.getPlacemarkGroup().getNodeCount()); assertTrue(node.isPermanent()); }
@Test public void testInitialPinVectorDataNodeState() throws Exception { final Product p = new Product("n", "t", 1, 1); assertNotNull(p.getPinGroup()); final VectorDataNode node = p.getVectorDataGroup().get("pins"); assertNotNull(node); assertTrue(node.getPlacemarkDescriptor() instanceof PinDescriptor); assertSame(p.getPinGroup(), p.getPinGroup()); assertSame(p.getPinGroup(), node.getPlacemarkGroup()); assertTrue(node.getFeatureCollection().isEmpty()); assertEquals(0, node.getPlacemarkGroup().getNodeCount()); assertTrue(node.isPermanent()); }