[geos-commits] [SCM] GEOS branch master updated. 1b6521ef1c8ecd8098e8d27233030b689a33992f

git at osgeo.org git at osgeo.org
Mon Nov 2 15:38:12 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  1b6521ef1c8ecd8098e8d27233030b689a33992f (commit)
       via  94b4dc53f62634a8c2e9545c2311254c4f83aaae (commit)
       via  73a73ebc4054064ef22b1c18dd0f74b6d7cdd160 (commit)
      from  ba34ee20395a4d30027776de4a734a88bf8767b8 (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 1b6521ef1c8ecd8098e8d27233030b689a33992f
Merge: 94b4dc5 ba34ee2
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Nov 2 15:36:41 2020 -0800

    Merge branch 'master' of https://git.osgeo.org/gitea/geos/geos


commit 94b4dc53f62634a8c2e9545c2311254c4f83aaae
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Nov 2 15:36:34 2020 -0800

    Comment out accidental test case

diff --git a/tests/unit/operation/valid/MakeValidTest.cpp b/tests/unit/operation/valid/MakeValidTest.cpp
index bad9f26..53bc8ec 100644
--- a/tests/unit/operation/valid/MakeValidTest.cpp
+++ b/tests/unit/operation/valid/MakeValidTest.cpp
@@ -69,39 +69,39 @@ void object::test<1>
     ensure(validGeom->isValid());
 }
 
-template<>
-template<>
-void object::test<2>
-()
-{
+// template<>
+// template<>
+// void object::test<2>
+// ()
+// {
 
 
-    std::ifstream ifs("GoesBathymetryBug.txt");
-    std::string content((std::istreambuf_iterator<char>(ifs)),
-                       (std::istreambuf_iterator<char>()));
+//     std::ifstream ifs("GoesBathymetryBug.txt");
+//     std::string content((std::istreambuf_iterator<char>(ifs)),
+//                        (std::istreambuf_iterator<char>()));
 
-    geos::io::WKTReader reader;
-    auto geom(reader.read(content));
+//     geos::io::WKTReader reader;
+//     auto geom(reader.read(content));
 
-    // auto gf = GeometryFactory::getDefaultInstance();
+//     // auto gf = GeometryFactory::getDefaultInstance();
 
-    // auto cs = gf->getCoordinateSequenceFactory()->create(std::move(v));
-    // auto lr = gf->createLinearRing(std::move(cs));
-    // auto errplyg = gf->createPolygon(std::move(lr));
+//     // auto cs = gf->getCoordinateSequenceFactory()->create(std::move(v));
+//     // auto lr = gf->createLinearRing(std::move(cs));
+//     // auto errplyg = gf->createPolygon(std::move(lr));
 
-    // ensure(!errplyg->isValid());
+//     // ensure(!errplyg->isValid());
 
-    MakeValid mkvalid;
-    auto validGeom = mkvalid.build(geom.get());
-    ensure("MakeValid output is not valid", validGeom->isValid());
+//     MakeValid mkvalid;
+//     auto validGeom = mkvalid.build(geom.get());
+//     ensure("MakeValid output is not valid", validGeom->isValid());
 
-    geos::io::WKTWriter writer;
-    writer.setOutputDimension(2);
-    writer.setTrim(true);
-    std::string result = writer.write(validGeom.get());
-    std::cout << result << std::endl;
+//     geos::io::WKTWriter writer;
+//     writer.setOutputDimension(2);
+//     writer.setTrim(true);
+//     std::string result = writer.write(validGeom.get());
+//     std::cout << result << std::endl;
 
-}
+// }
 
 
 

commit 73a73ebc4054064ef22b1c18dd0f74b6d7cdd160
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Nov 2 14:55:36 2020 -0800

    Use shuffle instead of random_shuffle to avoid C++ deprecations, use a type-strong enumeration

diff --git a/include/geos/algorithm/LineIntersector.h b/include/geos/algorithm/LineIntersector.h
index 771a524..8b1232e 100644
--- a/include/geos/algorithm/LineIntersector.h
+++ b/include/geos/algorithm/LineIntersector.h
@@ -128,14 +128,7 @@ public:
     /// Same as above but doesn't compute intersection point. Faster.
     static bool hasIntersection(const geom::Coordinate& p, const geom::Coordinate& p1, const geom::Coordinate& p2);
 
