protected long longitudeSpan() { return this.end().getLongitude().asDm7() - this.start().getLongitude().asDm7(); } }
@Override public Location middle() { return new Location( Latitude.degrees((this.start().getLatitude().asDegrees() + this.end().getLatitude().asDegrees()) / 2.0), Longitude.degrees((this.start().getLongitude().asDegrees() + this.end().getLongitude().asDegrees()) / 2.0)); }
@Override public boolean equals(final Object other) { if (other instanceof Location) { final Location that = (Location) other; return this.getLatitude().equals(that.getLatitude()) && this.getLongitude().equals(that.getLongitude()); } return false; }
public CompleteNode withLocation(final Location location) { this.location = location; if (this.originalBounds == null) { this.originalBounds = location.bounds(); } this.aggregateBounds = Rectangle.forLocated(this.originalBounds, location.bounds()); return this; }
/** * @return True if this segment is exactly east west (the two latitudes are the same) */ public boolean isEastWest() { return start().hasSameLatitudeAs(end()); }
/** * @return True if this segment is exactly north south (the two longitudes are the same) */ public boolean isNorthSouth() { return start().hasSameLongitudeAs(end()); }
public CompleteLine withPolyLine(final PolyLine polyLine) { this.polyLine = polyLine; if (this.originalBounds == null) { this.originalBounds = polyLine.bounds(); } this.aggregateBounds = Rectangle.forLocated(this.originalBounds, polyLine.bounds()); return this; }
public CompleteArea withPolygon(final Polygon polygon) { this.polygon = polygon; if (this.originalBounds == null) { this.originalBounds = polygon.bounds(); } this.aggregateBounds = Rectangle.forLocated(this.originalBounds, polygon.bounds()); return this; }
/** * @param other * The other {@link Location} to test * @return True if this {@link Location} is east of the other {@link Location}. */ public boolean isEastOf(final Location other) { return this.getLongitude().isGreaterThan(other.getLongitude()); }
@Override public Rectangle bounds() { return asPolyLine().bounds(); }
/** * @param other * The other {@link Location} to test * @return True if this {@link Location} and the other {@link Location} to test are on the same * East-West line. */ public boolean hasSameLatitudeAs(final Location other) { return this.getLatitude().equals(other.getLatitude()); }
/** * @param other * The other {@link Location} to test * @return True if this {@link Location} is north or on the same {@link Latitude} as the other * {@link Location}. */ public boolean isNorthOfOrOnTheSameLatitudeAs(final Location other) { return this.getLatitude().isGreaterThanOrEqualTo(other.getLatitude()); }
public Polygon asPolygon() { return new Polygon(asPolyLine()); } }
/** * @param other * The other {@link Location} to test * @return True if this {@link Location} and the other {@link Location} to test are on the same * North-South line. */ public boolean hasSameLongitudeAs(final Location other) { return this.getLongitude().equals(other.getLongitude()); }
public CompletePoint withLocation(final Location location) { this.location = location; if (this.originalBounds == null) { this.originalBounds = location.bounds(); } this.aggregateBounds = Rectangle.forLocated(this.originalBounds, location.bounds()); return this; }