zoukankan      html  css  js  c++  java
  • 添加图层

    void CmapwingisTest2View::OnToolsAddLayer()

    {

             TCHAR szFilters[]= _T("TIFF Files (*.tif)|*.tif|SHP Files (*.shp)|*.shp||");  

             CFileDialog fileDlg (TRUE,_T("tif"),_T("*.tif"),  

                       OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, szFilters, this);  

             if( fileDlg.DoModal ()!=IDOK )   return;

             CString m_strFilePath = fileDlg.GetPathName();  

             if (_T("")!=m_strFilePath)  

             {  

                       // 先删除所有图层  

                       //m_map.RemoveAllLayers();  

                       // 获取后缀名判断文件是tif图像还是shp文件  

                       CString strExt = m_strFilePath.Right(3);  

                       if (_T("tif")==strExt)  

                       {  

                                // 创建图像接口打开图像加入地图  

                                mapWindow::IImagePtr pImage;  

                                pImage.CreateInstance(__uuidof(mapWindow::Image));  

                                pImage->Open(_bstr_t(m_strFilePath),mapWindow::USE_FILE_EXTENSION,TRUE,NULL);  

                                m_map.AddLayer(pImage,true);   

                       }

                       if (_T("shp")==strExt)  

                       {  

                                mapWindow::IShapefilePtr pshapefilebound;

                                pshapefilebound.CreateInstance(__uuidof(mapWindow::Shapefile));

                                pshapefilebound->Open(_bstr_t(m_strFilePath),false );

                                m_map.AddLayer( pshapefilebound,TRUE) ;

                                return;

                                                   }

             }

             return;

    }

  • 相关阅读:
    【JavaWeb】Hibernate Dao层设计
    【C#】身份证识别(一):身份证号定位
    【JavaWeb】SpringMVC重定向页面取值
    关于chrome扩展的东西
    【C#】基于Opencv/Emgucv的身份证识别
    Bashware
    【java多线程】分段阶乘计算
    【java】多项式计算(中缀转后缀)
    iOS  OTA问题排查【itms-servers协议在线安装ipa包】
    【深度学习】BP算法分类iris数据集
  • 原文地址:https://www.cnblogs.com/hyhy904/p/11491402.html
Copyright © 2011-2022 走看看