[geos-commits] r3960 - in trunk: include/geos/geom include/geos/geom/util src/geom src/geom/util

svn_geos at osgeo.org svn_geos at osgeo.org
Tue Nov 19 00:26:43 PST 2013


Author: strk
Date: 2013-11-19 00:26:42 -0800 (Tue, 19 Nov 2013)
New Revision: 3960

Added:
   trunk/src/geom/util/LinearComponentExtracter.cpp
   trunk/src/geom/util/PointExtracter.cpp
   trunk/src/geom/util/PolygonExtracter.cpp
Modified:
   trunk/include/geos/geom/Geometry.h
   trunk/include/geos/geom/util/ComponentCoordinateExtracter.h
   trunk/include/geos/geom/util/LinearComponentExtracter.h
   trunk/include/geos/geom/util/PointExtracter.h
   trunk/include/geos/geom/util/PolygonExtracter.h
   trunk/src/geom/Geometry.cpp
   trunk/src/geom/util/ComponentCoordinateExtracter.cpp
   trunk/src/geom/util/Makefile.am
Log:
Define ComponentCoordinateExtracter classes in .cpp file (#535)

This is a workaround for a bug in GCC 4.4 failing to properly
encode inheritance info in the shared library when the class is
fully inlined.

Patch by Daniel Komisar <dkomisar at mak.com>

Modified: trunk/include/geos/geom/Geometry.h
===================================================================
--- trunk/include/geos/geom/Geometry.h	2013-09-13 17:03:30 UTC (rev 3959)
+++ trunk/include/geos/geom/Geometry.h	2013-11-19 08:26:42 UTC (rev 3960)
@@ -832,13 +832,10 @@
 
 	int getClassSortIndex() const;
 
-	class GeometryChangedFilter : public GeometryComponentFilter
+	class GEOS_DLL GeometryChangedFilter : public GeometryComponentFilter
 	{
 	public:
-		void filter_rw(Geometry* geom)
-		{
-			geom->geometryChangedAction();
-		}
+		void filter_rw(Geometry* geom);
 	};
 
 	static GeometryChangedFilter geometryChangedFilter;

Modified: trunk/include/geos/geom/util/ComponentCoordinateExtracter.h
===================================================================
--- trunk/include/geos/geom/util/ComponentCoordinateExtracter.h	2013-09-13 17:03:30 UTC (rev 3959)
+++ trunk/include/geos/geom/util/ComponentCoordinateExtracter.h	2013-11-19 08:26:42 UTC (rev 3960)
@@ -45,44 +45,17 @@
 	 * efficient to create a single ComponentCoordinateFilter instance
 	 * and pass it to multiple geometries.
 	 */
-	static void getCoordinates(const Geometry &geom, std::vector<const Coordinate*> &ret)
-	{
-		ComponentCoordinateExtracter cce(ret);
-		geom.apply_ro(&cce);
-	}
+	static void getCoordinates(const Geometry &geom, std::vector<const Coordinate*> &ret);
 
 	/**
 	 * Constructs a ComponentCoordinateFilter with a list in which
 	 * to store Coordinates found.
 	 */
-	ComponentCoordinateExtracter( std::vector<const Coordinate*> &newComps)
-		:
-		comps(newComps)
-		{}
+	ComponentCoordinateExtracter( std::vector<const Coordinate*> &newComps);
 
-	void filter_rw( Geometry * geom)
-	{
-		if (	geom->getGeometryTypeId() == geos::geom::GEOS_LINEARRING 
-			||	geom->getGeometryTypeId() == geos::geom::GEOS_LINESTRING
-			||	geom->getGeometryTypeId() == geos::geom::GEOS_POINT ) 
-			comps.push_back( geom->getCoordinate() );
-		//if (	typeid( *geom ) == typeid( LineString )
-		//	||	typeid( *geom ) == typeid( Point ) )
-		//if ( const Coordinate *ls=dynamic_cast<const Coordinate *>(geom) )
-		//	comps.push_back(ls);
-	}
+	void filter_rw( Geometry * geom);
 
-	void filter_ro( const Geometry * geom)
-	{
-		//if (	typeid( *geom ) == typeid( LineString )
-		//	||	typeid( *geom ) == typeid( Point ) )
-		if (	geom->getGeometryTypeId() == geos::geom::GEOS_LINEARRING 
-			||	geom->getGeometryTypeId() == geos::geom::GEOS_LINESTRING
-			||	geom->getGeometryTypeId() == geos::geom::GEOS_POINT ) 
-			comps.push_back( geom->getCoordinate() );
-		//if ( const Coordinate *ls=dynamic_cast<const Coordinate *>(geom) )
-		//	comps.push_back(ls);
-	}
+	void filter_ro( const Geometry * geom);
 
 private:
 

Modified: trunk/include/geos/geom/util/LinearComponentExtracter.h
===================================================================
--- trunk/include/geos/geom/util/LinearComponentExtracter.h	2013-09-13 17:03:30 UTC (rev 3959)
+++ trunk/include/geos/geom/util/LinearComponentExtracter.h	2013-11-19 08:26:42 UTC (rev 3960)
@@ -50,32 +50,16 @@
 	 * efficient to create a single LinearComponentExtracterFilter instance
 	 * and pass it to multiple geometries.
 	 */
-	static void getLines(const Geometry &geom, std::vector<const LineString*> &ret)
-	{
-		LinearComponentExtracter lce(ret);
-		geom.apply_ro(&lce);
-	}
-
+	static void getLines(const Geometry &geom, std::vector<const LineString*> &ret);
 	/**
 	 * Constructs a LinearComponentExtracterFilter with a list in which
 	 * to store LineStrings found.
 	 */
-	LinearComponentExtracter(std::vector<const LineString*> &newComps)
-		:
-		comps(newComps)
-		{}
+	LinearComponentExtracter(std::vector<const LineString*> &newComps);
 
-	void filter_rw(Geometry *geom)
-	{
-if ( const LineString *ls=dynamic_cast<const LineString *>(geom) )
-		comps.push_back(ls);
-	}
+	void filter_rw(Geometry *geom);
 
-	void filter_ro(const Geometry *geom)
-	{
-if ( const LineString *ls=dynamic_cast<const LineString *>(geom) )
-		comps.push_back(ls);
-	}
+	void filter_ro(const Geometry *geom);
 
 };
 

