public class MapModel2D
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAP_WIDTH_LONGITUDE |
Constructor and Description |
---|
MapModel2D(int viewportWidth)
Constructor
|
Modifier and Type | Method and Description |
---|---|
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
|
public static final int DEFAULT_MAP_WIDTH_LONGITUDE
public MapModel2D(int viewportWidth)
viewportWidth
- the pixel width of the viewport (component) in which
the map is displayedpublic 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 convertPoint
a pixel co-ordinatepublic Position toPosition(java.awt.Point p)
p
- Point
object that you wish to convert into
longitude / latiudePosition
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 mapPosition
object marking the map's (lat, long) centre