[geos-commits] [SCM] GEOS branch master updated. c17501f0a9c5132e455eb5995be5ebcf536f7bb6

git at osgeo.org git at osgeo.org
Wed Sep 18 16:28:18 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  c17501f0a9c5132e455eb5995be5ebcf536f7bb6 (commit)
       via  6493e5760af104f17789e7c02f0436bf0a4e9204 (commit)
      from  a1710cdc950658e3dcc9cb4d52c352052587ef72 (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 c17501f0a9c5132e455eb5995be5ebcf536f7bb6
Author: Daniel Baston <dbaston at gmail.com>
Date:   Wed Sep 18 19:18:26 2019 -0400

    Return unique_ptr from MinimumBoundingCircle

diff --git a/include/geos/algorithm/MinimumBoundingCircle.h b/include/geos/algorithm/MinimumBoundingCircle.h
index 1e62c56..76b64fe 100644
--- a/include/geos/algorithm/MinimumBoundingCircle.h
+++ b/include/geos/algorithm/MinimumBoundingCircle.h
@@ -93,7 +93,7 @@ public:
     * @return a empty LineString if the input is empty
     * @return a Point if the input is a point
     */
-    geom::Geometry* getFarthestPoints();
+    std::unique_ptr<geom::Geometry> getFarthestPoints();
 
     /**
     * Gets a geometry representing the diameter of the computed Minimum Bounding
@@ -103,7 +103,7 @@ public:
     * @return a empty LineString if the input is empty
     * @return a Point if the input is a point
     */
-    geom::Geometry* getDiameter();
+    std::unique_ptr<geom::Geometry> getDiameter();
 
     /**
     * Gets the extremal points which define the computed Minimum Bounding Circle.
diff --git a/src/algorithm/MinimumBoundingCircle.cpp b/src/algorithm/MinimumBoundingCircle.cpp
index 2533278..2a6a508 100644
--- a/src/algorithm/MinimumBoundingCircle.cpp
+++ b/src/algorithm/MinimumBoundingCircle.cpp
@@ -60,15 +60,15 @@ MinimumBoundingCircle::getCircle()
 }
 
 /*public*/
-Geometry*
+std::unique_ptr<Geometry>
 MinimumBoundingCircle::getFarthestPoints()
 {
     compute();
     switch(extremalPts.size()) {
     case 0:
-        return input->getFactory()->createLineString().release();
+        return input->getFactory()->createLineString();
     case 1:
-        return input->getFactory()->createPoint(centre);
+        return std::unique_ptr<Geometry>(input->getFactory()->createPoint(centre));
     }
 
     size_t dims = input->getCoordinateDimension();
@@ -76,19 +76,19 @@ MinimumBoundingCircle::getFarthestPoints()
     auto cs = input->getFactory()->getCoordinateSequenceFactory()->create(len, dims);
     cs->setAt(extremalPts[0], 0);
     cs->setAt(extremalPts[extremalPts.size() - 1], 1);
-    return input->getFactory()->createLineString(cs.release());
+    return input->getFactory()->createLineString(std::move(cs));
 }
 
 /*public*/
-Geometry*
+std::unique_ptr<Geometry>
 MinimumBoundingCircle::getDiameter()
 {
     compute();
     switch(extremalPts.size()) {
     case 0:
-        return input->getFactory()->createLineString().release();
+        return input->getFactory()->createLineString();
     case 1:
-        return input->getFactory()->createPoint(centre);
+        return std::unique_ptr<Geometry>(input->getFactory()->createPoint(centre));
     }
     size_t dims = input->getCoordinateDimension();
     size_t len = 2;
@@ -97,7 +97,7 @@ MinimumBoundingCircle::getDiameter()
     // them through the centre point with len = 2*radius
     cs->setAt(extremalPts[0], 0);
     cs->setAt(extremalPts[1], 1);
-    return input->getFactory()->createLineString(cs.release());
+    return input->getFactory()->createLineString(std::move(cs));
 }
 
 /*public*/

commit 6493e5760af104f17789e7c02f0436bf0a4e9204
Author: Daniel Baston <dbaston at gmail.com>
Date:   Wed Sep 18 19:18:50 2019 -0400

    Minor simplification in ConvexHull

diff --git a/src/algorithm/ConvexHull.cpp b/src/algorithm/ConvexHull.cpp
index 2fd08b3..734459d 100644
--- a/src/algorithm/ConvexHull.cpp
+++ b/src/algorithm/ConvexHull.cpp
@@ -227,7 +227,7 @@ ConvexHull::getConvexHull()
     size_t nInputPts = inputPts.size();
 
     if(nInputPts == 0) { // Return an empty geometry
-        return std::unique_ptr<Geometry>(geomFactory->createEmptyGeometry());
+        return geomFactory->createEmptyGeometry();
     }
 
     if(nInputPts == 1) { // Return a Point
@@ -238,7 +238,7 @@ ConvexHull::getConvexHull()
     if(nInputPts == 2) { // Return a LineString
         // Copy all Coordinates from the ConstVect
         auto cs = toCoordinateSequence(inputPts);
-        return std::unique_ptr<Geometry>(geomFactory->createLineString(cs.release()));
+        return geomFactory->createLineString(std::move(cs));
     }
 
     // use heuristic to reduce points, if large

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

Summary of changes:
 include/geos/algorithm/MinimumBoundingCircle.h |  4 ++--
 src/algorithm/ConvexHull.cpp                   |  4 ++--
 src/algorithm/MinimumBoundingCircle.cpp        | 16 ++++++++--------
 3 files changed, 12 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list