Modified: trunk/include/geos/geom/util/PointExtracter.h
===================================================================
--- trunk/include/geos/geom/util/PointExtracter.h	2013-09-13 17:03:30 UTC (rev 3959)
+++ trunk/include/geos/geom/util/PointExtracter.h	2013-11-19 08:26:42 UTC (rev 3960)
@@ -38,32 +38,17 @@
 	 * efficient to create a single PointExtracter filter instance
 	 * and pass it to multiple geometries.
 	 */
-	static void getPoints(const Geometry &geom, Point::ConstVect &ret)
-	{
-		PointExtracter pe(ret);
-		geom.apply_ro(&pe);
-	}
+	static void getPoints(const Geometry &geom, Point::ConstVect &ret);
 
 	/**
 	 * Constructs a PointExtracterFilter with a list in which
 	 * to store Points found.
 	 */
-	PointExtracter(Point::ConstVect& newComps)
-		:
-		comps(newComps)
-		{}
+	PointExtracter(Point::ConstVect& newComps);
 
-	void filter_rw(Geometry *geom)
-	{
-if ( const Point *p=dynamic_cast<const Point *>(geom) )
-		comps.push_back(p);
-	}
+	void filter_rw(Geometry *geom);
 
-	void filter_ro(const Geometry *geom)
-	{
-if ( const Point *p=dynamic_cast<const Point *>(geom) )
-		comps.push_back(p);
-	}
+	void filter_ro(const Geometry *geom);
 
 private:
 

Modified: trunk/include/geos/geom/util/PolygonExtracter.h
===================================================================
--- trunk/include/geos/geom/util/PolygonExtracter.h	2013-09-13 17:03:30 UTC (rev 3959)
+++ trunk/include/geos/geom/util/PolygonExtracter.h	2013-11-19 08:26:42 UTC (rev 3960)
@@ -40,35 +40,17 @@
 	 * efficient to create a single PolygonExtracterFilter instance
 	 * and pass it to multiple geometries.
 	 */
-	static void getPolygons(const Geometry &geom, std::vector<const Polygon*>& ret)
-	{
-		PolygonExtracter pe(ret);
-		geom.apply_ro(&pe);
-	}
+	static void getPolygons(const Geometry &geom, std::vector<const Polygon*>& ret);
 
 	/**
 	 * Constructs a PolygonExtracterFilter with a list in which
 	 * to store Polygons found.
 	 */
-	PolygonExtracter(std::vector<const Polygon*>& newComps)
-		:
-		comps(newComps)
-		{}
+	PolygonExtracter(std::vector<const Polygon*>& newComps);
 
-	void filter_rw(Geometry *geom) {
-		if ( const Polygon *p=dynamic_cast<const Polygon *>(geom) )
-		{
-			comps.push_back(p);
-		}
-	}
+	void filter_rw(Geometry *geom);
 
