private static Placemark[] getValidGcps(ProductNodeGroup<Placemark> gcpGroup) { final List<Placemark> gcpList = new ArrayList<Placemark>(gcpGroup.getNodeCount()); for (int i = 0; i < gcpGroup.getNodeCount(); i++) { final Placemark p = gcpGroup.get(i); final PixelPos pixelPos = p.getPixelPos(); final GeoPos geoPos = p.getGeoPos(); if (pixelPos != null && pixelPos.isValid() && geoPos != null && geoPos.isValid()) { gcpList.add(p); } } return gcpList.toArray(new Placemark[gcpList.size()]); }
private static boolean isValid(Placemark p) { final PixelPos pixelPos = p.getPixelPos(); final GeoPos geoPos = p.getGeoPos(); return pixelPos != null && pixelPos.isValid() && geoPos != null && geoPos.isValid(); }
int nLonPixels = (int) Math.abs(pixelCorners[1].x - pixelCorners[0].x); if(!upperLeftGeo.isValid()) { return null;
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.getSceneGeoCoding(); final GeoPos geoPos1 = geoCoding.getGeoPos(pixelPos1, null); final GeoPos geoPos2 = geoCoding.getGeoPos(pixelPos2, null); if(geoPos1.isValid()) { double lat = geoPos1.getLat(); lat = MathUtils.crop(lat, -90.0, 90.0); paramNorthLat1.setValue(lat, null); double lon = geoPos1.getLon(); lon = MathUtils.crop(lon, -180.0, 180.0); paramWestLon1.setValue(lon, null); } if (geoPos2.isValid()) { double lat = geoPos2.getLat(); lat = MathUtils.crop(lat, -90.0, 90.0); paramSouthLat2.setValue(lat, null); double lon = geoPos2.getLon(); lon = MathUtils.crop(lon, -180.0, 180.0); paramEastLon2.setValue(lon, null); } }
@Override public void paintOverlay(LayerCanvas canvas, Rendering rendering) { if (geoPosition == null || !geoPosition.isValid()) { return; } final GeoCoding geoCoding = sceneView.getRaster().getGeoCoding(); if (!geoCoding.canGetPixelPos()) { return; } final Product product = sceneView.getRaster().getProduct(); final PixelPos pixelPos = geoCoding.getPixelPos(geoPosition, null); if (!pixelPos.isValid() || !product.containsPixel(pixelPos)) { return; } final Viewport viewport = canvas.getViewport(); drawCursor(rendering.getGraphics(), viewport, pixelPos); }