[geos-commits] r2373 - in trunk/source: algorithm/distance headers/geos/algorithm/distance

svn_geos at osgeo.org svn_geos at osgeo.org
Wed Apr 15 11:58:09 EDT 2009


Author: strk
Date: 2009-04-15 11:58:09 -0400 (Wed, 15 Apr 2009)
New Revision: 2373

Added:
   trunk/source/algorithm/distance/DistanceToPoint.cpp
   trunk/source/headers/geos/algorithm/distance/DistanceToPoint.h
Removed:
   trunk/source/algorithm/distance/EuclideanDistanceToPoint.cpp
   trunk/source/headers/geos/algorithm/distance/EuclideanDistanceToPoint.h
Modified:
   trunk/source/algorithm/distance/DiscreteHausdorffDistance.cpp
   trunk/source/algorithm/distance/Makefile.am
   trunk/source/headers/geos/algorithm/distance/DiscreteHausdorffDistance.h
   trunk/source/headers/geos/algorithm/distance/Makefile.am
Log:
New class rename, following JTS

Modified: trunk/source/algorithm/distance/DiscreteHausdorffDistance.cpp
===================================================================
--- trunk/source/algorithm/distance/DiscreteHausdorffDistance.cpp	2009-04-15 12:56:08 UTC (rev 2372)
+++ trunk/source/algorithm/distance/DiscreteHausdorffDistance.cpp	2009-04-15 15:58:09 UTC (rev 2373)
@@ -13,7 +13,7 @@
  *
  **********************************************************************
  *
- * Last port: algorithm/distance/DiscreteHausdorffDistance.java 1.4 (JTS-1.9)
+ * Last port: algorithm/distance/DiscreteHausdorffDistance.java 1.5 (JTS-1.9)
  *
  **********************************************************************/
 
@@ -57,7 +57,7 @@
       double y = p0.y + i*dely;
       Coordinate pt(x, y);
       minPtDist.initialize();
-      EuclideanDistanceToPoint::computeDistance(geom, pt, minPtDist);
+      DistanceToPoint::computeDistance(geom, pt, minPtDist);
       maxPtDist.setMaximum(minPtDist);
     }
 