-	void filter_ro(const Geometry *geom)
-	{
-		if ( const Polygon *p=dynamic_cast<const Polygon *>(geom) )
-		{
-			comps.push_back(p);
-		}
-	}
+	void filter_ro(const Geometry *geom);
 
 private:
 

Modified: trunk/src/geom/Geometry.cpp
===================================================================
--- trunk/src/geom/Geometry.cpp	2013-09-13 17:03:30 UTC (rev 3959)
+++ trunk/src/geom/Geometry.cpp	2013-11-19 08:26:42 UTC (rev 3960)
@@ -687,6 +687,11 @@
 #endif
 }
 
+void Geometry::GeometryChangedFilter::filter_rw(Geometry* geom)
+{
+   geom->geometryChangedAction();
+}
+
 int
 Geometry::compare(vector<Coordinate> a, vector<Coordinate> b) const
 {

Modified: trunk/src/geom/util/ComponentCoordinateExtracter.cpp
===================================================================
--- trunk/src/geom/util/ComponentCoordinateExtracter.cpp	2013-09-13 17:03:30 UTC (rev 3959)
+++ trunk/src/geom/util/ComponentCoordinateExtracter.cpp	2013-11-19 08:26:42 UTC (rev 3960)
@@ -20,6 +20,43 @@
 namespace geom { // geos.geom
 namespace util { // geos.geom.util
 
+         ComponentCoordinateExtracter::ComponentCoordinateExtracter( std::vector<const Coordinate*> &newComps)
+            :
+         comps(newComps)
+         {}
+
+         void ComponentCoordinateExtracter::filter_rw( Geometry * geom)
+         {
+            if (	geom->getGeometryTypeId() == geos::geom::GEOS_LINEARRING 
+               ||	geom->getGeometryTypeId() == geos::geom::GEOS_LINESTRING
+               ||	geom->getGeometryTypeId() == geos::geom::GEOS_POINT ) 
+               comps.push_back( geom->getCoordinate() );
+            //if (	typeid( *geom ) == typeid( LineString )
+            //	||	typeid( *geom ) == typeid( Point ) )
+            //if ( const Coordinate *ls=dynamic_cast<const Coordinate *>(geom) )
+            //	comps.push_back(ls);
+         }
+
+         void ComponentCoordinateExtracter::filter_ro( const Geometry * geom)
+         {
+            //if (	typeid( *geom ) == typeid( LineString )
+            //	||	typeid( *geom ) == typeid( Point ) )
+            if (	geom->getGeometryTypeId() == geos::geom::GEOS_LINEARRING 
+               ||	geom->getGeometryTypeId() == geos::geom::GEOS_LINESTRING
+               ||	geom->getGeometryTypeId() == geos::geom::GEOS_POINT ) 
+               comps.push_back( geom->getCoordinate() );
+            //if ( const Coordinate *ls=dynamic_cast<const Coordinate *>(geom) )
+            //	comps.push_back(ls);
+         }
+
+
+         void ComponentCoordinateExtracter::getCoordinates(const Geometry &geom, std::vector<const Coordinate*> &ret)
+         {
+            ComponentCoordinateExtracter cce(ret);
+            geom.apply_ro(&cce);
+         }
+
 } // namespace geos.geom.util
 } // namespace geos.geom
 } // namespace geos
+

Added: trunk/src/geom/util/LinearComponentExtracter.cpp
===================================================================
--- trunk/src/geom/util/LinearComponentExtracter.cpp	                        (rev 0)
+++ trunk/src/geom/util/LinearComponentExtracter.cpp	2013-11-19 08:26:42 UTC (rev 3960)
@@ -0,0 +1,51 @@
+/**********************************************************************
+ *
+ * GEOS - Geometry Engine Open Source
+ * http://geos.osgeo.org
+ *
+ * Copyright (C) 2001-2002 Vivid Solutions Inc.
+ * Copyright (C) 2006 Refractions Research Inc.
+ *
+ * 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.
+ *
+ **********************************************************************/
+
+#include <geos/export.h>
+#include <vector>
+
+#include <geos/geom/GeometryComponentFilter.h>
+#include <geos/geom/util/LinearComponentExtracter.h>
+
+namespace geos {
+   namespace geom { // geos.geom
+      namespace util { // geos.geom.util
+
+         LinearComponentExtracter::LinearComponentExtracter(std::vector<const LineString*> &newComps)
+            :
+         comps(newComps)
+         {}
+
+         void LinearComponentExtracter::getLines(const Geometry &geom, std::vector<const LineString*> &ret)
+         {
+            LinearComponentExtracter lce(ret);
+            geom.apply_ro(&lce);
+         }
+
+         void LinearComponentExtracter::filter_rw(Geometry *geom)
+         {
+            if ( const LineString *ls=dynamic_cast<const LineString *>(geom) )
+               comps.push_back(ls);
+         }
+
+         void LinearComponentExtracter::filter_ro(const Geometry *geom)
+         {
+            if ( const LineString *ls=dynamic_cast<const LineString *>(geom) )
+               comps.push_back(ls);
+         }
+
+      }
+   }
+}

