private Placemark createPlacemark(String name, PixelPos pixelPos, GeoPos geoPos) { return Placemark.createPointPlacemark(PinDescriptor.getInstance(), name, "", "", pixelPos, geoPos, null); } }
@Override public void actionPerformed(ActionEvent e) { final Placemark placemark = Placemark.createPointPlacemark(PinDescriptor.getInstance(), "Coord_" + tableModel.getRowCount(), "", "", new PixelPos(), new GeoPos(0, 0), null); tableModel.addPlacemark(placemark); } }
private Placemark createDummyPin(String name) { return Placemark.createPointPlacemark(PinDescriptor.getInstance(), name, "", "", new PixelPos(0.5f, 0.5f), null, null); }
private List<Placemark> createPlacemarks(PlacemarkDescriptor descriptor, CrsGeoCoding geoCoding, Rectangle data_bounds) { ArrayList<Placemark> placemarkList = new ArrayList<Placemark>(); for (int i = 0; i < NUM_PLACEMARKS; i++) { PixelPos pixelPos = new PixelPos((float) Math.random() * data_bounds.width, (float) Math.random() * data_bounds.height); GeoPos geoPos = geoCoding.getGeoPos(pixelPos, null); Placemark placemark = Placemark.createPointPlacemark(descriptor, "name_" + i, "label_" + i, "description_" + i, pixelPos, geoPos, geoCoding); placemark.setStyleCss("fill:#FFFFFF;stroke:#000000"); placemarkList.add(placemark); } return placemarkList; }
private void insertPlacemark(ProductSceneView view) { Product product = view.getProduct(); final String[] uniqueNameAndLabel = PlacemarkNameFactory.createUniqueNameAndLabel(placemarkDescriptor, product); final String name = uniqueNameAndLabel[0]; final String label = uniqueNameAndLabel[1]; final PixelPos pixelPos = new PixelPos(view.getCurrentPixelX() + 0.5f, view.getCurrentPixelY() + 0.5f); final Placemark newPlacemark = Placemark.createPointPlacemark(placemarkDescriptor, name, label, "", pixelPos, null, product.getGeoCoding()); getPlacemarkGroup(product).add(newPlacemark); }
void newPin() { Guardian.assertNotNull("product", product); String[] uniquePinNameAndLabel = PlacemarkNameFactory.createUniqueNameAndLabel(placemarkDescriptor, product); Placemark newPlacemark = Placemark.createPointPlacemark(placemarkDescriptor, uniquePinNameAndLabel[0], uniquePinNameAndLabel[1], "", new PixelPos(0, 0), null, product.getGeoCoding()); if (PlacemarkDialog.showEditPlacemarkDialog(getPaneWindow(), product, newPlacemark, placemarkDescriptor)) { makePlacemarkNameUnique(newPlacemark); updateUIState(); } }
@Before public void setup() throws TransformException, FactoryException { final AffineTransform i2m = new AffineTransform(); i2m.scale(2.0, 2.0); final GeoCoding geoCoding = new CrsGeoCoding(DefaultGeographicCRS.WGS84, new Rectangle(0, 0, 10, 10), i2m); final Product product = new Product("P", "T", 10, 10); product.setGeoCoding(geoCoding); placemark = Placemark.createPointPlacemark(PinDescriptor.getInstance(), "P1", "L", "", new PixelPos(1.0f, 1.0f), null, product.getGeoCoding()); product.getPinGroup().add(placemark); }
public void testWriteXML_IndentIsSmallerThanZero() { Placemark placemark = Placemark.createPointPlacemark(PinDescriptor.getInstance(), "pinName", "pinLabel", "", null, new GeoPos(), product.getGeoCoding()); try { int indent = -1; PlacemarkIO.writeXML(placemark, new XmlWriter(new StringWriter(), false), indent); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException e) { // expected IllegalArgumentException } catch (Exception e) { fail("IllegalArgumentException expected"); } }
public static void main(String[] args) throws TransformException, FactoryException { Product product1 = new Product("A", "B", 360, 180); product1.setGeoCoding(new CrsGeoCoding(DefaultGeographicCRS.WGS84, 360, 180, -180.0, 90.0, 1.0, 1.0, 0.0, 0.0)); PinDescriptor descriptor = PinDescriptor.getInstance(); Placemark pin1 = Placemark.createPointPlacemark(descriptor, "pin_1", "Pin 1", "Schnatter!", new PixelPos(0, 0), new GeoPos(), product1.getGeoCoding()); product1.getPinGroup().add(pin1); showEditPlacemarkDialog(null, product1, pin1, descriptor); } }
@Test public void testMaskIsNotAddedWhenGcpIsAddedForTheSecondTime() throws Exception { final Product p = new Product("P", "T", 1, 1); p.getGcpGroup().add(Placemark.createPointPlacemark(GcpDescriptor.getInstance(), "a", "a", "a", new PixelPos(), new GeoPos(), null)); p.getGcpGroup().add(Placemark.createPointPlacemark(GcpDescriptor.getInstance(), "b", "b", "b", new PixelPos(), new GeoPos(), null)); assertEquals(1, p.getMaskGroup().getNodeCount()); assertNotNull(p.getMaskGroup().get("ground_control_points")); }
@Test public void testMaskIsNotAddedWhenPinIsAddedForTheSecondTime() throws Exception { final Product p = new Product("P", "T", 1, 1); p.getPinGroup().add(Placemark.createPointPlacemark(PinDescriptor.getInstance(), "a", "a", "a", new PixelPos(), new GeoPos(), null)); p.getPinGroup().add(Placemark.createPointPlacemark(PinDescriptor.getInstance(), "b", "b", "b", new PixelPos(), new GeoPos(), null)); assertEquals(1, p.getMaskGroup().getNodeCount()); assertNotNull(p.getMaskGroup().get("pins")); }
@Test public void testMaskIsAddedWhenPinIsAddedForTheFirstTime() throws Exception { final Product p = new Product("P", "T", 1, 1); p.getPinGroup().add(Placemark.createPointPlacemark(PinDescriptor.getInstance(), "a", "a", "a", new PixelPos(), new GeoPos(), null)); assertEquals(1, p.getMaskGroup().getNodeCount()); assertNotNull(p.getMaskGroup().get("pins")); }
public void testWriteXML_XmlWriterIsNull() { Placemark placemark = Placemark.createPointPlacemark(PinDescriptor.getInstance(), "pinName", "pinLabel", "", null, new GeoPos(), product.getGeoCoding()); try { PlacemarkIO.writeXML(placemark, null, 1); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException e) { // expected IllegalArgumentException } catch (Exception e) { fail("IllegalArgumentException expected"); } }
@Test public void testMaskIsAddedWhenGcpIsAddedForTheFirstTime() throws Exception { final Product p = new Product("P", "T", 1, 1); p.getGcpGroup().add(Placemark.createPointPlacemark(GcpDescriptor.getInstance(), "a", "a", "a", new PixelPos(), new GeoPos(), null)); assertEquals(1, p.getMaskGroup().getNodeCount()); assertNotNull(p.getMaskGroup().get("ground_control_points")); }
@Test public void testMaskIsRemovedWhenAllPinsAreRemoved() throws Exception { final Product p = new Product("P", "T", 1, 1); p.getPinGroup().add(Placemark.createPointPlacemark(PinDescriptor.getInstance(), "a", "a", "a", new PixelPos(), new GeoPos(), null)); p.getPinGroup().removeAll(); assertEquals(0, p.getMaskGroup().getNodeCount()); }
@Test public void testMaskIsRemovedWhenAllGcpsAreRemoved() throws Exception { final Product p = new Product("P", "T", 1, 1); p.getGcpGroup().add(Placemark.createPointPlacemark(GcpDescriptor.getInstance(), "a", "a", "a", new PixelPos(), new GeoPos(), null)); p.getGcpGroup().removeAll(); assertEquals(0, p.getMaskGroup().getNodeCount()); }
void copyActivePlacemark() { Guardian.assertNotNull("product", product); Placemark activePlacemark = getSelectedPlacemark(); Guardian.assertNotNull("activePlacemark", activePlacemark); Placemark newPlacemark = Placemark.createPointPlacemark(activePlacemark.getDescriptor(), "copy_of_" + activePlacemark.getName(), activePlacemark.getLabel(), activePlacemark.getDescription(), activePlacemark.getPixelPos(), activePlacemark.getGeoPos(), activePlacemark.getProduct().getGeoCoding()); newPlacemark.setStyleCss(activePlacemark.getStyleCss()); if (PlacemarkDialog.showEditPlacemarkDialog(getPaneWindow(), product, newPlacemark, placemarkDescriptor)) { makePlacemarkNameUnique(newPlacemark); updateUIState(); } }
public void testNodeChangeIsObservable() { final Product p = new Product("p", "t", 10, 10); final ProductNodeGroup<Placemark> pinGroup = p.getPinGroup(); final Placemark placemark = Placemark.createPointPlacemark(PinDescriptor.getInstance(), "p1", "l1", "", new PixelPos(0, 0), null, null); pinGroup.add(placemark); final PNL listener = new PNL(Placemark.class); p.addProductNodeListener(listener); placemark.setLabel("new label"); assertEquals(true, p.isModified()); assertEquals("c:p1.label;", listener.trace); }
public void testLabelSettings() { Placemark p = Placemark.createPointPlacemark(PinDescriptor.getInstance(), "rallamann", "rallamann", "", null, new GeoPos(), product.getGeoCoding()); assertEquals("rallamann", p.getName()); assertEquals("rallamann", p.getLabel()); p.setLabel("schanteri"); assertEquals("rallamann", p.getName()); assertEquals("schanteri", p.getLabel()); p.setLabel(null); assertEquals("", p.getLabel()); p.setLabel(""); assertEquals("", p.getLabel()); } }
@Test public void testVectorDataNodeAndPlacemarkGroup() { Product p = new Product("p", "pt", 512, 512); ProductNodeGroup<VectorDataNode> vectorDataGroup = p.getVectorDataGroup(); Placemark placemark = Placemark.createPointPlacemark(PointDescriptor.getInstance(), "placemark_1", null, null, new PixelPos(10, 10), null, null); VectorDataNode vectorDataNode = new VectorDataNode("Features", Placemark.createPointFeatureType("feature")); FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection = vectorDataNode.getFeatureCollection(); vectorDataGroup.add(vectorDataNode); //Also: Sets the owner of the vectorDataNode vectorDataNode.getPlacemarkGroup(); //Also: Creates the PlacemarkGroup (owner has to be set!) featureCollection.add(placemark.getFeature()); assertEquals(1, vectorDataNode.getFeatureCollection().size()); assertEquals(vectorDataNode.getFeatureCollection().size(), vectorDataNode.getPlacemarkGroup().getNodeCount()); }