[geos-commits] [SCM] GEOS branch master updated. 4c0a3939972280f449833f4450e6ebc1a34a5950

git at osgeo.org git at osgeo.org
Mon Dec 21 15:31:35 PST 2020


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  4c0a3939972280f449833f4450e6ebc1a34a5950 (commit)
       via  c1258b2e21c10eb308136ccfc2f229a4b0438929 (commit)
       via  27cd0bfe8016c0b0eefc9e802afeda441fd1a5e5 (commit)
       via  cc17008115009238f57fc40809f3932000dab99d (commit)
       via  54c0f66ef0f700586743ddb601eca83ff737c48a (commit)
      from  f553315974d88d9407f6710ce6f3b66eb855139e (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 4c0a3939972280f449833f4450e6ebc1a34a5950
Merge: c1258b2 cc17008
Author: Daniel Baston <dbaston at gmail.com>
Date:   Mon Dec 21 18:31:19 2020 -0500

    Merge branch 'edgenoding-builder-nocopy'


commit c1258b2e21c10eb308136ccfc2f229a4b0438929
Merge: f553315 27cd0bf
Author: Daniel Baston <dbaston at gmail.com>
Date:   Mon Dec 21 18:30:59 2020 -0500

    Merge branch 'redundant-move'


commit 27cd0bfe8016c0b0eefc9e802afeda441fd1a5e5
Author: Daniel Baston <dbaston at gmail.com>
Date:   Sun Dec 20 11:59:17 2020 -0500

    Address "redundant move" compiler warnings

diff --git a/include/geos/geom/FixedSizeCoordinateSequence.h b/include/geos/geom/FixedSizeCoordinateSequence.h
index 61ebe3e..e99579f 100644
--- a/include/geos/geom/FixedSizeCoordinateSequence.h
+++ b/include/geos/geom/FixedSizeCoordinateSequence.h
@@ -37,7 +37,7 @@ namespace geom {
         std::unique_ptr<CoordinateSequence> clone() const final override {
             auto seq = detail::make_unique<FixedSizeCoordinateSequence<N>>(dimension);
             seq->m_data = m_data;
-            return std::move(seq); // move needed for gcc 4.8
+            return RETURN_UNIQUE_PTR(seq);
         }
 
         const Coordinate& getAt(std::size_t i) const final override {
diff --git a/include/geos/util.h b/include/geos/util.h
index e5ed10b..fd4f1ee 100644
--- a/include/geos/util.h
+++ b/include/geos/util.h
@@ -104,6 +104,17 @@ template<typename To, typename From> inline To down_cast(From* f)
     return static_cast<To>(f);
 }
 
+// Avoid "redundant move" warning when calling std::move() to return
+// unique_ptr<Derived> from a function with return type unique_ptr<Base>
+// The std::move is required for the gcc 4.9 series, which has not addressed
+// CWG defect 1579 ("return by converting move constructor")
+// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1579
+#if __GNUC__ > 0 && __GNUC__ < 5
+#define RETURN_UNIQUE_PTR(x) (std::move(x))
+#else
+#define RETURN_UNIQUE_PTR(x) (x)
+#endif
+
 } // namespace detail
 } // namespace geos
 
diff --git a/src/io/WKTReader.cpp b/src/io/WKTReader.cpp
index 95b8304..bae2b49 100644
--- a/src/io/WKTReader.cpp
+++ b/src/io/WKTReader.cpp
@@ -88,7 +88,7 @@ WKTReader::getCoordinates(StringTokenizer* tokenizer)
         nextToken = getNextCloserOrComma(tokenizer);
     }
 
-    return std::move(coordinates);
+    return RETURN_UNIQUE_PTR(coordinates);
 }
 
 

commit cc17008115009238f57fc40809f3932000dab99d
Author: Daniel Baston <dbaston at gmail.com>
Date:   Sat Dec 19 18:30:30 2020 -0500

    Avoid CoordinateSequence clone in OverlayEdgeRing

diff --git a/include/geos/operation/overlayng/OverlayEdgeRing.h b/include/geos/operation/overlayng/OverlayEdgeRing.h
index 017a6cc..0c2058c 100644
--- a/include/geos/operation/overlayng/OverlayEdgeRing.h
+++ b/include/geos/operation/overlayng/OverlayEdgeRing.h
@@ -56,7 +56,6 @@ private:
     OverlayEdge* startEdge;
     std::unique_ptr<LinearRing> ring;
     bool m_isHole;
-    CoordinateArraySequence ringPts;
     std::unique_ptr<IndexedPointInAreaLocator> locator;
     OverlayEdgeRing* shell;
     // a list of EdgeRings which are holes in this EdgeRing
@@ -64,7 +63,7 @@ private:
 
     // Methods
     void computeRingPts(OverlayEdge* start, CoordinateArraySequence& pts);
-    void computeRing(const CoordinateArraySequence& ringPts, const GeometryFactory* geometryFactory);
+    void computeRing(std::unique_ptr<CoordinateArraySequence> && ringPts, const GeometryFactory* geometryFactory);
 
     /**
     * Computes the list of coordinates which are contained in this ring.
@@ -73,7 +72,7 @@ private:
     */
     const CoordinateArraySequence& getCoordinates();
     PointOnGeometryLocator* getLocator();
