|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.refractions.udig.tools.edit.support.PrimitiveShape
public class PrimitiveShape
Represents the simplest shape. GeomShapes are made up of PrimitiveShapes.
This is not a composite pattern.
Constructor Summary | |
---|---|
PrimitiveShape(EditGeom owner)
|
|
PrimitiveShape(PrimitiveShape shape)
|
Method Summary | |
---|---|
void |
assertValid()
|
boolean |
contains(double x,
double y)
|
boolean |
contains(double x,
double y,
double w,
double h)
|
boolean |
contains(java.awt.geom.Point2D p)
|
boolean |
contains(Point point,
boolean treatUnknownGeomsAsPolygon)
Returns true if the point is contained in the shape or on the edge. |
boolean |
contains(Point point,
boolean treatUnknownGeomsAsPolygon,
boolean ignoreVertexRadius)
Returns true if the point is contained in the shape or on the edge. |
boolean |
contains(java.awt.geom.Rectangle2D r)
|
Coordinate[] |
coordArray()
Returns an array with all the coordinates in shape. |
java.util.Iterator<Coordinate> |
coordIterator()
|
int |
getAssociatedPointIndex(int coordIndex)
|
java.awt.Rectangle |
getBounds()
Returns the bounding box of the Shape in pixel space. |
java.awt.geom.Rectangle2D |
getBounds2D()
|
ClosestEdge |
getClosestEdge(Point click,
boolean treatUnknownAsPolygon)
Returns a ClosestEdge object that has information about the point that closest to the
click paramter and is on an edge of the part. |
Coordinate |
getCoord(int i)
|
java.util.List<Coordinate> |
getCoordsAt(int i)
Returns all the coordinates that map to the point at location i. |
java.util.List<Coordinate> |
getCoordsAt(Point point)
|
EditBlackboard |
getEditBlackboard()
|
EditGeom |
getEditGeom()
|
Envelope |
getEnvelope()
|
int |
getNumCoords()
|
int |
getNumPoints()
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at)
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at,
double flatness)
|
Point |
getPoint(int i)
|
boolean |
hasVertex(Point p)
returns true if the point is contained in this shape. |
boolean |
intersects(double x,
double y,
double w,
double h)
|
boolean |
intersects(java.awt.geom.Rectangle2D r)
|
java.util.Iterator<Point> |
iterator()
|
boolean |
overlap(PrimitiveShape shape2,
boolean treatUnknownAsPolygon,
boolean acceptTouches)
Currently a simple stupid implementation for detecting if 2 polygons overlap. |
Point |
overVertex(Point location,
int radius)
Returns the point closest to location. |
Point |
overVertex(Point location,
int radius,
boolean ignore)
Returns the point closest to location. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PrimitiveShape(EditGeom owner)
public PrimitiveShape(PrimitiveShape shape)
Method Detail |
---|
public int getNumPoints()
public Point getPoint(int i)
public int getNumCoords()
public Coordinate getCoord(int i)
public java.lang.String toString()
toString
in class java.lang.Object
public EditGeom getEditGeom()
public EditBlackboard getEditBlackboard()
public java.util.Iterator<Point> iterator()
iterator
in interface java.lang.Iterable<Point>
public java.util.Iterator<Coordinate> coordIterator()
public Coordinate[] coordArray()
public boolean hasVertex(Point p)
p
- an arbitrary point
public ClosestEdge getClosestEdge(Point click, boolean treatUnknownAsPolygon)
ClosestEdge
object that has information about the point that closest to the
click paramter and is on an edge of the part.
click
- the point to use as the reference point
public java.awt.Rectangle getBounds()
getBounds
in interface java.awt.Shape
public boolean contains(Point point, boolean treatUnknownGeomsAsPolygon)
PreferenceUtil.getVertexRadius()
of the edge.
point
- An astrbitrary pointtreatUnknownGeomsAsPolygon
- if EditGeom.getShapeType()
return UNKOWN this
parameter is used to determine if this shape should be considered a polygon.
public boolean contains(Point point, boolean treatUnknownGeomsAsPolygon, boolean ignoreVertexRadius)
point
- An astrbitrary pointtreatUnknownGeomsAsPolygon
- if EditGeom.getShapeType()
return UNKOWN this
parameter is used to determine if this shape should be considered a polygon.ignoreVertexRadius
- if true then the point is only considered to be on the edge if it
is directly on the edge. (within 1 pixel of the line).
public java.awt.geom.Rectangle2D getBounds2D()
getBounds2D
in interface java.awt.Shape
public boolean contains(double x, double y)
contains
in interface java.awt.Shape
public boolean contains(java.awt.geom.Point2D p)
contains
in interface java.awt.Shape
public boolean intersects(double x, double y, double w, double h)
intersects
in interface java.awt.Shape
public boolean intersects(java.awt.geom.Rectangle2D r)
intersects
in interface java.awt.Shape
public boolean contains(double x, double y, double w, double h)
contains
in interface java.awt.Shape
public boolean contains(java.awt.geom.Rectangle2D r)
contains
in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
getPathIterator
in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
getPathIterator
in interface java.awt.Shape
public java.util.List<Coordinate> getCoordsAt(int i)
i
- index of a point in the shape
public java.util.List<Coordinate> getCoordsAt(Point point)
public int getAssociatedPointIndex(int coordIndex)
public void assertValid()
public Point overVertex(Point location, int radius)
location
- the locations to start searching from.radius
- the distance away from location to search.
public Point overVertex(Point location, int radius, boolean ignore)
location
- the locations to start searching from.radius
- radius the distance away from location to search.ignore
- true if the vertex at location is ignored
public Envelope getEnvelope()
public boolean overlap(PrimitiveShape shape2, boolean treatUnknownAsPolygon, boolean acceptTouches)
------------------ | --------- | | | | | ----|-------|----- | | ---------Above is considered overlapping but below is only if acceptTouches is true:
------------------ | | | | ------------------ | | ---------
Note: If one of the shapes is a point and the other is a line or a point then acceptTouches must be true other or this method will always return false.
shape2
- other shape to test againstacceptTouches
- if true then this method will return true if the two shapes simply touch
(but don't fully overlap). See above for more details
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |