Class FlatGlobe
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.globes.EllipsoidalGlobe
-
- gov.nasa.worldwind.globes.FlatGlobe
-
- All Implemented Interfaces:
AVList,MessageListener,Extent,Globe,Globe2D,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
- Direct Known Subclasses:
EarthFlat
public class FlatGlobe extends EllipsoidalGlobe implements Globe2D
Defines a globe represented as a projection onto a plane. The projection type is modifiable. The default projection is Mercator. New projections may be added by extending this class and overridinggeodeticToCartesiancartesianToGeodetic.This globe uses a Cartesian coordinate system in the world plane is located at the origin and has UNIT-Z as normal. The Y axis points to the north pole. The Z axis points up. The X axis completes a right-handed coordinate system, and points east. Latitude and longitude zero are at the origin on y and x respectively. Sea level is at z = zero.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gov.nasa.worldwind.globes.EllipsoidalGlobe
EllipsoidalGlobe.StateKey
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancontinuousprotected intoffsetprotected Vec4offsetVectorprotected GeographicProjectionprojectionstatic java.lang.StringPROJECTION_LAT_LONLatitude/Longitude projection.static java.lang.StringPROJECTION_MERCATORMercator projection.static java.lang.StringPROJECTION_MODIFIED_SINUSOIDALstatic java.lang.StringPROJECTION_SINUSOIDALSinusoidal projection.-
Fields inherited from class gov.nasa.worldwind.globes.EllipsoidalGlobe
egm96, equatorialRadius, es, polarRadius
-
-
Constructor Summary
Constructors Constructor Description FlatGlobe(double equatorialRadius, double polarRadius, double es, ElevationModel em)Create a new globe.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PositioncartesianToGeodetic(Vec4 cart)Compute the geographic position to corresponds to a Cartesian point.Vec4computeNorthPointingTangentAtLocation(Angle latitude, Angle longitude)Computes a vector tangent to this globe and pointing toward the north pole.Vec4computeSurfaceNormalAtLocation(Angle latitude, Angle longitude)Returns the normal to the Globe at the specified position.Vec4computeSurfaceNormalAtPoint(Vec4 point)Returns the normal to the Globe at the specified cartiesian point.MatrixcomputeSurfaceOrientationAtPosition(Angle latitude, Angle longitude, double metersElevation)Returns the cartesian transform matrix that maps model coordinates to a local coordinate system at (latitude, longitude, metersElevation).protected Vec4geodeticToCartesian(Angle latitude, Angle longitude, double metersElevation)Maps a position to a flat world Cartesian coordinates.protected voidgeodeticToCartesian(Sector sector, int numLat, int numLon, double[] metersElevation, Vec4[] out)Maps a grid of geographic positions to Cartesian coordinates.doublegetElevation(Angle latitude, Angle longitude)Indicates the elevation at a specified location.GlobeStateKeygetGlobeStateKey()Returns a typed state key identifying this globe's current configuration.GlobeStateKeygetGlobeStateKey(DrawContext dc)Returns a typed state key identifying this globe's current configuration.intgetOffset()GeographicProjectiongetProjection()Indicates the projection used to project the globe onto a plane.java.lang.ObjectgetStateKey(DrawContext dc)Returns a state key identifying this globe's current configuration.protected Intersection[]intersect(Line line, double equRadius, double polarRadius)booleanintersects(Frustum frustum)Determines whether or not thisExtentintersectsfrustum.booleanintersects(Line line)Determines whether or notlineintersects thisExtent.booleanintersects(Plane plane)Calculate whether or not thisExtentis intersected byplane.booleanisContinuous()Indicates whether it makes sense to treat the associated projection as contiguous with itself.booleanisPointAboveElevation(Vec4 point, double elevation)Determines whether a point is above a given elevationvoidsetContinuous(boolean continuous)Specifies whether to treat the associated projection as contiguous with itself.voidsetOffset(int offset)Indicates an offset to apply to Cartesian points computed by this globe.voidsetProjection(GeographicProjection projection)Specifies the geographic projection for this globe.-
Methods inherited from class gov.nasa.worldwind.globes.EllipsoidalGlobe
applyEGMA96Offsets, computeEllipsoidalNormalAtLocation, computeEllipsoidalOrientationAtPosition, computeEllipsoidalPointFromLocation, computeEllipsoidalPointFromPosition, computeEllipsoidalPointFromPosition, computeModelCoordinateOriginTransform, computeModelCoordinateOriginTransform, computePointFromLocation, computePointFromPosition, computePointFromPosition, computePointFromPosition, computePointsFromPositions, computePositionFromEllipsoidalPoint, computePositionFromPoint, computeSurfaceOrientationAtPosition, ellipsoidalToGeodetic, geodeticToEllipsoidal, getCenter, getDiameter, getEccentricitySquared, getEffectiveRadius, getElevationModel, getElevations, getElevations, getEquatorialRadius, getExtent, getIntersectionPosition, getMaxElevation, getMaximumRadius, getMinAndMaxElevations, getMinAndMaxElevations, getMinElevation, getPolarRadius, getProjectedArea, getRadius, getRadiusAt, getRadiusAt, getTessellator, intersect, intersect, intersect, makeElevationModel, setElevationModel, setTessellator, tessellate
-
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
-
PROJECTION_LAT_LON
public static final java.lang.String PROJECTION_LAT_LON
Latitude/Longitude projection. Also known as the geographic projection, the equirectangular projection, or the Plate Carree projection.- See Also:
- Constant Field Values
-
PROJECTION_MERCATOR
public static final java.lang.String PROJECTION_MERCATOR
Mercator projection.- See Also:
- Constant Field Values
-
PROJECTION_SINUSOIDAL
public static final java.lang.String PROJECTION_SINUSOIDAL
Sinusoidal projection.- See Also:
- Constant Field Values
-
PROJECTION_MODIFIED_SINUSOIDAL
public static final java.lang.String PROJECTION_MODIFIED_SINUSOIDAL
- See Also:
- Constant Field Values
-
projection
protected GeographicProjection projection
-
continuous
protected boolean continuous
-
offset
protected int offset
-
offsetVector
protected Vec4 offsetVector
-
-
Constructor Detail
-
FlatGlobe
public FlatGlobe(double equatorialRadius, double polarRadius, double es, ElevationModel em)Create a new globe. The globe will use the Mercator projection. The projection can be changed usingsetProjection(GeographicProjection).- 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.
-
-
Method Detail
-
getStateKey
public java.lang.Object getStateKey(DrawContext dc)
Description copied from interface:GlobeReturns a state key identifying this globe's current configuration. Can be used to subsequently determine whether the globe's configuration has changed.- Specified by:
getStateKeyin interfaceGlobe- Overrides:
getStateKeyin classEllipsoidalGlobe- 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:GlobeReturns 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:
getGlobeStateKeyin interfaceGlobe- Overrides:
getGlobeStateKeyin classEllipsoidalGlobe- Parameters:
dc- the current draw context.- Returns:
- a state key for the globe's current configuration.
-
getGlobeStateKey
public GlobeStateKey getGlobeStateKey()
Description copied from interface:GlobeReturns 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:
getGlobeStateKeyin interfaceGlobe- Overrides:
getGlobeStateKeyin classEllipsoidalGlobe- Returns:
- a state key for the globe's current configuration.
-
setProjection
public void setProjection(GeographicProjection projection)
Description copied from interface:Globe2DSpecifies the geographic projection for this globe. The geographic projection converts geographic positions to Cartesian coordinates and back. Implementations of this interface define their default projection.- Specified by:
setProjectionin interfaceGlobe2D- Parameters:
projection- The projection to apply to this globe.- See Also:
GeographicProjection
-
getProjection
public GeographicProjection getProjection()
Indicates the projection used to project the globe onto a plane. The default projection is Mercator.- Specified by:
getProjectionin interfaceGlobe2D- Returns:
- The active projection.
- See Also:
setProjection(java.lang.String)
-
setContinuous
public void setContinuous(boolean continuous)
Description copied from interface:Globe2DSpecifies whether to treat the associated projection as contiguous with itself. If true, the scene controller will make the implementing globe appear to scroll continuously horizontally. Calling this method overrides the associated projection's value for this field.- Specified by:
setContinuousin interfaceGlobe2D- Parameters:
continuous-trueif it makes sense to treat the associated projection as continuous, otherwisefalse.- See Also:
GeographicProjection.isContinuous()
-
isContinuous
public boolean isContinuous()
Description copied from interface:Globe2DIndicates whether it makes sense to treat the associated projection as contiguous with itself. If true, the scene controller will make the implementing globe appear to scroll continuously horizontally.- Specified by:
isContinuousin interfaceGlobe2D- Returns:
trueif it makes sense to treat the associated projection as continuous, otherwisefalse.
-
setOffset
public void setOffset(int offset)
Description copied from interface:Globe2DIndicates an offset to apply to Cartesian points computed by this globe. The offset is in units of globe widths, e.g., an offset of one indicates a Cartesian offset of the globe's width in meters.
-
intersects
public boolean intersects(Frustum frustum)
Description copied from interface:ExtentDetermines whether or not thisExtentintersectsfrustum. Returns true if any part of these two objects intersect, including the case where either object wholly contains the other, false otherwise.- Specified by:
intersectsin interfaceExtent- Overrides:
intersectsin classEllipsoidalGlobe- Parameters:
frustum- theFrustumwith which to test for intersection.- Returns:
- true if there is an intersection, false otherwise.
-
intersect
protected Intersection[] intersect(Line line, double equRadius, double polarRadius)
- Overrides:
intersectin classEllipsoidalGlobe
-
intersects
public boolean intersects(Line line)
Description copied from interface:ExtentDetermines whether or notlineintersects 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:
intersectsin interfaceExtent- Overrides:
intersectsin classEllipsoidalGlobe- Parameters:
line- theLinewith which to test for intersection.- Returns:
- true if an intersection is found, false otherwise.
-
intersects
public boolean intersects(Plane plane)
Description copied from interface:ExtentCalculate whether or not thisExtentis intersected byplane.- Specified by:
intersectsin interfaceExtent- Overrides:
intersectsin classEllipsoidalGlobe- Parameters:
plane- thePlanewith which to test for intersection.- Returns:
- true if
planeis found to intersect thisExtent.
-
computeSurfaceNormalAtLocation
public Vec4 computeSurfaceNormalAtLocation(Angle latitude, Angle longitude)
Description copied from class:EllipsoidalGlobeReturns the normal to the Globe at the specified position.- Specified by:
computeSurfaceNormalAtLocationin interfaceGlobe- Overrides:
computeSurfaceNormalAtLocationin classEllipsoidalGlobe- 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)
Description copied from class:EllipsoidalGlobeReturns the normal to the Globe at the specified cartiesian point.- Specified by:
computeSurfaceNormalAtPointin interfaceGlobe- Overrides:
computeSurfaceNormalAtPointin classEllipsoidalGlobe- 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:GlobeComputes a vector tangent to this globe and pointing toward the north pole.- Specified by:
computeNorthPointingTangentAtLocationin interfaceGlobe- Overrides:
computeNorthPointingTangentAtLocationin classEllipsoidalGlobe- 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.
-
computeSurfaceOrientationAtPosition
public Matrix computeSurfaceOrientationAtPosition(Angle latitude, Angle longitude, double metersElevation)
Description copied from class:EllipsoidalGlobeReturns 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:
computeSurfaceOrientationAtPositionin interfaceGlobe- Overrides:
computeSurfaceOrientationAtPositionin classEllipsoidalGlobe- 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.
-
getElevation
public double getElevation(Angle latitude, Angle longitude)
Description copied from interface:GlobeIndicates 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:
getElevationin interfaceGlobe- Overrides:
getElevationin classEllipsoidalGlobe- 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()
-
geodeticToCartesian
protected Vec4 geodeticToCartesian(Angle latitude, Angle longitude, double metersElevation)
Maps a position to a flat world Cartesian coordinates. The world plane is located at the origin and has UNIT-Z as normal. The Y axis points to the north pole. The Z axis points up. The X axis completes a right-handed coordinate system, and points east. Latitude and longitude zero are at the origin on y and x respectively. Sea level is at z = zero.- Overrides:
geodeticToCartesianin classEllipsoidalGlobe- 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.
-
geodeticToCartesian
protected void geodeticToCartesian(Sector sector, int numLat, int numLon, double[] metersElevation, Vec4[] out)
Description copied from class:EllipsoidalGlobeMaps 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 numLatevenly 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.
- Overrides:
geodeticToCartesianin classEllipsoidalGlobe- 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.
-
cartesianToGeodetic
protected Position cartesianToGeodetic(Vec4 cart)
Description copied from class:EllipsoidalGlobeCompute the geographic position to corresponds to a Cartesian point.- Overrides:
cartesianToGeodeticin classEllipsoidalGlobe- Parameters:
cart- Cartesian point to convert to geographic.- Returns:
- The geographic position of
cart. - See Also:
EllipsoidalGlobe.geodeticToCartesian(gov.nasa.worldwind.geom.Angle, gov.nasa.worldwind.geom.Angle, double)
-
isPointAboveElevation
public boolean isPointAboveElevation(Vec4 point, double elevation)
Determines whether a point is above a given elevation- Specified by:
isPointAboveElevationin interfaceGlobe- Overrides:
isPointAboveElevationin classEllipsoidalGlobe- Parameters:
point- theVec4point to test.elevation- the elevation to test for.- Returns:
- true if the given point is above the given elevation.
-
-