当前位置: 首页>>代码示例>>C++>>正文


C++ OsmReader::setDefaultStatus方法代码示例

本文整理汇总了C++中OsmReader::setDefaultStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ OsmReader::setDefaultStatus方法的具体用法?C++ OsmReader::setDefaultStatus怎么用?C++ OsmReader::setDefaultStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OsmReader的用法示例。


在下文中一共展示了OsmReader::setDefaultStatus方法的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);
  }
开发者ID:drew-bower,项目名称:hootenanny,代码行数:35,代码来源:BuildingMergerTest.cpp

示例2: 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);
  }
开发者ID:drew-bower,项目名称:hootenanny,代码行数:34,代码来源:EdgeDistanceExtractorTest.cpp

示例3: 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"]);
  }
开发者ID:digideskio,项目名称:hootenanny,代码行数:25,代码来源:MatchCandidateCountVisitorTest.cpp

示例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"]);
  }
开发者ID:digideskio,项目名称:hootenanny,代码行数:32,代码来源:MatchCandidateCountVisitorTest.cpp

示例5: 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);
  }
开发者ID:drew-bower,项目名称:hootenanny,代码行数:33,代码来源:EdgeDistanceExtractorTest.cpp

示例6: 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");
  }
开发者ID:bpross-52n,项目名称:hootenanny,代码行数:28,代码来源:CookieCutterOpTest.cpp

示例7: 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));
  }
开发者ID:drew-bower,项目名称:hootenanny,代码行数:59,代码来源:BuildingMergerTest.cpp

示例8: 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());
  }
开发者ID:mort85,项目名称:hootenanny,代码行数:58,代码来源:BuildingMergeManipulatorTest.cpp

示例9: 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);

  }
开发者ID:drew-bower,项目名称:hootenanny,代码行数:56,代码来源:DividedHighwayMergerTest.cpp

示例10: 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);
  }
开发者ID:bpross-52n,项目名称:hootenanny,代码行数:55,代码来源:MatchComparatorTest.cpp

示例11: 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");
  }
开发者ID:drew-bower,项目名称:hootenanny,代码行数:25,代码来源:FindIntersectionsOpTest.cpp

示例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());
  }
开发者ID:Nanonid,项目名称:hootenanny,代码行数:28,代码来源:RemoveDuplicateAreaVisitorTest.cpp

示例13: 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");
  }
开发者ID:drew-bower,项目名称:hootenanny,代码行数:47,代码来源:DividedHighwayManipulationTest.cpp

示例14: map

 shared_ptr<OsmMap> _loadMap()
 {
   OsmReader reader;
   shared_ptr<OsmMap> map(new OsmMap());
   OsmMap::resetCounters();
   reader.setDefaultStatus(Status::Unknown1);
   reader.read("test-files/visitors/TagKeyCountVisitorTest.osm", map);
   return map;
 }
开发者ID:Nanonid,项目名称:hootenanny,代码行数:9,代码来源:TagKeyCountVisitorTest.cpp

示例15: runTest

    void runTest()
    {
        OsmReader reader;

        shared_ptr<OsmMap> map(new OsmMap());
        reader.setDefaultStatus(Status::Unknown1);
        reader.setUseDataSourceIds(true);
        reader.read("test-files/MaximalNearestSubline.osm", map);

        shared_ptr<OsmMap> map2(new OsmMap(map->getProjection()));

        shared_ptr<OGRSpatialReference> srs =
            MapReprojector::createAeacProjection(map->calculateBounds());
        MapReprojector::reproject(map, srs);

        stringstream ss;

        shared_ptr<Way> w;
        w = MaximalNearestSubline::getMaximalNearestSubline(map, map->getWay(-353),
                map->getWay(-313),
                10.0, 10.0);
        w->setStatus(Status::Conflated);
        ss << ElementConverter(map).convertToLineString(w)->toString() << endl;

        w = MaximalNearestSubline::getMaximalNearestSubline(map, map->getWay(-313),
                map->getWay(-353),
                10.0, 10.0);
        w->setStatus(Status::Conflated);
        ss << ElementConverter(map).convertToLineString(w)->toString() << endl;

        w = MaximalNearestSubline::getMaximalNearestSubline(map, map->getWay(-260),
                map->getWay(-247),
                10.0, 10.0);
        w->setStatus(Status::Conflated);
        ss << ElementConverter(map).convertToLineString(w)->toString() << endl;

        w = MaximalNearestSubline::getMaximalNearestSubline(map, map->getWay(-247),
                map->getWay(-260),
                10.0, 10.0);
        w->setStatus(Status::Conflated);
        ss << ElementConverter(map).convertToLineString(w)->toString() << endl;

//      {
//        shared_ptr<OsmMap> wgs84(new OsmMap(map2));
//        MapReprojector::reprojectToWgs84(wgs84);
//        OsmWriter writer;
//        QString fn = QString("test-output/algorithms/MaximalNearestSublineTestOutput.osm");
//        writer.write(wgs84, fn);
//      }

        QFile fp("test-files/algorithms/MaximalNearestSublineTest.txt");
        fp.open(QIODevice::ReadOnly);
        QString s = fp.readAll();
        CPPUNIT_ASSERT_EQUAL(s.toStdString(), ss.str());

    }
开发者ID:mitulvpatel,项目名称:hootenanny,代码行数:56,代码来源:MaximalNearestSublineTest.cpp


注:本文中的OsmReader::setDefaultStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。