-    // These are deprecated, due to ambiguous naming
-    enum {
-        DONT_INTERSECT = 0,
-        DO_INTERSECT = 1,
-        COLLINEAR = 2
-    };
-
-    enum {
+    enum intersection_type : unsigned char {
         /// Indicates that line segments do not intersect
         NO_INTERSECTION = 0,
 
diff --git a/src/noding/snapround/HotPixelIndex.cpp b/src/noding/snapround/HotPixelIndex.cpp
index 157d06e..58e1533 100644
--- a/src/noding/snapround/HotPixelIndex.cpp
+++ b/src/noding/snapround/HotPixelIndex.cpp
@@ -17,6 +17,7 @@
 #include <geos/index/ItemVisitor.h>
 #include <geos/geom/CoordinateSequence.h>
 
+#include <random>
 #include <algorithm> // for std::min and std::max
 #include <cassert>
 #include <memory>
@@ -89,7 +90,10 @@ HotPixelIndex::add(const CoordinateSequence *pts)
     for (size_t i = 0, sz = pts->size(); i < sz; i++)
         idxs.push_back(i);
 
-    std::random_shuffle(idxs.begin(), idxs.end());
+    std::random_device rd;
+    std::mt19937 g(rd());
+    std::shuffle(idxs.begin(), idxs.end(), g);
+
     for (auto i : idxs) {
         add(pts->getAt(i));
     }
@@ -103,7 +107,9 @@ HotPixelIndex::add(const std::vector<geom::Coordinate>& pts)
     for (size_t i = 0, sz = pts.size(); i < sz; i++)
         idxs.push_back(i);
 
-    std::random_shuffle(idxs.begin(), idxs.end());
+    std::random_device rd;
+    std::mt19937 g(rd());
+    std::shuffle(idxs.begin(), idxs.end(), g);
 
     for (auto i : idxs) {
         add(pts[i]);
diff --git a/tests/unit/operation/valid/MakeValidTest.cpp b/tests/unit/operation/valid/MakeValidTest.cpp
index 7eeda21..bad9f26 100644
--- a/tests/unit/operation/valid/MakeValidTest.cpp
+++ b/tests/unit/operation/valid/MakeValidTest.cpp
@@ -6,10 +6,13 @@
 #include <geos/geom/Polygon.h>
 #include <geos/geom/GeometryFactory.h>
 #include <geos/operation/valid/MakeValid.h>
+#include <geos/io/WKTReader.h>
+#include <geos/io/WKTWriter.h>
 // std
 #include <cmath>
 #include <string>
 #include <vector>
+#include <fstream>
 
 using namespace geos::geom;
 using namespace geos::operation::valid;
@@ -66,4 +69,40 @@ void object::test<1>
     ensure(validGeom->isValid());
 }
 
+template<>
+template<>
+void object::test<2>
+()
+{
+
+
+    std::ifstream ifs("GoesBathymetryBug.txt");
+    std::string content((std::istreambuf_iterator<char>(ifs)),
+                       (std::istreambuf_iterator<char>()));
+
+    geos::io::WKTReader reader;
+    auto geom(reader.read(content));
+
+    // auto gf = GeometryFactory::getDefaultInstance();
+
+    // auto cs = gf->getCoordinateSequenceFactory()->create(std::move(v));
+    // auto lr = gf->createLinearRing(std::move(cs));
+    // auto errplyg = gf->createPolygon(std::move(lr));
+
+    // ensure(!errplyg->isValid());
+
+    MakeValid mkvalid;
+    auto validGeom = mkvalid.build(geom.get());
+    ensure("MakeValid output is not valid", validGeom->isValid());
+
+    geos::io::WKTWriter writer;
+    writer.setOutputDimension(2);
+    writer.setTrim(true);
+    std::string result = writer.write(validGeom.get());
+    std::cout << result << std::endl;
+
+}
+
+
+
 } // namespace tut

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

Summary of changes:
 include/geos/algorithm/LineIntersector.h     |  9 +------
 src/noding/snapround/HotPixelIndex.cpp       | 10 +++++--
 tests/unit/operation/valid/MakeValidTest.cpp | 39 ++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list