public class Point extends java.lang.Object implements GraphicalPrimitive
Modifier and Type | Field and Description |
---|---|
static int |
CIRCLE
A constant representing the circle shape symbol for displaying the point.
|
static int |
CROSS
A constant representing the cross shape symbol for displaying the point.
|
java.awt.Color |
drawColor
The drawing color.
|
static int |
SQUARE
A constant representing the square shape symbol for displaying the point.
|
Constructor and Description |
---|
Point(double x,
double y)
Initializes a point with its coordinates and a default drawing color (strong gray).
|
Point(double x,
double y,
java.awt.Color dc)
Initializes a point with its coordinates and drawing color.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(java.awt.Graphics2D g2d,
CoordinateConverter converter)
The function that draws the primitive
|
BoundingBox |
getBoundingBox()
Computes the bounding box of the graphical primitive.
|
double |
getX()
Gets the x coordinate of the point.
|
double |
getY()
Gets the y coordinate of the point.
|
void |
setShape(int shape)
Sets the symbol to display (see the shape constants).
|
void |
setSize(int size)
Sets the size of the symbol to display.
|
public static final int CROSS
public static final int SQUARE
public static final int CIRCLE
public java.awt.Color drawColor
public Point(double x, double y)
x
- the x coordinate (in the map reference).y
- the y coordinate (in the map reference).public Point(double x, double y, java.awt.Color dc)
x
- the x coordinate (in the map reference).y
- the y coordinate (in the map reference).dc
- the drawing color.public void setSize(int size)
size
- the size (in pixels).public void setShape(int shape)
shape
- the symbol to display (cross, circle, square...).public void draw(java.awt.Graphics2D g2d, CoordinateConverter converter)
GraphicalPrimitive
draw
in interface GraphicalPrimitive
g2d
- the Graphics2D object on which the shape must be drawn.converter
- the coordinate converter used to convert the primitive's coordinates into the screen (hence Graphics2D) coordinates.public double getX()
public double getY()
public BoundingBox getBoundingBox()
GraphicalPrimitive
getBoundingBox
in interface GraphicalPrimitive