public PinManagerToolView() { super(PinDescriptor.getInstance(), new TableModelFactory() { @Override public PinTableModel createTableModel(PlacemarkDescriptor placemarkDescriptor, Product product, Band[] selectedBands, TiePointGrid[] selectedGrids) { return new PinTableModel(placemarkDescriptor, product, selectedBands, selectedGrids); } }); } }
public InsertPinInteractor() { super(PinDescriptor.getInstance()); } }
CoordinateTableModel() { super(PinDescriptor.getInstance(), null, null, null); }
@Deprecated static void addPins(Document dom, Product product) { Element groupElement = dom.getRootElement().getChild(DimapProductConstants.TAG_PIN_GROUP); List elements; if (groupElement != null) { elements = groupElement.getChildren(DimapProductConstants.TAG_PLACEMARK); } else { // get pins of old DIMAP files prior version 2.3 elements = dom.getRootElement().getChildren(DimapProductConstants.TAG_PIN); } for (Object elementObj : elements) { final Element element = (Element) elementObj; final Placemark placemark = PlacemarkIO.createPlacemark(element, PinDescriptor.getInstance(), product.getGeoCoding()); if (placemark != null) { product.getPinGroup().add(placemark); } } }
private Placemark createPlacemark(String name, PixelPos pixelPos, GeoPos geoPos) { return Placemark.createPointPlacemark(PinDescriptor.getInstance(), name, "", "", pixelPos, geoPos, null); } }
@Test public void testPinDescriptorIsRegistered() throws Exception { assertNotNull(PinDescriptor.getInstance()); assertEquals(PinDescriptor.class, PinDescriptor.getInstance().getClass()); }
private Placemark createDummyPin(String name) { return Placemark.createPointPlacemark(PinDescriptor.getInstance(), name, "", "", new PixelPos(0.5f, 0.5f), null, 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); } }
@Test public void testReadWritePinXmlFile() throws Exception { testReadWritePlacemarkXmlFile(PinDescriptor.getInstance()); }
@Test public void testGetInstance() throws Exception { assertNotNull(instance); assertSame(instance, PinDescriptor.getInstance()); assertSame(PinDescriptor.class, instance.getClass()); }
@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"); } }
@Test public void testReadMinimalPlacemarkTextFile() throws Exception { testReadMinimalPlacemarkTextFile(GcpDescriptor.getInstance()); testReadMinimalPlacemarkTextFile(PinDescriptor.getInstance()); }
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 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 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()); }
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()); } }