/** * @deprecated since BEAM 4.10, use setDefaultStyleCss() */ @SuppressWarnings({"JavaDoc"}) @Deprecated public void setDefaultCSS(String defaultCSS) { setDefaultStyleCss(defaultCSS); }
private synchronized PlacemarkGroup createPinGroup() { final VectorDataNode vectorDataNode = new VectorDataNode(PIN_GROUP_NAME, Placemark.createPinFeatureType()); vectorDataNode.setDefaultStyleCss( "symbol:pin; fill:#0000ff; fill-opacity:0.7; stroke:#ffffff; stroke-opacity:1.0; stroke-width:0.5"); vectorDataNode.setPermanent(true); this.vectorDataGroup.add(vectorDataNode); return vectorDataNode.getPlacemarkGroup(); }
private synchronized PlacemarkGroup createGcpGroup() { final VectorDataNode vectorDataNode = new VectorDataNode(GCP_GROUP_NAME, Placemark.createGcpFeatureType()); vectorDataNode.setDefaultStyleCss("symbol:plus; stroke:#ff8800; stroke-opacity:0.8; stroke-width:1.0"); vectorDataNode.setPermanent(true); this.vectorDataGroup.add(vectorDataNode); return vectorDataNode.getPlacemarkGroup(); }
vectorDataNode.setDefaultStyleCss(properties.get(VectorDataNodeIO.PROPERTY_NAME_DEFAULT_CSS));
public TrackLayer(VectorDataLayerType vectorDataLayerType, VectorDataNode vectorDataNode, PropertySet configuration) { super(vectorDataLayerType, vectorDataNode, configuration); String styleCss = vectorDataNode.getDefaultStyleCss(); DefaultFigureStyle style = new DefaultFigureStyle(styleCss); style.fromCssString(styleCss); style.setSymbolName("circle"); style.setStrokeColor(STROKE_COLOR); style.setStrokeWidth(STROKE_WIDTH); style.setStrokeOpacity(STROKE_OPACITY); style.setFillColor(FILL_COLOR); style.setFillOpacity(FILL_OPACITY); strokePaint = style.getStrokePaint(); vectorDataNode.setDefaultStyleCss(style.toCssString()); }
@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()); }
@Test public void testDefaultStyle() { SimpleFeatureType unknownType = PlacemarkDescriptorRegistryTest.createYetUnknownFeatureType(); Product p = new Product("p", "pt", 4, 4); VectorDataNode vdn = new VectorDataNode("vdn", unknownType); p.getVectorDataGroup().add(vdn); MyProductNodeListenerAdapter pnl = new MyProductNodeListenerAdapter(); p.addProductNodeListener(pnl); String styleCss = vdn.getStyleCss(); assertNotNull(vdn.getDefaultStyleCss()); vdn.setDefaultStyleCss("fill:#aabbcc"); assertEquals("fill:#aabbcc", vdn.getDefaultStyleCss()); assertNotNull(pnl.event); assertEquals("defaultStyleCss", pnl.event.getPropertyName()); assertEquals("fill:#aabbcc", pnl.event.getNewValue()); pnl.event = null; vdn.setDefaultStyleCss("fill:#aabbcc"); assertNull(pnl.event); vdn.setDefaultStyleCss("fill:#000000"); assertNotNull(pnl.event); assertEquals("defaultStyleCss", pnl.event.getPropertyName()); assertEquals("fill:#000000", pnl.event.getNewValue()); // test that styleCss is not affected assertEquals(styleCss, vdn.getStyleCss()); }
targetVDN.setDefaultStyleCss(sourceVDN.getDefaultStyleCss()); targetVDN.setDescription(sourceVDN.getDescription()); targetVDN.getPlacemarkGroup(); targetVDN.getFeatureCollection().addAll(featureCollection); targetVDN.setDefaultStyleCss(sourceVDN.getDefaultStyleCss()); targetVDN.setDescription(sourceVDN.getDescription());