コード例 #1
0
  Integer findClosestZoom(GridSet gridSet, WMSMapContent map) {
    double reqScale =
        RendererUtilities.calculateOGCScale(bounds(map), gridSet.getTileWidth(), null);

    int i = 0;
    double error = Math.abs(gridSet.getGrid(i).getScaleDenominator() - reqScale);
    while (i < gridSet.getNumLevels() - 1) {
      Grid g = gridSet.getGrid(i + 1);
      double e = Math.abs(g.getScaleDenominator() - reqScale);

      if (e > error) {
        break;
      } else {
        error = e;
      }
      i++;
    }

    return Math.max(i, 0);
  }
コード例 #2
0
ファイル: Map.java プロジェクト: SOLA-SAMOA/clients
 /**
  * Gets the current scale of the map. The calculation happens according to OGC specification.
  *
  * @return The scale
  */
 public Double getScale() {
   return RendererUtilities.calculateOGCScale(this.getDisplayArea(), this.getWidth(), null);
 }