Copied: trunk/source/algorithm/distance/DistanceToPoint.cpp (from rev 2361, trunk/source/algorithm/distance/EuclideanDistanceToPoint.cpp)
===================================================================
--- trunk/source/algorithm/distance/DistanceToPoint.cpp	                        (rev 0)
+++ trunk/source/algorithm/distance/DistanceToPoint.cpp	2009-04-15 15:58:09 UTC (rev 2373)
@@ -0,0 +1,119 @@
+/**********************************************************************
+ * $Id$
+ *
+ * GEOS - Geometry Engine Open Source
+ * http://geos.refractions.net
+ *
+ * Copyright (C) 2009  Sandro Santilli <strk at keybit.net>
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU Lesser General Public Licence as published
+ * by the Free Software Foundation. 
+ * See the COPYING file for more information.
+ *
+ **********************************************************************
+ *
+ * Last port: algorithm/distance/DistanceToPoint.java 1.1 (JTS-1.9)
+ *
+ **********************************************************************/
+
+#include <geos/algorithm/distance/DistanceToPoint.h>
+#include <geos/algorithm/distance/PointPairDistance.h>
+#include <geos/geom/Coordinate.h>
+#include <geos/geom/CoordinateSequence.h>
+#include <geos/geom/LineSegment.h>
+#include <geos/geom/LineString.h>
+#include <geos/geom/Polygon.h>
+#include <geos/geom/GeometryCollection.h>
+
+#include <typeinfo> // for dynamic_cast
+#include <cassert>
+
+using namespace geos::geom;
+
+namespace geos {
+namespace algorithm { // geos.algorithm
+namespace distance { // geos.algorithm.distance
+
+/* static */
+LineSegment DistanceToPoint::tempSegment;
+
+
+/* public static */
+void
+DistanceToPoint::computeDistance(const geom::Geometry& geom,
+                                          const geom::Coordinate& pt,
+                                          PointPairDistance& ptDist)
+{
+	if ( const LineString* ls = dynamic_cast<const LineString*>(&geom) )
+	{
+		computeDistance(*ls, pt, ptDist);
+	}
+	else if ( const Polygon* pl = dynamic_cast<const Polygon*>(&geom) )
+	{
+		computeDistance(*pl, pt, ptDist);
+	}
+	else if ( const GeometryCollection* gc = dynamic_cast<const GeometryCollection*>(&geom) )
+	{
+		for (size_t i = 0; i < gc->getNumGeometries(); i++)
+		{
+			const Geometry* g = gc->getGeometryN(i);
+			computeDistance(*g, pt, ptDist);
+		}
+	}
+	else
+	{
+		// assume geom is Point
+		ptDist.setMinimum(*(geom.getCoordinate()), pt);
+	}
+}
+
+/* public static */
+void
+DistanceToPoint::computeDistance(const geom::LineString& line,
+                                          const geom::Coordinate& pt,
+                                          PointPairDistance& ptDist)
+{
+	const CoordinateSequence* coordsRO = line.getCoordinatesRO();
+	const CoordinateSequence& coords = *coordsRO;
+	for (size_t i=0, n=coords.size()-1; i<n; ++i)
+	{
+		// NOT THREAD SAFE
+		tempSegment.setCoordinates(coords[i], coords[i + 1]);
+		// this is somewhat inefficient - could do better
+		Coordinate closestPt;
+		tempSegment.closestPoint(pt, closestPt);
+		ptDist.setMinimum(closestPt, pt);
+	}
+
+}
+
+/* public static */
+void
+DistanceToPoint::computeDistance(const geom::LineSegment& segment,
+                                          const geom::Coordinate& pt,
+                                          PointPairDistance& ptDist)
+{
+	Coordinate closestPt;
+	segment.closestPoint(pt, closestPt);
+	ptDist.setMinimum(closestPt, pt);
+}
+
+/* public static */
+void
+DistanceToPoint::computeDistance(const geom::Polygon& poly,
+                                          const geom::Coordinate& pt,
+                                          PointPairDistance& ptDist)
+{
+	computeDistance(*(poly.getExteriorRing()), pt, ptDist);
+	for (size_t i=0, n=poly.getNumInteriorRing(); i<n; ++i)
+	{
+		computeDistance(*(poly.getInteriorRingN(i)), pt, ptDist);
+	}
+}
+
+
+} // namespace geos.algorithm.distance
+} // namespace geos.algorithm
+} // namespace geos
+


