Skip to content

v0.2.49..v0.2.50 changeset RandomWayGeneralizerTest.cpp

Garret Voltz edited this page Nov 6, 2019 · 1 revision
diff --git a/hoot-core-test/src/test/cpp/hoot/core/visitors/RandomWayGeneralizerTest.cpp b/hoot-core-test/src/test/cpp/hoot/core/visitors/RandomWayGeneralizerTest.cpp
index 5f309a6..ed9a370 100644
--- a/hoot-core-test/src/test/cpp/hoot/core/visitors/RandomWayGeneralizerTest.cpp
+++ b/hoot-core-test/src/test/cpp/hoot/core/visitors/RandomWayGeneralizerTest.cpp
@@ -74,8 +74,9 @@ public:
   }
 
   void runTest(const QString& inputFile, const int randomNumberGeneratorSeed,
-               const double generalizeProbability, const double epsilon, const QString& outputFile,
-               const QString& outputCompareFile, const bool enableDebugLogging = false)
+               const double generalizeProbability, const double epsilon, const int numNodesRemoved,
+               const QString& outputFile, const QString& outputCompareFile,
+               const bool enableDebugLogging = false)
   {
     Log::WarningLevel levelBefore = Log::getInstance().getLevel();
     if (enableDebugLogging)
@@ -113,11 +114,12 @@ public:
     wayGeneralizeVisitor.setRng(rng);
     wayGeneralizeVisitor.setWayGeneralizeProbability(generalizeProbability);
     wayGeneralizeVisitor.setEpsilon(epsilon);
+    wayGeneralizeVisitor.setRemoveNodesSharedByWays(true);
     map->visitRw(wayGeneralizeVisitor);
     MapProjector::projectToWgs84(map);
 
-    const int numNodesRemoved = numNodesBefore - map->getNodes().size();
-    CPPUNIT_ASSERT_EQUAL(0, numNodesRemoved);
+    const int numNodesActuallyRemoved = numNodesBefore - map->getNodes().size();
+    CPPUNIT_ASSERT_EQUAL(numNodesRemoved, numNodesActuallyRemoved);
     LOG_VARD(numNodesRemoved);
     const int numWaysRemoved = numWaysBefore - map->getWays().size();
     CPPUNIT_ASSERT_EQUAL(0, numWaysRemoved);
@@ -142,6 +144,7 @@ public:
       1,
       0.1,
       5.0,
+      2,
       _outputPath + "RandomWayGeneralizerTest-out-1.osm",
       _inputPath + "RandomWayGeneralizerTest-out-1.osm");
   }
@@ -153,6 +156,7 @@ public:
       1,
       0.5,
       5.0,
+      2,
       _outputPath + "RandomWayGeneralizerTest-out-2.osm",
       _inputPath + "RandomWayGeneralizerTest-out-2.osm");
   }
@@ -164,6 +168,7 @@ public:
       1,
       1.0,
       5.0,
+      17,
       _outputPath + "RandomWayGeneralizerTest-out-3.osm",
       _inputPath + "RandomWayGeneralizerTest-out-3.osm");
   }
@@ -175,6 +180,7 @@ public:
       1,
       0.1,
       10.0,
+      2,
       _outputPath + "RandomWayGeneralizerTest-out-4.osm",
       _inputPath + "RandomWayGeneralizerTest-out-4.osm");
   }
@@ -186,6 +192,7 @@ public:
       1,
       0.5,
       10.0,
+      2,
       _outputPath + "RandomWayGeneralizerTest-out-5.osm",
       _inputPath + "RandomWayGeneralizerTest-out-5.osm");
   }
@@ -197,6 +204,7 @@ public:
       1,
       1.0,
       10.0,
+      21,
       _outputPath + "RandomWayGeneralizerTest-out-6.osm",
       _inputPath + "RandomWayGeneralizerTest-out-6.osm");
   }
@@ -208,6 +216,7 @@ public:
       1,
       0.1,
       50.0,
+      2,
       _outputPath + "RandomWayGeneralizerTest-out-7.osm",
       _inputPath + "RandomWayGeneralizerTest-out-7.osm");
   }
@@ -219,6 +228,7 @@ public:
       1,
       0.5,
       50.0,
+      2,
       _outputPath + "RandomWayGeneralizerTest-out-8.osm",
       _inputPath + "RandomWayGeneralizerTest-out-8.osm");
   }
@@ -230,6 +240,7 @@ public:
       1,
       1.0,
       50.0,
+      27,
       _outputPath + "RandomWayGeneralizerTest-out-9.osm",
       _inputPath + "RandomWayGeneralizerTest-out-9.osm");
   }
Clone this wiki locally