本文整理汇总了C++中OsmReader::read方法的典型用法代码示例。如果您正苦于以下问题:C++ OsmReader::read方法的具体用法?C++ OsmReader::read怎么用?C++ OsmReader::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsmReader
的用法示例。
在下文中一共展示了OsmReader::read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runMatchTest
void runMatchTest()
{
OsmReader reader;
OsmMap::resetCounters();
shared_ptr<OsmMap> map(new OsmMap());
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/ToyBuildingsTestA.osm", map);
reader.setDefaultStatus(Status::Unknown2);
reader.read("test-files/ToyBuildingsTestB.osm", map);
MapReprojector::reprojectToPlanar(map);
vector<long> wids1 = map->findWays("REF1", "Target");
vector<long> wids2 = map->findWays("REF2", "Target");
set< pair<ElementId, ElementId> > pairs;
for (size_t i = 0; i < wids2.size(); i++)
{
pairs.insert(pair<ElementId, ElementId>(ElementId::way(wids1[0]), ElementId::way(wids2[i])));
}
vector< pair<ElementId, ElementId> > replaced;
BuildingMerger bm(pairs);
bm.apply(map, replaced);
MapReprojector::reprojectToWgs84(map);
QDir(".").mkpath("test-output/conflate/polygon");
OsmWriter writer;
writer.write(map, "test-output/conflate/polygon/BuildingMergerTest.osm");
HOOT_STR_EQUALS("[3]{(Way:-15, Way:-7), (Way:-14, Way:-7), (Way:-13, Way:-7)}", replaced);
}
示例2: runHighwayMatchCandidateCountTest
void runHighwayMatchCandidateCountTest()
{
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
OsmMap::resetCounters();
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/conflate/unified/AllDataTypesA.osm", map);
reader.setDefaultStatus(Status::Unknown2);
reader.read("test-files/conflate/unified/AllDataTypesB.osm", map);
MapProjector::projectToPlanar(map);
QStringList matchCreators;
matchCreators.clear();
matchCreators.append("hoot::HighwayMatchCreator");
MatchFactory::getInstance().reset();
MatchFactory::_setMatchCreators(matchCreators);
MatchCandidateCountVisitor uut2(MatchFactory::getInstance().getCreators());
map->visitRo(uut2);
CPPUNIT_ASSERT_EQUAL((int)8, (int)uut2.getStat());
QMap<QString, long> matchCandidateCountsByMatchCreator =
any_cast<QMap<QString, long> >(uut2.getData());
CPPUNIT_ASSERT_EQUAL(1, matchCandidateCountsByMatchCreator.size());
CPPUNIT_ASSERT_EQUAL((long)8, matchCandidateCountsByMatchCreator["hoot::HighwayMatchCreator"]);
}
示例3: runRoadsTest
void runRoadsTest()
{
OsmReader reader;
OsmMap::resetCounters();
shared_ptr<OsmMap> map(new OsmMap());
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/conflate/extractor/EdgeDistanceExtractor/ToyTestA.osm", map);
reader.setDefaultStatus(Status::Unknown2);
reader.read("test-files/conflate/extractor/EdgeDistanceExtractor/ToyTestB.osm", map);
MapReprojector::reprojectToPlanar(map);
EdgeDistanceExtractor uut2(new RmseAggregator());
vector<long> r1 = map->findWays("note", "1");
vector<long> r2 = map->findWays("note", "b");
shared_ptr<const Way> w1 = map->getWay(r1[0]);
shared_ptr<const Way> w2 = map->getWay(r2[0]);
CPPUNIT_ASSERT_DOUBLES_EQUAL(3.50153, uut2.distance(*map, w1, w2), 0.01);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.978273, uut2.extract(*map, w1, w2), 0.01);
vector<long> r3 = map->findWays("note", "25");
vector<long> r4 = map->findWays("note", "z");
shared_ptr<const Way> w3 = map->getWay(r3[0]);
shared_ptr<const Way> w4 = map->getWay(r4[0]);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0, uut2.distance(*map, w3, w4), 0.01);
CPPUNIT_ASSERT_DOUBLES_EQUAL(1, uut2.extract(*map, w3, w4), 0.01);
}
示例4: runCombinedMatchCandidateCountTest
void runCombinedMatchCandidateCountTest()
{
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
OsmMap::resetCounters();
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/conflate/unified/AllDataTypesA.osm", map);
reader.setDefaultStatus(Status::Unknown2);
reader.read("test-files/conflate/unified/AllDataTypesB.osm", map);
MapProjector::projectToPlanar(map);
QStringList matchCreators;
matchCreators.clear();
matchCreators.append("hoot::BuildingMatchCreator");
matchCreators.append("hoot::HighwayMatchCreator");
matchCreators.append("hoot::PlacesPoiMatchCreator");
matchCreators.append("hoot::CustomPoiMatchCreator");
MatchFactory::getInstance().reset();
MatchFactory::_setMatchCreators(matchCreators);
MatchCandidateCountVisitor uut3(MatchFactory::getInstance().getCreators());
map->visitRo(uut3);
CPPUNIT_ASSERT_EQUAL((int)68, (int)uut3.getStat());
QMap<QString, long> matchCandidateCountsByMatchCreator =
any_cast<QMap<QString, long> >(uut3.getData());
CPPUNIT_ASSERT_EQUAL(4, matchCandidateCountsByMatchCreator.size());
//These don't add up to the total...is there some overlap here?
CPPUNIT_ASSERT_EQUAL((long)18, matchCandidateCountsByMatchCreator["hoot::BuildingMatchCreator"]);
CPPUNIT_ASSERT_EQUAL((long)8, matchCandidateCountsByMatchCreator["hoot::HighwayMatchCreator"]);
CPPUNIT_ASSERT_EQUAL((long)21, matchCandidateCountsByMatchCreator["hoot::PlacesPoiMatchCreator"]);
CPPUNIT_ASSERT_EQUAL((long)21, matchCandidateCountsByMatchCreator["hoot::CustomPoiMatchCreator"]);
}
示例5: runBuildingsTest
void runBuildingsTest()
{
OsmReader reader;
OsmMap::resetCounters();
shared_ptr<OsmMap> map(new OsmMap());
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/ToyBuildingsTestA.osm", map);
reader.setDefaultStatus(Status::Unknown2);
reader.read("test-files/ToyBuildingsTestB.osm", map);
MapReprojector::reprojectToPlanar(map);
vector<long> r1 = map->findWays("REF1", "Target");
vector<long> r2 = map->findWays("name", "Target Grocery");
shared_ptr<const Way> w1 = map->getWay(r1[0]);
shared_ptr<const Way> w2 = map->getWay(r2[0]);
EdgeDistanceExtractor uut(new MeanAggregator(), 5.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(28.9069, uut.distance(*map, w1, w2), 0.01);
EdgeDistanceExtractor uut2(new RmseAggregator(), 5.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(41.2179, uut2.distance(*map, w1, w2), 0.01);
EdgeDistanceExtractor uut3(new MinAggregator(), 5.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.380561, uut3.distance(*map, w1, w2), 0.01);
EdgeDistanceExtractor uut4(new QuantileAggregator(0.5), 5.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(7.28364, uut4.distance(*map, w1, w2), 0.01);
EdgeDistanceExtractor uut5(new QuantileAggregator(0.1), 5.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.34317, uut5.distance(*map, w1, w2), 0.01);
}
示例6: runTest
void runTest()
{
OsmReader reader;
srand(0);
shared_ptr<OsmMap> map(new OsmMap());
reader.read("test-files/ToyTestA.osm", map);
shared_ptr<OsmMap> map2(new OsmMap());
reader.read("test-files/ToyTestB.osm", map2);
const WayMap& w1 = map->getWays();
for (WayMap::const_iterator it = w1.begin(); it != w1.end(); ++it)
{
shared_ptr<Way> w = map->getWay(it->second->getId());
w->setTag("highway", "road");
}
const WayMap& w2 = map2->getWays();
for (WayMap::const_iterator it = w2.begin(); it != w2.end(); ++it)
{
shared_ptr<Way> w = map2->getWay(it->second->getId());
w->setTag("highway", "road");
}
GraphComparator uut(map, map2);
uut.setIterations(3);
uut.setPixelSize(10);
uut.compareMaps();
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.973744272810634, uut.getMeanScore(), 0.00001);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00177888445763033, uut.getConfidenceInterval(), 0.00001);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.973924616144161, uut.getMedianScore(), 0.00001);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00187302021970233, uut.getStandardDeviation(), 0.00001);
}
示例7: runTest
void runTest()
{
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
OsmMap::resetCounters();
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/ops/CookieCutterOp/DcTigerRoads-cropped.osm", map);
reader.setDefaultStatus(Status::Unknown2);
reader.read("test-files/DcGisRoads.osm", map);
MapCleaner().apply(map);
CookieCutterOp uut;
uut.setAlpha(1000.0);
uut.setAlphaShapeBuffer(0.0);
uut.setCrop(false);
uut.setOutputBuffer(0.0);
uut.apply(map);
MapProjector::projectToWgs84(map);
QDir().mkpath("test-output/ops/CookieCutterOp");
OsmWriter writer;
writer.write(map, "test-output/ops/CookieCutterOp/CookieCutterOpTest.osm");
HOOT_FILE_EQUALS("test-files/ops/CookieCutterOp/CookieCutterOpTest.osm",
"test-output/ops/CookieCutterOp/CookieCutterOpTest.osm");
}
示例8: runTagTest
void runTagTest()
{
OsmReader reader;
OsmMap::resetCounters();
shared_ptr<OsmMap> map(new OsmMap());
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/conflate/unified/AllDataTypesA.osm", map);
reader.setDefaultStatus(Status::Unknown2);
reader.read("test-files/conflate/unified/AllDataTypesB.osm", map);
vector<long> wids1 = map->findWays("REF1", "Panera");
vector<long> wids2 = map->findWays("REF2", "Panera");
set< pair<ElementId, ElementId> > pairs;
for (size_t i = 0; i < wids2.size(); i++)
{
pairs.insert(pair<ElementId, ElementId>(ElementId::way(wids1[0]), ElementId::way(wids2[i])));
}
RemoveMissVisitor v(map, "Panera");
map->visitRw(v);
vector< pair<ElementId, ElementId> > replaced;
BuildingMerger bm(pairs);
bm.apply(map, replaced);
// QDir(".").mkpath("test-output/conflate/polygon");
// OsmWriter writer;
// writer.write(map, "test-output/conflate/polygon/BuildingTagTest.osm");
HOOT_STR_EQUALS("[3]{(Way:-26, Relation:-1), (Way:-25, Relation:-1), (Way:-14, Relation:-1)}",
replaced);
HOOT_STR_EQUALS("{\"version\": 0.6,\"generator\": \"Hootenanny\",\"elements\": [\n"
"{\"type\":\"node\",\"id\":-218,\"lat\":39.593278,\"lon\":-104.80656},\n"
"{\"type\":\"node\",\"id\":-219,\"lat\":39.593114,\"lon\":-104.80653},\n"
"{\"type\":\"node\",\"id\":-220,\"lat\":39.593124,\"lon\":-104.80645},\n"
"{\"type\":\"node\",\"id\":-221,\"lat\":39.593106,\"lon\":-104.80644},\n"
"{\"type\":\"node\",\"id\":-222,\"lat\":39.593114,\"lon\":-104.8064},\n"
"{\"type\":\"node\",\"id\":-223,\"lat\":39.593115,\"lon\":-104.80635},\n"
"{\"type\":\"node\",\"id\":-224,\"lat\":39.593291,\"lon\":-104.80637},\n"
"{\"type\":\"node\",\"id\":-225,\"lat\":39.593307,\"lon\":-104.80638},\n"
"{\"type\":\"node\",\"id\":-226,\"lat\":39.593279,\"lon\":-104.80647},\n"
"{\"type\":\"node\",\"id\":-227,\"lat\":39.593297,\"lon\":-104.80625},\n"
"{\"type\":\"node\",\"id\":-228,\"lat\":39.593303,\"lon\":-104.80612},\n"
"{\"type\":\"node\",\"id\":-229,\"lat\":39.593127,\"lon\":-104.80609},\n"
"{\"type\":\"node\",\"id\":-230,\"lat\":39.593124,\"lon\":-104.80611},\n"
"{\"type\":\"node\",\"id\":-231,\"lat\":39.593152,\"lon\":-104.80613},\n"
"{\"type\":\"node\",\"id\":-232,\"lat\":39.593143,\"lon\":-104.80622},\n"
"{\"type\":\"node\",\"id\":-233,\"lat\":39.593122,\"lon\":-104.80621},\n"
"{\"type\":\"way\",\"id\":-26,\"nodes\":[-224,-227,-228,-229,-230,-231,-232,-233,-223,-224],\"tags\":{\"building:part\":\"yes\",\"error:circular\":\"15\"},\n"
"{\"type\":\"way\",\"id\":-25,\"nodes\":[-218,-219,-220,-221,-222,-223,-224,-225,-226,-218],\"tags\":{\"building:part\":\"yes\",\"error:circular\":\"15\"},\n"
"{\"type\":\"relation\",\"id\":-1,\"members\":[\n"
"{\"type\":\"way\",\"ref\":-26,\"role\":\"part\"},\n"
"{\"type\":\"way\",\"ref\":-25,\"role\":\"part\"}],\"tags\":{\"REF1\":\"Panera\",\"REF2\":\"Panera\",\"hoot:building:match\":\"true\",\"alt_name\":\"Maid-Rite;Maid-Rite Diner\",\"building\":\"yes\",\"name\":\"Panera Bread\",\"error:circular\":\"-1\"}]\n"
"}\n",
OsmJsonWriter(8).toString(map));
}
示例9: runConflateTest
void runConflateTest()
{
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/ToyBuildingsTestA.osm", map);
reader.setDefaultStatus(Status::Unknown2);
reader.read("test-files/ToyBuildingsTestB.osm", map);
MapProjector::projectToPlanar(map);
WayMap wm = map->getWays();
for (WayMap::const_iterator it = wm.begin(); it != wm.end(); ++it)
{
const ConstWayPtr& w = it->second;
const Tags& t = w->getTags();
if (t["REF1"] != "Target" && t["REF2"] != "Target")
{
map->removeWay(it->first);
}
}
Conflator uut;
shared_ptr<Manipulator> m(new BuildingMergeManipulator());
deque< shared_ptr<Manipulator> > manipulators;
manipulators.push_back(m);
uut.setManipulators(manipulators);
uut.loadSource(map);
uut.conflate();
shared_ptr<OsmMap> out(new OsmMap(uut.getBestMap()));
MapProjector::projectToWgs84(out);
OsmWriter writer;
writer.setIncludeIds(true);
writer.write(out, "test-output/BuildingConflatorTest.osm");
ConstWayPtr cheddars = getWay(out, "REF1", "Cheddar's");
CPPUNIT_ASSERT_EQUAL(string("Cheddar's"), cheddars->getTags()["REF2"].toStdString());
HOOT_STR_EQUALS(Status::Conflated, cheddars->getStatus());
ConstWayPtr biondi = getWay(out, "REF1", "Biondi");
CPPUNIT_ASSERT_EQUAL(string("Biondi"), biondi->getTags()["REF2"].toStdString());
HOOT_STR_EQUALS(Status::Conflated, biondi->getStatus());
ConstWayPtr freddys = getWay(out, "REF1", "Freddy's");
CPPUNIT_ASSERT_EQUAL(false, freddys->getTags().contains("REF2"));
HOOT_STR_EQUALS(Status::Unknown1, freddys->getStatus());
ConstWayPtr target = getWay(out, "REF1", "Target");
CPPUNIT_ASSERT_EQUAL(string("Target"), biondi->getTags()["REF2"].toStdString());
HOOT_STR_EQUALS(Status::Unknown1, target->getStatus());
CPPUNIT_ASSERT_EQUAL((size_t)9, out->getWays().size());
}
示例10: parallelFilterTest
void parallelFilterTest()
{
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
OsmMap::resetCounters();
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/DividedHighway.osm", map);
reader.setDefaultStatus(Status::Unknown2);
reader.read("test-files/UndividedHighway.osm", map);
MapReprojector::reprojectToOrthographic(map);
long n0 = map->findWays("note", "0")[0];
long n1 = map->findWays("note", "1")[0];
long n2 = map->findWays("note", "2")[0];
long n6 = map->findWays("note", "6")[0];
long n8 = map->findWays("note", "8")[0];
long n9 = map->findWays("note", "9")[0];
long n10 = map->findWays("note", "10")[0];
long n11 = map->findWays("note", "11")[0];
long n12 = map->findWays("note", "12")[0];
long n13 = map->findWays("note", "13")[0];
long n14 = map->findWays("note", "14")[0];
long n15 = map->findWays("note", "15")[0];
long n16 = map->findWays("note", "16")[0];
long n17 = map->findWays("note", "17")[0];
long n18 = map->findWays("note", "18")[0];
long n19 = map->findWays("note", "19")[0];
ParallelWayFilter f1(map, map->getWay(n0));
CPPUNIT_ASSERT_EQUAL(f1.isFiltered(map->getWay(n1)), false);
CPPUNIT_ASSERT_EQUAL(f1.isFiltered(map->getWay(n2)), false);
CPPUNIT_ASSERT_EQUAL(f1.isFiltered(map->getWay(n6)), true);
CPPUNIT_ASSERT_EQUAL(f1.isFiltered(map->getWay(n8)), true);
ParallelWayFilter f2(map, map->getWay(n9));
CPPUNIT_ASSERT_EQUAL(f2.isFiltered(map->getWay(n10)), false);
CPPUNIT_ASSERT_EQUAL(f2.isFiltered(map->getWay(n11)), false);
CPPUNIT_ASSERT_EQUAL(f2.isFiltered(map->getWay(n12)), true);
CPPUNIT_ASSERT_EQUAL(f2.isFiltered(map->getWay(n13)), true);
CPPUNIT_ASSERT_EQUAL(f2.isFiltered(map->getWay(n14)), true);
ParallelWayFilter f3(map, map->getWay(n15));
CPPUNIT_ASSERT_EQUAL(f3.isFiltered(map->getWay(n16)), false);
CPPUNIT_ASSERT_EQUAL(f3.isFiltered(map->getWay(n10)), true);
ParallelWayFilter f17(map, map->getWay(n17));
CPPUNIT_ASSERT_EQUAL(f17.isFiltered(map->getWay(n18)), false);
CPPUNIT_ASSERT_EQUAL(f17.isFiltered(map->getWay(n19)), false);
}
示例11: runTest
void runTest()
{
DisableLog dl;
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
OsmMap::resetCounters();
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/ToyBuildingsTestA.osm", map);
reader.setDefaultStatus(Status::Unknown2);
reader.read("test-files/ToyBuildingsTestB.osm", map);
// introduce a false positive in the test data.
vector<long> wids = map->findWays("name", "Cheddar's Casual Cafe");
map->getWay(wids[0])->getTags()["REF1"] = "Bad REF1";
// introduce a false negative in the test data.
wids = map->findWays("name", "Freddy's");
map->getWay(wids[0])->getTags()["REF1"] = "Biondi";
// add a uuid to all buildings.
HasTagCriterion filter("REF1", "REF2");
AddUuidVisitor uuid("uuid");
FilteredVisitor v(filter, uuid);
map->visitRw(v);
shared_ptr<OsmMap> copy(new OsmMap(map));
/*#warning Remove this custom configuration that keeps the test from erroring out
Settings testSettings = conf();
testSettings.set("conflate.match.threshold", QString::number(0.6));
testSettings.set("conflate.miss.threshold", QString::number(0.6));
testSettings.set("conflate.review.threshold", QString::number(0.6));*/
UnifyingConflator conflator;
//conflator.setConfiguration(testSettings);
conflator.apply(copy);
MatchComparator comparator;
double tpr = comparator.evaluateMatches(map, copy);
LOG_INFO(comparator.toString());
// for debugging
MapProjector::projectToWgs84(copy);
QDir(".").mkpath("test-output/scoring");
OsmWriter writer;
writer.write(copy, "test-output/scoring/MatchComparatorTest.osm");
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.75, tpr, 0.001);
CPPUNIT_ASSERT_EQUAL(6, comparator.getTp());
CPPUNIT_ASSERT_EQUAL(1, comparator.getFn());
CPPUNIT_ASSERT_EQUAL(1, comparator.getFp());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.857143, comparator.getPertyScore(), 0.000001);
}
示例12: runToyTest
void runToyTest()
{
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
OsmMap::resetCounters();
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/visitors/RemoveDuplicateAreaVisitorTest.osm", map);
MapProjector::projectToPlanar(map);
RemoveDuplicateAreaVisitor uut;
map->visitRw(uut);
//#warning debug
// MapProjector::reprojectToWgs84(map);
// QDir().mkpath("test-output/visitors/");
// OsmWriter writer;
// writer.write(map, "test-output/visitors/RemoveDuplicateAreaVisitorTest.osm");
// these "duplicates" should not be removed.
CPPUNIT_ASSERT_EQUAL(2ul, map->findWays("note", "tag difference").size());
CPPUNIT_ASSERT_EQUAL(2ul, map->findWays("note", "small difference").size());
CPPUNIT_ASSERT_EQUAL(2ul, map->findWays("note", "different name").size());
// these duplicates should be removed.
CPPUNIT_ASSERT_EQUAL(1ul, map->findWays("note", "double").size());
CPPUNIT_ASSERT_EQUAL(1ul, map->findWays("note", "triple").size());
}
示例13: individualManipulationsTest
void individualManipulationsTest()
{
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
OsmMap::resetCounters();
reader.read("test-files/manipulators/WayMergeManipulation.osm", map);
MapReprojector::reprojectToOrthographic(map);
long left = map->findWays("note", "3")[0];
long right = map->findWays("note", "4")[0];
map->getWay(left)->setStatus(Status::Unknown1);
map->getWay(right)->setStatus(Status::Unknown2);
WayMergeManipulation uut(left, right, map, 10.0);
set<ElementId> ignored1, ignored2;
shared_ptr<OsmMap> after(new OsmMap(map));
uut.applyManipulation(after, ignored1, ignored2);
MapReprojector::reprojectToWgs84(after);
QDir().mkpath("test-output/manipulators/");
OsmWriter writer;
writer.setIncludeCompatibilityTags(false);
writer.write(after, "test-output/manipulators/WayMergeManipulation.osm");
HOOT_FILE_EQUALS("test-output/manipulators/WayMergeManipulation.osm",
"test-files/manipulators/WayMergeManipulationOutput.osm");
}
示例14: runToyTest
void runToyTest()
{
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
OsmMap::resetCounters();
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/ToyTestA.osm", map);
FindIntersectionsOp op;
op.apply(map);
// RefRemoveOp uut;
// uut.addCriterion(ElementCriterionPtr(new BuildingCriterion()));
// uut.apply(map);
LOG_VAR(TestUtils::toQuotedString(OsmJsonWriter(5).toString(map)));
MapReprojector::reprojectToWgs84(map);
QDir().mkpath("test-output/ops/FindIntersectionsOp/");
OsmWriter writer;
writer.write(map, "test-output/ops/FindIntersectionsOp/Toy_intersections.osm");
HOOT_FILE_EQUALS("test-files/ops/FindIntersectionsOp/ToyTestA_intersections.osm",
"test-output/ops/FindIntersectionsOp/Toy_intersections.osm");
}
示例15: individualManipulationsTest
void individualManipulationsTest()
{
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
OsmMap::resetCounters();
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/DividedHighway.osm", map);
reader.setDefaultStatus(Status::Unknown2);
reader.read("test-files/UndividedHighway.osm", map);
MapReprojector::reprojectToOrthographic(map);
long left = map->findWays("note", "0")[0];
long right = map->findWays("note", "1")[0];
long mid = map->findWays("note", "2")[0];
DividedHighwayManipulation uut(left, right, mid, map, 10.0);
qDebug() << uut.getScoreEstimate();
qDebug() << uut.calculateScore(map);
set<ElementId> ignored1, ignored2;
shared_ptr<OsmMap> after(new OsmMap(map));
uut.applyManipulation(after, ignored1, ignored2);
left = map->findWays("note", "3")[0];
right = map->findWays("note", "4")[0];
mid = map->findWays("note", "5")[0];
DividedHighwayManipulation uut2(left, right, mid, after, 10.0);
qDebug() << uut2.getScoreEstimate();
qDebug() << uut2.calculateScore(after);
uut2.applyManipulation(after, ignored1, ignored2);
left = map->findWays("note", "6")[0];
right = map->findWays("note", "7")[0];
mid = map->findWays("note", "8")[0];
DividedHighwayManipulation uut3(left, right, mid, after, 10.0);
qDebug() << uut3.getScoreEstimate();
qDebug() << uut3.calculateScore(after);
uut3.applyManipulation(after, ignored1, ignored2);
MapReprojector::reprojectToWgs84(after);
OsmWriter writer;
writer.write(after, "test-output/DividedHighwayManipulatorTest.osm");
}