Property changes on: trunk/source/algorithm/distance/DistanceToPoint.cpp
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/source/algorithm/distance/EuclideanDistanceToPoint.cpp
===================================================================
--- trunk/source/algorithm/distance/EuclideanDistanceToPoint.cpp	2009-04-15 12:56:08 UTC (rev 2372)
+++ trunk/source/algorithm/distance/EuclideanDistanceToPoint.cpp	2009-04-15 15:58:09 UTC (rev 2373)
@@ -1,119 +0,0 @@
-/**********************************************************************
- * $Id$
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.refractions.net
- *
- * Copyright (C) 2009  Sandro Santilli <strk at keybit.net>
- *
- * This is free software; you can redistribute and/or modify it under
- * the terms of the GNU Lesser General Public Licence as published
- * by the Free Software Foundation. 
- * See the COPYING file for more information.
- *
- **********************************************************************
- *
- * Last port: algorithm/distance/EuclideanDistanceToPoint.java 1.1 (JTS-1.9)
- *
- **********************************************************************/
-
-#include <geos/algorithm/distance/EuclideanDistanceToPoint.h>
-#include <geos/algorithm/distance/PointPairDistance.h>
-#include <geos/geom/Coordinate.h>
-#include <geos/geom/CoordinateSequence.h>
-#include <geos/geom/LineSegment.h>
-#include <geos/geom/LineString.h>
-#include <geos/geom/Polygon.h>
-#include <geos/geom/GeometryCollection.h>
-
-#include <typeinfo> // for dynamic_cast
-#include <cassert>
-
-using namespace geos::geom;
-
-namespace geos {
-namespace algorithm { // geos.algorithm
-namespace distance { // geos.algorithm.distance
-
-/* static */
-LineSegment EuclideanDistanceToPoint::tempSegment;
-
-
-/* public static */
-void
-EuclideanDistanceToPoint::computeDistance(const geom::Geometry& geom,
-                                          const geom::Coordinate& pt,
-                                          PointPairDistance& ptDist)
-{
-	if ( const LineString* ls = dynamic_cast<const LineString*>(&geom) )
-	{
-		computeDistance(*ls, pt, ptDist);
-	}
-	else if ( const Polygon* pl = dynamic_cast<const Polygon*>(&geom) )
-	{
-		computeDistance(*pl, pt, ptDist);
-	}
-	else if ( const GeometryCollection* gc = dynamic_cast<const GeometryCollection*>(&geom) )
-	{
-		for (size_t i = 0; i < gc->getNumGeometries(); i++)
-		{
-			const Geometry* g = gc->getGeometryN(i);
-			computeDistance(*g, pt, ptDist);
-		}
-	}
-	else
-	{
-		// assume geom is Point
-		ptDist.setMinimum(*(geom.getCoordinate()), pt);
-	}
-}
-
-/* public static */
-void
-EuclideanDistanceToPoint::computeDistance(const geom::LineString& line,
-                                          const geom::Coordinate& pt,
-                                          PointPairDistance& ptDist)
-{
-	const CoordinateSequence* coordsRO = line.getCoordinatesRO();
-	const CoordinateSequence& coords = *coordsRO;
-	for (size_t i=0, n=coords.size()-1; i<n; ++i)
-	{
-		// NOT THREAD SAFE
-		tempSegment.setCoordinates(coords[i], coords[i + 1]);
-		// this is somewhat inefficient - could do better
-		Coordinate closestPt;
-		tempSegment.closestPoint(pt, closestPt);
-		ptDist.setMinimum(closestPt, pt);
-	}
-
-}
-
-/* public static */
-void
-EuclideanDistanceToPoint::computeDistance(const geom::LineSegment& segment,
-                                          const geom::Coordinate& pt,
-                                          PointPairDistance& ptDist)
-{
-	Coordinate closestPt;
-	segment.closestPoint(pt, closestPt);
-	ptDist.setMinimum(closestPt, pt);
-}
-
-/* public static */
-void
-EuclideanDistanceToPoint::computeDistance(const geom::Polygon& poly,
-                                          const geom::Coordinate& pt,
-                                          PointPairDistance& ptDist)
-{
-	computeDistance(*(poly.getExteriorRing()), pt, ptDist);
-	for (size_t i=0, n=poly.getNumInteriorRing(); i<n; ++i)
-	{
-		computeDistance(*(poly.getInteriorRingN(i)), pt, ptDist);
-	}
-}
-
-
-} // namespace geos.algorithm.distance
-} // namespace geos.algorithm
-} // namespace geos
-

Modified: trunk/source/algorithm/distance/Makefile.am
===================================================================
--- trunk/source/algorithm/distance/Makefile.am	2009-04-15 12:56:08 UTC (rev 2372)
+++ trunk/source/algorithm/distance/Makefile.am	2009-04-15 15:58:09 UTC (rev 2373)
@@ -6,7 +6,7 @@
 
 libdistance_la_SOURCES = \
 	DiscreteHausdorffDistance.cpp \
-	EuclideanDistanceToPoint.cpp 
+	DistanceToPoint.cpp 
 
 libdistance_la_LIBADD = 
 

Modified: trunk/source/headers/geos/algorithm/distance/DiscreteHausdorffDistance.h
===================================================================
--- trunk/source/headers/geos/algorithm/distance/DiscreteHausdorffDistance.h	2009-04-15 12:56:08 UTC (rev 2372)
+++ trunk/source/headers/geos/algorithm/distance/DiscreteHausdorffDistance.h	2009-04-15 15:58:09 UTC (rev 2373)
@@ -13,7 +13,7 @@
  *
  **********************************************************************
  *
