Ejemplo n.º 1
0
  private boolean getPosition(
      final double lat,
      final double lon,
      final double alt,
      final int x0,
      final int y0,
      final int w,
      final int h,
      final PositionData data) {

    GeoUtils.geo2xyzWGS84(lat, lon, alt, data.earthPoint);

    /*final double zeroDopplerTime = SARGeocoding.getEarthPointZeroDopplerTimeNewton(
    firstLineUTC, lineTimeInterval, wavelength, data.earthPoint,
    orbit.sensorPosition, orbit.sensorVelocity);*/

    final double zeroDopplerTime =
        SARGeocoding.getEarthPointZeroDopplerTimeNewton(
            firstLineUTC, lineTimeInterval, wavelength, data.earthPoint, orbit);

    if (zeroDopplerTime == SARGeocoding.NonValidZeroDopplerTime) {
      return false;
    }

    data.slantRange =
        SARGeocoding.computeSlantRange(zeroDopplerTime, orbit, data.earthPoint, data.sensorPos);

    final double zeroDopplerTimeWithoutBias =
        zeroDopplerTime + data.slantRange / Constants.lightSpeedInMetersPerDay;

    data.azimuthIndex = (zeroDopplerTimeWithoutBias - firstLineUTC) / lineTimeInterval;

    if (!(data.azimuthIndex > y0 - 1 && data.azimuthIndex <= y0 + h)) {
      return false;
    }

    data.slantRange =
        SARGeocoding.computeSlantRange(
            zeroDopplerTimeWithoutBias, orbit, data.earthPoint, data.sensorPos);

    if (!srgrFlag) {
      data.rangeIndex = (data.slantRange - nearEdgeSlantRange) / rangeSpacing;
    } else {
      data.rangeIndex =
          SARGeocoding.computeRangeIndex(
              srgrFlag,
              sourceImageWidth,
              firstLineUTC,
              lastLineUTC,
              rangeSpacing,
              zeroDopplerTimeWithoutBias,
              data.slantRange,
              nearEdgeSlantRange,
              srgrConvParams);
    }

    if (data.rangeIndex <= 0.0) {
      return false;
    }

    if (!nearRangeOnLeft) {
      data.rangeIndex = sourceImageWidth - 1 - data.rangeIndex;
    }

    if (!(data.rangeIndex >= x0 && data.rangeIndex < x0 + w)) {
      return false;
    }
    return true;
  }
Ejemplo n.º 2
0
  private void computeTileOverlapPercentage(
      final int x0, final int y0, final int w, final int h, double[] overlapPercentages)
      throws Exception {

    final PixelPos pixPos = new PixelPos();
    final GeoPos geoPos = new GeoPos();
    final PosVector earthPoint = new PosVector();
    final PosVector sensorPos = new PosVector();
    double tileOverlapPercentageMax = -Double.MAX_VALUE;
    double tileOverlapPercentageMin = Double.MAX_VALUE;
    for (int y = y0; y < y0 + h; y += 20) {
      for (int x = x0; x < x0 + w; x += 20) {
        pixPos.setLocation(x, y);
        sourceGeoCoding.getGeoPos(pixPos, geoPos);
        final double alt = dem.getElevation(geoPos);
        GeoUtils.geo2xyzWGS84(geoPos.getLat(), geoPos.getLon(), alt, earthPoint);

        final double zeroDopplerTime =
            SARGeocoding.getEarthPointZeroDopplerTime(
                firstLineUTC,
                lineTimeInterval,
                wavelength,
                earthPoint,
                orbit.sensorPosition,
                orbit.sensorVelocity);

        if (zeroDopplerTime == SARGeocoding.NonValidZeroDopplerTime) {
          continue;
        }

        final double slantRange =
            SARGeocoding.computeSlantRange(zeroDopplerTime, orbit, earthPoint, sensorPos);

        final double zeroDopplerTimeWithoutBias =
            zeroDopplerTime + slantRange / Constants.lightSpeedInMetersPerDay;

        final int azimuthIndex =
            (int) ((zeroDopplerTimeWithoutBias - firstLineUTC) / lineTimeInterval + 0.5);

        double tileOverlapPercentage = (double) (azimuthIndex - y) / (double) tileSize;

        if (tileOverlapPercentage > tileOverlapPercentageMax) {
          tileOverlapPercentageMax = tileOverlapPercentage;
        }
        if (tileOverlapPercentage < tileOverlapPercentageMin) {
          tileOverlapPercentageMin = tileOverlapPercentage;
        }
      }
    }

    if (tileOverlapPercentageMin != Double.MAX_VALUE && tileOverlapPercentageMin < 0.0) {
      overlapPercentages[0] = tileOverlapPercentageMin - 0.5;
    } else {
      overlapPercentages[0] = 0.0;
    }

    if (tileOverlapPercentageMax != -Double.MAX_VALUE && tileOverlapPercentageMax > 0.0) {
      overlapPercentages[1] = tileOverlapPercentageMax + 0.5;
    } else {
      overlapPercentages[1] = 0.0;
    }
  }