public class EllipsoidalGlobe extends WWObjectImpl implements Globe
Modifier and Type | Class and Description |
---|---|
protected class |
EllipsoidalGlobe.StateKey |
Modifier and Type | Field and Description |
---|---|
protected EGM96 |
egm96 |
protected double |
equatorialRadius |
protected double |
es |
protected double |
polarRadius |
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
void |
applyEGMA96Offsets(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,
List<? extends LatLon> latLons,
double[] targetResolution,
double[] elevations)
Indicates the elevations of a collection of locations.
|
double |
getElevations(Sector sector,
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 this
Extent after it is projected into the specified
view'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.
|
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 with
line . |
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 this
Extent intersects frustum . |
boolean |
intersects(Line line)
Determines whether or not
line intersects this Extent . |
boolean |
intersects(Plane plane)
Calculate whether or not this
Extent is intersected by plane . |
boolean |
isPointAboveElevation(Vec4 point,
double elevation)
Determines whether a point is above a given elevation
|
static ElevationModel |
makeElevationModel(String key,
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.
|
onMessage, propertyChange
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
propertyChange
onMessage
protected EGM96 egm96
protected final double equatorialRadius
protected final double es
protected final double polarRadius
public EllipsoidalGlobe(double equatorialRadius, double polarRadius, double es, ElevationModel em)
AVKey.TESSELLATOR_CLASS_NAME
configuration parameter.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.public EllipsoidalGlobe(double equatorialRadius, double polarRadius, double es, ElevationModel em, Vec4 center)
AVKey.TESSELLATOR_CLASS_NAME
configuration parameter.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.public void applyEGMA96Offsets(String offsetsFilePath) throws IOException
IOException
protected Position cartesianToGeodetic(Vec4 cart)
cart
- Cartesian point to convert to geographic.cart
.geodeticToCartesian(gov.nasa.worldwind.geom.Angle, gov.nasa.worldwind.geom.Angle, double)
public Vec4 computeEllipsoidalNormalAtLocation(Angle latitude, Angle longitude)
computeEllipsoidalNormalAtLocation
in interface Globe
latitude
- Latitude of the location at which to compute the normal vector.longitude
- Longitude of the location at which to compute the normal vector.public Matrix computeEllipsoidalOrientationAtPosition(Angle latitude, Angle longitude, double metersElevation)
Globe
computeEllipsoidalOrientationAtPosition
in interface Globe
latitude
- the latitude of the position.longitude
- the longitude of the position.metersElevation
- the number of meters above or below mean sea level.public Vec4 computeEllipsoidalPointFromLocation(LatLon location)
computeEllipsoidalPointFromLocation
in interface Globe
location
- the location to convert.public Vec4 computeEllipsoidalPointFromPosition(Angle latitude, Angle longitude, double metersElevation)
computeEllipsoidalPointFromPosition
in interface Globe
latitude
- Latitude of the location to convert.longitude
- Longitude of the location to convert.metersElevation
- Elevation, in meters, of the geographic position to convert.public Vec4 computeEllipsoidalPointFromPosition(Position position)
computeEllipsoidalPointFromPosition
in interface Globe
position
- Position of the location to convert.public Matrix computeModelCoordinateOriginTransform(Angle latitude, Angle longitude, double metersElevation)
computeModelCoordinateOriginTransform
in interface Globe
Globe.computeSurfaceOrientationAtPosition(gov.nasa.worldwind.geom.Angle, gov.nasa.worldwind.geom.Angle, double).
public Matrix computeModelCoordinateOriginTransform(Position position)
computeModelCoordinateOriginTransform
in interface Globe
Globe.computeSurfaceOrientationAtPosition(gov.nasa.worldwind.geom.Position)
public Vec4 computeNorthPointingTangentAtLocation(Angle latitude, Angle longitude)
Globe
computeNorthPointingTangentAtLocation
in interface Globe
latitude
- Latitude of the location at which to compute the tangent vector.longitude
- Longitude of the location at which to compute the tangent vector.public Vec4 computePointFromLocation(LatLon location)
Globe
computePointFromLocation
in interface Globe
location
- Geographic location on the surface of the globe to convert to cartesian.public Vec4 computePointFromPosition(Angle latitude, Angle longitude, double metersElevation)
Globe
computePointFromPosition
in interface Globe
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.public Vec4 computePointFromPosition(LatLon latLon, double metersElevation)
Globe
computePointFromPosition
in interface Globe
latLon
- Geographic location to convert to cartesian.metersElevation
- Elevation, in meters, of the geographic position to convert to cartesian.public Vec4 computePointFromPosition(Position position)
Globe
computePointFromPosition
in interface Globe
position
- Geographic position to convert to cartesian. The position may include elevation above or below
the globe's surface.public void computePointsFromPositions(Sector sector, int numLat, int numLon, double[] metersElevation, Vec4[] out)
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.computePointsFromPositions
in interface Globe
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 least numLon 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 least
numLon x numLat
. Points are written to this array in row major order,
beginning with the row of minimum latitude.public Position computePositionFromEllipsoidalPoint(Vec4 ellipsoidalPoint)
computePositionFromEllipsoidalPoint
in interface Globe
ellipsoidalPoint
- Point of which to find the geographic position, relative to the ellipsoid defined by the
globe's radii.public Position computePositionFromPoint(Vec4 point)
Globe
computePositionFromPoint
in interface Globe
point
- Point of which to find the geographic position.public Vec4 computeSurfaceNormalAtLocation(Angle latitude, Angle longitude)
computeSurfaceNormalAtLocation
in interface Globe
latitude
- the latitude of the position.longitude
- the longitude of the position.public Vec4 computeSurfaceNormalAtPoint(Vec4 point)
computeSurfaceNormalAtPoint
in interface Globe
point
- the cartesian point.public Matrix computeSurfaceOrientationAtPosition(Angle latitude, Angle longitude, double metersElevation)
computeSurfaceOrientationAtPosition
in interface Globe
latitude
- the latitude of the position.longitude
- the longitude of the position.metersElevation
- the number of meters above or below mean sea level.public Matrix computeSurfaceOrientationAtPosition(Position position)
computeSurfaceOrientationAtPosition
in interface Globe
position
- the latitude, longitude, and number of meters above or below mean sea level.protected Position ellipsoidalToGeodetic(Vec4 cart)
cart
- Ellipsoidal point to convert to geographic.cart
.geodeticToEllipsoidal(gov.nasa.worldwind.geom.Angle, gov.nasa.worldwind.geom.Angle, double)
protected Vec4 geodeticToCartesian(Angle latitude, Angle longitude, double metersElevation)
latitude
- the latitude of the position.longitude
- the longitude of the position.metersElevation
- the number of meters above or below mean sea level.protected void geodeticToCartesian(Sector sector, int numLat, int numLon, double[] metersElevation, Vec4[] out)
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.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 least numLon 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 least
numLon x numLat
. Points are written to this array in row major order,
beginning with the row of minimum latitude.IllegalArgumentException
- If any argument is null, or if numLat or numLon are less than or equal to zero.protected Vec4 geodeticToEllipsoidal(Angle latitude, Angle longitude, double metersElevation)
latitude
- the latitude of the position.longitude
- the longitude of the position.metersElevation
- the number of meters above or below mean sea level.ellipsoidalToGeodetic(gov.nasa.worldwind.geom.Vec4)
public Vec4 getCenter()
Extent
public double getDiameter()
Extent
getDiameter
in interface Extent
public double getEccentricitySquared()
Globe
getEccentricitySquared
in interface Globe
public double getEffectiveRadius(Plane plane)
Extent
getEffectiveRadius
in interface Extent
plane
- the plane.public double getElevation(Angle latitude, Angle longitude)
Globe
getElevation
in interface Globe
latitude
- the latitude of the location at which to determine elevation.longitude
- the longitude of the location at which to determine elevation.Globe.getElevationModel()
public ElevationModel getElevationModel()
Globe
getElevationModel
in interface Globe
public double[] getElevations(Sector sector, List<? extends LatLon> latLons, double[] targetResolution, double[] elevations)
Globe
getElevations
in interface Globe
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 for
CompoundElevationModel
.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.Double.MAX_VALUE
if individual elevations cannot be
determined for all of the locations. Returns zero if an elevation model is not available.Globe.getElevationModel()
public double getElevations(Sector sector, List<? extends LatLon> latlons, double targetResolution, double[] elevations)
Globe
getElevations
in interface Globe
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.Double.MAX_VALUE
if individual elevations cannot be
determined for all of the locations. Returns zero if an elevation model is not available.Globe.getElevationModel()
public double getEquatorialRadius()
Globe
getEquatorialRadius
in interface Globe
public Extent getExtent()
Globe
public GlobeStateKey getGlobeStateKey()
Globe
getGlobeStateKey
in interface Globe
public GlobeStateKey getGlobeStateKey(DrawContext dc)
Globe
getGlobeStateKey
in interface Globe
dc
- the current draw context.public Position getIntersectionPosition(Line line)
Globe
getIntersectionPosition
in interface Globe
line
- the line with which to intersect this globe.public double getMaxElevation()
Globe
getMaxElevation
in interface Globe
public double getMaximumRadius()
Globe
getMaximumRadius
in interface Globe
public double[] getMinAndMaxElevations(Angle latitude, Angle longitude)
Globe
getMinAndMaxElevations
in interface Globe
latitude
- the latitude of the location in question.longitude
- the longitude of the location in question.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.public double[] getMinAndMaxElevations(Sector sector)
Globe
getMinAndMaxElevations
in interface Globe
sector
- the sector in question.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.public double getMinElevation()
Globe
getMinElevation
in interface Globe
public double getPolarRadius()
Globe
getPolarRadius
in interface Globe
public double getProjectedArea(View view)
Extent
after it is projected into the specified
view's
viewport. The returned value is the screen area that this Extent
covers in the
infinite plane defined by the view's
viewport. This area is not limited to the size of the
view's
viewport, and portions of this Extent
are not clipped by the view's
frustum.
This returns Double.POSITIVE_INFINITY
if the view's
eye point is inside this
Extent
, or if any portion of this Extent
is behind the eye point. In either case, this
Extent
has no finite projection on the view
.getProjectedArea
in interface Extent
view
- the View
for which to compute a projected screen area.Extent
in square pixels, or
Double.POSITIVE_INFINITY
if the view's
eye point is inside this
Extent
or part of this Extent
is behind the view's
eye point.public double getRadius()
Extent
public double getRadiusAt(Angle latitude, Angle longitude)
Globe
getRadiusAt
in interface Globe
latitude
- Latitude of the location at which to determine radius.longitude
- Longitude of the location at which to determine radius.public double getRadiusAt(LatLon location)
Globe
getRadiusAt
in interface Globe
location
- the location at which to determine radius.public Object getStateKey(DrawContext dc)
Globe
getStateKey
in interface Globe
dc
- the current draw context.public Tessellator getTessellator()
Globe
getTessellator
in interface Globe
public Intersection[] intersect(Line line)
Extent
line
. 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.public Intersection[] intersect(Line line, double altitude)
Globe
protected Intersection[] intersect(Line line, double equRadius, double polRadius)
public Intersection[] intersect(Triangle t, double elevation)
Globe
public boolean intersects(Frustum frustum)
Extent
Extent
intersects frustum
. Returns true if any part of
these two objects intersect, including the case where either object wholly contains the other, false otherwise.intersects
in interface Extent
frustum
- the Frustum
with which to test for intersection.public boolean intersects(Line line)
Extent
line
intersects this Extent
. This method may be faster than
checking the size of the array returned by intersect(Line)
. Implementing methods must ensure that
this method returns true if and only if intersect(Line)
returns a non-null array containing at least
one element.intersects
in interface Extent
line
- the Line
with which to test for intersection.public boolean intersects(Plane plane)
Extent
Extent
is intersected by plane
.intersects
in interface Extent
plane
- the Plane
with which to test for intersection.plane
is found to intersect this Extent
.public boolean isPointAboveElevation(Vec4 point, double elevation)
isPointAboveElevation
in interface Globe
point
- the Vec4
point to test.elevation
- the elevation to test for.public static ElevationModel makeElevationModel(String key, String defaultValue)
key
- the key identifying the configuration property in Configuration
.defaultValue
- the default value of the property to use if it's not found in Configuration
.public void setElevationModel(ElevationModel elevationModel)
Globe
setElevationModel
in interface Globe
elevationModel
- this globe's elevation model. May be null to indicate no elevation model.public void setTessellator(Tessellator tessellator)
Globe
setTessellator
in interface Globe
tessellator
- the new tessellator. Specify null to use the default tessellator.public SectorGeometryList tessellate(DrawContext dc)
Globe
tessellate
in interface Globe
dc
- the current draw context.