|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.refractions.udig.tools.edit.support.EditUtils
public class EditUtils
Methods for determining spatial relationships between points.
Nested Class Summary | |
---|---|
static class |
EditUtils.EditToolHandlerShapeProvider
|
static class |
EditUtils.MinFinder
Keeps track of the point that is the minimum distance to the center point. |
static class |
EditUtils.StaticEditGeomProvider
Provider for EditGeoms |
static class |
EditUtils.StaticShapeProvider
|
Field Summary | |
---|---|
static EditUtils |
instance
|
static int |
NO_INTERSECTION
|
static int |
OVER_EDGE
|
Constructor Summary | |
---|---|
EditUtils()
|
Method Summary | |
---|---|
UndoableComposite |
appendPathToShape(EditToolHandler handler,
java.awt.geom.PathIterator iter,
PrimitiveShape shape)
Appends the points defined in the PathIterator to the shape. |
UndoableComposite |
appendPathToShape(java.awt.geom.PathIterator iter,
ShapeType shapeType,
EditToolHandler handler,
EditBlackboard bb,
Appends the points defined in the PathIterator to the shape. |
void |
cancelHideSelection(ILayer selectedLayer)
When an edit is canceled the selected layer must be re-rendered because they were hidden by refreshLayer(ILayer, Feature, Envelope, boolean, boolean)
This method must be called in order to efficiently do that. |
void |
clearLayerStateShapeCache(java.util.Collection<ILayer> layers)
The framework stores the current shape and state on a layer when the currently selected layer changes. |
Coordinate |
closestCoordinateOnEdge(Coordinate endPoint1,
Coordinate endPoint2,
Coordinate src)
Returns the closest point on the line between vertex1 and vertex2 to coordinate
src |
Point |
closestPointOnEdge(Point endPoint1,
Point endPoint2,
Point src)
Returns the closest point on the line between vertex1 and vertex2 to coordinate
src |
int |
getClosest(Geometry geometry,
Coordinate click,
Coordinate[] result)
Returns the index of the coordinate closest to the click. |
Coordinate |
getClosestSnapPoint(EditToolHandler handler,
EditBlackboard editBlackboard,
Point centerPoint,
boolean includeVerticesInCurrent,
SnapBehaviour snapBehaviour,
EditState stateAfterSearch)
Searches all the layers in the map and the EditBlackboard for the closest vertex to center point |
EditGeom |
getGeomWithMouseOver(java.util.Collection<EditGeom> geoms,
Point location,
boolean treatUnknownAsPolygon)
Returns the Geometry from the collection that the mouse is over/intersects |
java.util.List<EditGeom> |
getIntersectingGeom(EditBlackboard editBlackboard,
Point point,
boolean treatUnknownAsPolygons)
Finds and returns the EditGeoms that intersect the point. |
Coordinate |
getTransformedClick(Coordinate click,
ILayer layer)
Convenience method; transforms the click from the viewportModel CRS to the layer's CRS. |
void |
hideSelectedFeatures(EditToolHandler handler,
ILayer selectedLayer)
Triggers a re-render that hides the features on the EditBlackboard . |
Coordinate |
intersectingLines(Coordinate line1P1,
Coordinate line1P2,
Coordinate line2P1,
Coordinate line2P2)
Returns the intersection where the two lines meet |
boolean |
intersection(Point point1,
Point point2,
PrimitiveShape shape,
int startIndex,
int endIndex)
Checks whether the edge from point1 to point2 intersects any edge in the shape from startIndex to the endIndex |
static Coordinate |
midPointOnLine(Coordinate coord,
Coordinate coord2)
|
boolean |
overEdge(Coordinate endPoint1,
Coordinate endPoint2,
Envelope env)
Returns true if the envelope overlaps some part of the edge |
boolean |
overEdgeCoordinatePrecision(PrimitiveShape shape,
Envelope env)
Return true if the envelope overlaps at least one edge of the shape. |
boolean |
overEdgePixelPrecision(PrimitiveShape shape,
Envelope env)
Return true if the envelope overlaps at least one edge of the shape. |
int |
overVertext(Coordinate[] coords,
Envelope env)
|
void |
refreshLayer(ILayer selectedLayer,
Feature feature,
Envelope refreshBounds,
boolean forceRefresh,
boolean hidefeature)
Sets the rendering hint on the layer so that the feature is hidden if hidefeature is true. |
void |
reverseOrder(PrimitiveShape shape)
Reverse the order of the vertices in a Shape. |
boolean |
selfIntersection(PrimitiveShape shape)
Returns true if the shape has a self intersection. |
Coordinate |
snapToGrid(Point centerPoint,
IMap map)
Returns the coordinate that is on the grid intersection closest to the coordinate. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int OVER_EDGE
public static final int NO_INTERSECTION
public static EditUtils instance
Constructor Detail |
---|
public EditUtils()
Method Detail |
---|
public int overVertext(Coordinate[] coords, Envelope env)
public boolean overEdgeCoordinatePrecision(PrimitiveShape shape, Envelope env)
shape
- to searchenv
- envelope used to see if it overlaps an edge
public boolean overEdgePixelPrecision(PrimitiveShape shape, Envelope env)
shape
- to searchenv
- envelope used to see if it overlaps an edge
public boolean overEdge(Coordinate endPoint1, Coordinate endPoint2, Envelope env)
endPoint1
- one end point of the edgeendPoint2
- the other end point of the edgeenv
- the reference envelope.
public int getClosest(Geometry geometry, Coordinate click, Coordinate[] result)
geometry
- the geometry to search for the closest coordinate; The default geometry is searched.click
- the closest coordinate in coordinates will be found with respect to
clickresult
- the first position will be fill with the closest coordinate in geometry.
public Coordinate closestCoordinateOnEdge(Coordinate endPoint1, Coordinate endPoint2, Coordinate src)
vertex1
and vertex2
to coordinate
src
All Coordinates must be in the same CRS
endPoint1
- first vertex of a line.endPoint2
- second vertex of a line.src
- the closes coordinate is found with respect to src.
vertex1
and vertex2
to coordinate
src
public Point closestPointOnEdge(Point endPoint1, Point endPoint2, Point src)
vertex1
and vertex2
to coordinate
src
All Coordinates must be in the same CRS
endPoint1
- first vertex of a line.endPoint2
- second vertex of a line.src
- the closes coordinate is found with respect to src.
vertex1
and vertex2
to coordinate
src
public Coordinate getTransformedClick(Coordinate click, ILayer layer)
click
-
public java.util.List<EditGeom> getIntersectingGeom(EditBlackboard editBlackboard, Point point, boolean treatUnknownAsPolygons)
editBlackboard
- point
- treatUnknownAsPolygons
-
public Coordinate snapToGrid(Point centerPoint, IMap map)
public Coordinate getClosestSnapPoint(EditToolHandler handler, EditBlackboard editBlackboard, Point centerPoint, boolean includeVerticesInCurrent, SnapBehaviour snapBehaviour, EditState stateAfterSearch)
includeVerticesInCurrent
- indicates whether the vertices of the current feature should be considered.stateAfterSearch
-
public Coordinate intersectingLines(Coordinate line1P1, Coordinate line1P2, Coordinate line2P1, Coordinate line2P2)
public void reverseOrder(PrimitiveShape shape)
shape
- public UndoableComposite appendPathToShape(EditToolHandler handler, java.awt.geom.PathIterator iter, PrimitiveShape shape)
iter
- The iterator to appendshape
- the shape to append to.
public UndoableComposite appendPathToShape(java.awt.geom.PathIterator iter, ShapeType shapeType, EditToolHandler handler, EditBlackboard bb,currentProvider2)
iter
- The iterator to appendbb
- the editblackboard used to add coordinatescurrentProvider2
- the shape provider that provides the shape to append the coordinates toshapeType
- the type of geometry that is expected from currentProvider.
public static Coordinate midPointOnLine(Coordinate coord, Coordinate coord2)
public void clearLayerStateShapeCache(java.util.Collection<ILayer> layers)
layers
- public void cancelHideSelection(ILayer selectedLayer)
refreshLayer(ILayer, Feature, Envelope, boolean, boolean)
This method must be called in order to efficiently do that.
selectedLayer
- refreshLayer(ILayer, Feature, Envelope, boolean, boolean)
public void hideSelectedFeatures(EditToolHandler handler, ILayer selectedLayer)
EditBlackboard
.
public void refreshLayer(ILayer selectedLayer, Feature feature, Envelope refreshBounds, boolean forceRefresh, boolean hidefeature)
cancelHideSelection(ILayer)
should be called if the edit is canceled.
selectedLayer
- feature
- refreshBounds
- the area to refresh (should be the the area of the feature). May be null to refresh entire area. Envelope should be in
Layer coordinates.hidefeature
- cancelHideSelection(ILayer)
public EditGeom getGeomWithMouseOver(java.util.Collection<EditGeom> geoms, Point location, boolean treatUnknownAsPolygon)
geoms
- Geoms to search throughlocation
- the location
public boolean selfIntersection(PrimitiveShape shape)
shape
- shape to test.
public boolean intersection(Point point1, Point point2, PrimitiveShape shape, int startIndex, int endIndex)
point1
- the first point in the reference edgepoint2
- the second point in the reference edgeshape
- the shape that is searched for intersectionsstartIndex
- the index in the shape of the point at which to start searching. The point indicated will be the
first point in the edge.endIndex
- the index to stop the search. It is the index of the end point of the last edge to compare
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |