Class EllipsoidalGlobe
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.globes.EllipsoidalGlobe
-
- All Implemented Interfaces:
AVList
,MessageListener
,Extent
,Globe
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
public class EllipsoidalGlobe extends WWObjectImpl implements Globe
Defines a globe modeled as an ellipsoid. This globe uses a Cartesian coordinate system in which the Y axis points to the north pole. The Z axis points to the intersection of the prime meridian and the equator, in the equatorial plane. The X axis completes a right-handed coordinate system, and is 90 degrees east of the Z axis and also in the equatorial plane. Sea level is at z = zero. By default the origin of the coordinate system lies at the center of the globe, but can be set to a different point when the globe is constructed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
EllipsoidalGlobe.StateKey
-
Field Summary
Fields Modifier and Type Field Description protected EGM96
egm96
protected double
equatorialRadius
protected double
es
protected double
polarRadius
-
Constructor Summary
Constructors Constructor Description EllipsoidalGlobe(double equatorialRadius, double polarRadius, double es, ElevationModel em)
Create a new globe.EllipsoidalGlobe(double equatorialRadius, double polarRadius, double es, ElevationModel em, Vec4 center)
Create a new globe, and set the position of the globe's center.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyEGMA96Offsets(java.lang.String offsetsFilePath)
protected Position
cartesianToGeodetic(Vec4 cart)
Compute the geographic position to corresponds to a Cartesian point.Vec4
computeEllipsoidalNormalAtLocation(Angle latitude, Angle longitude)
Computes a vector perpendicular to the surface of the ellipsoid specified by this globe, in cartesian coordinates.Matrix
computeEllipsoidalOrientationAtPosition(Angle latitude, Angle longitude, double metersElevation)
Returns the cartesian transform matrix that maps local model coordinates to an ellipsoidal coordinate system at (latitude, longitude, metersElevation).Vec4
computeEllipsoidalPointFromLocation(LatLon location)
Computes a ellipsoidal point from a latitude and longitude.Vec4
computeEllipsoidalPointFromPosition(Angle latitude, Angle longitude, double metersElevation)
Computes a ellipsoidal point from a latitude, longitude, and elevation.Vec4
computeEllipsoidalPointFromPosition(Position position)
Computes a ellipsoidal point from a latitude, longitude, and elevation.Matrix
computeModelCoordinateOriginTransform(Angle latitude, Angle longitude, double metersElevation)
Matrix
computeModelCoordinateOriginTransform(Position position)
Vec4
computeNorthPointingTangentAtLocation(Angle latitude, Angle longitude)
Computes a vector tangent to this globe and pointing toward the north pole.Vec4
computePointFromLocation(LatLon location)
Computes a cartesian point from a geographic location on the surface of this globe.Vec4
computePointFromPosition(Angle latitude, Angle longitude, double metersElevation)
Computes a cartesian point from a latitude, longitude, and elevation.Vec4
computePointFromPosition(LatLon latLon, double metersElevation)
Computes a cartesian point from a geographic location and elevation.Vec4
computePointFromPosition(Position position)
Computes a cartesian point from a geographic position.void
computePointsFromPositions(Sector sector, int numLat, int numLon, double[] metersElevation, Vec4[] out)
Computes a grid of cartesian points corresponding to a grid of geographic positions.Position
computePositionFromEllipsoidalPoint(Vec4 ellipsoidalPoint)
Computes the geographic position of a point in ellipsoidal coordinates.Position
computePositionFromPoint(Vec4 point)
Computes the geographic position of a point in cartesian coordinates.Vec4
computeSurfaceNormalAtLocation(Angle latitude, Angle longitude)
Returns the normal to the Globe at the specified position.Vec4
computeSurfaceNormalAtPoint(Vec4 point)
Returns the normal to the Globe at the specified cartiesian point.Matrix
computeSurfaceOrientationAtPosition(Angle latitude, Angle longitude, double metersElevation)
Returns the cartesian transform matrix that maps model coordinates to a local coordinate system at (latitude, longitude, metersElevation).Matrix
computeSurfaceOrientationAtPosition(Position position)
Returns the cartesian transform matrix that maps model coordinates to a local coordinate system at (latitude, longitude, metersElevation).protected Position
ellipsoidalToGeodetic(Vec4 cart)
Compute the geographic position to corresponds to an ellipsoidal point.protected Vec4
geodeticToCartesian(Angle latitude, Angle longitude, double metersElevation)
Maps a position to world Cartesian coordinates.protected void
geodeticToCartesian(Sector sector, int numLat, int numLon, double[] metersElevation, Vec4[] out)
Maps a grid of geographic positions to Cartesian coordinates.protected Vec4
geodeticToEllipsoidal(Angle latitude, Angle longitude, double metersElevation)
Maps a position to ellipsoidal coordinates.Vec4
getCenter()
Returns the extent's center point.double
getDiameter()
Returns the extent's diameter.double
getEccentricitySquared()
Indicates the square of this globe's eccentricity.double
getEffectiveRadius(Plane plane)
Computes the effective radius of the extent relative to a specified plane.double
getElevation(Angle latitude, Angle longitude)
Indicates the elevation at a specified location.ElevationModel
getElevationModel()
Indicates this globe's elevation model.double[]
getElevations(Sector sector, java.util.List<? extends LatLon> latLons, double[] targetResolution, double[] elevations)
Indicates the elevations of a collection of locations.double
getElevations(Sector sector, java.util.List<? extends LatLon> latlons, double targetResolution, double[] elevations)
Indicates the elevations of a collection of locations.double
getEquatorialRadius()
Indicates the radius of the globe at the equator, in meters.Extent
getExtent()
Indicates the spatial volume contained by this globe.GlobeStateKey
getGlobeStateKey()
Returns a typed state key identifying this globe's current configuration.GlobeStateKey
getGlobeStateKey(DrawContext dc)
Returns a typed state key identifying this globe's current configuration.Position
getIntersectionPosition(Line line)
Computes the intersections of this globe and a line.double
getMaxElevation()
Indicates the maximum elevation on this globe, in meters.double
getMaximumRadius()
Indicates the maximum radius on the globe.double[]
getMinAndMaxElevations(Angle latitude, Angle longitude)
Returns the minimum and maximum elevations at a specified location on this Globe.double[]
getMinAndMaxElevations(Sector sector)
Returns the minimum and maximum elevations within a specified sector on this Globe.double
getMinElevation()
Indicates the minimum elevation on this globe, in meters.double
getPolarRadius()
Indicates the radius of the globe at the poles, in meters.double
getProjectedArea(View view)
Computes the area in square pixels of thisExtent
after it is projected into the specifiedview's
viewport.double
getRadius()
Returns the extent's radius.double
getRadiusAt(Angle latitude, Angle longitude)
Indicates the radius in meters of the globe's ellipsoid at a location.double
getRadiusAt(LatLon location)
Indicates the radius in meters of the globe's ellipsoid at a location.java.lang.Object
getStateKey(DrawContext dc)
Returns a state key identifying this globe's current configuration.Tessellator
getTessellator()
Returns this globe's current tessellator.Intersection[]
intersect(Line line)
Computes the intersections of this extent withline
.Intersection[]
intersect(Line line, double altitude)
Intersects a specified line with this globe.protected Intersection[]
intersect(Line line, double equRadius, double polRadius)
Intersection[]
intersect(Triangle t, double elevation)
Intersects a specified triangle with the globe.boolean
intersects(Frustum frustum)
Determines whether or not thisExtent
intersectsfrustum
.boolean
intersects(Line line)
Determines whether or notline
intersects thisExtent
.boolean
intersects(Plane plane)
Calculate whether or not thisExtent
is intersected byplane
.boolean
isPointAboveElevation(Vec4 point, double elevation)
Determines whether a point is above a given elevationstatic ElevationModel
makeElevationModel(java.lang.String key, java.lang.String defaultValue)
Construct an elevation model given a key for a configuration source and the source's default value.void
setElevationModel(ElevationModel elevationModel)
Specifies this globe's elevation model.void
setTessellator(Tessellator tessellator)
Specifies this globe's tessellator.SectorGeometryList
tessellate(DrawContext dc)
Tessellate this globe for the currently visible region.-
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
-
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
-
-
-
-
Field Detail
-
equatorialRadius
protected final double equatorialRadius
-
polarRadius
protected final double polarRadius
-
es
protected final double es
-
egm96
protected EGM96 egm96
-
-
Constructor Detail
-
EllipsoidalGlobe
public EllipsoidalGlobe(double equatorialRadius, double polarRadius, double es, ElevationModel em)
Create a new globe. The globe's center point will be (0, 0, 0). The globe will be tessellated using tessellator defined by theAVKey.TESSELLATOR_CLASS_NAME
configuration parameter.- Parameters:
equatorialRadius
- Radius of the globe at the equator.polarRadius
- Radius of the globe at the poles.es
- Square of the globe's eccentricity.em
- Elevation model. May be null.
-
EllipsoidalGlobe
public EllipsoidalGlobe(double equatorialRadius, double polarRadius, double es, ElevationModel em, Vec4 center)
Create a new globe, and set the position of the globe's center. The globe will be tessellated using tessellator defined by theAVKey.TESSELLATOR_CLASS_NAME
configuration parameter.- Parameters:
equatorialRadius
- Radius of the globe at the equator.polarRadius
- Radius of the globe at the poles.es
- Square of the globe's eccentricity.em
- Elevation model. May be null.center
- Cartesian coordinates of the globe's center point.
-
-
Method Detail
-
getStateKey
public java.lang.Object getStateKey(DrawContext dc)
Description copied from interface:Globe
Returns a state key identifying this globe's current configuration. Can be used to subsequently determine whether the globe's configuration has changed.- Specified by:
getStateKey
in interfaceGlobe
- Parameters:
dc
- the current draw context.- Returns:
- a state key for the globe's current configuration.
-
getGlobeStateKey
public GlobeStateKey getGlobeStateKey(DrawContext dc)
Description copied from interface:Globe
Returns a typed state key identifying this globe's current configuration. Can be used to subsequently determine whether the globe's configuration has changed.- Specified by:
getGlobeStateKey
in interfaceGlobe
- Parameters:
dc
- the current draw context.- Returns:
- a state key for the globe's current configuration.
-
getGlobeStateKey
public GlobeStateKey getGlobeStateKey()
Description copied from interface:Globe
Returns a typed state key identifying this globe's current configuration. Can be used to subsequently determine whether the globe's configuration has changed.- Specified by:
getGlobeStateKey
in interfaceGlobe
- Returns:
- a state key for the globe's current configuration.
-
getTessellator
public Tessellator getTessellator()
Description copied from interface:Globe
Returns this globe's current tessellator.- Specified by:
getTessellator
in interfaceGlobe
- Returns:
- the globe's current tessellator.
-
setTessellator
public void setTessellator(Tessellator tessellator)
Description copied from interface:Globe
Specifies this globe's tessellator.- Specified by:
setTessellator
in interfaceGlobe
- Parameters:
tessellator
- the new tessellator. Specify null to use the default tessellator.
-
getElevationModel
public ElevationModel getElevationModel()
Description copied from interface:Globe
Indicates this globe's elevation model.- Specified by:
getElevationModel
in interfaceGlobe
- Returns:
- this globe's elevation model.
-
setElevationModel
public void setElevationModel(ElevationModel elevationModel)
Description copied from interface:Globe
Specifies this globe's elevation model.- Specified by:
setElevationModel
in interfaceGlobe
- Parameters:
elevationModel
- this globe's elevation model. May be null to indicate no elevation model.
-
getRadius
public double getRadius()
Description copied from interface:Extent
Returns the extent's radius. The computation of the radius depends on the implementing class. See the documentation for the individual classes to determine how they compute a radius.
-
getEquatorialRadius
public double getEquatorialRadius()
Description copied from interface:Globe
Indicates the radius of the globe at the equator, in meters.- Specified by:
getEquatorialRadius
in interfaceGlobe
- Returns:
- The radius at the equator, in meters.
-
getPolarRadius
public double getPolarRadius()
Description copied from interface:Globe
Indicates the radius of the globe at the poles, in meters.- Specified by:
getPolarRadius
in interfaceGlobe
- Returns:
- The radius at the poles, in meters.
-
getMaximumRadius
public double getMaximumRadius()
Description copied from interface:Globe
Indicates the maximum radius on the globe.- Specified by:
getMaximumRadius
in interfaceGlobe
- Returns:
- The maximum radius, in meters.
-
getRadiusAt
public double getRadiusAt(Angle latitude, Angle longitude)
Description copied from interface:Globe
Indicates the radius in meters of the globe's ellipsoid at a location.- Specified by:
getRadiusAt
in interfaceGlobe
- Parameters:
latitude
- Latitude of the location at which to determine radius.longitude
- Longitude of the location at which to determine radius.- Returns:
- The radius in meters of the globe's ellipsoid at the specified location.
-
getRadiusAt
public double getRadiusAt(LatLon location)
Description copied from interface:Globe
Indicates the radius in meters of the globe's ellipsoid at a location.- Specified by:
getRadiusAt
in interfaceGlobe
- Parameters:
location
- the location at which to determine radius.- Returns:
- The radius in meters of the globe's ellipsoid at the specified location.
-
getEccentricitySquared
public double getEccentricitySquared()
Description copied from interface:Globe
Indicates the square of this globe's eccentricity. Eccentricity is a measure of how the equatorial and polar radii are related.- Specified by:
getEccentricitySquared
in interfaceGlobe
- Returns:
- The square of this globe's eccentricity.
-
getDiameter
public double getDiameter()
Description copied from interface:Extent
Returns the extent's diameter. The computation of the diameter depends on the implementing class. See the documentation for the individual classes to determine how they compute a diameter.- Specified by:
getDiameter
in interfaceExtent
- Returns:
- the extent's diameter.
-
getCenter
public Vec4 getCenter()
Description copied from interface:Extent
Returns the extent's center point.
-
getMaxElevation
public double getMaxElevation()
Description copied from interface:Globe
Indicates the maximum elevation on this globe, in meters.- Specified by:
getMaxElevation
in interfaceGlobe
- Returns:
- The maximum elevation, or zero if the maximum elevation cannot be determined.
-
getMinElevation
public double getMinElevation()
Description copied from interface:Globe
Indicates the minimum elevation on this globe, in meters.- Specified by:
getMinElevation
in interfaceGlobe
- Returns:
- The minimum elevation, or zero if the minimum elevation cannot be determined.
-
getMinAndMaxElevations
public double[] getMinAndMaxElevations(Angle latitude, Angle longitude)
Description copied from interface:Globe
Returns the minimum and maximum elevations at a specified location on this Globe. This returns a two-element array filled with zero if this Globe has no elevation model.- Specified by:
getMinAndMaxElevations
in interfaceGlobe
- Parameters:
latitude
- the latitude of the location in question.longitude
- the longitude of the location in question.- Returns:
- A two-element
double
array indicating the minimum and maximum elevations at the specified location, respectively. These values are the global minimum and maximum if the local minimum and maximum values are currently unknown, or zero if this Globe has no elevation model.
-
getMinAndMaxElevations
public double[] getMinAndMaxElevations(Sector sector)
Description copied from interface:Globe
Returns the minimum and maximum elevations within a specified sector on this Globe. This returns a two-element array filled with zero if this Globe has no elevation model.- Specified by:
getMinAndMaxElevations
in interfaceGlobe
- Parameters:
sector
- the sector in question.- Returns:
- A two-element
double
array indicating the sector's minimum and maximum elevations, respectively. These elements are the global minimum and maximum if the local minimum and maximum values are currently unknown, or zero if this Globe has no elevation model.
-
getExtent
public Extent getExtent()
Description copied from interface:Globe
Indicates the spatial volume contained by this globe.
-
getEffectiveRadius
public double getEffectiveRadius(Plane plane)
Description copied from interface:Extent
Computes the effective radius of the extent relative to a specified plane.- Specified by:
getEffectiveRadius
in interfaceExtent
- Parameters:
plane
- the plane.- Returns:
- the effective radius, or 0 if the plane is null.
-
intersects
public boolean intersects(Frustum frustum)
Description copied from interface:Extent
Determines whether or not thisExtent
intersectsfrustum
. Returns true if any part of these two objects intersect, including the case where either object wholly contains the other, false otherwise.- Specified by:
intersects
in interfaceExtent
- Parameters:
frustum
- theFrustum
with which to test for intersection.- Returns:
- true if there is an intersection, false otherwise.
-
intersect
public Intersection[] intersect(Line line)
Description copied from interface:Extent
Computes the intersections of this extent withline
. The returned array may be either null or of zero length if no intersections are discovered. It does not contain null elements. Tangential intersections are marked as such.line
is considered to have infinite length in both directions.
-
intersect
public Intersection[] intersect(Line line, double altitude)
Description copied from interface:Globe
Intersects a specified line with this globe. Only the ellipsoid itself is considered; terrain elevations are not incorporated.
-
intersect
protected Intersection[] intersect(Line line, double equRadius, double polRadius)
-
intersect
public Intersection[] intersect(Triangle t, double elevation)
Description copied from interface:Globe
Intersects a specified triangle with the globe. Only the ellipsoid itself is considered; terrain elevations are not incorporated.
-
intersects
public boolean intersects(Line line)
Description copied from interface:Extent
Determines whether or notline
intersects thisExtent
. This method may be faster than checking the size of the array returned byintersect(Line)
. Implementing methods must ensure that this method returns true if and only ifintersect(Line)
returns a non-null array containing at least one element.- Specified by:
intersects
in interfaceExtent
- Parameters:
line
- theLine
with which to test for intersection.- Returns:
- true if an intersection is found, false otherwise.
-
intersects
public boolean intersects(Plane plane)
Description copied from interface:Extent
Calculate whether or not thisExtent
is intersected byplane
.- Specified by:
intersects
in interfaceExtent
- Parameters:
plane
- thePlane
with which to test for intersection.- Returns:
- true if
plane
is found to intersect thisExtent
.
-
getProjectedArea
public double getProjectedArea(View view)
Computes the area in square pixels of thisExtent
after it is projected into the specifiedview's
viewport. The returned value is the screen area that thisExtent
covers in the infinite plane defined by theview's
viewport. This area is not limited to the size of theview's
viewport, and portions of thisExtent
are not clipped by theview's
frustum.This returns
Double.POSITIVE_INFINITY
if theview's
eye point is inside thisExtent
, or if any portion of thisExtent
is behind the eye point. In either case, thisExtent
has no finite projection on theview
.- Specified by:
getProjectedArea
in interfaceExtent
- Parameters:
view
- theView
for which to compute a projected screen area.- Returns:
- the projected screen area of this
Extent
in square pixels, orDouble.POSITIVE_INFINITY
if theview's
eye point is inside thisExtent
or part of thisExtent
is behind theview's
eye point.
-
applyEGMA96Offsets
public void applyEGMA96Offsets(java.lang.String offsetsFilePath) throws java.io.IOException
- Throws:
java.io.IOException
-
getElevations
public double getElevations(Sector sector, java.util.List<? extends LatLon> latlons, double targetResolution, double[] elevations)
Description copied from interface:Globe
Indicates the elevations of a collection of locations. Replaces any elevation values corresponding to the missing data signal with the elevation model's missing data replacement value. If a location within the elevation model's coverage area cannot currently be determined, the elevation model's minimum extreme elevation for that location is returned in the output buffer. If a location is outside the elevation model's coverage area, the output buffer for that location is not modified; it retains the buffer's original value.- Specified by:
getElevations
in interfaceGlobe
- Parameters:
sector
- the sector in question.latlons
- the locations to return elevations for. If a location is null, the output buffer for that location is not modified.targetResolution
- the desired horizontal resolution, in radians, of the raster or other elevation sample from which elevations are drawn. (To compute radians from a distance, divide the distance by the radius of the globe, ensuring that both the distance and the radius are in the same units.)elevations
- an array in which to place the returned elevations. The array must be pre-allocated and contain at least as many elements as the list of locations.- Returns:
- the resolution achieved, in radians, or
Double.MAX_VALUE
if individual elevations cannot be determined for all of the locations. Returns zero if an elevation model is not available. - See Also:
Globe.getElevationModel()
-
getElevations
public double[] getElevations(Sector sector, java.util.List<? extends LatLon> latLons, double[] targetResolution, double[] elevations)
Description copied from interface:Globe
Indicates the elevations of a collection of locations. Replaces any elevation values corresponding to the missing data signal with the elevation model's missing data replacement value. If a location within the elevation model's coverage area cannot currently be determined, the elevation model's minimum extreme elevation for that location is returned in the output buffer. If a location is outside the elevation model's coverage area, the output buffer for that location is not modified; it retains the buffer's original value.- Specified by:
getElevations
in interfaceGlobe
- Parameters:
sector
- the sector in question.latLons
- the locations to return elevations for. If a location is null, the output buffer for that location is not modified.targetResolution
- the desired horizontal resolution, in radians, of the raster or other elevation sample from which elevations are drawn. (To compute radians from a distance, divide the distance by the radius of the globe, ensuring that both the distance and the radius are in the same units.) This parameter is an array to allow varying resolutions to be specified forCompoundElevationModel
.elevations
- an array in which to place the returned elevations. The array must be pre-allocated and contain at least as many elements as the list of locations.- Returns:
- the resolution achieved, in radians, or
Double.MAX_VALUE
if individual elevations cannot be determined for all of the locations. Returns zero if an elevation model is not available. - See Also:
Globe.getElevationModel()
-
getElevation
public double getElevation(Angle latitude, Angle longitude)
Description copied from interface:Globe
Indicates the elevation at a specified location. If the elevation at the specified location is the elevation model's missing data signal, or if the location specified is outside the elevation model's coverage area, the elevation model's missing data replacement value is returned.The elevation returned from this method is the best available in memory. If no elevation is in memory, the elevation model's minimum extreme elevation at the location is returned. Local disk caches are not consulted.
- Specified by:
getElevation
in interfaceGlobe
- Parameters:
latitude
- the latitude of the location at which to determine elevation.longitude
- the longitude of the location at which to determine elevation.- Returns:
- The elevation corresponding to the specified location, or the elevation model's missing-data replacement value if there is no elevation for the given location. Returns zero if no elevation model is available.
- See Also:
Globe.getElevationModel()
-
computePointFromPosition
public Vec4 computePointFromPosition(Position position)
Description copied from interface:Globe
Computes a cartesian point from a geographic position.- Specified by:
computePointFromPosition
in interfaceGlobe
- Parameters:
position
- Geographic position to convert to cartesian. The position may include elevation above or below the globe's surface.- Returns:
- The cartesian point that corresponds to the specified geographic position.
-
computePointFromLocation
public Vec4 computePointFromLocation(LatLon location)
Description copied from interface:Globe
Computes a cartesian point from a geographic location on the surface of this globe.- Specified by:
computePointFromLocation
in interfaceGlobe
- Parameters:
location
- Geographic location on the surface of the globe to convert to cartesian.- Returns:
- The cartesian point that corresponds to the specified geographic location.
-
computePointFromPosition
public Vec4 computePointFromPosition(LatLon latLon, double metersElevation)
Description copied from interface:Globe
Computes a cartesian point from a geographic location and elevation.- Specified by:
computePointFromPosition
in interfaceGlobe
- Parameters:
latLon
- Geographic location to convert to cartesian.metersElevation
- Elevation, in meters, of the geographic position to convert to cartesian.- Returns:
- The cartesian point that corresponds to the specified geographic position.
-
computePointFromPosition
public Vec4 computePointFromPosition(Angle latitude, Angle longitude, double metersElevation)
Description copied from interface:Globe
Computes a cartesian point from a latitude, longitude, and elevation.- Specified by:
computePointFromPosition
in interfaceGlobe
- Parameters:
latitude
- Latitude of the location to convert to cartesian.longitude
- Longitude of the location to convert to cartesian.metersElevation
- Elevation, in meters, of the geographic position to convert to cartesian.- Returns:
- The cartesian point that corresponds to the specified geographic position.
-
computePositionFromPoint
public Position computePositionFromPoint(Vec4 point)
Description copied from interface:Globe
Computes the geographic position of a point in cartesian coordinates.- Specified by:
computePositionFromPoint
in interfaceGlobe
- Parameters:
point
- Point of which to find the geographic position.- Returns:
- The geographic position of the specified point.
-
computePointsFromPositions
public void computePointsFromPositions(Sector sector, int numLat, int numLon, double[] metersElevation, Vec4[] out)
Computes a grid of cartesian points corresponding to a grid of geographic positions.This method provides an interface for efficient generation of a grid of cartesian points within a sector. The grid is constructed by dividing the sector into
numLon x numLat
evenly separated points in geographic coordinates. The first and last points in latitude and longitude are placed at the sector's minimum and maximum boundary, and the remaining points are spaced evenly between those boundary points.For each grid point within the sector, an elevation value is specified via an array of elevations. The calculation at each position incorporates the associated elevation.
- Specified by:
computePointsFromPositions
in interfaceGlobe
- Parameters:
sector
- The sector over which to generate the points.numLat
- The number of points to generate latitudinally.numLon
- The number of points to generate longitudinally.metersElevation
- An array of elevations to incorporate in the point calculations. There must be one elevation value in the array for each generated point, so the array must have a length of at leastnumLon x numLat
. Elevations are read from this array in row major order, beginning with the row of minimum latitude.out
- An array to hold the computed cartesian points. It must have a length of at leastnumLon x numLat
. Points are written to this array in row major order, beginning with the row of minimum latitude.
-
computeSurfaceNormalAtLocation
public Vec4 computeSurfaceNormalAtLocation(Angle latitude, Angle longitude)
Returns the normal to the Globe at the specified position.- Specified by:
computeSurfaceNormalAtLocation
in interfaceGlobe
- Parameters:
latitude
- the latitude of the position.longitude
- the longitude of the position.- Returns:
- the Globe normal at the specified position.
-
computeSurfaceNormalAtPoint
public Vec4 computeSurfaceNormalAtPoint(Vec4 point)
Returns the normal to the Globe at the specified cartiesian point.- Specified by:
computeSurfaceNormalAtPoint
in interfaceGlobe
- Parameters:
point
- the cartesian point.- Returns:
- the Globe normal at the specified point.
-
computeNorthPointingTangentAtLocation
public Vec4 computeNorthPointingTangentAtLocation(Angle latitude, Angle longitude)
Description copied from interface:Globe
Computes a vector tangent to this globe and pointing toward the north pole.- Specified by:
computeNorthPointingTangentAtLocation
in interfaceGlobe
- Parameters:
latitude
- Latitude of the location at which to compute the tangent vector.longitude
- Longitude of the location at which to compute the tangent vector.- Returns:
- A vector tangent to this globe at (latitude, longitude), and pointing toward the north pole of this globe.
-
computeModelCoordinateOriginTransform
public Matrix computeModelCoordinateOriginTransform(Angle latitude, Angle longitude, double metersElevation)
- Specified by:
computeModelCoordinateOriginTransform
in interfaceGlobe
- Parameters:
latitude
- See computeSurfaceOrientationAtPosition.longitude
- See computeSurfaceOrientationAtPosition.metersElevation
- See computeSurfaceOrientationAtPosition.- Returns:
- See computeSurfaceOrientationAtPosition.
- See Also:
Globe.computeSurfaceOrientationAtPosition(gov.nasa.worldwind.geom.Angle, gov.nasa.worldwind.geom.Angle, double)
-
computeModelCoordinateOriginTransform
public Matrix computeModelCoordinateOriginTransform(Position position)
- Specified by:
computeModelCoordinateOriginTransform
in interfaceGlobe
- Parameters:
position
- See computeSurfaceOrientationAtPosition.- Returns:
- See computeSurfaceOrientationAtPosition.
- See Also:
Globe.computeSurfaceOrientationAtPosition(gov.nasa.worldwind.geom.Position)
-
computeSurfaceOrientationAtPosition
public Matrix computeSurfaceOrientationAtPosition(Angle latitude, Angle longitude, double metersElevation)
Returns the cartesian transform matrix that maps model coordinates to a local coordinate system at (latitude, longitude, metersElevation). The X axis is mapped to the vector tangent to the globe and pointing East. The Y axis is mapped to the vector tangent to the globe and pointing to the North Pole. The Z axis is mapped to the globe normal at (latitude, longitude, metersElevation). The origin is mapped to the cartesian position of (latitude, longitude, metersElevation).- Specified by:
computeSurfaceOrientationAtPosition
in interfaceGlobe
- Parameters:
latitude
- the latitude of the position.longitude
- the longitude of the position.metersElevation
- the number of meters above or below mean sea level.- Returns:
- the cartesian transform matrix that maps model coordinates to the local coordinate system at the specified position.
-
computeSurfaceOrientationAtPosition
public Matrix computeSurfaceOrientationAtPosition(Position position)
Returns the cartesian transform matrix that maps model coordinates to a local coordinate system at (latitude, longitude, metersElevation). They X axis is mapped to the vector tangent to the globe and pointing East. The Y axis is mapped to the vector tangent to the globe and pointing to the North Pole. The Z axis is mapped to the globe normal at (latitude, longitude, metersElevation). The origin is mapped to the cartesian position of (latitude, longitude, metersElevation).- Specified by:
computeSurfaceOrientationAtPosition
in interfaceGlobe
- Parameters:
position
- the latitude, longitude, and number of meters above or below mean sea level.- Returns:
- The cartesian transform matrix that maps model coordinates to the local coordinate system at the specified position.
-
computeEllipsoidalPointFromPosition
public Vec4 computeEllipsoidalPointFromPosition(Angle latitude, Angle longitude, double metersElevation)
Computes a ellipsoidal point from a latitude, longitude, and elevation.The returned point is a function of this globe's equatorial radius and its polar radius, and always represents a point on the ellipsoid in 3D cartesian coordinates that corresponds to the specified position. Calling this method on an instance of Globe2D will return a point on the ellipsoid defined by the 2D globe's radii.
- Specified by:
computeEllipsoidalPointFromPosition
in interfaceGlobe
- Parameters:
latitude
- Latitude of the location to convert.longitude
- Longitude of the location to convert.metersElevation
- Elevation, in meters, of the geographic position to convert.- Returns:
- The ellipsoidal point that corresponds to the specified geographic position.
-
computeEllipsoidalPointFromPosition
public Vec4 computeEllipsoidalPointFromPosition(Position position)
Computes a ellipsoidal point from a latitude, longitude, and elevation.The returned point is a function of this globe's equatorial radius and its polar radius, and always represents a point on the ellipsoid in 3D cartesian coordinates that corresponds to the specified position. Calling this method on an instance of Globe2D will return a point on the ellipsoid defined by the 2D globe's radii.
- Specified by:
computeEllipsoidalPointFromPosition
in interfaceGlobe
- Parameters:
position
- Position of the location to convert.- Returns:
- The ellipsoidal point that corresponds to the specified geographic position.
-
computeEllipsoidalPointFromLocation
public Vec4 computeEllipsoidalPointFromLocation(LatLon location)
Computes a ellipsoidal point from a latitude and longitude.The returned point is a function of this globe's equatorial radius and its polar radius, and always represents a point on the ellipsoid in 3D cartesian coordinates that corresponds to the specified location. Calling this method on an instance of Globe2D will return a point on the ellipsoid defined by the 2D globe's radii.
- Specified by:
computeEllipsoidalPointFromLocation
in interfaceGlobe
- Parameters:
location
- the location to convert.- Returns:
- The ellipsoidal point that corresponds to the specified geographic location.
-
computePositionFromEllipsoidalPoint
public Position computePositionFromEllipsoidalPoint(Vec4 ellipsoidalPoint)
Computes the geographic position of a point in ellipsoidal coordinates.The returned position is a function of this globe's equatorial radius and its polar radius, and always represents a position corresponding to the point on the ellipsoid in 3D cartesian coordinates. Calling this method on an instance of Globe2D will return a position corresponding to the ellipsoid defined by the 2D globe's radii.
- Specified by:
computePositionFromEllipsoidalPoint
in interfaceGlobe
- Parameters:
ellipsoidalPoint
- Point of which to find the geographic position, relative to the ellipsoid defined by the globe's radii.- Returns:
- The geographic position of the specified ellipsoidal point.
-
computeEllipsoidalNormalAtLocation
public Vec4 computeEllipsoidalNormalAtLocation(Angle latitude, Angle longitude)
Computes a vector perpendicular to the surface of the ellipsoid specified by this globe, in cartesian coordinates.The returned vector is a function of this globe's equatorial radius and its polar radius, and always represents a vector normal to the corresponding ellipsoid in 3D cartesian coordinates. Calling this method on an instance of Globe2D will return a vector normal to the ellipsoid defined by the 2D globe's radii.
- Specified by:
computeEllipsoidalNormalAtLocation
in interfaceGlobe
- Parameters:
latitude
- Latitude of the location at which to compute the normal vector.longitude
- Longitude of the location at which to compute the normal vector.- Returns:
- A vector perpendicular to the surface of the ellipsoid specified by this globe, at the specified location.
-
computeEllipsoidalOrientationAtPosition
public Matrix computeEllipsoidalOrientationAtPosition(Angle latitude, Angle longitude, double metersElevation)
Description copied from interface:Globe
Returns the cartesian transform matrix that maps local model coordinates to an ellipsoidal coordinate system at (latitude, longitude, metersElevation). The X axis is mapped to the vector tangent to the ellipsoid and pointing East. The Y axis is mapped to the vector tangent to the ellipsoid and pointing to the North Pole. The Z axis is mapped to the ellipsoidal normal at (latitude, longitude, metersElevation). The origin is mapped to the ellipsoidal position of (latitude, longitude, metersElevation).The returned matrix is a function of this globe's equatorial radius and its polar radius, and always represents a transform matrix appropriate for the corresponding ellipsoid in 3D cartesian coordinates. Calling this method on an instance of Globe2D will return a transform matrix for the ellipsoid defined by the 2D globe's radii.
- Specified by:
computeEllipsoidalOrientationAtPosition
in interfaceGlobe
- Parameters:
latitude
- the latitude of the position.longitude
- the longitude of the position.metersElevation
- the number of meters above or below mean sea level.- Returns:
- The cartesian transform matrix that maps model coordinates to the ellipsoidal coordinate system at the specified position.
-
getIntersectionPosition
public Position getIntersectionPosition(Line line)
Description copied from interface:Globe
Computes the intersections of this globe and a line.- Specified by:
getIntersectionPosition
in interfaceGlobe
- Parameters:
line
- the line with which to intersect this globe.- Returns:
- the geographic position of the intersection of this globe and specified line. If there are multiple intersections the intersection nearest to the line's origin is returned. The intersection may be a tangent. Returns null if the line does not intersect this globe.
-
geodeticToCartesian
protected Vec4 geodeticToCartesian(Angle latitude, Angle longitude, double metersElevation)
Maps a position to world Cartesian coordinates. The Y axis points to the north pole. The Z axis points to the intersection of the prime meridian and the equator, in the equatorial plane. The X axis completes a right-handed coordinate system, and is 90 degrees east of the Z axis and also in the equatorial plane. Sea level is at z = zero.- Parameters:
latitude
- the latitude of the position.longitude
- the longitude of the position.metersElevation
- the number of meters above or below mean sea level.- Returns:
- The Cartesian point corresponding to the input position.
-
geodeticToEllipsoidal
protected Vec4 geodeticToEllipsoidal(Angle latitude, Angle longitude, double metersElevation)
Maps a position to ellipsoidal coordinates. The Y axis points to the north pole. The Z axis points to the intersection of the prime meridian and the equator, in the equatorial plane. The X axis completes a right-handed coordinate system, and is 90 degrees east of the Z axis and also in the equatorial plane. Sea level is at z = zero.- Parameters:
latitude
- the latitude of the position.longitude
- the longitude of the position.metersElevation
- the number of meters above or below mean sea level.- Returns:
- The ellipsoidal point corresponding to the input position.
- See Also:
ellipsoidalToGeodetic(gov.nasa.worldwind.geom.Vec4)
-
geodeticToCartesian
protected void geodeticToCartesian(Sector sector, int numLat, int numLon, double[] metersElevation, Vec4[] out)
Maps a grid of geographic positions to Cartesian coordinates. The Y axis points to the north pole. The Z axis points to the intersection of the prime meridian and the equator, in the equatorial plane. The X axis completes a right-handed coordinate system, and is 90 degrees east of the Z axis and also in the equatorial plane. Sea level is at z = zero.This method provides an interface for efficient generation of a grid of cartesian points within a sector. The grid is constructed by dividing the sector into
numLon x numLat
evenly separated points in geographic coordinates. The first and last points in latitude and longitude are placed at the sector's minimum and maximum boundary, and the remaining points are spaced evenly between those boundary points.For each grid point within the sector, an elevation value is specified via an array of elevations. The calculation at each position incorporates the associated elevation.
- Parameters:
sector
- The sector over which to generate the points.numLat
- The number of points to generate latitudinally.numLon
- The number of points to generate longitudinally.metersElevation
- An array of elevations to incorporate in the point calculations. There must be one elevation value in the array for each generated point, so the array must have a length of at leastnumLon x numLat
. Elevations are read from this array in row major order, beginning with the row of minimum latitude.out
- An array to hold the computed cartesian points. It must have a length of at leastnumLon x numLat
. Points are written to this array in row major order, beginning with the row of minimum latitude.- Throws:
java.lang.IllegalArgumentException
- If any argument is null, or if numLat or numLon are less than or equal to zero.
-
cartesianToGeodetic
protected Position cartesianToGeodetic(Vec4 cart)
Compute the geographic position to corresponds to a Cartesian point.- Parameters:
cart
- Cartesian point to convert to geographic.- Returns:
- The geographic position of
cart
. - See Also:
geodeticToCartesian(gov.nasa.worldwind.geom.Angle, gov.nasa.worldwind.geom.Angle, double)
-
ellipsoidalToGeodetic
protected Position ellipsoidalToGeodetic(Vec4 cart)
Compute the geographic position to corresponds to an ellipsoidal point.- Parameters:
cart
- Ellipsoidal point to convert to geographic.- Returns:
- The geographic position of
cart
. - See Also:
geodeticToEllipsoidal(gov.nasa.worldwind.geom.Angle, gov.nasa.worldwind.geom.Angle, double)
-
tessellate
public SectorGeometryList tessellate(DrawContext dc)
Description copied from interface:Globe
Tessellate this globe for the currently visible region.- Specified by:
tessellate
in interfaceGlobe
- Parameters:
dc
- the current draw context.- Returns:
- the tessellation, or null if the tessellation failed or the draw context identifies no visible region.
-
isPointAboveElevation
public boolean isPointAboveElevation(Vec4 point, double elevation)
Determines whether a point is above a given elevation- Specified by:
isPointAboveElevation
in interfaceGlobe
- Parameters:
point
- theVec4
point to test.elevation
- the elevation to test for.- Returns:
- true if the given point is above the given elevation.
-
makeElevationModel
public static ElevationModel makeElevationModel(java.lang.String key, java.lang.String defaultValue)
Construct an elevation model given a key for a configuration source and the source's default value.- Parameters:
key
- the key identifying the configuration property inConfiguration
.defaultValue
- the default value of the property to use if it's not found inConfiguration
.- Returns:
- a new elevation model configured according to the configuration source.
-
-