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


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

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


在下文中一共展示了OsmReader::setUseDataSourceIds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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

示例2: runWaySplitTest

  void runWaySplitTest()
  {
    //Log::WarningLevel levelBefore = Log::getInstance().getLevel();
    //Log::getInstance().setLevel(Log::Debug);

    OsmMap::resetCounters();
    OsmReader reader;
    shared_ptr<OsmMap> map(new OsmMap());
    reader.setDefaultStatus(Status::Unknown1);
    reader.setUseDataSourceIds(true);
    reader.read("test-files/perty/PertyWaySplitVisitorTest/PertyWaySplitVisitorTest-in-1.osm", map);
    const int numNodesBeforeSplitting = map->getNodeMap().size();
    LOG_VARD(numNodesBeforeSplitting);
    const int numWaysBeforeSplitting = map->getWays().size();
    LOG_VARD(numWaysBeforeSplitting)

    MapProjector::projectToPlanar(map);
    PertyWaySplitVisitor waySplitVisitor;
    boost::minstd_rand rng;
    rng.seed(1);
    waySplitVisitor.setRng(rng);
    waySplitVisitor.setWaySplitProbability(0.5);
    waySplitVisitor.setMinNodeSpacing(1.0);
    map->visitRw(waySplitVisitor);
    MapProjector::projectToWgs84(map);
    const int numNewNodesCreatedBySpliting = map->getNodeMap().size() - numNodesBeforeSplitting;
    LOG_VARD(numNewNodesCreatedBySpliting);
    const int numNewWaysCreatedBySpliting = map->getWays().size() - numWaysBeforeSplitting;
    LOG_VARD(numNewWaysCreatedBySpliting);

    const QString outDir = "test-output/perty/PertyWaySplitVisitorTest/";
    QDir().mkpath(outDir);
    OsmWriter writer;
    writer.setIncludeHootInfo(true);
    const QString outFile = outDir + "/PertyWaySplitVisitorTest-out-1.osm";
    writer.write(map, outFile);

    HOOT_FILE_EQUALS(
      "test-files/perty/PertyWaySplitVisitorTest/PertyWaySplitVisitorTest-out-1.osm", outFile);

    //Log::getInstance().setLevel(levelBefore);
  }
开发者ID:Nanonid,项目名称:hootenanny,代码行数:42,代码来源:PertyWaySplitVisitorTest.cpp

示例3: dl

  shared_ptr<CalculateStatsOp> _calcStats(const QString& inputFile)
  {
    OsmReader reader;
    shared_ptr<OsmMap> map(new OsmMap());
    OsmMap::resetCounters();
    reader.setDefaultStatus(Status::Unknown1);
    reader.setUseStatusFromFile(true);
    reader.setUseDataSourceIds(true);
    reader.read(inputFile, map);

    shared_ptr<CalculateStatsOp> calcStatsOp(new CalculateStatsOp());
    //If we figure out the error messages logged by the script translator related stats are
    //invalid and fix them, then this log disablement can be removed.
    {
      DisableLog dl(Log::Fatal);
      calcStatsOp->apply(map);
    }
    //calcStatsOp->printStats();
    return calcStatsOp;
  }
开发者ID:digideskio,项目名称:hootenanny,代码行数:20,代码来源:CalculateStatsOpTest.cpp


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