Ejemplo n.º 1
0
  public GeoPath traceSingleContourAtPoint(GeoGrid geoGrid, double x, double y) {

    this.flags = new boolean[geoGrid.getRows()][geoGrid.getCols()];

    double cellSize = geoGrid.getCellSize();
    double west = geoGrid.getWest();
    double north = geoGrid.getNorth();
    double level = geoGrid.getBicubicInterpol(x, y);

    int[] cell = new int[] {(int) ((x - west) / cellSize), (int) ((north - y) / cellSize)};
    GeoPath geoPath = traceContour(geoGrid.getGrid(), cell, level, west, north, cellSize);
    return geoPath;
  }
Ejemplo n.º 2
0
  private void contourLevel(GeoGrid geoGrid, double level, GeoSet levelGeoSet) {

    final int nbrCellsX = geoGrid.getCols() - 1;
    final int nbrCellsY = geoGrid.getRows() - 1;
    float[][] grid = geoGrid.getGrid();
    double west = geoGrid.getWest();
    double north = geoGrid.getNorth();
    double cellSize = geoGrid.getCellSize();

    for (int i = 0; i < this.flags.length; i++) {
      java.util.Arrays.fill(this.flags[i], false);
    }

    for (int y = 0; y < nbrCellsY; y++) {
      boolean[] flag_row = flags[y];
      for (int x = 0; x < nbrCellsX; x++) {
        if (flag_row[x] == false) {
          traceContour(grid, new int[] {x, y}, level, west, north, cellSize, levelGeoSet);
        }
      }
    }
  }
Ejemplo n.º 3
0
  public GeoObject operate(GeoGrid geoGrid, double firstContourLevel, double lastContourLevel) {
    flags = new boolean[geoGrid.getRows()][geoGrid.getCols()];

    GeoSet geoSet = new GeoSet();

    final int nlevels = (int) ((lastContourLevel - firstContourLevel) / interval) + 1;
    if (treatDegreeJump) {
      GeoSet levelGeoSet = new GeoSet();
      this.contourLevel(geoGrid, 0.f, levelGeoSet);
      levelGeoSet.setName(Float.toString(0.f));
      geoSet.add(levelGeoSet);
    }

    for (int i = 0; i < nlevels; ++i) {
      final double contourLevel = firstContourLevel + i * interval;
      GeoSet levelGeoSet = new GeoSet();
      this.contourLevel(geoGrid, contourLevel, levelGeoSet);
      levelGeoSet.setName(Double.toString(contourLevel));
      geoSet.add(levelGeoSet);
    }
    return geoSet;
  }