コード例 #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);
    }
コード例 #2
0
ファイル: IOParameterPage.java プロジェクト: TonioF/beam
  private void updateLogParameter(final Request request) {
    Parameter param;
    Parameter toUpdate;

    param = request.getParameter(LOG_PREFIX_PARAM_NAME);
    final ParamGroup paramGroup = getParamGroup();
    if (param != null) {
      toUpdate = paramGroup.getParameter(LOG_PREFIX_PARAM_NAME);
      toUpdate.setValue(param.getValue(), null);
    }

    param = request.getParameter(LOG_TO_OUTPUT_PARAM_NAME);
    if (param != null) {
      toUpdate = paramGroup.getParameter(LOG_TO_OUTPUT_PARAM_NAME);
      toUpdate.setValue(param.getValue(), null);
    }
  }
コード例 #3
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);
    }
コード例 #4
0
    @Override
    public void sliderBoxChanged(Rectangle sliderBoxBounds) {
      int x1 = sliderBoxBounds.x * thumbNailSubSampling;
      int y1 = sliderBoxBounds.y * thumbNailSubSampling;
      int x2 = x1 + sliderBoxBounds.width * thumbNailSubSampling;
      int y2 = y1 + sliderBoxBounds.height * thumbNailSubSampling;
      int w = product.getSceneRasterWidth();
      int h = product.getSceneRasterHeight();
      if (x1 < 0) {
        x1 = 0;
      }
      if (x1 > w - 2) {
        x1 = w - 2;
      }
      if (y1 < 0) {
        y1 = 0;
      }
      if (y1 > h - 2) {
        y1 = h - 2;
      }
      if (x2 < 1) {
        x2 = 1;
      }
      if (x2 > w - 1) {
        x2 = w - 1;
      }
      if (y2 < 1) {
        y2 = 1;
      }
      if (y2 > h - 1) {
        y2 = h - 1;
      }
      // first reset the bounds, otherwise negative regions can occur
      paramX1.setValue(0, null);
      paramY1.setValue(0, null);
      paramX2.setValue(w - 1, null);
      paramY2.setValue(h - 1, null);

      paramX1.setValue(x1, null);
      paramY1.setValue(y1, null);
      paramX2.setValue(x2, null);
      paramY2.setValue(y2, null);
    }