| java.lang.Object net.refractions.udig.tools.edit.support.EditBlackboard
EditBlackboard | public class EditBlackboard (Code) | | Maps between each pixel to a list of coordinates. Also provides convenience methods to move all
coordinates at a location
author: jeichar |
Method Summary | |
public Point | addCoordinate(Coordinate coord, PrimitiveShape shape) | public Map<Geometry, EditGeom> | addGeometry(Geometry geom, String featureID) Adds a Geometry to the contained geometries. | public Coordinate | addPoint(int x, int y, PrimitiveShape shape) Adds a Coordinate at the x,y location on the screen to the end of the geomtry. | public ClosestEdge | addToNearestEdge(int x, int y, EditGeom geom, boolean treatUnknownAsPolygon) Adds a Coordinate the nearest edge . | public List<ClosestEdge> | addToNearestEdge(int x, int y, boolean treatUnknownAsPolygon) Adds a Coordinate the nearest edge . | public void | clear() Removes all EditGeometries from blackboard and places an empty one on the black board. | public boolean | contains(String fid) Returns true if the blackboard currently holds the noted feature ID. | public void | fireBatchedEvents() Fires all the batched events and resets the EditBlackboard so that it no longer batches
events. | public synchronized List<ClosestEdge> | getCandidates(int x, int y, boolean treatUnknownAsPolygon) Returns the GeomShapes that will have the coordinate added if
is called. | public synchronized List<Coordinate> | getCoords(int x, int y) returns the list of coordinates at location:(x,y) TREAT COORDINATES AS IMMUTABLE!!
This is a dangerous method because the coordinates are mutable but if they are modified
outside of this class then the model is messed up and crazy bugs will happen. | public synchronized List<EditGeom> | getGeoms() The list of geometries mapped. | public synchronized List<EditGeom> | getGeoms(int x, int y) Returns a list of the geometries with vertices at the position (x,y). | public synchronized int | getHeight() | public Set<EditBlackboardListener> | getListeners() Returns the list of Listeners so that listeners can be added and removed. | public Selection | getSelection() | public synchronized int | getWidth() | public Coordinate | insertCoord(int x, int y, int pointIndex, PrimitiveShape shape) Adds a Coordinate at the index indicated.
The index is the position in the coordinate list in the shell of the geometry.
Parameters: x - the x screen location to place the new coordinate Parameters: y - the x screen location to place the new coordinate Parameters: pointIndex - the index in terms of points in the shape to add the coordinate. Parameters: geom - the geometry to append the point to. | public Point | insertCoordinate(Coordinate coord, int index, PrimitiveShape shape) | public void | insertCoords(int pointIndex, Point p, List<Coordinate> coords, PrimitiveShape shape) Inserts the list of coordinates into the shape at the index indicated. | public synchronized boolean | isCollapseVertices() | public List<Coordinate> | moveCoords(int x, int y, int endX, int endY) Moves all the coordinates at location by an offset of (deltaX, deltaY). | public void | moveSelection(int diffX, int diffY, Selection selection) Moves the selection
Parameters: diffX - the distance to move the geometry in the x direction. | public EditGeom | newGeom(String featureId, ShapeType type) Creates a new EditGeom in the map. | void | notify(EditBlackboardEvent event) | 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 void | removeCoordinate(int pointIndex, Coordinate coord, PrimitiveShape shape) Removes a coordinate from the shape. | public void | removeCoords(int x, int y, PrimitiveShape shape) Deletes the coordinates at the provided point in the provided shape. | public List<Coordinate> | removeCoordsAtPoint(int x, int y) Deletes all the coordinates at a location TREAT COORDINATES AS IMMUTABLE!!
the deleted coordinates. | public List<EditGeom> | removeGeometries(Collection<EditGeom> geomsToRemove) | public boolean | selectionAdd(Point point) | public boolean | selectionAddAll(Collection<Point> points) | public void | selectionClear() | public boolean | selectionRemove(Point point) | public boolean | selectionRemoveAll(Collection<Point> points) | public boolean | selectionRetainAll(Collection<Point> points) | public synchronized void | setCollapseVertices(boolean collapseVertices) | public void | setCoords(Point point, Coordinate newValue) Sets all the coordinates at the point to provided coordinate. | public Map<Geometry, EditGeom> | setGeometries(Geometry geom, String featureId) Adds a Geometry to the contained geometries. | public synchronized void | setHeight(int height) | public void | setMapLayerTransform(MathTransform mapToLayer) | public void | setToScreenTransform(AffineTransform newToScreen) Modifies the mapping of points to coordinates so that the transform passed in as a parameter
is the new toScreen transform. | public synchronized void | setWidth(int width) | public synchronized void | startBatchingEvents() Changes the behaviour of the EditBlackboard so that events are not fired but batched together
until
is called. | public synchronized Coordinate | toCoord(Point point) | public synchronized Point | toPoint(Coordinate coord) Transforms a Coordinate into the point location it would occupy on the screen. |
EditBlackboard | public EditBlackboard(int width, int height, AffineTransform toScreen, MathTransform layerToMap)(Code) | | Creates a PixelCoordMap. A default GeomShape will be created and can be obtained by
EditBlackboard.getGeoms() .get(0)
Parameters: width - width of the current ViewportPane Parameters: height - height of the current ViewportPane Parameters: toScreen - transform to take the coordinates to a screen location. Parameters: layerToMap - transform to transform coordinates from a layer's CRS to the map's CRS Parameters: coords - coordinates that need to be mapped. |
addGeometry | public Map<Geometry, EditGeom> addGeometry(Geometry geom, String featureID)(Code) | | Adds a Geometry to the contained geometries. If the Geometry is a MultiGeometry it will not
be in the mapping only the sub geometries will be in the geometry.
Parameters: geom - the geometry that will be added. Parameters: featureID - The id of the feature the geometry was part of. Maybe null. |
addPoint | public Coordinate addPoint(int x, int y, PrimitiveShape shape) throws IllegalArgumentException(Code) | | Adds a Coordinate at the x,y location on the screen to the end of the geomtry. Closure of the
hole is not enforced.
Parameters: x - the x screen location to place the new coordinate Parameters: y - the x screen location to place the new coordinate Parameters: holeIndex - the hole to append to. added coordinate. Do not modify coordinate otherwise the state of this class willbe wrong and bugs will occur in the code. |
addToNearestEdge | public ClosestEdge addToNearestEdge(int x, int y, EditGeom geom, boolean treatUnknownAsPolygon) throws IllegalArgumentException(Code) | | Adds a Coordinate the nearest edge .
If two edges are equidistant the first edge in the geometry will be targeted edge
Parameters: x - the x screen location to place the new coordinate Parameters: y - the x screen location to place the new coordinate Parameters: geom - the geometry to append the point to. Parameters: treatUnknownAsPolygon - declares whether to treat geometries of type UNKNOWN as a polygon |
addToNearestEdge | public List<ClosestEdge> addToNearestEdge(int x, int y, boolean treatUnknownAsPolygon) throws IllegalArgumentException(Code) | | Adds a Coordinate the nearest edge .
If two edges of the same geometry are equidistant the first edge in the geometry will be
targeted edge
If two edges of different geometries are equidistant both will have a vertex added.
If the vertex would end up being added to the same location as an existing vertex then no
vertext is added
Parameters: x - the x screen location to place the new coordinate Parameters: y - the x screen location to place the new coordinate Parameters: treatUnknownAsPolygon - declares whether to treat geometries of type UNKNOWN as a polygon the list of GeomShapes that had the coordinate added to. |
clear | public void clear()(Code) | | Removes all EditGeometries from blackboard and places an empty one on the black board.
|
contains | public boolean contains(String fid)(Code) | | Returns true if the blackboard currently holds the noted feature ID.
Parameters: fid - Feature ID boolean |
fireBatchedEvents | public void fireBatchedEvents()(Code) | | Fires all the batched events and resets the EditBlackboard so that it no longer batches
events.
|
getCandidates | public synchronized List<ClosestEdge> getCandidates(int x, int y, boolean treatUnknownAsPolygon)(Code) | | Returns the GeomShapes that will have the coordinate added if
is called.
Parameters: x - the x screen location to place the new coordinate Parameters: y - the x screen location to place the new coordinate Parameters: treatUnknownAsPolygon - declares whether to treat geometries of type UNKNOWN as a polygon the GeomShapes that will have the coordinate added if is called. |
getCoords | public synchronized List<Coordinate> getCoords(int x, int y)(Code) | | returns the list of coordinates at location:(x,y) TREAT COORDINATES AS IMMUTABLE!!
This is a dangerous method because the coordinates are mutable but if they are modified
outside of this class then the model is messed up and crazy bugs will happen. The weakness is
permitted for performance reasons. I'm trusting people to not be stupid.
the list of coordinates at location:(x,y). TREAT COORDINATES AS IMMUTABLE!! |
getGeoms | public synchronized List<EditGeom> getGeoms()(Code) | | The list of geometries mapped.
list of geometries mapped. |
getGeoms | public synchronized List<EditGeom> getGeoms(int x, int y)(Code) | | Returns a list of the geometries with vertices at the position (x,y). Edges are not
calculated.
Parameters: x - x coordinate of point Parameters: y - x coordinate of point a list of the geometries at the position (x,y) |
getHeight | public synchronized int getHeight()(Code) | | Returns the height. |
getListeners | public Set<EditBlackboardListener> getListeners()(Code) | | Returns the list of Listeners so that listeners can be added and removed. This is thread
safe. Each Listener can only be added once.
Returns the listeners. |
getWidth | public synchronized int getWidth()(Code) | | Returns the width. |
insertCoord | public Coordinate insertCoord(int x, int y, int pointIndex, PrimitiveShape shape) throws IllegalArgumentException(Code) | | Adds a Coordinate at the index indicated.
The index is the position in the coordinate list in the shell of the geometry.
Parameters: x - the x screen location to place the new coordinate Parameters: y - the x screen location to place the new coordinate Parameters: pointIndex - the index in terms of points in the shape to add the coordinate. Parameters: geom - the geometry to append the point to. added coordinate. Do not modify coordinate otherwise the state of this class willbe wrong and bugs will occur in the code. |
insertCoords | public void insertCoords(int pointIndex, Point p, List<Coordinate> coords, PrimitiveShape shape)(Code) | | Inserts the list of coordinates into the shape at the index indicated.
Parameters: pointIndex - the location that the coordinates will be inserted. Parameters: coords - coords that will inserted.insertCoords Parameters: shape - the shape that will have the coords inserted. |
isCollapseVertices | public synchronized boolean isCollapseVertices()(Code) | | Returns the collapseVertices. |
moveCoords | public List<Coordinate> moveCoords(int x, int y, int endX, int endY)(Code) | | Moves all the coordinates at location by an offset of (deltaX, deltaY).
Parameters: x - x coordinate of coords to move Parameters: y - y coordinate of coords to move Parameters: deltaX - the number of pixels to move coords in the positive x direction(Screen space) Parameters: deltaY - the number of pixels to move coords in the positive y direction(Screen space) |
moveSelection | public void moveSelection(int diffX, int diffY, Selection selection)(Code) | | Moves the selection
Parameters: diffX - the distance to move the geometry in the x direction. The delta is in pixels. Parameters: diffY - the distance to move the geometry in the y direction. The delta is in pixels. Parameters: selection - the selection to move. |
newGeom | public EditGeom newGeom(String featureId, ShapeType type)(Code) | | Creates a new EditGeom in the map. If there is only one geometry on the bb and it has no
points and has not been editted it will be removed.
Parameters: featureId - The id of the feature the geometry was part of. Maybe null. Parameters: type - the type of geometry to create if null then the type will be unknown the created geometry |
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. |
removeCoordinate | public void removeCoordinate(int pointIndex, Coordinate coord, PrimitiveShape shape)(Code) | | Removes a coordinate from the shape. The index indicates which point to remove, the Point
parameter is a check to ensure that the correct point is indicated, and the coord is the
coordinate that will be removed
Parameters: pointIndex - index of point in shape Parameters: coord - coordinate to remove Parameters: shape - shape to remove from |
removeCoords | public void removeCoords(int x, int y, PrimitiveShape shape)(Code) | | Deletes the coordinates at the provided point in the provided shape.
Parameters: x - x coordinate in screen coords Parameters: y - y coordinate in screen coords Parameters: shape - shape to delete from. |
removeCoordsAtPoint | public List<Coordinate> removeCoordsAtPoint(int x, int y)(Code) | | Deletes all the coordinates at a location TREAT COORDINATES AS IMMUTABLE!!
the deleted coordinates. TREAT COORDINATES AS IMMUTABLE!! |
removeGeometries | public List<EditGeom> removeGeometries(Collection<EditGeom> geomsToRemove)(Code) | | Removes all the geometries in the list from the blackboard and all the coordinates in the
geometries
Parameters: geomsToRemove - the list of geometries to remove. |
selectionAdd | public boolean selectionAdd(Point point)(Code) | | |
selectionClear | public void selectionClear()(Code) | | |
selectionRemove | public boolean selectionRemove(Point point)(Code) | | |
setCollapseVertices | public synchronized void setCollapseVertices(boolean collapseVertices)(Code) | | Parameters: collapseVertices - The collapseVertices to set. |
setCoords | public void setCoords(Point point, Coordinate newValue)(Code) | | Sets all the coordinates at the point to provided coordinate.
The coodinate must still map to the point
Parameters: point - the point at which all the coordinates will be changed Parameters: newValue - the new coordinate value of coordinates at the point |
setGeometries | public Map<Geometry, EditGeom> setGeometries(Geometry geom, String featureId)(Code) | | Adds a Geometry to the contained geometries. If the Geometry is a MultiGeometry it will not
be in the mapping only the sub geometries will be in the geometry.
Parameters: geom - the geometry that will be added. Parameters: featureId - The id of the feature the geometry was part of. Maybe null. |
setHeight | public synchronized void setHeight(int height)(Code) | | Parameters: height - The height to set. |
setMapLayerTransform | public void setMapLayerTransform(MathTransform mapToLayer)(Code) | | |
setToScreenTransform | public void setToScreenTransform(AffineTransform newToScreen)(Code) | | Modifies the mapping of points to coordinates so that the transform passed in as a parameter
is the new toScreen transform.
Parameters: transform - new transform |
setWidth | public synchronized void setWidth(int width)(Code) | | Parameters: width - The width to set. |
startBatchingEvents | public synchronized void startBatchingEvents()(Code) | | Changes the behaviour of the EditBlackboard so that events are not fired but batched together
until
is called.
|
toCoord | public synchronized Coordinate toCoord(Point point)(Code) | | |
toPoint | public synchronized Point toPoint(Coordinate coord)(Code) | | Transforms a Coordinate into the point location it would occupy on the screen.
Parameters: coord - coordinate object point coordinate would occupy on the screen. |
|
|