map
Class MapPoint

java.lang.Object
  extended by map.MapPoint

public class MapPoint
extends java.lang.Object

A Map Point is a point on the Grid that can be assigned a specific Unit, created for example by tapping the stylus on a specific location on the Grid.
Coherent Map Points (see figure MAP Grid) are stored in a vector (= Path). The path is used for creating MapItemLists in later step.


e.g.: Map Point 1 has the coordinates (x,y) and is mapped to Unit (0,3)

Note:
A Map Point is not a MapItem!

Author:
Hlavac Peter
See Also:
MapItemList, Grid, Unit

Constructor Summary
MapPoint(int x, int y, java.lang.Integer unitId)
          Creates a Map Point with default color: white
MapPoint(int x, int y, java.lang.Integer unitId, int color)
          Creates a Map Point with a given color
 
Method Summary
 int getColor()
          Returns the color of the Map Point
 java.lang.Integer getUnitId()
          Returns the mapped Unit Id to the Map Point
 int getX()
          Returns the x-axis value in pixels
 int getY()
          Returns the y-axis value in pixels
static boolean minDistance(int x1, int y1, int x2, int y2, int d)
          Returns true, if the distance between points p1(x1,y1) and p2(x2,y2) is bigger than the given distance d
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapPoint

public MapPoint(int x,
                int y,
                java.lang.Integer unitId,
                int color)
Creates a Map Point with a given color

Parameters:
x - x-axis Value (in Pixels)
y - y-axis Value (in Pixels)
unitId - The corresponding Unit Id of the Map Point on the Grid
color - The Color of the Map Point

MapPoint

public MapPoint(int x,
                int y,
                java.lang.Integer unitId)
Creates a Map Point with default color: white

Parameters:
x - x-axis Value (in Pixels)
y - y-axis Value (in Pixels)
unitId - The corresponding Unit Id of the Map Point on the Grid
Method Detail

minDistance

public static boolean minDistance(int x1,
                                  int y1,
                                  int x2,
                                  int y2,
                                  int d)
Returns true, if the distance between points p1(x1,y1) and p2(x2,y2) is bigger than the given distance d

Parameters:
x1 - the x value of point p1
y1 - the y value of point p1
x2 - the x value of point p2
y2 - the y value of point p2
d - the minimal distance between the 2 given points
Returns:
true, if the distance between points p1(x1,y1) and p2(x2,y2) is bigger than the given distance d

getX

public int getX()
Returns the x-axis value in pixels

Returns:
The x-axis value in pixels

getY

public int getY()
Returns the y-axis value in pixels

Returns:
The y-axis value in pixels

getUnitId

public java.lang.Integer getUnitId()
Returns the mapped Unit Id to the Map Point

Returns:
The mapped Unit Id to the Map Point

getColor

public int getColor()
Returns the color of the Map Point

Returns:
The color of the Map Point