Java Doc for EditUtils.java in  » GIS » udig-1.1 » net » refractions » udig » tools » edit » support » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » udig 1.1 » net.refractions.udig.tools.edit.support 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.refractions.udig.tools.edit.support.EditUtils

EditUtils
public class EditUtils (Code)
Methods for determining spatial relationships between points.
author:
   Jesse
since:
   1.1.0

Inner Class :public static class MinFinder
Inner Class :public static class StaticShapeProvider implements IBlockingProvider<PrimitiveShape>
Inner Class :public static class EditToolHandlerShapeProvider implements IBlockingProvider<PrimitiveShape>
Inner Class :public static class StaticEditGeomProvider implements IBlockingProvider<EditGeom>

Field Summary
final public static  intNO_INTERSECTION
    
final public static  intOVER_EDGE
    
final static  intTOPBOTTOMRIGHTLEFT
    
public static  EditUtilsinstance
    


Method Summary
public  UndoableCompositeappendPathToShape(EditToolHandler handler, PathIterator iter, PrimitiveShape shape)
     Appends the points defined in the PathIterator to the shape.
public  UndoableCompositeappendPathToShape(PathIterator iter, ShapeType shapeType, EditToolHandler handler, EditBlackboard bb, IBlockingProvider<PrimitiveShape> currentProvider2)
     Appends the points defined in the PathIterator to the shape.
public  voidcancelHideSelection(ILayer selectedLayer)
     When an edit is canceled the selected layer must be re-rendered because they were hidden by EditUtils.refreshLayer(ILayer,Feature,Envelope,boolean,boolean) This method must be called in order to efficiently do that.
public  voidclearLayerStateShapeCache(Collection<ILayer> layers)
     The framework stores the current shape and state on a layer when the currently selected layer changes.
public  CoordinateclosestCoordinateOnEdge(Coordinate endPoint1, Coordinate endPoint2, Coordinate src)
     Returns the closest point on the line between vertex1 and vertex2 to coordinate src

All Coordinates must be in the same CRS


Parameters:
  endPoint1 - first vertex of a line.
Parameters:
  endPoint2 - second vertex of a line.
Parameters:
  src - the closes coordinate is found with respect to src.
public  PointclosestPointOnEdge(Point endPoint1, Point endPoint2, Point src)
     Returns the closest point on the line between vertex1 and vertex2 to coordinate src

All Coordinates must be in the same CRS


Parameters:
  endPoint1 - first vertex of a line.
Parameters:
  endPoint2 - second vertex of a line.
Parameters:
  src - the closes coordinate is found with respect to src.
public  intgetClosest(Geometry geometry, Coordinate click, Coordinate[] result)
     Returns the index of the coordinate closest to the click.
Parameters:
  geometry - the geometry to search for the closest coordinate; The default geometry is searched.
Parameters:
  click - the closest coordinate in coordinates will be found with respect toclick
Parameters:
  result - the first position will be fill with the closest coordinate in geometry.
public  CoordinategetClosestSnapPoint(EditToolHandler handler, EditBlackboard editBlackboard, Point centerPoint, boolean includeVerticesInCurrent, SnapBehaviour snapBehaviour, EditState stateAfterSearch)
    
public  EditGeomgetGeomWithMouseOver(Collection<EditGeom> geoms, Point location, boolean treatUnknownAsPolygon)
    
public  List<EditGeom>getIntersectingGeom(EditBlackboard editBlackboard, Point point, boolean treatUnknownAsPolygons)
     Finds and returns the EditGeoms that intersect the point.
public  CoordinategetTransformedClick(Coordinate click, ILayer layer)
     Convenience method; transforms the click from the viewportModel CRS to the layer's CRS.
public  voidhideSelectedFeatures(EditToolHandler handler, ILayer selectedLayer)
     Triggers a re-render that hides the features on the EditBlackboard .
public  CoordinateintersectingLines(Coordinate line1P1, Coordinate line1P2, Coordinate line2P1, Coordinate line2P2)
    
