Provides access to members that control the reading and writing of map document files.(提供访问的成员,控制读写地图文档文件)
1:MapDocumentClass Class
The MapDocument coclass is used to read and write map document files.(地图文档组件类是用于读写地图文档文件。)实现了IMapDocument接口。
m_MapDocument = new MapDocumentClass();
2:Open Method
[C#]public void Open (string sDocument,string bsPassword);
[C++]HRESULT Open( BSTR sDocument, BSTR bsPassword);
The MapDocument will be cached so no other users will be able to access the MapDocument until it has been closed.(MapDocument将会被缓存,所以没有其他用户可以访问MapDocument,除非它已被关闭。)Before using the Open methods check whether the specified document
IsPresent,
IsRestricted,
IsMapDocument and
IsPasswordProtected. If the MapDocument is password protected, specify the password in the Open method.
3:MapCount Property
The number of Map objects contained within the map document
// 使用IMapDocument打开文档
IMapDocument m_MapDocument;
private void LoadMapDoc()
{
m_MapDocument = new MapDocumentClass();
try
{
//打开文档对话框选择MXD文件
System.Windows.Forms. OpenFileDialog openFileDialog2;
openFileDialog2 = new OpenFileDialog();
openFileDialog2.Title = "Open Map Document";
openFileDialog2.Filter = "Map Documents (*.mxd)|*.mxd";
openFileDialog2.ShowDialog();
string sFilePath = openFileDialog2.FileName;
//将数据加载到pMapDocument并与MapControl联系起来
m_MapDocument.Open(sFilePath, "");
int i;
int sum = m_MapDocument.MapCount ;
for (i = 0; i <sum; i++)
{
// 一个IMapDocument对象中可能包含很多Map对象,遍历map对象
axMapControl1.Map = m_MapDocument.get_Map(i);
}
// 刷新地图控件
axMapControl1.Refresh();
}
catch ( Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
4:Map Property
[C#]public IMap get_Map (int mapIndex);
[C++]HRESULT get_Map(long mapIndex, IMap** ppMap);
5:IsReadOnly Property
[C#]public bool get_IsReadOnly (string sDocument);
[C++]HRESULT get_IsReadOnly( BSTR sDocument, VARIANT_BOOL* IsReadOnly);
Determines whether the specified file is read only. The
Save method cannot overwrite a read-only MapDocument, use the
SaveAs to write to a new document.(保存方法不能覆盖只读的地图文件,使用另存为)
6:Save Method
[C#]public void Save (bool bUseRelativePaths, bool bCreateThumnbail);
[C#]
Optional Values
bUseRelativePaths Supply true as a default value.(true代码默认值)
bCreateThumnbail Supply true as a default value.
[C++]HRESULT Save(VARIANT_BOOL bUseRelativePaths,VARIANT_BOOL bCreateThumnbail);
7:UsesRelativePaths Property
[C#]public
boolUsesRelativePaths {get;}
[C++]HRESULT get_UsesRelativePaths(VARIANT_BOOL* bUsesRelativePaths);文件是
Indicates if the data in the map document is referenced using relative paths.
(表明如果数据在地图文件是使用相对路径引用。)
// 使用IMapDocument保存文档
private void SaveDocument()
{
// 判断文档是否为只读
if (m_MapDocument.get_IsReadOnly(m_MapDocument.DocumentFilename))
{
MessageBox.Show( "This map document is read only!");
return;
}
//用当前的文件路径设置保存文件
m_MapDocument.Save(m_MapDocument.UsesRelativePaths, true);
MessageBox.Show( "Changes saved successfully!");
}
8:SaveAs Method
Save the contents of the map document to the specified file name.
[C#]public void SaveAs (string sDocument, bool bUseRelativePaths, boolbCreateThumnbail);
Optional Values
bUseRelativePaths Supply true as a default value.
bCreateThumnbail Supply true as a default value.
// 地图文档另存为
private void SaveAsDocument ()
{
//Open a file dialog for saving map documents
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Title = "Save Map Document As";
saveFileDialog1.Filter = "Map Documents (*.mxd)|*.mxd";
saveFileDialog1.ShowDialog();
//Exit if no map document is selected
string sFilePath = saveFileDialog1.FileName;
if (sFilePath == "")
{
return;
}
if (sFilePath == m_MapDocument.DocumentFilename)
{
// 当选择文件和当前文件相同时,保存即可
SaveDocument();
}
else
{
//SaveAs a new document with relative paths
m_MapDocument.SaveAs(sFilePath, true, true);
//Open document
MessageBox.Show( "Document saved successfully!");
}
}
- angular2系列教程(七)Injectable、Promise、Interface、使用服务
今天我们要讲的ng2的service这个概念,和ng1一样,service通常用于发送http请求,但其实你可以在里面封装任何你想封装的方法,有时候控制器之间的通讯也是依靠service来完成的,让我 ...
- 接口--interface
“interface”(接口)关键字使抽象的概念更深入了一层.我们可将其想象为一个“纯”抽象类.它允许创建者规定一个类的基本形式:方法名.自变量列表以及返回类型,但不规定方法主体.接口也包含了基本数据 ...
- Configure a bridge interface over a VLAN tagged bonded interface
SOLUTION VERIFIED February 5 2014 KB340153 Environment Red Hat Enterprise Linux 6 (All Versions) Red ...
- Create a bridge using a tagged vlan (8021.q) interface
SOLUTION VERIFIED April 27 2013 KB26727 Environment Red Hat Enterprise Linux 5 Red Hat Enterprise Li ...
- Configure a bridged network interface for KVM using RHEL 5.4 or later?
environment Red Hat Enterprise Linux 5.4 or later Red Hat Enterprise Linux 6.0 or later KVM virtual ...
- Set up VLAN (802.1q) tagging on a network interface?
SOLUTION VERIFIED October 13 2015 KB39674 KB741413 environment Red Hat Enterprise Linux 4 Red Hat En ...
- 谨慎使用Marker Interface
之所以写这篇文章,源自于组内的一些技术讨论.实际上,Effective Java的Item 37已经详细地讨论了Marker Interface.但是从整个Item的角度来看,其对于Marker In ...
- 浅析Go语言的Interface机制
前几日一朋友在学GO,问了我一些interface机制的问题.试着解释发现自己也不是太清楚,所以今天下午特意查了资料和阅读GO的源码(基于go1.4),整理出了此文.如果有错误的地方还望指正. GO语 ...
- 如何设计一门语言(七)——闭包、lambda和interface
人们都很喜欢讨论闭包这个概念.其实这个概念对于写代码来讲一点用都没有,写代码只需要掌握好lambda表达式和class+interface的语义就行了.基本上只有在写编译器和虚拟机的时候才需要管什么是 ...
- 流媒体学习二-------SIP协议学习(基本场景分析 )
作者:gnuhpc 出处:http://www.cnblogs.com/gnuhpc/ 1.SIP业务基本知识 1.1 业务介绍 会话初始协议(Session Initiation Protocol) ...
- Moogoose操作之Schema实现增删查改
Schema不仅定义了文档结构和使用性能,可以为后面的Model和Entity提供公共的属性和方法. Schema.Model.Entity的关系: Schema : 可以定义字段类型,不具备数据库的 ...
- Linux中的ps命令
Linux中ps命令用来列出系统中当前运行的那些进程. 使用格式:ps 参数 如:ps -A 通过man ps可以获得ps的详细参数用法 -A 显示所有进程信息 c 列出程序时,显示每个程序真正的 ...
- 20145211 《Java程序设计》实验报告四: Android开发基础
实验内容 基于Android Studio开发简单的Android应用并部署测试; 了解Android组件.布局管理器的使用: 掌握Android中事件处理机制. Android Studio安装 实 ...
- [Stanford 2011] 知识点小结
1.获得帮助:option+click / option+double click 2.@property里的nonatomic,表示非原子性访问,atomic是obj-c里使用的一种线程保护技术, ...
- 转:Asp.net Mvc4默认权限详细(上)
前言 上篇的菜鸟去重复之Sql的问题还没有得到满意的答案.如果哪位大哥有相关的资料解释,能够分享给我,那就太谢谢了. 以后每发表一篇博文我都会将以前遗留的问题在前言里指出,直到解决为止. 本文主要在于 ...
- Vim-Vundle-plugins-scripts
配置文件.vimrc set tabstop= set softtabstop= set shiftwidth= set noexpandtab set autoindent set cindent ...
- 实战案例:DIV嵌套
缘于页面结构语义化的考虑,我们应该慎用div和span这两个通用元素,只有当划分页面结构模块时才使用div元素,因为模块本身是没有任何语义的,他仅代表一块独立的结构.如果想对段落内部分内联元素或文本应 ...
- python笔记 - day6
python笔记 - day6 参考: http://www.cnblogs.com/wupeiqi/articles/5501365.html 大纲: 利用递归,实现阶乘: Python反射 pyt ...
- 磁盘空间已满导致rabbitmq无法启动
rabbitmq-server 启动问题 今天遇到一个挺奇怪的 rabbitmq-server 的启动问题. 在内部使用的 openstack 环境上,rabbitmq-server突然就关掉了,无法 ...