/** * Copy Constructor. * * @param pt point to copy */ public LatLonPointImpl(LatLonPoint pt) { this(pt.getLatitude(), pt.getLongitude()); }
/** * Returns the result of {@link #nearlyEquals(LatLonPoint, double)}, with {@link Misc#defaultMaxRelativeDiffDouble}. */ default boolean nearlyEquals(LatLonPoint that) { return nearlyEquals(that, Misc.defaultMaxRelativeDiffDouble); }
/** * Copy Constructor. * * @param pt point to copy */ public LatLonPointImpl(LatLonPoint pt) { this(pt.getLatitude(), pt.getLongitude()); }
public static boolean equals(EarthLocation loc1, EarthLocation loc2) { if (loc1 == loc2) { return true; } else if (loc1 == null || loc2 == null) { return false; } if (!loc1.getLatLon().nearlyEquals(loc2.getLatLon(), 1.0e-8)) { return false; } else if (!Misc.nearlyEquals(loc1.getAltitude(), loc2.getAltitude(), 1.0e-8)) { return false; } else if (!Objects.deepEquals(loc1.isMissing(), loc2.isMissing())) { return false; } return true; }
/** * Copy Constructor. * * @param pt point to copy */ public LatLonPointImpl(LatLonPoint pt) { this(pt.getLatitude(), pt.getLongitude()); }
/** * Copy Constructor. * * @param pt point to copy */ public LatLonPointImpl(LatLonPoint pt) { this(pt.getLatitude(), pt.getLongitude()); }
public LatLonPointImmutable(LatLonPoint pt) { this(pt.getLatitude(), pt.getLongitude()); }
@Override public boolean equals(LatLonPoint pt) { if (Double.compare(pt.getLatitude(), lat) != 0) return false; if (Double.compare(pt.getLongitude(), lon) != 0) return false; return true; }
/** * Calculate the bearing between the 2 points. * See calculateBearing below. Uses default Earth object. * * @param pt1 Point 1 * @param pt2 Point 2 * @param result Object to use if non-null * @return The bearing */ public static Bearing calculateBearing(LatLonPoint pt1, LatLonPoint pt2, Bearing result) { return calculateBearing(defaultEarth, pt1.getLatitude(), pt1.getLongitude(), pt2.getLatitude(), pt2.getLongitude(), result); }
/** * Construct a lat/lon bounding box from two points. * The order of longitude coord of the two points matters: * pt1.lon is always the "left" point, then points contained within the box * increase (unless crossing the Dateline, in which case they jump to -180, but * then start increasing again) until pt2.lon * The order of lat doesnt matter: smaller will go to "lower" point (further south) * * @param left left corner * @param right right corner */ public LatLonRect(LatLonPoint left, LatLonPoint right) { this(left, right.getLatitude() - left.getLatitude(), LatLonPointImpl.lonNormal360(right.getLongitude() - left.getLongitude())); }
/** * Construct a lat/lon bounding box from two points. * The order of longitude coord of the two points matters: * pt1.lon is always the "left" point, then points contained within the box * increase (unless crossing the Dateline, in which case they jump to -180, but * then start increasing again) until pt2.lon * The order of lat doesnt matter: smaller will go to "lower" point (further south) * * @param left left corner * @param right right corner */ public LatLonRect(LatLonPoint left, LatLonPoint right) { this(left, right.getLatitude() - left.getLatitude(), LatLonPointImpl.lonNormal360(right.getLongitude() - left.getLongitude())); }
/** * Construct a lat/lon bounding box from two points. * The order of longitude coord of the two points matters: * pt1.lon is always the "left" point, then points contained within the box * increase (unless crossing the Dateline, in which case they jump to -180, but * then start increasing again) until pt2.lon * The order of lat doesnt matter: smaller will go to "lower" point (further south) * * @param left left corner * @param right right corner */ public LatLonRect(LatLonPoint left, LatLonPoint right) { this(left, right.getLatitude() - left.getLatitude(), LatLonPointImpl.lonNormal360(right.getLongitude() - left.getLongitude())); }
/** * Calculate the bearing between the 2 points. * See calculateBearing below. Uses default Earth object. * * @param pt1 Point 1 * @param pt2 Point 2 * @param result Object to use if non-null * @return The bearing */ public static Bearing calculateBearing(LatLonPoint pt1, LatLonPoint pt2, Bearing result) { return calculateBearing(defaultEarth, pt1.getLatitude(), pt1.getLongitude(), pt2.getLatitude(), pt2.getLongitude(), result); }
/** * Construct a lat/lon bounding box from two points. * The order of longitude coord of the two points matters: * pt1.lon is always the "left" point, then points contained within the box * increase (unless crossing the Dateline, in which case they jump to -180, but * then start increasing again) until pt2.lon * The order of lat doesnt matter: smaller will go to "lower" point (further south) * * @param left left corner * @param right right corner */ public LatLonRect(LatLonPoint left, LatLonPoint right) { this(left, right.getLatitude() - left.getLatitude(), LatLonPointImpl.lonNormal360(right.getLongitude() - left.getLongitude())); }
/** * Calculate the bearing between the 2 points. * See calculateBearing below. Uses default Earth object. * * @param pt1 Point 1 * @param pt2 Point 2 * @param result Object to use if non-null * @return The bearing */ public static Bearing calculateBearing(LatLonPoint pt1, LatLonPoint pt2, Bearing result) { return calculateBearing(defaultEarth, pt1.getLatitude(), pt1.getLongitude(), pt2.getLatitude(), pt2.getLongitude(), result); }
/** * Calculate the bearing between the 2 points. * See calculateBearing below. Uses default Earth object. * * @param pt1 Point 1 * @param pt2 Point 2 * @param result Object to use if non-null * @return The bearing */ public static Bearing calculateBearing(LatLonPoint pt1, LatLonPoint pt2, Bearing result) { return calculateBearing(defaultEarth, pt1.getLatitude(), pt1.getLongitude(), pt2.getLatitude(), pt2.getLongitude(), result); }
/** * Calculate the bearing between the 2 points. * See calculateBearing below. * * @param e Earth object (defines radius & flattening) * @param pt1 Point 1 * @param pt2 Point 2 * @param result Object to use if non-null * @return The bearing */ public static Bearing calculateBearing(Earth e, LatLonPoint pt1, LatLonPoint pt2, Bearing result) { return calculateBearing(e, pt1.getLatitude(), pt1.getLongitude(), pt2.getLatitude(), pt2.getLongitude(), result); }
/** * Calculate the bearing between the 2 points. * See calculateBearing below. * * @param e Earth object (defines radius & flattening) * @param pt1 Point 1 * @param pt2 Point 2 * @param result Object to use if non-null * @return The bearing */ public static Bearing calculateBearing(Earth e, LatLonPoint pt1, LatLonPoint pt2, Bearing result) { return calculateBearing(e, pt1.getLatitude(), pt1.getLongitude(), pt2.getLatitude(), pt2.getLongitude(), result); }
@Override public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl destPoint) { int status = geocoord2pixcoord(latlon.getLatitude(), latlon.getLongitude(), destPoint); return destPoint; }
/** * Determine if a specified LatLonPoint is contained in this bounding box. * * @param p the specified point to be tested * @return true if point is contained in this bounding box */ public boolean contains(LatLonPoint p) { return contains(p.getLatitude(), p.getLongitude()); }