示例#1
0
文件: OSMWay.java 项目: tfreese/misc
  /**
   * @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);
  }
示例#2
0
文件: OSMWay.java 项目: tfreese/misc
  /** @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;
  }