/** * Returns an array of this object's latitude and longitude in degrees. * * @return the array of latitude and longitude, arranged in that order. */ public double[] asDegreesArray() { return new double[] {this.getLatitude().degrees, this.getLongitude().degrees}; }
continue; if (minLatLocation == null || minLatLocation.getLatitude().degrees > extremes[0].getLatitude().degrees) minLatLocation = extremes[0]; if (maxLatLocation == null || maxLatLocation.getLatitude().degrees < extremes[1].getLatitude().degrees) maxLatLocation = extremes[1];
/** * Returns an array of this object's latitude and longitude in radians. * * @return the array of latitude and longitude, arranged in that order. */ public double[] asRadiansArray() { return new double[] {this.getLatitude().radians, this.getLongitude().radians}; }
public static Sector boundingSector(LatLon pA, LatLon pB) { if (pA == null || pB == null) { throw new IllegalArgumentException("Positions List Is Null"); } double minLat = pA.getLatitude().degrees; double minLon = pA.getLongitude().degrees; double maxLat = pA.getLatitude().degrees; double maxLon = pA.getLongitude().degrees; if (pB.getLatitude().degrees < minLat) minLat = pB.getLatitude().degrees; else if (pB.getLatitude().degrees > maxLat) maxLat = pB.getLatitude().degrees; if (pB.getLongitude().degrees < minLon) minLon = pB.getLongitude().degrees; else if (pB.getLongitude().degrees > maxLon) maxLon = pB.getLongitude().degrees; return Sector.fromDegrees(minLat, maxLat, minLon, maxLon); }
@Override public String toString() { String las = String.format("Lat %7.4f\u00B0", this.getLatitude().getDegrees()); String los = String.format("Lon %7.4f\u00B0", this.getLongitude().getDegrees()); return "(" + las + ", " + los + ")"; }
double lat1 = p1.getLatitude().radians; double lon1 = p1.getLongitude().radians; double lat2 = p2.getLatitude().radians; double lon2 = p2.getLongitude().radians;
public static Sector union(Iterable<? extends Sector> sectors) { if (sectors == null) { throw new IllegalArgumentException("Sector List Is Null"); } Angle minLat = Angle.POS90; Angle maxLat = Angle.NEG90; Angle minLon = Angle.POS180; Angle maxLon = Angle.NEG180; for (Sector s : sectors) { if (s == null) continue; for (LatLon p : s) { if (p.getLatitude().degrees < minLat.degrees) minLat = p.getLatitude(); if (p.getLatitude().degrees > maxLat.degrees) maxLat = p.getLatitude(); if (p.getLongitude().degrees < minLon.degrees) minLon = p.getLongitude(); if (p.getLongitude().degrees > maxLon.degrees) maxLon = p.getLongitude(); } } return new Sector(minLat, maxLat, minLon, maxLon); }
public static boolean equals(LatLon a, LatLon b) { return a.getLatitude().equals(b.getLatitude()) && a.getLongitude().equals(b.getLongitude()); }
double lat1 = p1.getLatitude().radians; double lon1 = p1.getLongitude().radians; double lat2 = p2.getLatitude().radians; double lon2 = p2.getLongitude().radians;
double lat1 = p1.getLatitude().radians; double lon1 = p1.getLongitude().radians; double lat2 = p2.getLatitude().radians; double lon2 = p2.getLongitude().radians;
/** * Determines whether a latitude/longitude position is within the sector. The sector's angles are assumed to be * normalized to +/- 90 degrees latitude and +/- 180 degrees longitude. The result of the operation is undefined if * they are not. * * @param latLon the position to test, with angles normalized to +/- π latitude and +/- 2π longitude. * * @return <code>true</code> if the position is within the sector, <code>false</code> otherwise. * * @throws IllegalArgumentException if <code>latlon</code> is null. */ public final boolean contains(LatLon latLon) { if (latLon == null) { throw new IllegalArgumentException("LatLon Is Null"); } return this.contains(latLon.getLatitude(), latLon.getLongitude()); }
double lat = p.getLatitude().radians; double lon = p.getLongitude().radians; double azimuth = greatCircleAzimuth.radians;
public static boolean isSector(Iterable<? extends LatLon> corners) { if (corners == null) { throw new IllegalArgumentException("Locations List Is Null"); } LatLon[] latlons = new LatLon[5]; int i = 0; for (LatLon ll : corners) { if (i > 4 || ll == null) return false; latlons[i++] = ll; } if (!latlons[0].getLatitude().equals(latlons[1].getLatitude())) return false; if (!latlons[2].getLatitude().equals(latlons[3].getLatitude())) return false; if (!latlons[0].getLongitude().equals(latlons[3].getLongitude())) return false; if (!latlons[1].getLongitude().equals(latlons[2].getLongitude())) return false; if (i == 5 && !latlons[4].equals(latlons[0])) return false; return true; }
/** * Convert a single MGRS coordinate to a decimal degree {@link Point} * * @param mgrs * The input MGRS coordinate {@link String} * * @return A {@link Point} converted from a MGRS coordinate string * * @throws IllegalArgumentException * If the input MGRS string is not valid */ public static Point toLatLonPoint(final String mgrs) { if (!MgrsConverter.isValid(mgrs)) { throw new IllegalArgumentException("MGRS string is not valid."); } // Creates a MGRS reference for conversion // The param for global is left null, which will default the projection to WGS84 final MGRSCoord mgrsCoordinate = MGRSCoord.fromString(mgrs); final GeometryFactory gf = new GeometryFactory(); //Returns MGRS Point to wayPoints Conversion final LatLon latLon = new LatLon(mgrsCoordinate.getLatitude(), mgrsCoordinate.getLongitude()); return gf.createPoint(new Coordinate(latLon.getLongitude().degrees, latLon.getLatitude().degrees)); }
public static LatLonBounds getCorners( List<LatLon> screenCorners ) { double minLat = Double.POSITIVE_INFINITY; double minLon = Double.POSITIVE_INFINITY; double maxLat = Double.NEGATIVE_INFINITY; double maxLon = Double.NEGATIVE_INFINITY; for ( LatLon latlon : screenCorners ) { double lat = latlon.getLatitude( ).getDegrees( ); double lon = latlon.getLongitude( ).getDegrees( ); if ( lat < minLat ) minLat = lat; if ( lat > maxLat ) maxLat = lat; if ( lon < minLon ) minLon = lon; if ( lon > maxLon ) maxLon = lon; } return new LatLonBounds( minLat, maxLat, minLon, maxLon ); }
public static Sector boundingSector(Iterable<? extends LatLon> locations) { if (locations == null) { throw new IllegalArgumentException("Positions List Is Null"); } if (!locations.iterator().hasNext()) return EMPTY_SECTOR; // TODO: should be returning null double minLat = Angle.POS90.getDegrees(); double minLon = Angle.POS180.getDegrees(); double maxLat = Angle.NEG90.getDegrees(); double maxLon = Angle.NEG180.getDegrees(); for (LatLon p : locations) { double lat = p.getLatitude().getDegrees(); if (lat < minLat) minLat = lat; if (lat > maxLat) maxLat = lat; double lon = p.getLongitude().getDegrees(); if (lon < minLon) minLon = lon; if (lon > maxLon) maxLon = lon; } return Sector.fromDegrees(minLat, maxLat, minLon, maxLon); }
new Vec4(value1.getLongitude().radians, value1.getLatitude().radians, 0), new Vec4(value2.getLongitude().radians, value2.getLatitude().radians, 0));
public static UTMCoord fromLatLon(Angle latitude, Angle longitude, String datum) { if (latitude == null || longitude == null) { throw new IllegalArgumentException("Latitude Or Longitude Is Null"); } UTMCoordConverter converter; if (!WWUtil.isEmpty(datum) && datum.equals("NAD27")) { converter = new UTMCoordConverter(UTMCoordConverter.CLARKE_A, UTMCoordConverter.CLARKE_F); LatLon llNAD27 = UTMCoordConverter.convertWGS84ToNAD27(latitude, longitude); latitude = llNAD27.getLatitude(); longitude = llNAD27.getLongitude(); } else { converter = new UTMCoordConverter(UTMCoordConverter.WGS84_A, UTMCoordConverter.WGS84_F); } long err = converter.convertGeodeticToUTM(latitude.radians, longitude.radians); if (err != UTMCoordConverter.UTM_NO_ERROR) { throw new IllegalArgumentException("UTM Conversion Error"); } return new UTMCoord(latitude, longitude, converter.getZone(), converter.getHemisphere(), converter.getEasting(), converter.getNorthing(), Angle.fromRadians(converter.getCentralMeridian())); }
double dLat = this.levels.getLevelZeroTileDelta().getLatitude().degrees / 90.0; int firstRow = Tile.computeRow(level.getTileDelta().getLatitude(), sector.getMinLatitude()); int firstCol = Tile.computeColumn(level.getTileDelta().getLongitude(), sector.getMinLongitude()); int lastRow = Tile.computeRow(level.getTileDelta().getLatitude(), sector.getMaxLatitude()); int lastCol = Tile.computeColumn(level.getTileDelta().getLongitude(), sector.getMaxLongitude());
ll.getLatitude(), ll.getLongitude(), dc.getGlobe().getElevation(ll.getLatitude(), ll.getLongitude())); pt = dc.getView().project(pt);