[geos-commits] r2425 - in trunk/source: headers/geos/operation operation

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Apr 30 04:33:46 EDT 2009


Author: strk
Date: 2009-04-30 04:33:46 -0400 (Thu, 30 Apr 2009)
New Revision: 2425

Modified:
   trunk/source/headers/geos/operation/IsSimpleOp.h
   trunk/source/operation/IsSimpleOp.cpp
Log:
Port info, and sync from 1.14 to 1.17 (more to do, need more classes)


Modified: trunk/source/headers/geos/operation/IsSimpleOp.h
===================================================================
--- trunk/source/headers/geos/operation/IsSimpleOp.h	2009-04-29 23:52:36 UTC (rev 2424)
+++ trunk/source/headers/geos/operation/IsSimpleOp.h	2009-04-30 08:33:46 UTC (rev 2425)
@@ -12,6 +12,10 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: operation/IsSimpleOp.java rev. 1.17
+ *
  **********************************************************************/
 
 #ifndef GEOS_OPERATION_ISSIMPLEOP_H
@@ -44,22 +48,62 @@
 /** \brief
  * Tests whether a Geometry is simple.
  *
- * Only Geometry whose definition allows them
- * to be simple or non-simple are tested.  (E.g. Polygons must be simple
- * by definition, so no test is provided.  To test whether a given Polygon is valid,
- * use <code>Geometry#isValid</code>)
+ * In general, the SFS specification of simplicity follows the rule:
  *
+ *  - A Geometry is simple iff the only self-intersections are at
+ *    boundary points.
+ *
+ * Simplicity is defined for each {@link Geometry} subclass as follows:
+ * 
+ *  - Valid polygonal geometries are simple by definition, so
+ *    <code>isSimple</code> trivially returns true.
+ *  - Linear geometries are simple iff they do not self-intersect at points
+ *    other than boundary points.
+ *  - Zero-dimensional geometries (points) are simple iff they have no
+ *    repeated points.
+ *  - Empty <code>Geometry</code>s are always simple
+ *
  */
 class IsSimpleOp {
+
 public:
+
 	IsSimpleOp();
+
 	bool isSimple(const geom::LineString *geom);
+
 	bool isSimple(const geom::MultiLineString *geom);
+
+	/**
+	 * A MultiPoint is simple iff it has no repeated points
+	 */
 	bool isSimple(const geom::MultiPoint *mp);
+
 	bool isSimpleLinearGeometry(const geom::Geometry *geom);
+
 private:
+
+	/**
+	 * For all edges, check if there are any intersections which are
+	 * NOT at an endpoint.
+	 * The Geometry is not simple if there are intersections not at
+	 * endpoints.
+	 */
 	bool hasNonEndpointIntersection(geomgraph::GeometryGraph &graph);
+
+	/**
+	 * Tests that no edge intersection is the endpoint of a closed line.
+	 * This ensures that closed lines are not touched at their endpoint,
+	 * which is an interior point according to the Mod-2 rule
+	 * To check this we compute the degree of each endpoint.
+	 * The degree of endpoints of closed lines
+	 * must be exactly 2.
+	 */
 	bool hasClosedEndpointIntersection(geomgraph::GeometryGraph &graph);
+
+	/**
+	 * Add an endpoint to the map, creating an entry for it if none exists
+	 */
 	void addEndpoint(std::map<const geom::Coordinate*, EndpointInfo*,
 			geom::CoordinateLessThen>&endPoints,
 			const geom::Coordinate *p, bool isClosed);

Modified: trunk/source/operation/IsSimpleOp.cpp
===================================================================
--- trunk/source/operation/IsSimpleOp.cpp	2009-04-29 23:52:36 UTC (rev 2424)
+++ trunk/source/operation/IsSimpleOp.cpp	2009-04-30 08:33:46 UTC (rev 2425)
@@ -14,6 +14,8 @@
  *
  **********************************************************************
  *
+ * Last port: operation/IsSimpleOp.java rev. 1.17
+ *
  **********************************************************************/
 
 #include <geos/operation/IsSimpleOp.h>
@@ -41,24 +43,25 @@
 namespace geos {
 namespace operation { // geos.operation
 
+/*public*/
 IsSimpleOp::IsSimpleOp()
 {}
 
+/*public*/
 bool
 IsSimpleOp::isSimple(const LineString *geom)
 {
 	return isSimpleLinearGeometry(geom);
 }
 
+/*public*/
 bool
 IsSimpleOp::isSimple(const MultiLineString *geom)
 {
 	return isSimpleLinearGeometry(geom);
 }
 
-/**
- * A MultiPoint is simple iff it has no repeated points
- */
+/*public*/
 bool
 IsSimpleOp::isSimple(const MultiPoint *mp)
 {
@@ -106,10 +109,7 @@
 	return true;
 }
 
-/**
- * For all edges, check if there are any intersections which are NOT at an endpoint.
- * The Geometry is not simple if there are intersections not at endpoints.
- */
+/*private*/
 bool
 IsSimpleOp::hasNonEndpointIntersection(GeometryGraph &graph)
 {
@@ -129,12 +129,7 @@
 	return false;
 }
 
-/**
- * Test that no edge intersection is the
- * endpoint of a closed line.  To check this we compute the
- * degree of each endpoint. The degree of endpoints of closed lines
- * must be exactly 2.
- */
+/*private*/
 bool
 IsSimpleOp::hasClosedEndpointIntersection(GeometryGraph &graph)
 {
@@ -171,9 +166,7 @@
 	return false;
 }
 
-/**
-* Add an endpoint to the map, creating an entry for it if none exists
-*/
+/*private*/
 void
 IsSimpleOp::addEndpoint(
 	map<const Coordinate*,EndpointInfo*,CoordinateLessThen>&endPoints,
@@ -210,89 +203,3 @@
 } // namespace geos::operation
 } // namespace geos
 
-/**********************************************************************
- * $Log$
- * Revision 1.23  2006/03/21 21:42:54  strk
- * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
- *
- * Revision 1.22  2006/03/09 16:46:49  strk
- * geos::geom namespace definition, first pass at headers split
- *
- * Revision 1.21  2006/02/19 19:46:49  strk
- * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
- *
- * Revision 1.20  2006/01/08 15:24:40  strk
- * Changed container-related typedef to class-scoped STL-like typedefs.
- * Fixed const correctness of EdgeIntersectionList::begin() and ::end() consts;
- * defined M_PI when undef as suggested by Charlie Savage.
- * Removed <stdio.h> include from GeometricShapeFactory.cpp.
- *
- * Revision 1.19  2005/11/21 16:03:20  strk
- *
- * Coordinate interface change:
- *         Removed setCoordinate call, use assignment operator
- *         instead. Provided a compile-time switch to
- *         make copy ctor and assignment operators non-inline
- *         to allow for more accurate profiling.
- *
- * Coordinate copies removal:
- *         NodeFactory::createNode() takes now a Coordinate reference
- *         rather then real value. This brings coordinate copies
- *         in the testLeaksBig.xml test from 654818 to 645991
- *         (tested in 2.1 branch). In the head branch Coordinate
- *         copies are 222198.
- *         Removed useless coordinate copies in ConvexHull
- *         operations
- *
- * STL containers heap allocations reduction:
- *         Converted many containers element from
- *         pointers to real objects.
- *         Made some use of .reserve() or size
- *         initialization when final container size is known
- *         in advance.
- *
- * Stateless classes allocations reduction:
- *         Provided ::instance() function for
- *         NodeFactories, to avoid allocating
- *         more then one (they are all
- *         stateless).
- *
- * HCoordinate improvements:
- *         Changed HCoordinate constructor by HCoordinates
- *         take reference rather then real objects.
- *         Changed HCoordinate::intersection to avoid
- *         a new allocation but rather return into a provided
- *         storage. LineIntersector changed to reflect
- *         the above change.
- *
- * Revision 1.18  2005/11/16 15:49:54  strk
- * Reduced gratuitous heap allocations.
- *
- * Revision 1.17  2005/11/07 12:31:24  strk
- * Changed EdgeIntersectionList to use a set<> rathern then a vector<>, and
- * to avoid dynamic allocation of initial header.
- * Inlined short SweepLineEvent methods.
- *
- * Revision 1.16  2005/06/24 11:09:43  strk
- * Dropped RobustLineIntersector, made LineIntersector a concrete class.
- * Added LineIntersector::hasIntersection(Coordinate&,Coordinate&,Coordinate&)
- * to avoid computing intersection point (Z) when it's not necessary.
- *
- * Revision 1.15  2005/02/05 05:44:47  strk
- * Changed geomgraph nodeMap to use Coordinate pointers as keys, reduces
- * lots of other Coordinate copies.
- *
- * Revision 1.14  2004/12/08 13:54:43  strk
- * gcc warnings checked and fixed, general cleanups.
- *
- * Revision 1.13  2004/07/02 13:28:27  strk
- * Fixed all #include lines to reflect headers layout change.
- * Added client application build tips in README.
- *
- * Revision 1.12  2003/11/07 01:23:42  pramsey
- * Add standard CVS headers licence notices and copyrights to all cpp and h
- * files.
- *
- *
- **********************************************************************/
-



More information about the geos-commits mailing list