| java.lang.Object net.refractions.udig.tools.edit.support.PrimitiveShape
PrimitiveShape | public class PrimitiveShape implements Iterable<Point>,Shape(Code) | | Represents the simplest shape. GeomShapes are made up of PrimitiveShapes.
This is not a composite pattern.
author: jones since: 1.1.0 |
Method Summary | |
public void | assertValid() | public boolean | contains(Point point, boolean treatUnknownGeomsAsPolygon) Returns true if the point is contained in the shape or on the edge. | public boolean | contains(Point point, boolean treatUnknownGeomsAsPolygon, boolean ignoreVertexRadius) Returns true if the point is contained in the shape or on the edge.
Parameters: point - An astrbitrary point Parameters: treatUnknownGeomsAsPolygon - if EditGeom.getShapeType return UNKOWN thisparameter is used to determine if this shape should be considered a polygon. Parameters: ignoreVertexRadius - if true then the point is only considered to be on the edge if itis directly on the edge. | public boolean | contains(double x, double y) | public boolean | contains(Point2D p) | public boolean | contains(double x, double y, double w, double h) | public boolean | contains(Rectangle2D r) | public boolean | contains(Coordinate startCoord, boolean treatUnknownGeomsAsPolygon) | public Coordinate[] | coordArray() Returns an array with all the coordinates in shape. | public Iterator<Coordinate> | coordIterator() Returns an iterator that iterates over all visible coordinates in shape. | public int | getAssociatedPointIndex(int coordIndex) | public Rectangle | getBounds() Returns the bounding box of the Shape in pixel space. | public Rectangle2D | getBounds2D() | public 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. | public Coordinate | getCoord(int i) | public List<Coordinate> | getCoordsAt(int i) Returns all the coordinates that map to the point at location i. | public List<Coordinate> | getCoordsAt(Point point) | public EditBlackboard | getEditBlackboard() | public EditGeom | getEditGeom() | public Envelope | getEnvelope() | Mutator | getMutator() | public int | getNumCoords() | public int | getNumPoints() | public PathIterator | getPathIterator(AffineTransform at) | public PathIterator | getPathIterator(AffineTransform at, double flatness) | public Point | getPoint(int i) | public boolean | hasVertex(Point p) returns true if the point is contained in this shape. | boolean | hasVertex(Point p, LazyCoord coord) | public boolean | hasVertex(Coordinate start) | public boolean | intersects(double x, double y, double w, double h) | public boolean | intersects(Rectangle2D r) | public Iterator<Point> | iterator() Returns an iterator that iterates over all visible points in shape. | public Point | overVertex(Point location, int radius) Returns the point closest to location. | public synchronized Point | overVertex(Point location, int radius, boolean ignore) Returns the point closest to location. | public boolean | overlap(PrimitiveShape shape2, boolean treatUnknownAsPolygon, boolean acceptTouches) Currently a simple stupid implementation for detecting if 2 polygons overlap. | public String | toString() |
assertValid | public void assertValid()(Code) | | |
contains | public boolean contains(Point point, boolean treatUnknownGeomsAsPolygon)(Code) | | Returns true if the point is contained in the shape or on the edge. It is considered on the
edge if it is within
PreferenceUtil.getVertexRadius of the edge.
Parameters: point - An astrbitrary point Parameters: treatUnknownGeomsAsPolygon - if EditGeom.getShapeType return UNKOWN thisparameter is used to determine if this shape should be considered a polygon. true if the point is contained in the shape. |
contains | public boolean contains(Point point, boolean treatUnknownGeomsAsPolygon, boolean ignoreVertexRadius)(Code) | | Returns true if the point is contained in the shape or on the edge.
Parameters: point - An astrbitrary point Parameters: treatUnknownGeomsAsPolygon - if EditGeom.getShapeType return UNKOWN thisparameter is used to determine if this shape should be considered a polygon. Parameters: ignoreVertexRadius - if true then the point is only considered to be on the edge if itis directly on the edge. (within 1 pixel of the line). true if the point is contained in the shape. |
contains | public boolean contains(double x, double y)(Code) | | |
contains | public boolean contains(double x, double y, double w, double h)(Code) | | |
contains | public boolean contains(Coordinate startCoord, boolean treatUnknownGeomsAsPolygon)(Code) | | |
coordArray | public Coordinate[] coordArray()(Code) | | Returns an array with all the coordinates in shape.
an array with all the coordinates in shape. |
coordIterator | public Iterator<Coordinate> coordIterator()(Code) | | Returns an iterator that iterates over all visible coordinates in shape. Notmodifyible |
getAssociatedPointIndex | public int getAssociatedPointIndex(int coordIndex)(Code) | | |
getBounds | public Rectangle getBounds()(Code) | | Returns the bounding box of the Shape in pixel space.
the bounding box of the Shape in pixel space. |
getClosestEdge | public ClosestEdge getClosestEdge(Point click, boolean treatUnknownAsPolygon)(Code) | | Returns a
ClosestEdge object that has information about the point that closest to the
click paramter and is on an edge of the part.
Parameters: click - the point to use as the reference point |
getCoord | public Coordinate getCoord(int i)(Code) | | |
getCoordsAt | public List<Coordinate> getCoordsAt(int i)(Code) | | Returns all the coordinates that map to the point at location i.
Parameters: i - index of a point in the shape Returns all the coordinates that map to the point at location i. |
getEnvelope | public Envelope getEnvelope()(Code) | | |
getMutator | Mutator getMutator()(Code) | | |
getNumCoords | public int getNumCoords()(Code) | | |
getNumPoints | public int getNumPoints()(Code) | | |
hasVertex | public boolean hasVertex(Point p)(Code) | | returns true if the point is contained in this shape.
Parameters: p - an arbitrary point Returns true if the point is contained in this shape. |
hasVertex | public boolean hasVertex(Coordinate start)(Code) | | |
intersects | public boolean intersects(double x, double y, double w, double h)(Code) | | |
iterator | public Iterator<Point> iterator()(Code) | | Returns an iterator that iterates over all visible points in shape. Not modifyable |
overVertex | public Point overVertex(Point location, int radius)(Code) | | Returns the point closest to location. The search is a square of height and width radius + 1.
Parameters: location - the locations to start searching from. Parameters: radius - the distance away from location to search. the point closest to location or null if no point exists. |
overVertex | public synchronized Point overVertex(Point location, int radius, boolean ignore)(Code) | | Returns the point closest to location. If ignore is true the point at locations will not be
returned. The search is a square of height and width radius + 1.
Parameters: location - the locations to start searching from. Parameters: radius - radius the distance away from location to search. Parameters: ignore - true if the vertex at location is ignored the point closest to location or null if no point exists. |
overlap | public boolean overlap(PrimitiveShape shape2, boolean treatUnknownAsPolygon, boolean acceptTouches)(Code) | | Currently a simple stupid implementation for detecting if 2 polygons overlap. Currently it
only check the points not the real coordinates so this method must be used with care. Just
iterates through all the edges in one shape and checks if it overlap with an edge in the
other shape.
------------------
| --------- |
| | | |
----|-------|-----
| |
---------
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.
Parameters: shape2 - other shape to test against Parameters: acceptTouches - if true then this method will return true if the two shapes simply touch(but don't fully overlap). See above for more details true if the two shapes overlap |
|
|