com.nutiteq.components
Class MapPos

java.lang.Object
  extended by com.nutiteq.components.MapPos

public class MapPos
extends java.lang.Object

Implements a projected position on a map as a set of 3 numbers: (x,y) projected pixel coordinates, (zoom) zoom level.


Constructor Summary
MapPos(int x, int y, int zoom)
          Constructor for MapPos.
 
Method Summary
static boolean checkBounds(int x, int y, int width, int height, int screenWidth, int screenHeight)
          Not part of public API Check if an image bounded by left, top, right, bottom can be displayed.
 MapPos copy()
          Not part of public API Create a copy of this object.
 int distanceFromLineInPixels(int x1, int y1, int x2, int y2)
           
 int distanceFromLineInPixels(Point pOne, Point pTwo)
           
 int distanceInPixels(MapPos pos)
          Not part of public API
 boolean equals(java.lang.Object o)
          Equals only compares x, y, zoom.
 int getZoom()
           
 int getX()
           
 int getY()
           
 int hashCode()
           
 boolean isVisible(MapPos middlePoint, int displayCenterX, int displayCenterY)
          Not part of public API
 void setZoom(int zoom)
           
 void setX(int x)
           
 void setY(int y)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapPos

public MapPos(int x,
              int y,
              int zoom)
Constructor for MapPos.

Parameters:
x - x coordinate
y - y coordinate
zoom - zoom
Method Detail

getX

public int getX()

getY

public int getY()

getZoom

public int getZoom()

setX

public void setX(int x)

setY

public void setY(int y)

setZoom

public void setZoom(int zoom)

checkBounds

public static boolean checkBounds(int x,
                                  int y,
                                  int width,
                                  int height,
                                  int screenWidth,
                                  int screenHeight)
Not part of public API Check if an image bounded by left, top, right, bottom can be displayed.

Parameters:
x - top-left corner
y - top-left corner
width - image width
height - image height
Returns:
true if visible, false otherwise

copy

public MapPos copy()
Not part of public API Create a copy of this object.

Returns:
the newly created copy

equals

public boolean equals(java.lang.Object o)
Equals only compares x, y, zoom.

Overrides:
equals in class java.lang.Object
Parameters:
o - other map pos object
Returns:
true if equal, false otherwise

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

isVisible

public boolean isVisible(MapPos middlePoint,
                         int displayCenterX,
                         int displayCenterY)
Not part of public API


distanceInPixels

public int distanceInPixels(MapPos pos)
Not part of public API


distanceFromLineInPixels

public int distanceFromLineInPixels(int x1,
                                    int y1,
                                    int x2,
                                    int y2)

distanceFromLineInPixels

public int distanceFromLineInPixels(Point pOne,
                                    Point pTwo)