public class Drawable
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
TYPE_AREA
polygon or multi-polygon
|
static int |
TYPE_IMAGE
Image
|
static int |
TYPE_LINESTRING
linestring or multi-linestring
|
static int |
TYPE_ORIENTED_POINT
Oriented point
|
static int |
TYPE_POINT
point or multi-point
|
| Constructor and Description |
|---|
Drawable() |
Drawable(java.awt.Image img) |
Drawable(java.awt.geom.Point2D point)
Constructs a Drawable instance that is a point.
|
Drawable(java.awt.geom.Point2D point,
double vectorX,
double vectorY)
Constructs a Drawable instance that is an oriented point, with vectorX and
vectorY representing the end point of the orientation vector.
|
Drawable(java.awt.Shape shape,
int type)
Constructs a Drawable instance that is a shape.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(double x,
double y)
Tests if the specified coordinates are inside the boundary of the Drawable.
|
boolean |
contains(java.awt.geom.Point2D p)
Tests if a specified Point2D is inside the boundary of the Shape.
|
static Drawable |
createDrawable(JGeometry[] geoms,
java.awt.geom.AffineTransform at)
Creates a Drawable instance collection out from the given JGeometry instances
|
static Drawable |
createDrawable(JGeometry geom,
java.awt.geom.AffineTransform at)
Creates a Drawable instance out from a JGeometry instance
|
void |
draw(java.awt.Graphics2D g)
Draws the current Drawable instance
|
void |
fill(java.awt.Graphics2D g)
Fills the current Drawable instance
|
java.awt.Rectangle |
getBounds()
Returns an integer Rectangle that completely encloses the Drawable.
|
java.awt.geom.Rectangle2D |
getBounds2D()
Returns a high precision and more accurate bounding box of the Drawable
than the getBounds method.
|
static int |
getDefaultPointSize()
Gets the default point size
|
Drawable |
getLast()
Gets the last Drawable instance in a Drawable collection
|
Drawable |
getNext()
Gets the next Drawable instance in a Drawable collection
|
java.awt.geom.Point2D |
getPoint()
Gets the referenced point.
|
java.awt.Shape |
getShape()
Gets the referenced shape.
|
int |
getType()
Gets the type of drawable.
|
double |
getVectorX()
Gets the end point's x ordinate of an oriented point
|
double |
getVectorY()
Gets the end point's y ordinate of an oriented point
|
boolean |
hitTest(java.awt.geom.Point2D p,
double tolerance)
Hit-test the specified point against this drawable object.
|
boolean |
isPoint()
Tests to see if this Drawable is a point.
|
boolean |
isShape()
Tests to see if this Drawable is a shape.
|
static void |
setDefaultPointSize(int defaultPointSize)
Sets the default point size
|
void |
setNext(Drawable dr)
Sets the next Drawable instance for a collection of Drawable instances
|
void |
setPoint(java.awt.geom.Point2D pt) |
void |
setShape(java.awt.Shape shp,
int type)
Sets the shape for this drawable.
|
public static final int TYPE_AREA
public static final int TYPE_LINESTRING
public static final int TYPE_POINT
public static final int TYPE_ORIENTED_POINT
public static final int TYPE_IMAGE
public Drawable()
public Drawable(java.awt.Shape shape,
int type)
shape - the shape to be referenced by this instance.type - the type of shape which is either TYPE_AREA (for polygon or
multi-polygons) or TYPE_LINESTRING (for linestring or
multi-linestrings).public Drawable(java.awt.geom.Point2D point)
point - the point to be referenced by this instance.public Drawable(java.awt.geom.Point2D point,
double vectorX,
double vectorY)
public Drawable(java.awt.Image img)
public java.awt.Shape getShape()
public java.awt.geom.Point2D getPoint()
public void setShape(java.awt.Shape shp,
int type)
shp - public void setPoint(java.awt.geom.Point2D pt)
public boolean isShape()
public boolean isPoint()
public java.awt.geom.Rectangle2D getBounds2D()
public java.awt.Rectangle getBounds()
public boolean contains(double x,
double y)
x - the specified x coordinatey - the specified y coordinatepublic boolean contains(java.awt.geom.Point2D p)
p - a specified Point2Dpublic boolean hitTest(java.awt.geom.Point2D p,
double tolerance)
p - the point to testtolerance - the tolerance value to be considered; value should be in
pixels.public void draw(java.awt.Graphics2D g)
g - public void fill(java.awt.Graphics2D g)
g - public void setNext(Drawable dr)
dr - public Drawable getNext()
public Drawable getLast()
public static int getDefaultPointSize()
public static void setDefaultPointSize(int defaultPointSize)
defaultPointSize - public int getType()
public double getVectorX()
public double getVectorY()
public static Drawable createDrawable(JGeometry geom, java.awt.geom.AffineTransform at)
geom - a JGeometry instanceat - the AffineTransform usedpublic static Drawable createDrawable(JGeometry[] geoms, java.awt.geom.AffineTransform at)
geom - a JGeometry arrayat - the AffineTransform used