[geos-commits] r2763 - in trunk/source/operation: buffer linemerge overlay predicate valid

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Dec 3 14:02:18 EST 2009


Author: mloskot
Date: 2009-12-03 14:02:17 -0500 (Thu, 03 Dec 2009)
New Revision: 2763

Modified:
   trunk/source/operation/buffer/BufferInputLineSimplifier.h
   trunk/source/operation/buffer/OffsetCurveBuilder.cpp
   trunk/source/operation/linemerge/LineSequencer.cpp
   trunk/source/operation/overlay/OverlayOp.cpp
   trunk/source/operation/overlay/PolygonBuilder.cpp
   trunk/source/operation/predicate/RectangleIntersects.cpp
   trunk/source/operation/valid/IsValidOp.cpp
Log:
Part 3 of larger changeset - source/operation:
* Declare noncopyable types as such explicitly (Ticket #304).
* Tidy up.

Modified: trunk/source/operation/buffer/BufferInputLineSimplifier.h
===================================================================
--- trunk/source/operation/buffer/BufferInputLineSimplifier.h	2009-12-03 19:01:10 UTC (rev 2762)
+++ trunk/source/operation/buffer/BufferInputLineSimplifier.h	2009-12-03 19:02:17 UTC (rev 2763)
@@ -20,7 +20,7 @@
 #ifndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
 #define GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
 
-
+#include <geos/geom/CoordinateSequence.h> // complete type required
 #include <geos/algorithm/CGAlgorithms.h> // for enum
 
 #include <memory>
@@ -169,6 +169,10 @@
 	std::vector<int> isDeleted;
 
 	int angleOrientation;
+
+    // Declare type as noncopyable
+    BufferInputLineSimplifier(const BufferInputLineSimplifier& other);
+    BufferInputLineSimplifier& operator=(const BufferInputLineSimplifier& rhs);
 };
 
 

Modified: trunk/source/operation/buffer/OffsetCurveBuilder.cpp
===================================================================
--- trunk/source/operation/buffer/OffsetCurveBuilder.cpp	2009-12-03 19:01:10 UTC (rev 2762)
+++ trunk/source/operation/buffer/OffsetCurveBuilder.cpp	2009-12-03 19:02:17 UTC (rev 2763)
@@ -35,6 +35,7 @@
 #include <geos/geom/PrecisionModel.h>
 #include <geos/algorithm/NotRepresentableException.h>
 #include <geos/algorithm/HCoordinate.h>
+#include <geos/util.h>
 
 #include "OffsetCurveVertexList.h"
 #include "BufferInputLineSimplifier.h"
@@ -626,6 +627,9 @@
 void
 OffsetCurveBuilder::addInsideTurn(int orientation, bool addStartPoint)
 {
+    ::geos::ignore_unused_variable_warning(orientation);
+    ::geos::ignore_unused_variable_warning(addStartPoint);
+
 	// add intersection point of offset segments (if any)
 	li.computeIntersection(offset0.p0, offset0.p1, offset1.p0, offset1.p1);
 	if (li.hasIntersection())
@@ -718,34 +722,36 @@
 	 * by the check for whether the offset segment endpoints are
 	 * almost coincident
          */
-	try
-	{
-		HCoordinate::intersection(offset0.p0, offset0.p1,
-		                          offset1.p0, offset1.p1,
-		                          intPt);
+    try
+    {
+        HCoordinate::intersection(offset0.p0, offset0.p1,
+            offset1.p0, offset1.p1,
+            intPt);
 
-		double mitreRatio = distance <= 0.0 ? 1.0
-			: intPt.distance(p) / fabs(distance);
+        double mitreRatio = distance <= 0.0 ? 1.0
+            : intPt.distance(p) / fabs(distance);
 
-		if (mitreRatio > bufParams.getMitreLimit())
-			isMitreWithinLimit = false;
-	}
-	catch (const NotRepresentableException& e)
-	{
-                intPt = Coordinate(0,0);
-                isMitreWithinLimit = false;
-        }
+        if (mitreRatio > bufParams.getMitreLimit())
+            isMitreWithinLimit = false;
+    }
+    catch (const NotRepresentableException& e)
+    {
+        ::geos::ignore_unused_variable_warning(e);
 
-	if (isMitreWithinLimit)
-	{
-                vertexList->addPt(intPt);
-        }
-        else
-	{
-		addLimitedMitreJoin(offset0, offset1, distance,
-		                    bufParams.getMitreLimit());
-		//addBevelJoin(offset0, offset1);
-	}
+        intPt = Coordinate(0,0);
+        isMitreWithinLimit = false;
+    }
+
+    if (isMitreWithinLimit)
+    {
+        vertexList->addPt(intPt);
+    }
+    else
+    {
+        addLimitedMitreJoin(offset0, offset1, distance,
+            bufParams.getMitreLimit());
+        //addBevelJoin(offset0, offset1);
+    }
 }
 
 /* private */
