private void updateGeoPos() { if (canGetGeoPos && !adjusting) { adjusting = true; GeoPos geoPos = placemarkDescriptor.updateGeoPos(product.getSceneGeoCoding(), getPixelPos(), getGeoPos()); setGeoPos(geoPos); adjusting = false; } }
@Override protected void onOK() { if (ProductNode.isValidNodeName(getName())) { super.onOK(); } else { showInformationDialog("'" + getName() + "' is not a valid " + placemarkDescriptor.getRoleLabel() + " name."); /*I18N*/ } }
@Test public void test() { try { PlacemarkDialog pinDialog = new PlacemarkDialog(null, new Product("x", "y", 10, 10), PinDescriptor.getInstance(), false); pinDialog.setDescription("descrip"); assertEquals("descrip", pinDialog.getDescription()); pinDialog.setLat(3.6f); assertEquals(3.6f, pinDialog.getLat(), 1e-15); pinDialog.setLon(5.7f); assertEquals(5.7f, pinDialog.getLon(), 1e-15); GeoPos geoPos = pinDialog.getGeoPos(); assertNotNull(geoPos); assertEquals(3.6f, geoPos.lat, 1e-6f); assertEquals(5.7f, geoPos.lon, 1e-6f); pinDialog.setName("name"); assertEquals("name", pinDialog.getName()); pinDialog.setLabel("label"); assertEquals("label", pinDialog.getLabel()); pinDialog.setPixelX(2.3F); assertEquals(2.3F, pinDialog.getPixelX(), 1e-6F); pinDialog.setPixelY(14.1F); assertEquals(14.1F, pinDialog.getPixelY(), 1e-6F);
final PlacemarkDialog dialog = new PlacemarkDialog(parent, product, placemarkDescriptor, placemarkDescriptor instanceof PinDescriptor); boolean belongsToProduct = placemark.getProduct() != null; String roleLabel = StringUtils.firstLetterUp(placemarkDescriptor.getRoleLabel()); dialog.getJDialog().setTitle(titlePrefix + " " + roleLabel); dialog.getJDialog().setName(titlePrefix + "_" + roleLabel); dialog.setName(placemark.getName()); dialog.setLabel(placemark.getLabel()); dialog.setDescription(placemark.getDescription() != null ? placemark.getDescription() : ""); dialog.setPixelPos(placemark.getPixelPos()); GeoPos geoPos = placemark.getGeoPos(); dialog.setGeoPos(geoPos != null ? geoPos : new GeoPos(Float.NaN, Float.NaN)); dialog.adjusting = false; dialog.setStyleCss(placemark.getStyleCss()); boolean ok = (dialog.show() == ID_OK); if (ok) { if (!belongsToProduct) { placemark.setName(dialog.getName()); placemark.setLabel(dialog.getLabel()); placemark.setDescription(dialog.getDescription()); placemark.setGeoPos(dialog.getGeoPos()); placemark.setStyleCss(dialog.getStyleCss());
private void updatePixelPos() { if (canGetPixelPos && !adjusting) { adjusting = true; PixelPos pixelPos = placemarkDescriptor.updatePixelPos(product.getSceneGeoCoding(), getGeoPos(), getPixelPos()); setPixelPos(pixelPos); adjusting = false; } }