zoukankan      html  css  js  c++  java
  • MapEase

    这是我用MapEase编的程,希望对你有参考作用  
       
      private   MEDataEngine.MeDataConnection   conn;       //map链接  
      private   AxMapEase.AxMeMap   mapMain;  
       
      private   void   FormMain_Load(object   sender,   System.EventArgs   e)  
      {  
              conn   =   new     MEDataEngine.MeDataConnectionClass();       //链接实例化  
              InitMapData();  
      }  
       
      //加载层  
      private   void   InitMapData()  
      {  
                        conn.Database   =   GetDataPath("..\\..\\..\\Data108");     //打开map所在目录      
      if   (!conn.Open())  
      {  
      MessageBox.Show("Could   not   connect   to   the   geo   database.");  
      return;  
      }  
       
      ///********************************************************  
      ///初始化mapMain  
      ///********************************************************  
      MeMapModel   mapModel1   =   new   MeMapModelClass();  
      mapModel1.BackColor   =   (MEMap.Colors)0xE3F6E1;  
       
      AddLayer("VDTable",   mapModel1);       //"VDTable"——table名  
       
      mapMain.MapModel   =   mapModel1;  
      mapMain.MouseTool   =   new   MePanToolClass();  
      }  
       
      private   void   AddLayer(string   dsName,   MeMapModel   mapModel)  
      {  
      //   get   geo   data   source   from   connection  
      MeSetVDataSource   dataSource;  
      dataSource   =   (MeSetVDataSource)conn.FindDataSource(dsName);  
      if   (dataSource   ==   null)  
      {  
      MessageBox.Show("Could   not   find   the   geo   data   source:   "   +   dsName); return;  
      }  
       
      //   open   the   geo   data   source  
      if   (!dataSource.Open(true,   true))  
      {  
      MessageBox.Show("Failed   to   open   the   geo   data   source:   "   +   dsName);  
      return;  
      }  
       
      //   create   a   geo   dataset   object   from   the   geo   data   source  
      MEDataEngine.MeVectorDataset   dataset   =   new   MEDataEngine.MeVectorDataset();  
      dataset.Open(dataSource,   mapModel.CoordinateSystem,   null);  
       
      //   then   add   the   dataset   to   the   map   model//s   Datasets   collection  
      mapModel.Datasets.Add(dataset);  
       
      //   create   layer   from   dataset  
      MeVectorLayer   layer   =   new   MeVectorLayerClass();  
      layer.Name   =   mapModel.Layers.GetDefaultName(dataset.Name);  
      MeRecordset   rs   =   new   MeRecordsetClass();  
      rs.Open(dataset,   null);  
      layer.DataSource   =   rs;  
       
      //   add   to   the   layers   collection  
      mapModel.Layers.Add(layer);  
      }
  • 相关阅读:
    Zookeeper
    激活函数
    线程池
    用rand()和srand()产生伪随机数的方法总结 (转贴)
    连接SDE数据库代码
    ProgressBar
    ArcEngine+OpenGL之二系统平台搭建
    我所知道的ArcObjects开发(转)
    oracle wm_concat函数 乱码
    修改32位的AutoCAD2012,使其能在64位系统上安装
  • 原文地址:https://www.cnblogs.com/lgzh3/p/992718.html
Copyright © 2011-2022 走看看