-    void closeRing(CoordinateArraySequence& pts);
+    static void closeRing(CoordinateArraySequence& pts);
 
 
 public:
diff --git a/src/operation/overlayng/OverlayEdgeRing.cpp b/src/operation/overlayng/OverlayEdgeRing.cpp
index d183a54..4fead2c 100644
--- a/src/operation/overlayng/OverlayEdgeRing.cpp
+++ b/src/operation/overlayng/OverlayEdgeRing.cpp
@@ -41,8 +41,9 @@ OverlayEdgeRing::OverlayEdgeRing(OverlayEdge* start, const GeometryFactory* geom
     , locator(nullptr)
     , shell(nullptr)
 {
-    computeRingPts(start, ringPts);
-    computeRing(ringPts, geometryFactory);
+    auto ringPts = detail::make_unique<CoordinateArraySequence>();
+    computeRingPts(start, *ringPts);
+    computeRing(std::move(ringPts), geometryFactory);
 }
 
 /*public*/
@@ -143,15 +144,14 @@ OverlayEdgeRing::computeRingPts(OverlayEdge* start, CoordinateArraySequence& pts
     }
     while (edge != start);
     closeRing(pts);
-    return;
 }
 
 /*private*/
 void
-OverlayEdgeRing::computeRing(const CoordinateArraySequence& p_ringPts, const GeometryFactory* geometryFactory)
+OverlayEdgeRing::computeRing(std::unique_ptr<CoordinateArraySequence> && p_ringPts, const GeometryFactory* geometryFactory)
 {
     if (ring != nullptr) return;   // don't compute more than once
-    ring.reset(geometryFactory->createLinearRing(p_ringPts));
+    ring = geometryFactory->createLinearRing(std::move(p_ringPts));
     m_isHole = algorithm::Orientation::isCCW(ring->getCoordinatesRO());
 }
 
@@ -165,7 +165,7 @@ OverlayEdgeRing::computeRing(const CoordinateArraySequence& p_ringPts, const Geo
 const CoordinateArraySequence&
 OverlayEdgeRing::getCoordinates()
 {
-    return ringPts;
+    return *(detail::down_cast<const CoordinateArraySequence*>(ring->getCoordinatesRO()));
 }
 
 /**
@@ -242,7 +242,7 @@ OverlayEdgeRing::isInRing(const Coordinate& pt)
 const Coordinate&
 OverlayEdgeRing::getCoordinate()
 {
-    return ringPts.getAt(0);
+    return ring->getCoordinatesRO()->getAt(0);
 }
 
 /**

commit 54c0f66ef0f700586743ddb601eca83ff737c48a
Author: Daniel Baston <dbaston at gmail.com>
Date:   Sat Dec 19 18:29:48 2020 -0500

    Avoid CoordinateSequence clone in EdgeNodingBuilder

diff --git a/src/noding/NodedSegmentString.cpp b/src/noding/NodedSegmentString.cpp
index 93c0756..c440198 100644
--- a/src/noding/NodedSegmentString.cpp
+++ b/src/noding/NodedSegmentString.cpp
@@ -88,6 +88,12 @@ NodedSegmentString::getCoordinates() const
     return pts.get();
 }
 
+geom::CoordinateSequence*
+NodedSegmentString::releaseCoordinates()
+{
+    return pts.release();
+}
+
 /* virtual public */
 bool
 NodedSegmentString::isClosed() const
diff --git a/src/operation/overlayng/EdgeNodingBuilder.cpp b/src/operation/overlayng/EdgeNodingBuilder.cpp
index adf1a75..851ecf7 100644
--- a/src/operation/overlayng/EdgeNodingBuilder.cpp
+++ b/src/operation/overlayng/EdgeNodingBuilder.cpp
@@ -18,6 +18,7 @@
 
 #include <geos/operation/overlayng/EdgeNodingBuilder.h>
 #include <geos/operation/overlayng/EdgeMerger.h>
+#include <geos/util.h>
 
 using geos::operation::valid::RepeatedPointRemover;
 
@@ -128,8 +129,8 @@ EdgeNodingBuilder::createEdges(std::vector<SegmentString*>* segStrings)
         // Record that a non-collapsed edge exists for the parent geometry
         hasEdges[info->getIndex()] = true;
         // Allocate the new Edge locally in a std::deque
-        std::unique_ptr<CoordinateSequence> ssPts = ss->getCoordinates()->clone();
-        edgeQue.emplace_back(ssPts.release(), info);
+        NodedSegmentString* nss = detail::down_cast<NodedSegmentString*>(ss);
+        edgeQue.emplace_back(nss->releaseCoordinates(), info);
         Edge* newEdge = &(edgeQue.back());
         createdEdges.push_back(newEdge);
     }

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

Summary of changes:
 include/geos/geom/FixedSizeCoordinateSequence.h    |  2 +-
 include/geos/operation/overlayng/OverlayEdgeRing.h |  5 ++---
 include/geos/util.h                                | 11 +++++++++++
 src/io/WKTReader.cpp                               |  2 +-
 src/noding/NodedSegmentString.cpp                  |  6 ++++++
 src/operation/overlayng/EdgeNodingBuilder.cpp      |  5 +++--
 src/operation/overlayng/OverlayEdgeRing.cpp        | 14 +++++++-------
 7 files changed, 31 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list