Class ProjectionMercator
- java.lang.Object
-
- gov.nasa.worldwind.globes.projections.AbstractGeographicProjection
-
- gov.nasa.worldwind.globes.projections.ProjectionMercator
-
- All Implemented Interfaces:
GeographicProjection
public class ProjectionMercator extends AbstractGeographicProjection
Provides a Mercator projection of an ellipsoidal globe.
-
-
Field Summary
-
Fields inherited from class gov.nasa.worldwind.globes.projections.AbstractGeographicProjection
projectionLimits
-
-
Constructor Summary
Constructors Constructor Description ProjectionMercator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Position
cartesianToGeographic(Globe globe, Vec4 cart, Vec4 offset)
Converts a Cartesian point in meters to a geographic position.Vec4
geographicToCartesian(Globe globe, Angle latitude, Angle longitude, double metersElevation, Vec4 offset)
Converts a geographic position to meters in Cartesian coordinates.void
geographicToCartesian(Globe globe, Sector sector, int numLat, int numLon, double[] metersElevation, Vec4 offset, Vec4[] out)
Converts a grid of geographic positions to a grid of points in Cartesian coordinates.java.lang.String
getName()
Returns the projection name.boolean
isContinuous()
Indicates whether it makes sense to treat this projection as contiguous with itself.Vec4
northPointingTangent(Globe globe, Angle latitude, Angle longitude)
Computes a Cartesian vector that points north and is tangent to the meridian at the specified geographic location.-
Methods inherited from class gov.nasa.worldwind.globes.projections.AbstractGeographicProjection
getProjectionLimits, setProjectionLimits
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:GeographicProjection
Returns the projection name.- Returns:
- The projection name.
-
isContinuous
public boolean isContinuous()
Description copied from interface:GeographicProjection
Indicates whether it makes sense to treat this projection as contiguous with itself. If true, the scene controller will make the globe using the projection appear to scroll continuously horizontally.- Returns:
true
if it makes sense to treat this projection as continuous, otherwisefalse
.
-
geographicToCartesian
public Vec4 geographicToCartesian(Globe globe, Angle latitude, Angle longitude, double metersElevation, Vec4 offset)
Description copied from interface:GeographicProjection
Converts a geographic position to meters in Cartesian coordinates.Note: The input arguments are not checked for
null
prior to being used. The caller, typically aGlobe2D
implementation, is expected do perform that check prior to calling this method.- Parameters:
globe
- The globe this projection is applied to.latitude
- The latitude of the position.longitude
- The longitude of the position.metersElevation
- The elevation of the position, in meters.offset
- An optional offset to be applied to the Cartesian output. Typically only projections that are continuous (seeGeographicProjection.isContinuous()
apply this offset. Others ignore it. May be null.- Returns:
- The Cartesian point, in meters, corresponding to the input position.
- See Also:
GeographicProjection.cartesianToGeographic(Globe, gov.nasa.worldwind.geom.Vec4, gov.nasa.worldwind.geom.Vec4)
-
geographicToCartesian
public void geographicToCartesian(Globe globe, Sector sector, int numLat, int numLon, double[] metersElevation, Vec4 offset, Vec4[] out)
Description copied from interface:GeographicProjection
Converts a grid of geographic positions to a grid of points in Cartesian coordinates.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:
globe
- The globe this projection is applied to.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.offset
- An optional offset to be applied to the Cartesian output. Typically only projections that are continuous (seeGeographicProjection.isContinuous()
apply this offset. Others ignore it. May be null.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.
-
cartesianToGeographic
public Position cartesianToGeographic(Globe globe, Vec4 cart, Vec4 offset)
Description copied from interface:GeographicProjection
Converts a Cartesian point in meters to a geographic position.Note: The input arguments are not checked for
null
prior to being used. The caller, typically aGlobe2D
implementation, is expected do perform that check prior to calling this method.- Parameters:
globe
- The globe this projection is applied to.cart
- The Cartesian point, in meters.offset
- An optional offset to be applied to the Cartesian input prior to converting it. Typically only projections that are continuous (seeGeographicProjection.isContinuous()
apply this offset. Others ignore it. May be null.- Returns:
- The geographic position corresponding to the input point.
- See Also:
GeographicProjection.geographicToCartesian(Globe, gov.nasa.worldwind.geom.Angle, gov.nasa.worldwind.geom.Angle, double, gov.nasa.worldwind.geom.Vec4)
-
northPointingTangent
public Vec4 northPointingTangent(Globe globe, Angle latitude, Angle longitude)
Description copied from interface:GeographicProjection
Computes a Cartesian vector that points north and is tangent to the meridian at the specified geographic location.- Parameters:
globe
- The globe this projection is applied to.latitude
- The latitude of the location.longitude
- The longitude of the location.- Returns:
- The north pointing tangent corresponding to the input location.
-
-