Jan Jezek a écrit : > I need just the CGAlgorithms.isPointInRing and CGAlgorithms.isOnLine methods > to know if the DirectPosition is inside the ring or not. I can implement it > by myself. If I should do that, it should be in the org.geotools.geometry > package. Do you agree with this proposal or do you have different > meaning?prefer my work to be placed into referencing package so I would like > to get rid of the JTS dependency.
Would the java.awt.geom.GeneralPath class be of some help? http://java.sun.com/j2se/1.4.2/docs/api/java/awt/geom/GeneralPath.html It has a 'contains' method, which probably provides the same functionalities than CGAlgorithms.isPointInRing. However there is no equivalent of CGAlgorithms.isOnLine that I can see. GeneralPath probably consume less memory than CGAlgorithms, and also supports curves in addition of straight lines. However it work in float precision only in Java 5 (Java 6 provides a double precision version). If we wish to add our own algorithm, we could put them in the following class: org.geotools.resources.geometry.ShapeUtilities This is a non-documented class (everything in org.geotools.resources is hiden from javadoc) because I'm not sure that this API should be public. ShapeUtilities already contains some methods working on Java2D Shape, which are used by J2D-Renderer among others. If utilities methods are added there, it would be nice if they could work on java.awt.Shape objects (instead of expecting some kind of double[] or Coordinate[] array in argument). One more note: on which kind of geometric object do you wish to test point inclusion? If they are mostly triangles, then a better approach would be to define a new Triangle class in this package: http://javadoc.geotools.fr/snapshot/org/geotools/display/geom/package-summary.html (note: maybe we should find a better name for this package). This Triangle class should implement java.awt.Shape, in the same way than Arrow2D in the above-cited package. This Shape implementation would then implements the 'contains' method in a more efficient way than a general-purpose algorithm. Martin ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
