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的语义就行了.基本上只有在写编译器和虚拟机的时候才需要管什么是 ...
- 后台获取前台runat=server的select的值
<li> <asp:Label ID="Lpro" runat="server" Text="省份:" CssClass= ...
- php apc
APC,全称是Alternative PHP Cache,官方翻译叫”可选PHP缓存”.它为我们提供了缓存和优化PHP的中间代码的框架. APC的缓存分两部分:系统缓存和用户数据缓存. 系统缓存 它是 ...
- java中的trim()
trim():去掉字符串首尾的空格.但该方法并不仅仅是去除空格,它能够去除从编码'\u0000′ 至 '\u0020′ 的所有字符. 回车换行也在这20个字符 例1: public static vo ...
- 设计模式:抽象工厂模式(Abstract Factory)
定 义:提供一个创建一系列相关或相互依赖对象的接口,而无需指定它们具体的类. 结构图: 示例结构图: 实体类: class User { public int Id { get; set; } p ...
- Dynamics AX Read OLEDB
static System.Data.DataTable getOLEDB_Record(str _dbPath,str _query) { System.Data.OleDb.OleDbConnec ...
- [LeetCode]题解(python):064-Minimum Path Sum
题目来源 https://leetcode.com/problems/minimum-path-sum/ Given a m x n grid filled with non-negative num ...
- sqlserver 中server 函数GETDATE(),DEFAULT用法
alter table Persons add datenow date DEFAULT GETDATE() null, datetimenow datetime DEFAULT GETDATE()n ...
- Hibernate 代码生成器
Hibernate 代码生成器 点击Hibernate Code Generation 点击以下 创建管理代码生成配置 点击RUN.自动生成
- 【转】Android 获得view的宽和高
转自:http://blog.csdn.net/yangdeli888/article/details/25405263 Android 获得view的宽和高 分类: android 技术点项目20 ...
- sell- 获取邮箱的后缀
1. public static void main(String[] args) { System.out.println(getEmailSuffix("jim_chen28270@16 ...