/** * Constructs and initializes a <code>LatLonGeo</code> at the given coordinates. * * @param northLat north latitude in degrees of the newly constructed <code>LatLonGeo</code> * @param eastLon east longitude in degrees of the newly constructed <code>LatLonGeo</code> * @param altitude altitude in system units of the newly constructed <code>LatLonGeo</code> */ public static LatLonGeo fromDeg( double northLat, double eastLon, double altitude ) { return new LatLonGeo( northLat * piOver180, eastLon * piOver180, altitude, true ); }
/** * Constructs and initializes a <code>LatLonGeo</code> at the given coordinates. Altitude * will default to 0. * * @param northLat north latitude in degrees of the newly constructed <code>LatLonGeo</code> * @param eastLon east longitude in degrees of the newly constructed <code>LatLonGeo</code> */ public static LatLonGeo fromDeg( double northLat, double eastLon ) { return new LatLonGeo( northLat * piOver180, eastLon * piOver180, 0d, true ); }
/** * Constructs and initializes a <code>LatLonGeo</code> at the given coordinates. * * @param northLat north latitude in radians of the newly constructed <code>LatLonGeo</code> * @param eastLon east longitude in radians of the newly constructed <code>LatLonGeo</code> * @param altitude altitude in system units of the newly constructed <code>LatLonGeo</code> */ public static LatLonGeo fromRad( double northLat, double eastLon, double altitude ) { return new LatLonGeo( northLat, eastLon, altitude, true ); }
/** * Constructs and initializes a <code>LatLonGeo</code> at the given coordinates. Altitude * will default to 0. * * @param northLat north latitude in radians of the newly constructed <code>LatLonGeo</code> * @param eastLon east longitude in radians of the newly constructed <code>LatLonGeo</code> */ public static LatLonGeo fromRad( double northLat, double eastLon ) { return new LatLonGeo( northLat, eastLon, 0d, true ); }
/** * Constructs and initializes a <code>LatLonGeo</code> at the given coordinates. * * @param northLatHours hours of north latitude (degrees) in new <code>LatLonGeo</code> * @param northLatMinutes minutes of north latitude (degrees) in new <code>LatLonGeo</code> * @param eastLonHours hours of east longitude (degrees) in new <code>LatLonGeo</code> * @param eastLonMinutes minutes of east longitude (degrees) in new <code>LatLonGeo</code> */ public static LatLonGeo fromDeg( int northLatHours, double northLatMinutes, int eastLonHours, double eastLonMinutes ) { final double northLatDeg = northLatHours + northLatMinutes / 60d; final double eastLonDeg = eastLonHours + eastLonMinutes / 60d; return new LatLonGeo( northLatDeg * piOver180, eastLonDeg * piOver180, 0d, true ); }
public static LatLonGeo parseToLatLonGeo( String s ) throws LatLonFormatParseException { String[] latLonString = s.split( "," ); if ( latLonString.length < 2 ) { throw new LatLonFormatParseException( s, "fewer than 2 components" ); } try { double lat = Double.parseDouble( latLonString[0] ); double lon = Double.parseDouble( latLonString[1] ); return new LatLonGeo( lat, lon ); } catch ( NumberFormatException nfe ) { throw new LatLonFormatParseException( s, nfe ); } } }
/** * Returns a newly constructed <code>LatLonGeo</code> with a * new altitude but same latitude and same longitude as the current * <code>LatLonGeo</code>. * * @param altitude altitude of the newly constructed <code>LatLonGeo</code> */ public LatLonGeo withAltitude( double altitude ) { return new LatLonGeo( getLatRad( ), getLonRad( ), altitude, true ); }
private static Set<Pair<IntPoint2d, LatLonGeo>> extractRegistrationPoints( String header ) { Set<Pair<IntPoint2d, LatLonGeo>> refPoints = new HashSet<Pair<IntPoint2d, LatLonGeo>>( ); Vector<Pair<String, String>> allTokenData = extractTokenData( header, "REF" ); for ( Pair<String, String> tokenData : allTokenData ) { Scanner s = new Scanner( tokenData.second( ).replaceAll( "\r\n", "" ) ).useDelimiter( "," ); s.nextInt( ); int x = s.nextInt( ); int y = s.nextInt( ); double lat_DEG = s.nextDouble( ); double lon_DEG = s.nextDouble( ); refPoints.add( new Pair<IntPoint2d, LatLonGeo>( new IntPoint2d( x, y ), new LatLonGeo( lat_DEG, lon_DEG ) ) ); s.close( ); } return refPoints; }
/** * Converts a point on the unit sphere (ECEF-r) to LatLon. * <p> * Deliberately non-static, to allow overriding. */ protected LatLonGeo pointOnUnitSphereToLatLon( Vector3d pointOnUnitSphere ) { double lonRad = calcAtan2( pointOnUnitSphere.getY( ), pointOnUnitSphere.getX( ) ); double latRad = PolynomialApprox.asin( pointOnUnitSphere.getZ( ) ); LatLonGeo latLon = new LatLonGeo( Angle.radiansToDegrees( latRad ), Angle.radiansToDegrees( lonRad ) ); return latLon; }