ArcGIS Runtime SDK for QT:加载天地图

总体流程:

  1. 定义天地图切片信息、地址信息、地址域信息
  2. 使用WebTiledLayer定义底图
  3. 加载天地图

一、定义天地图切片信息

包括天地图:

//天地图dpi
   static  int TDTDpi;
    //天地图图片格式
   static TileImageFormat TDTImageFormat;
    //天地图空间坐标系
   static  SpatialReference TDTSR;
    //天地图原点
   static  Point TDTOrigin;
    //天地图图片高
   static int TDTPixHeight;
    //天地图图片宽
   static  int TDTPixWidth;
    //天地图切片矩阵
   static  QList TDTLevels;
    //天地图电子地图地址
   static QString TDTURLVEC;
   //天地图卫星影像
   static QString TDTURLIMG;
    //天地图注记
   static QString TDTURLCVA;
   //天地图地址域
   static QStringList TDTDOMAINS;
    //天地图全局视图范围
   static Envelope TDTFullExtent;

 
  
void CGIS::componentComplete()
{
    qDebug()<<"CGIS::componentComplete():start--------------"< levels(tdtlvs);
    std::initializer_list lvItems={
        LevelOfDetail(0,1.40625,590995197.141669),
        LevelOfDetail(1,0.703125,295497598.570834),
        LevelOfDetail(2,0.3515625,147748799.285417),
        LevelOfDetail(3,0.17578125,73874399.6427086),
        LevelOfDetail(4,0.087890625,36937199.8213543),
        LevelOfDetail(5,0.0439453125,18468599.9106771),
        LevelOfDetail(6,0.02197265625,9234299.95533857),
        LevelOfDetail(7,0.010986328125,4617149.97766928),
        LevelOfDetail(8,0.0054931640625,2308574.98883464),
        LevelOfDetail(9,0.00274658203125,1154287.49441732),
        LevelOfDetail(10,0.001373291015625,577143.747208661),
        LevelOfDetail(11,0.0006866455078125,288571.87360433),
        LevelOfDetail(12,0.00034332275390625,144285.936802165),
        LevelOfDetail(13,0.000171661376953125,72142.9684010826),
        LevelOfDetail(14,8.58306884765625E-05,36071.4842005413),
        LevelOfDetail(15,4.29153442382812E-05,18035.7421002706),
        LevelOfDetail(16,2.14576721191406E-05,9017.87105013533),
        LevelOfDetail(17,1.07288360595703E-05,4508.93552506766),
        LevelOfDetail(18,5.36441802978515E-06,2254.46776253383),
        LevelOfDetail(19,2.68220901489257E-06,1127.23388126691),
        LevelOfDetail(20,1.34110450744628E-06,563.616940633458)
    };

    QList tdtlevels=lvItems;


    m_mapView = findChild("mapView");
    m_mapView->setWrapAroundMode(WrapAroundMode::Disabled);

    tdtTileInfo=new TileInfo(TDT::TDTDpi,TileImageFormat::Unknown,tdtlevels,
                                 TDT::TDTSR,Point(-180,90,TDT::TDTSR),256,256);
    std::shared_ptr sp_tdtTileInfo(tdtTileInfo);

    qDebug()<<"tdt-dpi:"<dpi();
    qDebug()<<"tdt-tileHeight:"<tileHeight();

    tdtWebTiledLayer=new WebTiledLayer(
                TDT::TDTURLIMG,TDT::TDTDOMAINS,*sp_tdtTileInfo,TDT::TDTFullExtent,this);
    std::shared_ptr sp_tdtlayer(tdtWebTiledLayer);


    qDebug()<<"tdtLayer-url:"<templateUrl();
    basemap=new Basemap(sp_tdtlayer.get(), this);

    m_map = new Map(SpatialReference(4490), this);
    m_map->setBasemap(basemap);

    Point pt(121.13464303314697, 31.56970212181205,TDT::TDTSR);
    Viewpoint vp(pt, 5000.0);

    m_map->setInitialViewpoint(vp);

    // Set map to map view
    m_mapView->setMap(m_map);

    qDebug()<<"CGIS::componentComplete():end--------------"<





你可能感兴趣的:(c++,qt,ArcGIS,FOR,QT)