@@ -755,6 +761,9 @@
 	                  const geom::LineSegment& offset1,
 	                  double distance, double mitreLimit)
 {
+    ::geos::ignore_unused_variable_warning(offset0);
+    ::geos::ignore_unused_variable_warning(offset1);
+
 	const Coordinate& basePt = seg0.p1;
 
 	double ang0 = Angle::angle(basePt, seg0.p0);

Modified: trunk/source/operation/linemerge/LineSequencer.cpp
===================================================================
--- trunk/source/operation/linemerge/LineSequencer.cpp	2009-12-03 19:01:10 UTC (rev 2762)
+++ trunk/source/operation/linemerge/LineSequencer.cpp	2009-12-03 19:02:17 UTC (rev 2763)
@@ -40,6 +40,10 @@
 using namespace geos::geom;
 //using namespace geos::planargraph::algorithm;
 
+#ifdef _MSC_VER
+#pragma warning(disable : 4127)
+#endif
+
 namespace geos {
 namespace operation { // geos.operation
 namespace linemerge { // geos.operation.linemerge
@@ -50,7 +54,7 @@
 {
 	const MultiLineString *mls;
 
-	if ( ! (mls=dynamic_cast<const MultiLineString *>(geom)) )
+	if ( 0 == (mls=dynamic_cast<const MultiLineString *>(geom)) )
 	{
 		return true;
 	}

Modified: trunk/source/operation/overlay/OverlayOp.cpp
===================================================================
--- trunk/source/operation/overlay/OverlayOp.cpp	2009-12-03 19:01:10 UTC (rev 2762)
+++ trunk/source/operation/overlay/OverlayOp.cpp	2009-12-03 19:02:17 UTC (rev 2763)
@@ -911,6 +911,11 @@
 			"A point on first geom boundary isn't covered "
 			"by either result or second geom");
 	}
+
+private:
+    // Declare type as noncopyable
+    PointCoveredByAny(const PointCoveredByAny& other);
+    PointCoveredByAny& operator=(const PointCoveredByAny& rhs);
 };
 
 void

Modified: trunk/source/operation/overlay/PolygonBuilder.cpp
===================================================================
--- trunk/source/operation/overlay/PolygonBuilder.cpp	2009-12-03 19:01:10 UTC (rev 2762)
+++ trunk/source/operation/overlay/PolygonBuilder.cpp	2009-12-03 19:02:17 UTC (rev 2763)
@@ -31,6 +31,7 @@
 #include <geos/algorithm/CGAlgorithms.h>
 #include <geos/util/TopologyException.h>
 #include <geos/util/GEOSException.h>
+#include <geos/util.h>
 
 #include <vector>
 #include <cassert>
@@ -176,6 +177,7 @@
 			delete (*maxEdgeRings)[i];
 		delete maxEdgeRings;
 		//cerr << "Exception! " << e.what() << endl;
+        ::geos::ignore_unused_variable_warning(e);
 		throw;
 	}
 				maxEdgeRings->push_back(er);

Modified: trunk/source/operation/predicate/RectangleIntersects.cpp
===================================================================
--- trunk/source/operation/predicate/RectangleIntersects.cpp	2009-12-03 19:01:10 UTC (rev 2762)
+++ trunk/source/operation/predicate/RectangleIntersects.cpp	2009-12-03 19:02:17 UTC (rev 2763)
@@ -51,6 +51,10 @@
 	const geom::Envelope &rectEnv;
 	bool intersectsVar;
 
+    // Declare type as noncopyable
+    EnvelopeIntersectsVisitor(const EnvelopeIntersectsVisitor& other);
+    EnvelopeIntersectsVisitor& operator=(const EnvelopeIntersectsVisitor& rhs);
+
 protected:
 
 	/**
@@ -130,6 +134,10 @@
 	bool containsPointVar;
 	const geom::CoordinateSequence &rectSeq;
 
+    // Declare type as noncopyable
+    ContainsPointVisitor(const ContainsPointVisitor& other);
+    ContainsPointVisitor& operator=(const ContainsPointVisitor& rhs);
+
 protected:
 
 	void visit(const geom::Geometry &geom)
@@ -138,7 +146,7 @@
 
 		const geom::Polygon *poly;
 
-		if ( !(poly=dynamic_cast<const geom::Polygon *>(&geom)) ) {
+		if ( 0 == (poly=dynamic_cast<const geom::Polygon *>(&geom)) ) {
 			return;
 		}
 
@@ -212,6 +220,10 @@
 		}
 	}
 
+    // Declare type as noncopyable
+    LineIntersectsVisitor(const LineIntersectsVisitor& other);
+    LineIntersectsVisitor& operator=(const LineIntersectsVisitor& rhs);
+
 protected:
 
 	void visit(const geom::Geometry &geom)

Modified: trunk/source/operation/valid/IsValidOp.cpp
===================================================================
--- trunk/source/operation/valid/IsValidOp.cpp	2009-12-03 19:01:10 UTC (rev 2762)
+++ trunk/source/operation/valid/IsValidOp.cpp	2009-12-03 19:02:17 UTC (rev 2763)
@@ -127,7 +127,7 @@
 	else if (typeid(*g)==typeid(LineString)) checkValid((LineString*)g);
 	else if (typeid(*g)==typeid(Polygon)) checkValid((Polygon*)g);
 	else if (typeid(*g)==typeid(MultiPolygon)) checkValid((MultiPolygon*)g);
-	else if ((gc=dynamic_cast<const GeometryCollection *>(g)))
+	else if (0 != (gc=dynamic_cast<const GeometryCollection *>(g)))
 		checkValid(gc);
 	else throw util::UnsupportedOperationException();
         isChecked=true;



More information about the geos-commits mailing list