/** * Sets this placemark's label. * * @param label the label, if {@code null} an empty label is set. */ public void setLabel(String label) { setAttributeValue(PROPERTY_NAME_LABEL, label != null ? label : ""); }
/** * Sets this placemark's (XHTML) text. * * @param text The text, if {@code null} an empty text is set. */ public void setText(String text) { setAttributeValue(PROPERTY_NAME_TEXT, text != null ? text : ""); }
/** * Sets this placemark's CSS style. * * @param styleCss The text, if {@code null} an empty text is set. * @since BEAM 4.10 */ public void setStyleCss(String styleCss) { setAttributeValue(PROPERTY_NAME_STYLE_CSS, styleCss != null ? styleCss : ""); }
@Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { if (placemark != null) { final AttributeDescriptor attributeDescriptor = placemark.getFeature().getFeatureType().getAttributeDescriptors().get(rowIndex); final Class<?> binding = attributeDescriptor.getType().getBinding(); if (String.class.isAssignableFrom(binding)) { placemark.setAttributeValue(attributeDescriptor.getLocalName(), aValue); } else if (Geometry.class.isAssignableFrom(binding)) { WKTReader reader = new WKTReader(); try { final Geometry geometry = reader.read((String) aValue); placemark.setAttributeValue(attributeDescriptor.getLocalName(), geometry); } catch (ParseException e) { // No way to handle this any further :( e.printStackTrace(); } } } }
private void setGeoPosAttribute(GeoPos geoPos, boolean updatePixelPos) { final Coordinate newCoordinate = toCoordinate(geoPos); final Coordinate oldCoordinate = getGeoPosAttribute(); if (!ObjectUtils.equalObjects(oldCoordinate, newCoordinate)) { if (oldCoordinate == null) { final GeometryFactory geometryFactory = new GeometryFactory(); setAttributeValue(PROPERTY_NAME_GEOPOS, geometryFactory.createPoint(newCoordinate)); } else if (newCoordinate != null) { final Point point = (Point) getAttributeValue(PROPERTY_NAME_GEOPOS); point.getCoordinate().setCoordinate(newCoordinate); point.geometryChanged(); } if (updatePixelPos && getProduct() != null) { final PixelPos pixelPos = getPixelPos(); descriptor.updatePixelPos(getProduct().getGeoCoding(), geoPos, pixelPos); setPixelPosAttribute(pixelPos, false, true); } fireProductNodeChanged(PROPERTY_NAME_GEOPOS); } }
private void setPixelPosAttribute(PixelPos pixelPos, boolean updateGeoPos, boolean updateDefaultGeometry) { final Coordinate newCoordinate = toCoordinate(pixelPos); final Coordinate oldCoordinate = getPixelPosAttribute(); if (!ObjectUtils.equalObjects(oldCoordinate, newCoordinate)) { if (oldCoordinate == null) { final GeometryFactory geometryFactory = new GeometryFactory(); setAttributeValue(PROPERTY_NAME_PIXELPOS, geometryFactory.createPoint(newCoordinate)); } else { final Point point = (Point) getAttributeValue(PROPERTY_NAME_PIXELPOS); point.getCoordinate().setCoordinate(newCoordinate); point.geometryChanged(); } // Make sure, object is in a consistent state if (updateDefaultGeometry) { updateDefaultGeometryAttribute(pixelPos); } if (updateGeoPos && getProduct() != null) { final GeoPos geoPos = getGeoPos(); descriptor.updateGeoPos(getProduct().getGeoCoding(), pixelPos, geoPos); setGeoPosAttribute(geoPos, false); } fireProductNodeChanged(PROPERTY_NAME_PIXELPOS); } }