Example #1
0
  /**
   * @param myZTFMatrix {@link Matrix}
   * @return {@link Polygon}
   */
  public Polygon getDrawablePolygon(final Matrix myZTFMatrix) {
    if (this.polygon == null) {
      this.polygon = new Polygon();

      for (OSMNode osmNode : getNodes()) {
        double x = Mercator.mercX(osmNode.getLongitude());
        double y = Mercator.mercY(osmNode.getLatitude());
        this.polygon.addPoint((int) x, (int) y);
      }
    }

    return myZTFMatrix.multiply(this.polygon);
  }
Example #2
0
  /** @return {@link Rectangle} */
  public Rectangle getBounds() {
    if (this.bounds == null) {
      for (OSMNode osmNode : getNodes()) {
        double x = Mercator.mercX(osmNode.getLongitude());
        double y = Mercator.mercY(osmNode.getLatitude());

        if (this.bounds == null) {
          this.bounds = new Rectangle();
          this.bounds.x = (int) x;
          this.bounds.y = (int) y;
        }

        this.bounds.add(x, y);
      }
    }

    return this.bounds;
  }