private static void setLatLongMetadata( final Product product, final MetadataElement absRoot, final String tagLat, final String tagLon, final float x, final float y) { final PixelPos pixelPos = new PixelPos(x, y); final GeoPos geoPos = new GeoPos(); if (product.getGeoCoding() == null) return; product.getGeoCoding().getGeoPos(pixelPos, geoPos); final MetadataAttribute lat = absRoot.getAttribute(tagLat); if (lat != null) lat.getData().setElemDouble(geoPos.getLat()); final MetadataAttribute lon = absRoot.getAttribute(tagLon); if (lon != null) lon.getData().setElemDouble(geoPos.getLon()); }
private void syncLatLonWithXYParams() { final PixelPos pixelPos1 = new PixelPos( ((Number) paramX1.getValue()).intValue(), ((Number) paramY1.getValue()).intValue()); final PixelPos pixelPos2 = new PixelPos( ((Number) paramX2.getValue()).intValue(), ((Number) paramY2.getValue()).intValue()); final GeoCoding geoCoding = product.getGeoCoding(); final GeoPos geoPos1 = geoCoding.getGeoPos(pixelPos1, null); final GeoPos geoPos2 = geoCoding.getGeoPos(pixelPos2, null); paramNorthLat1.setValue(geoPos1.getLat(), null); paramWestLon1.setValue(geoPos1.getLon(), null); paramSouthLat2.setValue(geoPos2.getLat(), null); paramEastLon2.setValue(geoPos2.getLon(), null); }