|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjme3tools.navigation.MapModel2D
public class MapModel2D
A representation of the actual map in terms of lat/long and x,y co-ordinates. The Map class contains various helper methods such as methods for determining the pixel positions for lat/long co-ordinates and vice versa.
Field Summary | |
---|---|
static int |
DEFAULT_MAP_WIDTH_LONGITUDE
|
Constructor Summary | |
---|---|
MapModel2D(int viewportWidth)
Constructor |
Method Summary | |
---|---|
void |
calculateMinutesPerPixel(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 |
double |
getMetersPerPixel()
|
double |
getMinutesPerPixel()
Returns the number of minutes there are per pixel |
java.awt.Point |
getPixelCentre()
Returns the pixel (x,y) centre of the map |
int |
getViewportPixelHeight()
Returns the height of the viewport in pixels |
int |
getViewportPixelWidth()
Returns the width of the viewport in pixels |
void |
setCentre(java.awt.Point p)
Defines the centre of the map in pixels |
void |
setCentre(Position centre)
|
void |
setMinutesPerPixel(double minutesPerPixel)
|
void |
setViewportHeight(int viewportHeight)
|
void |
setViewportWidth(int viewportWidth)
|
void |
setXCentre(int xCentre)
Sets the map's xCentre |
void |
setYCentre(int yCentre)
Sets the map's yCentre |
java.awt.Point |
toPixel(Position position)
Converts a latitude/longitude position into a pixel co-ordinate |
Position |
toPosition(java.awt.Point p)
Converts a pixel position into a mercator position |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAP_WIDTH_LONGITUDE
Constructor Detail |
---|
public MapModel2D(int viewportWidth)
viewportWidth
- the pixel width of the viewport (component) in which
the map is displayedMethod Detail |
---|
public int getViewportPixelHeight()
public void calculateMinutesPerPixel(double mapWidthInLongitude)
mapWidthInLongitude
- public int getViewportPixelWidth()
public void setViewportWidth(int viewportWidth)
public void setViewportHeight(int viewportHeight)
public void setCentre(Position centre)
public double getMinutesPerPixel()
public double getMetersPerPixel()
public void setMinutesPerPixel(double minutesPerPixel)
public java.awt.Point toPixel(Position position)
position
- the position to convert
Point
a pixel co-ordinatepublic Position toPosition(java.awt.Point p)
p
- Point
object that you wish to convert into
longitude / latiude
Position
objectpublic void setCentre(java.awt.Point p)
p
- Point
object denoting the map's new centrepublic void setXCentre(int xCentre)
xCentre
- public void setYCentre(int yCentre)
yCentre
- public java.awt.Point getPixelCentre()
Point
object marking the map's (x,y) centrepublic Position getCentre()
Position
centre of the map
Position
object marking the map's (lat, long) centre
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |