Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    private void updateXYParams(GeoPos geoPos1, GeoPos geoPos2) {
      final GeoCoding geoCoding = product.getGeoCoding();
      final PixelPos pixelPos1 = geoCoding.getPixelPos(geoPos1, null);
      if (!pixelPos1.isValid()) {
        pixelPos1.setLocation(0, 0);
      }
      final PixelPos pixelPos2 = geoCoding.getPixelPos(geoPos2, null);
      if (!pixelPos2.isValid()) {
        pixelPos2.setLocation(product.getSceneRasterWidth(), product.getSceneRasterHeight());
      }
      final Rectangle.Float region = new Rectangle.Float();
      region.setFrameFromDiagonal(pixelPos1.x, pixelPos1.y, pixelPos2.x, pixelPos2.y);
      final Rectangle.Float productBounds =
          new Rectangle.Float(0, 0, product.getSceneRasterWidth(), product.getSceneRasterHeight());
      Rectangle2D finalRegion = productBounds.createIntersection(region);

      paramX1.setValue((int) finalRegion.getMinX(), null);
      paramY1.setValue((int) finalRegion.getMinY(), null);
      paramX2.setValue((int) finalRegion.getMaxX() - 1, null);
      paramY2.setValue((int) finalRegion.getMaxY() - 1, null);
    }
Esempio n. 3
0
 private boolean canUseGeoCoordinates(Product product) {
   final GeoCoding geoCoding = product.getGeoCoding();
   return geoCoding != null && geoCoding.canGetPixelPos() && geoCoding.canGetGeoPos();
 }