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


C++ Arguments::TileWidth方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
    osmscout::OSMTileIdBox  tileArea(tileA,tileB);

    std::cout << "----------" << std::endl;
    std::cout << "Drawing level " << level << ", " << tileArea.GetCount() << " tiles " << tileArea.GetDisplayText() << std::endl;

    size_t current=1;
    size_t tileCount=tileArea.GetCount();
    size_t delta=tileCount/20;

    if (delta==0) {
      delta=1;
    }

    for (const auto& tile : tileArea) {
      osmscout::MapData       data;
      osmscout::OSMTileIdBox  tileBox(osmscout::OSMTileId(tile.GetX()-1,tile.GetY()-1),
                                      osmscout::OSMTileId(tile.GetX()+1,tile.GetY()+1));
      osmscout::GeoBox        boundingBox;

      if ((current % delta)==0) {
        std::cout << current*100/tileCount << "% " << current;

        if (stats.tileCount>0) {
          std::cout << " " << stats.dbTotalTime/stats.tileCount;
          std::cout << " " << stats.drawTotalTime/stats.tileCount;
        }

        std::cout << std::endl;
      }

      projection.Set(tile,
                     magnification,
                     args.dpi,
                     args.TileWidth(),
                     args.TileHeight());

      projection.GetDimensions(boundingBox);
      projection.SetLinearInterpolationUsage(level.Get() >= 10);

      for (size_t i=0; i<args.loadRepeat; i++) {
        data.nodes.clear();
        data.ways.clear();
        data.areas.clear();

        osmscout::StopClock dbTimer;

        osmscout::GeoBox dataBoundingBox(tileBox.GetBoundingBox(magnification));

        std::list<osmscout::TileRef> tiles;

        // set cache size almost unlimited,
        // for better estimate of peak memory usage by tile loading
        mapService->SetCacheSize(10000000);

        mapService->LookupTiles(magnification, dataBoundingBox, tiles);
        mapService->LoadMissingTileData(searchParameter, *styleConfig, tiles);
        mapService->AddTileDataToMapData(tiles, data);

#if defined(HAVE_LIB_GPERFTOOLS)
        if (args.heapProfile) {
          std::ostringstream buff;
          buff << "load-" << level << "-" << tile.GetX() << "-" << tile.GetY();
          HeapProfilerDump(buff.str().c_str());
        }
        struct mallinfo alloc_info = tc_mallinfo();
#else
开发者ID:Karry,项目名称:osmscout-sailfish,代码行数:67,代码来源:PerformanceTest.cpp

示例2: PrepareBackend

PerformanceTestBackendPtr PrepareBackend(int argc, char* argv[], const Arguments &args, osmscout::StyleConfigRef styleConfig)
{
  if (args.driver=="cairo") {
    std::cout << "Using driver 'cairo'..." << std::endl;
#if defined(HAVE_LIB_OSMSCOUTMAPCAIRO)
    try{
      return std::make_shared<PerformanceTestBackendCairo>(args.TileWidth(),args.TileHeight(),styleConfig);
    } catch (std::runtime_error &e){
      std::cerr << e.what() << std::endl;
      return nullptr;
    }
#else
    std::cerr << "Driver 'cairo' is not enabled" << std::endl;
    return nullptr;
#endif
  }
  else if (args.driver=="Qt") {
    std::cout << "Using driver 'Qt'..." << std::endl;
#if defined(HAVE_LIB_OSMSCOUTMAPQT)
    SailfishApp::application(argc, argv);
    std::cout << "QGuiApplication created..." << std::endl;
    return std::make_shared<PerformanceTestBackendQt>(argc, argv, args.TileWidth(), args.TileHeight(), styleConfig);
#else
    std::cerr << "Driver 'Qt' is not enabled" << std::endl;
    return nullptr;
#endif
  } else if (args.driver == "agg") {
    std::cout << "Using driver 'Agg'..." << std::endl;
#if defined(HAVE_LIB_OSMSCOUTMAPAGG)
    return std::make_shared<PerformanceTestBackendAGG>(args.TileWidth(), args.TileHeight(), styleConfig);
#else
    std::cerr << "Driver 'Agg' is not enabled" << std::endl;
    return nullptr;
#endif
  } else if (args.driver == "opengl") {
    std::cout << "Using driver 'OpenGL'..." << std::endl;
#if defined(HAVE_LIB_OSMSCOUTMAPOPENGL)
    try{
      return std::make_shared<PerformanceTestBackendOGL>(args.TileWidth(), args.TileHeight(), args.dpi, styleConfig);
    } catch (std::runtime_error &e){
      std::cerr << e.what() << std::endl;
      return nullptr;
    }
#else
    std::cerr << "Driver 'OpenGL' is not enabled" << std::endl;
    return nullptr;
#endif
  }
  else if (args.driver=="noop") {
    std::cout << "Using driver 'noop'..." << std::endl;
    return std::make_shared<PerformanceTestBackendNoOp>(styleConfig);
  }
  else if (args.driver=="none") {
    std::cout << "Using driver 'none'..." << std::endl;
    return std::make_shared<PerformanceTestBackend>();
  }
  else {
    std::cerr << "Unsupported driver '" << args.driver << "'" << std::endl;
    return nullptr;
  }
}
开发者ID:Karry,项目名称:osmscout-sailfish,代码行数:61,代码来源:PerformanceTest.cpp


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