jme3tools.navigation
Class MapModel3D

java.lang.Object
  extended by jme3tools.navigation.MapModel3D

public class MapModel3D
extends java.lang.Object

A representation of the actual map in terms of lat/long and x,y,z co-ordinates. The Map class contains various helper methods such as methods for determining the world unit positions for lat/long coordinates and vice versa. This map projection does not handle screen/pixel coordinates.

Since:
1.0

Field Summary
static int DEFAULT_MAP_WIDTH_LONGITUDE
           
 
Constructor Summary
MapModel3D(int worldWidth)
          Constructor.
 
Method Summary
 void calculateMinutesPerWorldUnit(double mapWidthInLongitude)
          Calculates the number of minutes per pixels using a given map width in longitude.
 Position getCentre()
          Returns the Position centre of the map.
 Vector3f getCentreWu()
          Returns the WU (x,y,z) centre of the map.
 double getMetersPerWu()
          Returns the meters per WU.
 double getMinutesPerWu()
          Returns the number of minutes there are per WU.
 int getWorldHeight()
          Returns the height of the viewport in pixels.
 int getWorldWidth()
          Returns the width of the viewport in pixels.
 void setCentre(Position centre)
          Sets the map's centre.
 void setCentre(Vector3f posVec)
          Defines the centre of the map in pixels.
 void setWorldHeight(int viewportHeight)
          Sets the world's desired height.
 void setWorldWidth(int viewportWidth)
          Sets the world's desired width.
 Position toPosition(Vector3f posVec)
          Converts a world position into a Mercator position.
 Vector3f toWorldUnit(Position position)
          Converts a latitude/longitude position into a WU coordinate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAP_WIDTH_LONGITUDE

public static final int DEFAULT_MAP_WIDTH_LONGITUDE
See Also:
Constant Field Values
Constructor Detail

MapModel3D

public MapModel3D(int worldWidth)
Constructor.

Parameters:
worldWidth - The world unit width the map's area
Since:
1.0
Method Detail

getWorldHeight

public int getWorldHeight()
Returns the height of the viewport in pixels.

Returns:
The height of the viewport in pixels.
Since:
1.0

calculateMinutesPerWorldUnit

public void calculateMinutesPerWorldUnit(double mapWidthInLongitude)
Calculates the number of minutes per pixels using a given map width in longitude.

Parameters:
mapWidthInLongitude - The map's with in degrees of longitude.
Since:
1.0

getWorldWidth

public int getWorldWidth()
Returns the width of the viewport in pixels.

Returns:
The width of the viewport in pixels.
Since:
1.0

setWorldWidth

public void setWorldWidth(int viewportWidth)
Sets the world's desired width.

Parameters:
viewportWidth - The world's desired width in WU.
Since:
1.0

setWorldHeight

public void setWorldHeight(int viewportHeight)
Sets the world's desired height.

Parameters:
viewportHeight - The world's desired height in WU.
Since:
1.0

setCentre

public void setCentre(Position centre)
Sets the map's centre.

Parameters:
centre - The Position denoting the map's desired centre.
Since:
1.0

getMinutesPerWu

public double getMinutesPerWu()
Returns the number of minutes there are per WU.

Returns:
The number of minutes per WU.
Since:
1.0

getMetersPerWu

public double getMetersPerWu()
Returns the meters per WU.

Returns:
The meters per WU.
Since:
1.0

toWorldUnit

public Vector3f toWorldUnit(Position position)
Converts a latitude/longitude position into a WU coordinate.

Parameters:
position - The Position to convert.
Returns:
The Point a pixel coordinate.
Since:
1.0

toPosition

public Position toPosition(Vector3f posVec)
Converts a world position into a Mercator position.

Parameters:
posVec - Vector containing the world unit coordinates that are to be converted into longitude / latitude coordinates.
Returns:
The resulting Position in degrees of latitude and longitude.
Since:
1.0

setCentre

public void setCentre(Vector3f posVec)
Defines the centre of the map in pixels.

Parameters:
posVec - Vector3f object denoting the map's new centre.
Since:
1.0

getCentreWu

public Vector3f getCentreWu()
Returns the WU (x,y,z) centre of the map.

Returns:
Vector3f object marking the map's (x,y) centre.
Since:
1.0

getCentre

public Position getCentre()
Returns the Position centre of the map.

Returns:
Position object marking the map's (lat, long) centre.
Since:
1.0