Modified: trunk/src/geom/util/Makefile.am
===================================================================
--- trunk/src/geom/util/Makefile.am	2013-09-13 17:03:30 UTC (rev 3959)
+++ trunk/src/geom/util/Makefile.am	2013-11-19 08:26:42 UTC (rev 3960)
@@ -12,4 +12,7 @@
     GeometryTransformer.cpp \
     ShortCircuitedGeometryVisitor.cpp \
     SineStarFactory.cpp \
-    GeometryCombiner.cpp
+    GeometryCombiner.cpp \
+    LinearComponentExtracter.cpp \
+    PointExtracter.cpp \
+    PolygonExtracter.cpp

Added: trunk/src/geom/util/PointExtracter.cpp
===================================================================
--- trunk/src/geom/util/PointExtracter.cpp	                        (rev 0)
+++ trunk/src/geom/util/PointExtracter.cpp	2013-11-19 08:26:42 UTC (rev 3960)
@@ -0,0 +1,56 @@
+/**********************************************************************
+ *
+ * GEOS - Geometry Engine Open Source
+ * http://geos.osgeo.org
+ *
+ * Copyright (C) 2001-2002 Vivid Solutions Inc.
+ * Copyright (C) 2006 Refractions Research Inc.
+ *
+ * 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.
+ *
+ **********************************************************************/
+
+
+#include <geos/export.h>
+#include <vector>
+
+#include <geos/geom/GeometryComponentFilter.h>
+#include <geos/geom/util/PointExtracter.h>
+
+namespace geos {
+   namespace geom { // geos.geom
+      namespace util { // geos.geom.util
+
+
+          void PointExtracter::getPoints(const Geometry &geom, Point::ConstVect &ret)
+         {
+            PointExtracter pe(ret);
+            geom.apply_ro(&pe);
+         }
+
+         /**
+         * Constructs a PointExtracterFilter with a list in which
+         * to store Points found.
+         */
+         PointExtracter::PointExtracter(Point::ConstVect& newComps)
+            :
+         comps(newComps)
+         {}
+
+         void PointExtracter::filter_rw(Geometry *geom)
+         {
+            if ( const Point *p=dynamic_cast<const Point *>(geom) )
+               comps.push_back(p);
+         }
+
+         void PointExtracter::filter_ro(const Geometry *geom)
+         {
+            if ( const Point *p=dynamic_cast<const Point *>(geom) )
+               comps.push_back(p);
+         }
+      }
+   }
+}

Added: trunk/src/geom/util/PolygonExtracter.cpp
===================================================================
--- trunk/src/geom/util/PolygonExtracter.cpp	                        (rev 0)
+++ trunk/src/geom/util/PolygonExtracter.cpp	2013-11-19 08:26:42 UTC (rev 3960)
@@ -0,0 +1,54 @@
+/**********************************************************************
+ *
+ * GEOS - Geometry Engine Open Source
+ * http://geos.osgeo.org
+ *
+ * Copyright (C) 2001-2002 Vivid Solutions Inc.
+ * Copyright (C) 2006 Refractions Research Inc.
+ *
+ * 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.
+ *
+ **********************************************************************/
+
+
+#include <geos/export.h>
+#include <vector>
+
+#include <geos/geom/GeometryComponentFilter.h>
+#include <geos/geom/util/PolygonExtracter.h>
+
+namespace geos {
+namespace geom { // geos.geom
+namespace util { // geos.geom.util
+
+         void PolygonExtracter::getPolygons(const Geometry &geom, std::vector<const Polygon*>& ret)
+         {
+            PolygonExtracter pe(ret);
+            geom.apply_ro(&pe);
+         }
+
+         PolygonExtracter::PolygonExtracter(std::vector<const Polygon*>& newComps)
+         :
+         comps(newComps)
+         {}
+
+         void PolygonExtracter::filter_rw(Geometry *geom) {
+            if ( const Polygon *p=dynamic_cast<const Polygon *>(geom) )
+            {
+               comps.push_back(p);
+            }
+         }
+
+         void PolygonExtracter::filter_ro(const Geometry *geom)
+         {     
+            if ( const Polygon *p=dynamic_cast<const Polygon *>(geom) )
+            {
+               comps.push_back(p);
+            }
+         }
+}
+}
+}



More information about the geos-commits mailing list