[geos-commits] r4167 - in trunk/src: algorithm geomgraph operation/buffer

svn_geos at osgeo.org svn_geos at osgeo.org
Sun Mar 6 05:51:05 PST 2016


Author: mloskot
Date: 2016-03-06 05:51:05 -0800 (Sun, 06 Mar 2016)
New Revision: 4167

Modified:
   trunk/src/algorithm/Centroid.cpp
   trunk/src/geomgraph/EdgeEndStar.cpp
   trunk/src/operation/buffer/BufferBuilder.cpp
Log:
Clean up a bunch of MSVC++ 14.0 warning C4456: declaration of 'x' hides previous local declaration

Modified: trunk/src/algorithm/Centroid.cpp
===================================================================
--- trunk/src/algorithm/Centroid.cpp	2016-03-06 13:40:26 UTC (rev 4166)
+++ trunk/src/algorithm/Centroid.cpp	2016-03-06 13:51:05 UTC (rev 4167)
@@ -7,7 +7,7 @@
  *
  * 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. 
+ * by the Free Software Foundation.
  * See the COPYING file for more information.
  *
  **********************************************************************
@@ -70,14 +70,14 @@
 {
   if (geom.isEmpty()) return;
 
-  if (const Point* g = dynamic_cast<const Point*>(&geom)) {
-    addPoint(*g->getCoordinate());
+  if (const Point* pt = dynamic_cast<const Point*>(&geom)) {
+    addPoint(*pt->getCoordinate());
   }
-  else if (const LineString* g = dynamic_cast<const LineString*>(&geom)) {
-    addLineSegments(*g->getCoordinatesRO());
+  else if (const LineString* ls = dynamic_cast<const LineString*>(&geom)) {
+    addLineSegments(*ls->getCoordinatesRO());
   }
-  else if (const Polygon* g = dynamic_cast<const Polygon*>(&geom)) {
-    add(*g);
+  else if (const Polygon* p = dynamic_cast<const Polygon*>(&geom)) {
+    add(*p);
   }
   else if (const GeometryCollection* g = dynamic_cast<const GeometryCollection*>(&geom)) {
     for (size_t i = 0; i < g->getNumGeometries(); i++) {

Modified: trunk/src/geomgraph/EdgeEndStar.cpp
===================================================================
--- trunk/src/geomgraph/EdgeEndStar.cpp	2016-03-06 13:40:26 UTC (rev 4166)
+++ trunk/src/geomgraph/EdgeEndStar.cpp	2016-03-06 13:51:05 UTC (rev 4167)
@@ -9,7 +9,7 @@
  *
  * 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. 
+ * by the Free Software Foundation.
  * See the COPYING file for more information.
  *
  **********************************************************************
@@ -108,7 +108,7 @@
 	 * In all other cases (e.g. the node is on a line, on a point, or
 	 * not on the geometry at all) the edge
 	 * has the location EXTERIOR for the geometry.
-	 * 
+	 *
 	 * Note that the edge cannot be on the BOUNDARY of the geometry,
 	 * since then there would have been a parallel edge from the
 	 * Geometry at this node also labelled BOUNDARY
@@ -218,10 +218,8 @@
 	if (edgeMap.size()==0) return true;
 
 	// initialize startLoc to location of last L side (if any)
-	EdgeEndStar::reverse_iterator it=rbegin();
-
-	assert(*it);
-	const Label& startLabel = (*it)->getLabel();
+	assert(*rbegin());
+	const Label& startLabel = (*rbegin())->getLabel();
 	int startLoc = startLabel.getLocation(geomIndex, Position::LEFT);
 
 	// Found unlabelled area edge

Modified: trunk/src/operation/buffer/BufferBuilder.cpp
===================================================================
--- trunk/src/operation/buffer/BufferBuilder.cpp	2016-03-06 13:40:26 UTC (rev 4166)
+++ trunk/src/operation/buffer/BufferBuilder.cpp	2016-03-06 13:51:05 UTC (rev 4167)
@@ -10,7 +10,7 @@
  *
  * 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. 
+ * by the Free Software Foundation.
  * See the COPYING file for more information.
  *
  **********************************************************************
@@ -32,9 +32,9 @@
 #include <geos/operation/buffer/BufferSubgraph.h>
 #include <geos/operation/buffer/SubgraphDepthLocater.h>
 #include <geos/operation/overlay/OverlayOp.h>
-#include <geos/operation/overlay/snap/SnapOverlayOp.h> 
-#include <geos/operation/overlay/PolygonBuilder.h> 
-#include <geos/operation/overlay/OverlayNodeFactory.h> 
+#include <geos/operation/overlay/snap/SnapOverlayOp.h>
+#include <geos/operation/overlay/PolygonBuilder.h>
+#include <geos/operation/overlay/OverlayNodeFactory.h>
 #include <geos/operation/linemerge/LineMerger.h>
 #include <geos/algorithm/LineIntersector.h>
 #include <geos/noding/IntersectionAdder.h>
@@ -65,7 +65,7 @@
 #define GEOS_DEBUG 0
 #endif
 
-#ifndef JTS_DEBUG 
+#ifndef JTS_DEBUG
 #define JTS_DEBUG 0
 #endif
 
@@ -149,7 +149,7 @@
 
    // First, generate the two-sided buffer using a butt-cap.
    BufferParameters modParams = bufParams;
-   modParams.setEndCapStyle(BufferParameters::CAP_FLAT); 
+   modParams.setEndCapStyle(BufferParameters::CAP_FLAT);
    modParams.setSingleSided(false); // ignore parameter for areal-only geometries
    std::auto_ptr<Geometry> buf;
 
@@ -174,10 +174,12 @@
    OffsetCurveBuilder curveBuilder( precisionModel, modParams );
    std::vector< CoordinateSequence* > lineList;
 
-   std::auto_ptr< CoordinateSequence > coords ( g->getCoordinates() );
-   curveBuilder.getSingleSidedLineCurve( coords.get(), distance,
-                                         lineList, leftSide, !leftSide );
-   coords.reset();
+   {
+       std::auto_ptr< CoordinateSequence > coords(g->getCoordinates());
+       curveBuilder.getSingleSidedLineCurve(coords.get(), distance,
+           lineList, leftSide, !leftSide);
+       coords.reset();
+   }
 
    // Create a SegmentString from these coordinates.
    SegmentString::NonConstVect curveList;
@@ -261,9 +263,9 @@
          // included.
          //
          // Let's try and estimate a more accurate bound instead of just assuming
-         // 98%. With 98%, the episilon grows as the buffer distance grows, 
+         // 98%. With 98%, the episilon grows as the buffer distance grows,
          // so that at large distance, artifacts may skip through this filter
-         // Let the length of the line play a factor in the distance, which is still 
+         // Let the length of the line play a factor in the distance, which is still
          // going to be bounded by 98%. Take 10% of the length of the line  from the buffer distance
          // to try and minimize any artifacts.
          const double ptDistAllowance = std::max(distance - l->getLength()*0.1, distance * 0.98);
@@ -275,7 +277,7 @@
          // Clean up the front of the list.
          // Loop until the line's end is not inside the buffer width from
          // the startPoint.
-         while ( coords->size() > 1 && 
+         while ( coords->size() > 1 &&
                  coords->front().distance( startPoint ) < ptDistAllowance )
          {
             // Record the end segment length.
@@ -290,7 +292,7 @@
             // reference point, then delete the point.
             coords->deleteAt( 0 );
          }
-         while ( coords->size() > 1 && 
+         while ( coords->size() > 1 &&
                  coords->front().distance( endPoint ) < ptDistAllowance )
          {
             double segLength = coords->front().distance( ( *coords )[1] );
@@ -343,7 +345,7 @@
    intersectedLines.reset();
 
    if ( mergedLinesGeom->size() > 1 )
-   {      
+   {
       return geomFact->createMultiLineString( mergedLinesGeom );
    }
    else if ( mergedLinesGeom->size() == 1 )
@@ -375,7 +377,7 @@
 	// factory must be the same as the one used by the input
 	geomFact=g->getFactory();
 
-  { // This scope is here to force release of resources owned by 
+  { // This scope is here to force release of resources owned by
     // OffsetCurveSetBuilder when we're doing with it
 
 	OffsetCurveBuilder curveBuilder(precisionModel, bufParams);
@@ -464,7 +466,7 @@
 		subgraphList.clear();
 
 		throw;
-	} 
+	}
 
 	return resultGeom;
 }
@@ -551,11 +553,11 @@
 
 		CoordinateSequence* cs = CoordinateSequence::removeRepeatedPoints(segStr->getCoordinates());
 		delete segStr;
-		if ( cs->size() < 2 ) 
+		if ( cs->size() < 2 )
 		{
 			// don't insert collapsed edges
 			// we need to take care of the memory here as cs is a new sequence
-			delete cs; 
+			delete cs;
 			continue;
 		}
 
@@ -599,7 +601,7 @@
 		int newDelta = existingDelta + mergeDelta;
 		existingEdge->setDepthDelta(newDelta);
 
-		// we have memory release responsibility 
+		// we have memory release responsibility
 		delete e;
 
 	} else {   // no matching existing edge was found



More information about the geos-commits mailing list