- * Last port: algorithm/distance/DiscreteHausdorffDistance.java 1.4 (JTS-1.9)
+ * Last port: algorithm/distance/DiscreteHausdorffDistance.java 1.5 (JTS-1.9)
  *
  **********************************************************************/
 
@@ -21,7 +21,7 @@
 #define GEOS_ALGORITHM_DISTANCE_DISCRETEHAUSDORFFDISTANCE_H
 
 #include <geos/algorithm/distance/PointPairDistance.h> // for composition
-#include <geos/algorithm/distance/EuclideanDistanceToPoint.h> // for composition
+#include <geos/algorithm/distance/DistanceToPoint.h> // for composition
 #include <geos/util/IllegalArgumentException.h> // for inlines
 #include <geos/geom/Geometry.h> // for inlines
 #include <geos/util/math.h> // for inlines
@@ -157,7 +157,7 @@
 		void filter_ro(const geom::Coordinate* pt)
 		{
 			minPtDist.initialize();
-			EuclideanDistanceToPoint::computeDistance(geom, *pt,
+			DistanceToPoint::computeDistance(geom, *pt,
 			                                         minPtDist);
 			maxPtDist.setMaximum(minPtDist);
 		}
@@ -170,7 +170,7 @@
 	private:
 		PointPairDistance maxPtDist;
 		PointPairDistance minPtDist;
-		EuclideanDistanceToPoint euclideanDist;
+		DistanceToPoint euclideanDist;
 		const geom::Geometry& geom;
 	};
 

Copied: trunk/source/headers/geos/algorithm/distance/DistanceToPoint.h (from rev 2361, trunk/source/headers/geos/algorithm/distance/EuclideanDistanceToPoint.h)
===================================================================
--- trunk/source/headers/geos/algorithm/distance/DistanceToPoint.h	                        (rev 0)
+++ trunk/source/headers/geos/algorithm/distance/DistanceToPoint.h	2009-04-15 15:58:09 UTC (rev 2373)
@@ -0,0 +1,86 @@
+/**********************************************************************
+ * $Id$
+ *
+ * GEOS - Geometry Engine Open Source
+ * http://geos.refractions.net
+ *
+ * Copyright (C) 2009  Sandro Santilli <strk at keybit.net>
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU Lesser General Public Licence as published
+ * by the Free Software Foundation. 
+ * See the COPYING file for more information.
+ *
+ **********************************************************************
+ *
+ * Last port: algorithm/distance/DistanceToPoint.java 1.1 (JTS-1.9)
+ *
+ **********************************************************************/
+
+#ifndef GEOS_ALGORITHM_DISTANCE_DISTANCETOPOINT_H
+#define GEOS_ALGORITHM_DISTANCE_DISTANCETOPOINT_H
+
+#include <geos/geom/LineSegment.h> // for composition
+
+namespace geos {
+	namespace algorithm {
+		namespace distance {
+			class PointPairDistance;
+		}
+	}
+	namespace geom {
+		class Geometry;
+		class Coordinate; 
+		class LineString; 
+		class Polygon; 
+	}
+}
+
+namespace geos {
+namespace algorithm { // geos::algorithm
+namespace distance { // geos::algorithm::distance
+
+/**
+ * Computes the Euclidean distance (L2 metric) from a Point to a Geometry.
+ *
+ * Also computes two points which are separated by the distance.
+ */
+class DistanceToPoint
+{
+public:
+
+	DistanceToPoint() {}
+
+	static void computeDistance(const geom::Geometry& geom,
+			            const geom::Coordinate& pt,
+	                            PointPairDistance& ptDist);
+
+	static void computeDistance(const geom::LineString& geom,
+			            const geom::Coordinate& pt,
+	                            PointPairDistance& ptDist);
+
+	static void computeDistance(const geom::LineSegment& geom,
+			            const geom::Coordinate& pt,
+	                            PointPairDistance& ptDist);
+
+	static void computeDistance(const geom::Polygon& geom,
+			            const geom::Coordinate& pt,
+	                            PointPairDistance& ptDist);
+
+private:
+
+	// used for point-line distance calculation
+	// NOT THREAD SAFE !!
+	static geom::LineSegment tempSegment;
+};
+
+} // geos::algorithm::distance
+} // geos::algorithm
+} // geos
+
+#endif // GEOS_ALGORITHM_DISTANCE_DISTANCETOPOINT_H
+
+/**********************************************************************
+ * $Log$
+ **********************************************************************/
+


