• AE基础(1)


     1   //加载地图文档
     2         private void loadMapDocument()
     3         {
     4             System.Windows.Forms.OpenFileDialog openFileDialog;
     5             openFileDialog = new OpenFileDialog();
     6             openFileDialog.Title = "打开地图文档";
     7             openFileDialog.Filter = "地图文档(*.mxd)|*.mxd";
     8             openFileDialog.ShowDialog();
     9             string filePath = openFileDialog.FileName;
    10             if (axMapControl1.CheckMxFile(filePath))
    11             {
    12                 axMapControl1.MousePointer = esriControlsMousePointer.esriPointerHourglass;
    13                 axMapControl1.LoadMxFile(filePath, 0, Type.Missing);
    14                 axMapControl1.MousePointer = esriControlsMousePointer.esriPointerDefault;
    15             }
    16             else
    17             {
    18                 MessageBox.Show(filePath + "不是有效的地图文档");
    19             }
    20         }
    加载地图文档
     1         private void loadMapDocument2()
     2         {
     3             System.Windows.Forms.OpenFileDialog openFileDialog;
     4             openFileDialog = new OpenFileDialog();
     5             openFileDialog.Title = "打开地图文档";
     6             openFileDialog.Filter = "map documents(*.mxd)|*.mxd";
     7             openFileDialog.ShowDialog();
     8             string filePath = openFileDialog.FileName;
     9             if (axMapControl1.CheckMxFile(filePath))
    10             {
    11                 IArray arrayMap = axMapControl1.ReadMxMaps(filePath, Type.Missing);
    12                 int i;
    13                 IMap map;
    14                 for (i = 0; i < arrayMap.Count; i++)
    15                 {
    16                     map = arrayMap.get_Element(i) as IMap;
    17                     if (map.Name == "Layers")
    18                     {
    19                         axMapControl1.MousePointer = esriControlsMousePointer.esriPointerHourglass;
    20                         axMapControl1.LoadMxFile(filePath, 0, Type.Missing);
    21                         axMapControl1.MousePointer = esriControlsMousePointer.esriPointerDefault;
    22                         break;
    23                     }
    24                 }
    25             }
    26             else
    27             {
    28                 MessageBox.Show(filePath + "不是有效的地图文档");
    29             }
    30         }
    加载地图文档中特定地图
     1      
     2         private void saveDocument()
     3         {
     4             if (mapDocument.get_IsReadOnly(mapDocument.DocumentFilename) == true)
     5             {
     6                 MessageBox.Show("地图文档是只读的无法保存");
     7             }
     8        
     9             try
    10             {
    11                 mapDocument.Save(mapDocument.UsesRelativePaths, true);
    12                 MessageBox.Show("保存地图文档成功");
    13             }
    14             catch (Exception e)
    15             {
    16                 MessageBox.Show("保存地图文档失败!!!" + e.ToString());
    17             }
    18         }
    19 
    20         private void saveAsDocument()
    21         {
    22             if (mapDocument.get_IsReadOnly(mapDocument.DocumentFilename) == true)
    23             {
    24                 MessageBox.Show("地图文档是只读的无法保存");
    25             }
    26 
    27             string fileSavePath = @"f:
    ew.mxd";//这里路径不应该写死
    28             SaveFileDialog sfd = new SaveFileDialog();
    29             sfd.Title = "另存为";
    30             sfd.Filter = "map documents(*.mxd)|*.mxd";
    31             sfd.ShowDialog();
    32             fileSavePath = sfd.FileName;
    33             try
    34             {
    35                 mapDocument.SaveAs(fileSavePath, true, true);
    36                 MessageBox.Show("另存地图文档成功");
    37             }
    38             catch (Exception e)
    39             {
    40                 MessageBox.Show("另存地图文档失败!!!" + e.ToString());
    41             }
    42         }
    保存地图文档
  • 相关阅读:
    彻底领悟javascript中的exec与match方法
    javascript doT 使用
    pluginstorage 插件
    html5离线储存,application cache,manifest使用体验
    window.location.hash属性介绍 ajax后退按钮失效问题
    控制textarea光标移到末尾
    webkitanylink 谷歌浏览器CSS之A:HOVER
    正则表达式详细参考文档
    复杂应用的 CSS 性能分析和优化建议
    seaJs api 帮助文档
  • 原文地址:https://www.cnblogs.com/rockman/p/3318763.html
Copyright © 2020-2023  润新知