-
Notifications
You must be signed in to change notification settings - Fork 74
v0.2.54..v0.2.55 changeset UnconnectedWaySnapperTest.cpp
Garret Voltz edited this page Aug 14, 2020
·
1 revision
diff --git a/hoot-core-test/src/test/cpp/hoot/core/ops/UnconnectedWaySnapperTest.cpp b/hoot-core-test/src/test/cpp/hoot/core/ops/UnconnectedWaySnapperTest.cpp
index 051790a..7bb8c40 100644
--- a/hoot-core-test/src/test/cpp/hoot/core/ops/UnconnectedWaySnapperTest.cpp
+++ b/hoot-core-test/src/test/cpp/hoot/core/ops/UnconnectedWaySnapperTest.cpp
@@ -50,6 +50,8 @@ class UnconnectedWaySnapperTest : public HootTestFixture
CPPUNIT_TEST(runSnapTest);
CPPUNIT_TEST(runConfigOptionsValidationTest);
CPPUNIT_TEST(runStaticSnapTest);
+ CPPUNIT_TEST(runReviewSnappedTest);
+ CPPUNIT_TEST(runMarkOnlyTest);
CPPUNIT_TEST_SUITE_END();
public:
@@ -85,6 +87,88 @@ public:
uut.setWayNodeToSnapToCriterionClassName("hoot::HighwayWayNodeCriterion");
uut.setWayToSnapCriterionClassName("hoot::HighwayCriterion");
uut.setWayToSnapToCriterionClassName("hoot::HighwayCriterion");
+ uut.setMarkOnly(false);
+ uut.setReviewSnappedWays(false);
+ uut.apply(map);
+
+ MapProjector::projectToWgs84(map);
+
+ OsmXmlWriter writer;
+ writer.setIsDebugMap(true);
+ writer.write(map, _outputPath + testName + + "Out.osm");
+
+ CPPUNIT_ASSERT_EQUAL(43L, uut.getNumFeaturesAffected());
+ CPPUNIT_ASSERT_EQUAL(5L, uut.getNumSnappedToWayNodes());
+ CPPUNIT_ASSERT_EQUAL(38L, uut.getNumSnappedToWays());
+ HOOT_FILE_EQUALS(_inputPath + testName + + "Out.osm", _outputPath + testName + + "Out.osm");
+ }
+
+ void runReviewSnappedTest()
+ {
+ const QString testName = "runReviewSnappedTest";
+
+ OsmXmlReader reader;
+ OsmMapPtr map(new OsmMap());
+ reader.setDefaultStatus(Status::Unknown1);
+ reader.read(_inputPath + "runSnapTestIn1.osm", map);
+ reader.setDefaultStatus(Status::Unknown2);
+ reader.read(_inputPath + "runSnapTestIn2.osm", map);
+
+ UnconnectedWaySnapper uut;
+ uut.setAddCeToSearchDistance(false);
+ uut.setMaxNodeReuseDistance(0.5);
+ uut.setMaxSnapDistance(5.0);
+ uut.setMarkSnappedNodes(false);
+ uut.setMarkSnappedWays(false);
+ uut.setSnapToExistingWayNodes(true);
+ uut.setWayDiscretizationSpacing(1.0);
+ uut.setSnapToWayStatuses(QStringList(Status(Status::Unknown1).toString()));
+ uut.setSnapWayStatuses(QStringList(Status(Status::Unknown2).toString()));
+ uut.setWayNodeToSnapToCriterionClassName("hoot::HighwayWayNodeCriterion");
+ uut.setWayToSnapCriterionClassName("hoot::HighwayCriterion");
+ uut.setWayToSnapToCriterionClassName("hoot::HighwayCriterion");
+ uut.setMarkOnly(false);
+ uut.setReviewSnappedWays(true);
+ uut.apply(map);
+
+ MapProjector::projectToWgs84(map);
+
+ OsmXmlWriter writer;
+ writer.setIsDebugMap(true);
+ writer.write(map, _outputPath + testName + + "Out.osm");
+
+ CPPUNIT_ASSERT_EQUAL(43L, uut.getNumFeaturesAffected());
+ CPPUNIT_ASSERT_EQUAL(5L, uut.getNumSnappedToWayNodes());
+ CPPUNIT_ASSERT_EQUAL(38L, uut.getNumSnappedToWays());
+ HOOT_FILE_EQUALS(_inputPath + testName + + "Out.osm", _outputPath + testName + + "Out.osm");
+ }
+
+ void runMarkOnlyTest()
+ {
+ const QString testName = "runMarkOnlyTest";
+
+ OsmXmlReader reader;
+ OsmMapPtr map(new OsmMap());
+ reader.setDefaultStatus(Status::Unknown1);
+ reader.read(_inputPath + "runSnapTestIn1.osm", map);
+ reader.setDefaultStatus(Status::Unknown2);
+ reader.read(_inputPath + "runSnapTestIn2.osm", map);
+
+ UnconnectedWaySnapper uut;
+ uut.setAddCeToSearchDistance(false);
+ uut.setMaxNodeReuseDistance(0.5);
+ uut.setMaxSnapDistance(5.0);
+ uut.setMarkSnappedNodes(false);
+ uut.setMarkSnappedWays(false);
+ uut.setSnapToExistingWayNodes(true);
+ uut.setWayDiscretizationSpacing(1.0);
+ uut.setSnapToWayStatuses(QStringList(Status(Status::Unknown1).toString()));
+ uut.setSnapWayStatuses(QStringList(Status(Status::Unknown2).toString()));
+ uut.setWayNodeToSnapToCriterionClassName("hoot::HighwayWayNodeCriterion");
+ uut.setWayToSnapCriterionClassName("hoot::HighwayCriterion");
+ uut.setWayToSnapToCriterionClassName("hoot::HighwayCriterion");
+ uut.setMarkOnly(true);
+ uut.setReviewSnappedWays(true);
uut.apply(map);
MapProjector::projectToWgs84(map);