Property changes on: trunk/source/headers/geos/algorithm/distance/DistanceToPoint.h
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/source/headers/geos/algorithm/distance/EuclideanDistanceToPoint.h
===================================================================
--- trunk/source/headers/geos/algorithm/distance/EuclideanDistanceToPoint.h	2009-04-15 12:56:08 UTC (rev 2372)
+++ trunk/source/headers/geos/algorithm/distance/EuclideanDistanceToPoint.h	2009-04-15 15:58:09 UTC (rev 2373)
@@ -1,86 +0,0 @@
-/**********************************************************************
- * $Id$
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.refractions.net
- *
- * Copyright (C) 2009  Sandro Santilli <strk at keybit.net>
- *
- * This is free software; you can redistribute and/or modify it under
- * the terms of the GNU Lesser General Public Licence as published
- * by the Free Software Foundation. 
- * See the COPYING file for more information.
- *
- **********************************************************************
- *
- * Last port: algorithm/distance/EuclideanDistanceToPoint.java 1.1 (JTS-1.9)
- *
- **********************************************************************/
-
-#ifndef GEOS_ALGORITHM_DISTANCE_EUCLIDEANDISTANCETOPOINT_H
-#define GEOS_ALGORITHM_DISTANCE_EUCLIDEANDISTANCETOPOINT_H
-
-#include <geos/geom/LineSegment.h> // for composition
-
-namespace geos {
-	namespace algorithm {
-		namespace distance {
-			class PointPairDistance;
-		}
-	}
-	namespace geom {
-		class Geometry;
-		class Coordinate; 
-		class LineString; 
-		class Polygon; 
-	}
-}
-
-namespace geos {
-namespace algorithm { // geos::algorithm
-namespace distance { // geos::algorithm::distance
-
-/**
- * Computes the Euclidean distance (L2 metric) from a Point to a Geometry.
- *
- * Also computes two points which are separated by the distance.
- */
-class EuclideanDistanceToPoint
-{
-public:
-
-	EuclideanDistanceToPoint() {}
-
-	static void computeDistance(const geom::Geometry& geom,
-			            const geom::Coordinate& pt,
-	                            PointPairDistance& ptDist);
-
-	static void computeDistance(const geom::LineString& geom,
-			            const geom::Coordinate& pt,
-	                            PointPairDistance& ptDist);
-
-	static void computeDistance(const geom::LineSegment& geom,
-			            const geom::Coordinate& pt,
-	                            PointPairDistance& ptDist);
-
-	static void computeDistance(const geom::Polygon& geom,
-			            const geom::Coordinate& pt,
-	                            PointPairDistance& ptDist);
-
-private:
-
-	// used for point-line distance calculation
-	// NOT THREAD SAFE !!
-	static geom::LineSegment tempSegment;
-};
-
-} // geos::algorithm::distance
-} // geos::algorithm
-} // geos
-
-#endif // GEOS_ALGORITHM_DISTANCE_EUCLIDEANDISTANCETOPOINT_H
-
-/**********************************************************************
- * $Log$
- **********************************************************************/
-

Modified: trunk/source/headers/geos/algorithm/distance/Makefile.am
===================================================================
--- trunk/source/headers/geos/algorithm/distance/Makefile.am	2009-04-15 12:56:08 UTC (rev 2372)
+++ trunk/source/headers/geos/algorithm/distance/Makefile.am	2009-04-15 15:58:09 UTC (rev 2373)
@@ -12,5 +12,5 @@
 
 noinst_HEADERS = 			\
 	DiscreteHausdorffDistance.h	\
-	EuclideanDistanceToPoint.h	\
+	DistanceToPoint.h		\
 	PointPairDistance.h



More information about the geos-commits mailing list