public  PointintersectingLines(Point line1P1, Point line1P2, Point line2P1, Point line2P2)
    
public  booleanintersection(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
Parameters:
  point1 - the first point in the reference edge
Parameters:
  point2 - the second point in the reference edge
Parameters:
  shape - the shape that is searched for intersections
Parameters:
  startIndex - the index in the shape of the point at which to start searching.
public static  CoordinatemidPointOnLine(Coordinate coord, Coordinate coord2)
    
public  booleanoverEdge(Coordinate endPoint1, Coordinate endPoint2, Envelope env)
     Returns true if the envelope overlaps some part of the edge
Parameters:
  endPoint1 - one end point of the edge
Parameters:
  endPoint2 - the other end point of the edge
Parameters:
  env - the reference envelope.
public  booleanoverEdgeCoordinatePrecision(PrimitiveShape shape, Envelope env)
     Return true if the envelope overlaps at least one edge of the shape.
public  booleanoverEdgePixelPrecision(PrimitiveShape shape, Envelope env)
     Return true if the envelope overlaps at least one edge of the shape.
public  intoverVertext(Coordinate[] coords, Envelope env)
    
public  voidrefreshLayer(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.
public  voidrefreshLayer(ILayer selectedLayer, Set<String> fids, Envelope refreshBounds, boolean forceRefresh, boolean hidefeature)
     Sets the rendering hint on the layer so that the feature is hidden if hidefeature is true.
public  voidreverseOrder(PrimitiveShape shape)
     Reverse the order of the vertices in a Shape.
public  booleanselfIntersection(PrimitiveShape shape)
     Returns true if the shape has a self intersection.
public  CoordinatesnapToGrid(Point centerPoint, IMap map)
     Returns the coordinate that is on the grid intersection closest to the coordinate.

Field Detail
NO_INTERSECTION
final public static int NO_INTERSECTION(Code)



OVER_EDGE
final public static int OVER_EDGE(Code)



TOPBOTTOMRIGHTLEFT
final static int TOPBOTTOMRIGHTLEFT(Code)



instance
public static EditUtils instance(Code)





Method Detail
appendPathToShape
public UndoableComposite appendPathToShape(EditToolHandler handler, PathIterator iter, PrimitiveShape shape)(Code)
Appends the points defined in the PathIterator to the shape. Currently curve segments are not supported and if there is a moveto in the middle of the iterator a hole will be created in the shape. If the GeomType is line or point then an exception will be thrown but otherwise the client code must ensure that the request makes sense.
Parameters:
  iter - The iterator to append
Parameters:
  shape - the shape to append to. Commands that will append the points to the shape. Nothing is done until commands are run.



appendPathToShape
public UndoableComposite appendPathToShape(PathIterator iter, ShapeType shapeType, EditToolHandler handler, EditBlackboard bb, IBlockingProvider<PrimitiveShape> currentProvider2)(Code)
Appends the points defined in the PathIterator to the shape. Currently curve segments are not supported and if there is a move to in the middle of the iterator a hole will be created in the shape. If the GeomType is line or point then an exception will be thrown but otherwise the client code must ensure that the request makes sense.
Parameters:
  iter - The iterator to append
Parameters:
  bb - the editblackboard used to add coordinates
Parameters:
  currentProvider2 - the shape provider that provides the shape to append the coordinates to
Parameters:
  shapeType - the type of geometry that is expected from currentProvider. Commands that will append the points to the shape. Nothing is done until commands are run.



cancelHideSelection
public void cancelHideSelection(ILayer selectedLayer)(Code)
When an edit is canceled the selected layer must be re-rendered because they were hidden by EditUtils.refreshLayer(ILayer,Feature,Envelope,boolean,boolean) This method must be called in order to efficiently do that.
See Also:   EditUtils.refreshLayer(ILayer,Feature,Envelope,boolean,boolean)
Parameters:
  selectedLayer -



clearLayerStateShapeCache
public void clearLayerStateShapeCache(Collection<ILayer> layers)(Code)
The framework stores the current shape and state on a layer when the currently selected layer changes. This method clears that cache on the layers passed in. This should be called when the tool is de-actived and when a cancel and accept is run. This is so that the shapes can be garbage collected.
Parameters:
  layers -



closestCoordinateOnEdge
public Coordinate closestCoordinateOnEdge(Coordinate endPoint1, Coordinate endPoint2, Coordinate src)(Code)
Returns the closest point on the line between vertex1 and vertex2 to coordinate src

All Coordinates must be in the same CRS


Parameters:
  endPoint1 - first vertex of a line.
Parameters:
  endPoint2 - second vertex of a line.
Parameters:
  src - the closes coordinate is found with respect to src. the closest point on the line between vertex1 and vertex2 to coordinatesrc



closestPointOnEdge
public Point closestPointOnEdge(Point endPoint1, Point endPoint2, Point src)(Code)
Returns the closest point on the line between vertex1 and vertex2 to coordinate src

All Coordinates must be in the same CRS


Parameters:
  endPoint1 - first vertex of a line.
Parameters:
  endPoint2 - second vertex of a line.
Parameters:
  src - the closes coordinate is found with respect to src. the closest point on the line between vertex1 and vertex2 to coordinatesrc



getClosest
public int getClosest(Geometry geometry, Coordinate click, Coordinate[] result)(Code)
Returns the index of the coordinate closest to the click.
Parameters:
  geometry - the geometry to search for the closest coordinate; The default geometry is searched.
Parameters:
  click - the closest coordinate in coordinates will be found with respect toclick
Parameters:
  result - the first position will be fill with the closest coordinate in geometry. the index of the coordinate closest to the click.



getClosestSnapPoint
public Coordinate getClosestSnapPoint(EditToolHandler handler, EditBlackboard editBlackboard, Point centerPoint, boolean includeVerticesInCurrent, SnapBehaviour snapBehaviour, EditState stateAfterSearch)(Code)
Searches all the layers in the map and the EditBlackboard for the closest vertex to center point
Parameters:
  includeVerticesInCurrent - indicates whether the vertices of the current feature should be considered.
Parameters:
  stateAfterSearch - the Point that is the closest vertex.



getGeomWithMouseOver
public EditGeom getGeomWithMouseOver(Collection<EditGeom> geoms, Point location, boolean treatUnknownAsPolygon)(Code)
Returns the Geometry from the collection that the mouse is over/intersects
Parameters:
  geoms - Geoms to search through
Parameters:
  location - the location the first geom that the location is over/intersects



getIntersectingGeom
public List<EditGeom> getIntersectingGeom(EditBlackboard editBlackboard, Point point, boolean treatUnknownAsPolygons)(Code)
Finds and returns the EditGeoms that intersect the point. This maybe an expensive operation if there are a large number of EditGeoms each with many points. The calculation is done in screen space, however, so the number of coordinates in the shapes do not matter so much.
Parameters:
  editBlackboard -
Parameters:
  point -
Parameters:
  treatUnknownAsPolygons -



getTransformedClick
public Coordinate getTransformedClick(Coordinate click, ILayer layer)(Code)
Convenience method; transforms the click from the viewportModel CRS to the layer's CRS.
Parameters:
  click -



hideSelectedFeatures
public void hideSelectedFeatures(EditToolHandler handler, ILayer selectedLayer)(Code)
Triggers a re-render that hides the features on the EditBlackboard .



intersectingLines
public Coordinate intersectingLines(Coordinate line1P1, Coordinate line1P2, Coordinate line2P1, Coordinate line2P2)(Code)
Returns the intersection where the two lines meet



intersectingLines
public Point intersectingLines(Point line1P1, Point line1P2, Point line2P1, Point line2P2)(Code)
Returns the intersection where the two lines meet



intersection
public boolean intersection(Point point1, Point point2, PrimitiveShape shape, int startIndex, int endIndex)(Code)
Checks whether the edge from point1 to point2 intersects any edge in the shape from startIndex to the endIndex
Parameters:
  point1 - the first point in the reference edge
Parameters:
  point2 - the second point in the reference edge
Parameters:
  shape - the shape that is searched for intersections
Parameters:
  startIndex - the index in the shape of the point at which to start searching. The point indicated will be thefirst point in the edge.
Parameters:
  endIndex - the index to stop the search. It is the index of the end point of the last edge to compare true if there is an intersection between the edge indicated by last,current and the shape



midPointOnLine
public static Coordinate midPointOnLine(Coordinate coord, Coordinate coord2)(Code)



overEdge
public boolean overEdge(Coordinate endPoint1, Coordinate endPoint2, Envelope env)(Code)
Returns true if the envelope overlaps some part of the edge
Parameters:
  endPoint1 - one end point of the edge
Parameters:
  endPoint2 - the other end point of the edge
Parameters:
  env - the reference envelope. true if the envelope overlaps some part of the edge



overEdgeCoordinatePrecision
public boolean overEdgeCoordinatePrecision(PrimitiveShape shape, Envelope env)(Code)
Return true if the envelope overlaps at least one edge of the shape. This checks all the Coordinates in the shape so the envelope must be in the "world" space (same projection as coordinates).
Parameters:
  shape - to search
Parameters:
  env - envelope used to see if it overlaps an edge true if the envelope overlaps at least one edge of the shape.



overEdgePixelPrecision
public boolean overEdgePixelPrecision(PrimitiveShape shape, Envelope env)(Code)
Return true if the envelope overlaps at least one edge of the shape. This only checks the Points in the shape so the envelope must be in pixel space. This also means that it is not completely accurate but it is sufficient for interactive purposes.
Parameters:
  shape - to search
Parameters:
  env - envelope used to see if it overlaps an edge true if the envelope overlaps at least one edge of the shape.



overVertext
public int overVertext(Coordinate[] coords, Envelope env)(Code)



refreshLayer
public void refreshLayer(ILayer selectedLayer, Feature feature, Envelope refreshBounds, boolean forceRefresh, boolean hidefeature)(Code)
Sets the rendering hint on the layer so that the feature is hidden if hidefeature is true. If hidefeature is false then the hint is reset all features are shown

EditUtils.cancelHideSelection(ILayer) should be called if the edit is canceled.


See Also:   EditUtils.cancelHideSelection(ILayer)
Parameters:
  selectedLayer -
Parameters:
  feature -
Parameters:
  refreshBounds - the area to refresh (should be the the area of the feature). May be null to refresh entire area. Envelope should be inLayer coordinates.
Parameters:
  hidefeature -



refreshLayer
public void refreshLayer(ILayer selectedLayer, Set<String> fids, Envelope refreshBounds, boolean forceRefresh, boolean hidefeature)(Code)
Sets the rendering hint on the layer so that the feature is hidden if hidefeature is true. If hidefeature is false then the hint is reset all features are shown

EditUtils.cancelHideSelection(ILayer) should be called if the edit is cancelled.


See Also:   EditUtils.cancelHideSelection(ILayer)
Parameters:
  selectedLayer - the currently selected layer
Parameters:
  fids - the Feature Ids of the features that have been selected
Parameters:
  refreshBounds - the area to refresh (should be the the area of the features). May be null to refresh entire area. Envelope should be inLayer coordinates.
Parameters:
  hidefeature - if true then the features are hidden otherwise they will be shown again.



reverseOrder
public void reverseOrder(PrimitiveShape shape)(Code)
Reverse the order of the vertices in a Shape. Used because the holes and shells in polygons have to be in a particular order.
Parameters:
  shape -



selfIntersection
public boolean selfIntersection(PrimitiveShape shape)(Code)
Returns true if the shape has a self intersection. Only checks the points not the coordinates there for it is quicker but less accurate.
Parameters:
  shape - shape to test. true if the shape has a self intersection.



snapToGrid
public Coordinate snapToGrid(Point centerPoint, IMap map)(Code)
Returns the coordinate that is on the grid intersection closest to the coordinate.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.