/** * @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()); }
@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; }
if (Longitude.ANTIMERIDIAN_WEST.equals(masterLocation.getLongitude()))
@Override public boolean equals(final Object other) { if (other instanceof GeodeticCoordinate) { final GeodeticCoordinate that = (GeodeticCoordinate) other; return this.getLatitude().equals(that.getLatitude()) && this.getLongitude().equals(that.getLongitude()) && this.getAltitude().equals(that.getAltitude()); } return false; }
protected Long nodeIdentifierForLocation(final Location location) { buildNodeSpatialIndexIfNecessary(); final Iterator<Node> nodes; final Rectangle bounds = location.bounds(); // Handle the anti-meridian case. +180 and -180 are identical in the Atlas, if this happens // to be the Longitude of the passed in Location, make sure to also check the equivalent // Location across the anti-meridian. if (location.getLongitude().equals(Longitude.ANTIMERIDIAN_EAST) || location.getLongitude().equals(Longitude.ANTIMERIDIAN_WEST)) { final Location locationAcrossAntiMeridian = new Location(location.getLatitude(), Longitude.dm7(-location.getLongitude().asDm7())); final Rectangle boundsAcrossAntiMeridian = locationAcrossAntiMeridian.bounds(); nodes = new MultiIterable<>(this.getNodeSpatialIndex().get(bounds), this.getNodeSpatialIndex().get(boundsAcrossAntiMeridian)).iterator(); } else { nodes = this.getNodeSpatialIndex().get(bounds).iterator(); } if (nodes.hasNext()) { return nodes.next().getIdentifier(); } return null; }