[geos-commits] [SCM] GEOS branch master updated. 212ae25d09ae69894440f18c26ee8a3ca2d1052a

git at osgeo.org git at osgeo.org
Wed Apr 10 13:58:29 PDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, master has been updated
       via  212ae25d09ae69894440f18c26ee8a3ca2d1052a (commit)
      from  63f2794d7798da8db62ec41bf2bd07502b7d0894 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 212ae25d09ae69894440f18c26ee8a3ca2d1052a
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Apr 10 13:57:54 2019 -0700

    Reformat files after port
    JTS a4f3848da812691ab9881a9b3ec857e941bc9deb

diff --git a/README.md b/README.md
index 7043a38..8f6d012 100644
--- a/README.md
+++ b/README.md
@@ -135,8 +135,11 @@ To build Doxygen documentation:
 To format your code into the desired style, use astyle 3.1:
 
     astyle --style=stroustrup \
+           --unpad-paren \
+           --pad-header \
            --pad-comma \
            --indent=spaces=4 \
+           --align-pointer=type \
            --max-code-length=120 \
            --lineend=linux \
            yourfile.cpp
diff --git a/src/algorithm/InteriorPointArea.cpp b/src/algorithm/InteriorPointArea.cpp
index 24fef47..95f73bf 100644
--- a/src/algorithm/InteriorPointArea.cpp
+++ b/src/algorithm/InteriorPointArea.cpp
@@ -86,7 +86,7 @@ public:
     getScanLineY()
     {
         process(*poly.getExteriorRing());
-        for(size_t i = 0; i < poly.getNumInteriorRing(); i++) {
+        for (size_t i = 0; i < poly.getNumInteriorRing(); i++) {
             process(*poly.getInteriorRingN(i));
         }
         double bisectY = avg(hiY, loY);
@@ -104,7 +104,7 @@ private:
     process(const LineString& line)
     {
         const CoordinateSequence* seq = line.getCoordinatesRO();
-        for(std::size_t i = 0, s = seq->size(); i < s; i++) {
+        for (std::size_t i = 0, s = seq->size(); i < s; i++) {
             double y = seq->getY(i);
             updateInterval(y);
         }
@@ -113,13 +113,13 @@ private:
     void
     updateInterval(double y)
     {
-        if(y <= centreY) {
-            if(y > loY) {
+        if (y <= centreY) {
+            if (y > loY) {
                 loY = y;
             }
         }
-        else if(y > centreY) {
-            if(y < hiY) {
+        else if (y > centreY) {
+            if (y < hiY) {
                 hiY = y;
             }
         }
@@ -161,10 +161,10 @@ public:
         interiorPoint = *polygon.getCoordinate();
 
         const LinearRing* shell = dynamic_cast<const LinearRing*>(polygon.getExteriorRing());
-        scanRing( *shell, crossings );
+        scanRing(*shell, crossings);
         for (size_t i = 0; i < polygon.getNumInteriorRing(); i++) {
             const LinearRing* hole = dynamic_cast<const LinearRing*>(polygon.getInteriorRingN(i));
-            scanRing( *hole, crossings );
+            scanRing(*hole, crossings);
         }
         findBestMidpoint(crossings);
     }
@@ -178,7 +178,7 @@ private:
     void scanRing(const LinearRing& ring, vector<double>& crossings)
     {
         // skip rings which don't cross scan line
-        if ( ! intersectsHorizontalLine( ring.getEnvelopeInternal(), interiorPointY) )
+        if (! intersectsHorizontalLine(ring.getEnvelopeInternal(), interiorPointY))
             return;
 
         const CoordinateSequence* seq = ring.getCoordinatesRO();
@@ -189,17 +189,18 @@ private:
         }
     }
 
-    void addEdgeCrossing(Coordinate& p0, Coordinate& p1, double scanY, vector<double>& crossings) {
-      // skip non-crossing segments
-      if ( !intersectsHorizontalLine(p0, p1, scanY) )
-        return;
-      if (! isEdgeCrossingCounted(p0, p1, scanY) )
-        return;
+    void addEdgeCrossing(Coordinate& p0, Coordinate& p1, double scanY, vector<double>& crossings)
+    {
+        // skip non-crossing segments
+        if (!intersectsHorizontalLine(p0, p1, scanY))
+            return;
+        if (! isEdgeCrossingCounted(p0, p1, scanY))
+            return;
 
-      // edge intersects scan line, so add a crossing
-      double xInt = intersection(p0, p1, scanY);
-      crossings.push_back(xInt);
-      //checkIntersectionDD(p0, p1, scanY, xInt);
+        // edge intersects scan line, so add a crossing
+        double xInt = intersection(p0, p1, scanY);
+        crossings.push_back(xInt);
+        //checkIntersectionDD(p0, p1, scanY, xInt);
     }
 
     void findBestMidpoint(vector<double>& crossings)
@@ -220,7 +221,7 @@ private:
             double x2 = crossings[i + 1];
 
             double width = x2 - x1;
-            if ( width > interiorSectionWidth ) {
+            if (width > interiorSectionWidth) {
                 interiorSectionWidth = width;
                 double interiorPointX = avg(x1, x2);
                 interiorPoint = Coordinate(interiorPointX, interiorPointY);
@@ -229,18 +230,19 @@ private:
     }
 
     static bool
-    isEdgeCrossingCounted(Coordinate& p0, Coordinate& p1, double scanY) {
-      // skip horizontal lines
-      if ( p0.y == p1.y )
-        return false;
-      // handle cases where vertices lie on scan-line
-      // downward segment does not include start point
-      if ( p0.y == scanY && p1.y < scanY )
-        return false;
-      // upward segment does not include endpoint
-      if ( p1.y == scanY && p0.y < scanY )
-        return false;
-      return true;
+    isEdgeCrossingCounted(Coordinate& p0, Coordinate& p1, double scanY)
+    {
+        // skip horizontal lines
+        if (p0.y == p1.y)
+            return false;
+        // handle cases where vertices lie on scan-line
+        // downward segment does not include start point
+        if (p0.y == scanY && p1.y < scanY)
+            return false;
+        // upward segment does not include endpoint
+        if (p1.y == scanY && p0.y < scanY)
+            return false;
+        return true;
     }
 
     static double
@@ -249,8 +251,8 @@ private:
         double x0 = p0.x;
         double x1 = p1.x;
 
-        if ( x0 == x1 )
-        return x0;
+        if (x0 == x1)
+            return x0;
 
         // Assert: segDX is non-zero, due to previous equality test
         double segDX = x1 - x0;
@@ -263,23 +265,24 @@ private:
     static bool
     intersectsHorizontalLine(const Envelope* env, double y)
     {
-        if ( y < env->getMinY() )
+        if (y < env->getMinY())
             return false;
-        if ( y > env->getMaxY() )
+        if (y > env->getMaxY())
             return false;
         return true;
     }
 
     static bool
-    intersectsHorizontalLine(const Coordinate& p0, const Coordinate& p1, double y) {
-      // both ends above?
-      if ( p0.y > y && p1.y > y )
-        return false;
-      // both ends below?
-      if ( p0.y < y && p1.y < y )
-        return false;
-      // segment must intersect line
-      return true;
+    intersectsHorizontalLine(const Coordinate& p0, const Coordinate& p1, double y)
+    {
+        // both ends above?
+        if (p0.y > y && p1.y > y)
+            return false;
+        // both ends below?
+        if (p0.y < y && p1.y < y)
+            return false;
+        // segment must intersect line
+        return true;
     }
 };
 
@@ -314,14 +317,14 @@ InteriorPointArea::process(const Geometry* geom)
         return;
 
     const Polygon* poly = dynamic_cast<const Polygon*>(geom);
-    if(poly) {
+    if (poly) {
         processPolygon(poly);
         return;
     }
 
     const GeometryCollection* gc = dynamic_cast<const GeometryCollection*>(geom);
-    if(gc) {
-        for(std::size_t i = 0, n = gc->getNumGeometries(); i < n; i++) {
+    if (gc) {
+        for (std::size_t i = 0, n = gc->getNumGeometries(); i < n; i++) {
             process(gc->getGeometryN(i));
             GEOS_CHECK_FOR_INTERRUPTS();
         }
@@ -335,9 +338,9 @@ InteriorPointArea::processPolygon(const Polygon* polygon)
     InteriorPointPolygon intPtPoly(*polygon);
     intPtPoly.process();
     double width = intPtPoly.getWidth();
-    if ( width > maxWidth ) {
-      maxWidth = width;
-      intPtPoly.getInteriorPoint(interiorPoint);
+    if (width > maxWidth) {
+        maxWidth = width;
+        intPtPoly.getInteriorPoint(interiorPoint);
     }
 }
 
diff --git a/src/algorithm/InteriorPointLine.cpp b/src/algorithm/InteriorPointLine.cpp
index 4de12ad..a36818b 100644
--- a/src/algorithm/InteriorPointLine.cpp
+++ b/src/algorithm/InteriorPointLine.cpp
@@ -42,13 +42,13 @@ InteriorPointLine::InteriorPointLine(const Geometry* g)
 {
     minDistance = DoubleMax;
     hasInterior = false;
-    if(g->getCentroid(centroid)) {
+    if (g->getCentroid(centroid)) {
 #if GEOS_DEBUG
         std::cerr << "Centroid: " << centroid << std::endl;
 #endif
         addInterior(g);
     }
-    if(!hasInterior) {
+    if (!hasInterior) {
         addEndpoints(g);
     }
 }
@@ -68,14 +68,14 @@ void
 InteriorPointLine::addInterior(const Geometry* geom)
 {
     const LineString* ls = dynamic_cast<const LineString*>(geom);
-    if(ls) {
+    if (ls) {
         addInterior(ls->getCoordinatesRO());
         return;
     }
 
     const GeometryCollection* gc = dynamic_cast<const GeometryCollection*>(geom);
-    if(gc) {
-        for(std::size_t i = 0, n = gc->getNumGeometries(); i < n; i++) {
+    if (gc) {
+        for (std::size_t i = 0, n = gc->getNumGeometries(); i < n; i++) {
             addInterior(gc->getGeometryN(i));
         }
     }
@@ -85,7 +85,7 @@ void
 InteriorPointLine::addInterior(const CoordinateSequence* pts)
 {
     const std::size_t n = pts->getSize() - 1;
-    for(std::size_t i = 1; i < n; ++i) {
+    for (std::size_t i = 1; i < n; ++i) {
         add(pts->getAt(i));
     }
 }
@@ -101,14 +101,14 @@ void
 InteriorPointLine::addEndpoints(const Geometry* geom)
 {
     const LineString* ls = dynamic_cast<const LineString*>(geom);
-    if(ls) {
+    if (ls) {
         addEndpoints(ls->getCoordinatesRO());
         return;
     }
 
     const GeometryCollection* gc = dynamic_cast<const GeometryCollection*>(geom);
-    if(gc) {
-        for(std::size_t i = 0, n = gc->getNumGeometries(); i < n; i++) {
+    if (gc) {
+        for (std::size_t i = 0, n = gc->getNumGeometries(); i < n; i++) {
             addEndpoints(gc->getGeometryN(i));
         }
     }
@@ -118,9 +118,9 @@ void
 InteriorPointLine::addEndpoints(const CoordinateSequence* pts)
 {
     size_t npts = pts->size();
-    if(npts) {
+    if (npts) {
         add(pts->getAt(0));
-        if(npts > 1) {
+        if (npts > 1) {
             add(pts->getAt(npts - 1));
         }
     }
@@ -135,7 +135,7 @@ InteriorPointLine::add(const Coordinate& point)
 #if GEOS_DEBUG
     std::cerr << "point " << point << " dist " << dist << ", minDistance " << minDistance << std::endl;
 #endif
-    if(!hasInterior || dist < minDistance) {
+    if (!hasInterior || dist < minDistance) {
         interiorPoint = point;
 #if GEOS_DEBUG
         std::cerr << " is new InteriorPoint" << std::endl;
@@ -148,7 +148,7 @@ InteriorPointLine::add(const Coordinate& point)
 bool
 InteriorPointLine::getInteriorPoint(Coordinate& ret) const
 {
-    if(! hasInterior) {
+    if (! hasInterior) {
         return false;
     }
     ret = interiorPoint;
diff --git a/src/algorithm/InteriorPointPoint.cpp b/src/algorithm/InteriorPointPoint.cpp
index 7f953ae..5d23333 100644
--- a/src/algorithm/InteriorPointPoint.cpp
+++ b/src/algorithm/InteriorPointPoint.cpp
@@ -34,7 +34,7 @@ namespace algorithm { // geos.algorithm
 InteriorPointPoint::InteriorPointPoint(const Geometry* g)
 {
     minDistance = DoubleMax;
-    if(! g->getCentroid(centroid)) {
+    if (! g->getCentroid(centroid)) {
         hasInterior = false;
     }
     else {
@@ -48,14 +48,14 @@ void
 InteriorPointPoint::add(const Geometry* geom)
 {
     const Point* po = dynamic_cast<const Point*>(geom);
-    if(po) {
+    if (po) {
         add(po->getCoordinate());
         return;
     }
 
     const GeometryCollection* gc = dynamic_cast<const GeometryCollection*>(geom);
-    if(gc) {
-        for(std::size_t i = 0, n = gc->getNumGeometries(); i < n; i++) {
+    if (gc) {
+        for (std::size_t i = 0, n = gc->getNumGeometries(); i < n; i++) {
             add(gc->getGeometryN(i));
         }
     }
@@ -67,7 +67,7 @@ InteriorPointPoint::add(const Coordinate* point)
 {
     assert(point);    // we wouldn't been called if this was an empty geom
     double dist = point->distance(centroid);
-    if(dist < minDistance) {
+    if (dist < minDistance) {
         interiorPoint = *point;
         minDistance = dist;
     }
@@ -77,7 +77,7 @@ InteriorPointPoint::add(const Coordinate* point)
 bool
 InteriorPointPoint::getInteriorPoint(Coordinate& ret) const
 {
-    if(! hasInterior) {
+    if (! hasInterior) {
         return false;
     }
     ret = interiorPoint;

-----------------------------------------------------------------------

Summary of changes:
 README.md                            |   3 +
 src/algorithm/InteriorPointArea.cpp  | 105 ++++++++++++++++++-----------------
 src/algorithm/InteriorPointLine.cpp  |  26 ++++-----
 src/algorithm/InteriorPointPoint.cpp |  12 ++--
 4 files changed, 76 insertions(+), 70 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list