wjhgis
路人甲
路人甲
  • 注册日期2005-03-11
  • 发帖数67
  • QQ
  • 铜币359枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:3496回复:13

请问怎么将pagelayout或mapcontrol中的当前地图保存为mxd文件!!!

楼主#
更多 发布于:2005-04-05 22:47
请问怎么将pagelayout或mapcontrol中的当前地图保存为mxd文件!!!
喜欢0 评分0
wjhgis
路人甲
路人甲
  • 注册日期2005-03-11
  • 发帖数67
  • QQ
  • 铜币359枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2005-05-09 09:04
是不是在vb中引用某个类库才能使用这Imapdocument这个接口啊,具体是要引用那个类库呢?(在AO里是查不到,我查过),期待------不胜感激!
举报 回复(0) 喜欢(0)     评分
wjhgis
路人甲
路人甲
  • 注册日期2005-03-11
  • 发帖数67
  • QQ
  • 铜币359枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2005-05-09 08:55
哦,我去查查!谢谢<FONT color=#000066><B>waterblue</B></FONT> !<img src="images/post/smile/dvbbs/em02.gif" />
举报 回复(0) 喜欢(0)     评分
wjhgis
路人甲
路人甲
  • 注册日期2005-03-11
  • 发帖数67
  • QQ
  • 铜币359枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-05-09 08:52
唉,难道这个功能就不能用VB+AO实现吗?仍在期待中------<img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em08.gif" />
举报 回复(0) 喜欢(0)     评分
waterblue
路人甲
路人甲
  • 注册日期2004-09-02
  • 发帖数72
  • QQ
  • 铜币387枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2005-05-07 21:28
<H1>IMapDocument Interface (<a href="mk:@MSITStore:C:\Program%20Files\ArcGIS\DeveloperKit\Help\COM\VB\esriCarto.chm::/Carto_library.htm" target="_blank" >esriCarto</A>)</H1>
<P></P><P>Provides access to members that control the reading and writing of map document files. </P><P><B>Product Availability</B></P><DIV>Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.</DIV><P><B>Description</B></P><P>The IMapDocument interface provides properties and methods for reading map document files (*.mxd, *mxt, *.pmf) and writing and saving changes to map document files (*.mxd). </P>
http://www.geostar.com.cn(吉奥 公司) http://www.waterblue.com.cn(水之灵,蓝之静 个人)
举报 回复(0) 喜欢(0)     评分
wjhgis
路人甲
路人甲
  • 注册日期2005-03-11
  • 发帖数67
  • QQ
  • 铜币359枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2005-05-07 10:46
Ao里面怎么没有这个IMapDocument接口啊!!!!,
举报 回复(0) 喜欢(0)     评分
wjhgis
路人甲
路人甲
  • 注册日期2005-03-11
  • 发帖数67
  • QQ
  • 铜币359枚
  • 威望0点
  • 贡献值0点
  • 银元0个
6楼#
发布于:2005-05-06 21:24
Ao里面没有这个IMapDocument接口啊!!!!,你是engine吧,这个我没用过!!!!!!!!!!!!!!!!!!!<img src="images/post/smile/dvbbs/em05.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em01.gif" />
举报 回复(0) 喜欢(0)     评分
waterblue
路人甲
路人甲
  • 注册日期2004-09-02
  • 发帖数72
  • QQ
  • 铜币387枚
  • 威望0点
  • 贡献值0点
  • 银元0个
7楼#
发布于:2005-04-30 21:28
<P>SaveMapDocument.frm
Option Explicit</P>
<P>Private m_pAoInitialize As IAoInitialize
Private m_pMapDocument As IMapDocument</P>
<P>Private Sub cmdOpen_Click()</P>
<P>  'Open a file dialog for opening map documents
  CommonDialog1.DialogTitle = "Open Map Document"
  CommonDialog1.Filter = "Map Documents (*.mxd)|*.mxd"
  CommonDialog1.ShowOpen
  
  'Exit if no map document is selected
  Dim sFilePath As String
  sFilePath = CommonDialog1.FileName
  If sFilePath = "" Then Exit Sub
  
  'Open document
  OpenDocument (sFilePath)
    
  If cmdSave.Enabled = False Then cmdSave.Enabled = True
  If cmdSaveAs.Enabled = False Then cmdSaveAs.Enabled = True
    
End Sub</P>
<P>Private Sub cmdSave_Click()
  
  'Save changes to the current document
  SaveDocument</P>
<P>End Sub</P>
<P>Private Sub cmdSaveAs_Click()</P>
<P>  'Open a file dialog for saving map documents
  CommonDialog1.DialogTitle = "Save Map Document As"
  CommonDialog1.Filter = "Map Documents (*.mxd)|*.mxd"
  CommonDialog1.ShowSave</P>
<P>  'Exit if no map document is selected
  Dim sFilePath As String
  sFilePath = CommonDialog1.FileName
  If sFilePath = "" Then Exit Sub
  
  If sFilePath = m_pMapDocument.DocumentFilename Then
    'Save changes to the current document
    SaveDocument
  Else
    'SaveAs a new document with relative paths
    m_pMapDocument.SaveAs sFilePath, True
    'Open document
    OpenDocument (sFilePath)
    MsgBox "Document saved successfully!", , "Saved Document"
  End If
  
End Sub</P>
<P>Private Sub Form_Load()
  
  'Create a new AoInitialize object
  Set m_pAoInitialize = New AoInitialize
  If m_pAoInitialize Is Nothing Then
    MsgBox "Unable to initialize. This application cannot run!"
    Unload Form1
    Exit Sub
  End If
  'Determine if the product is available
  If m_pAoInitialize.IsProductCodeAvailable(esriLicenseProductCodeEngine) = esriLicenseAvailable Then
    If m_pAoInitialize.Initialize(esriLicenseProductCodeEngine) <> esriLicenseCheckedOut Then
      MsgBox "The initialization failed. This application cannot run!"
      Unload Form1
      Exit Sub
    End If
  Else
    MsgBox "The ArcGIS Engine product is unavailable. This application cannot run!"
    Unload Form1
    Exit Sub
  End If
  
  'Add toolbar definitions to the ToolbarControl
  ToolbarControl1.AddToolbarDef "esriControlCommands.ControlsPageLayoutToolbar", -1, False, 0, esriCommandStyleIconOnly
  ToolbarControl1.AddToolbarDef "esriControlCommands.ControlsGraphicElementToolbar", -1, True, 0, esriCommandStyleIconOnly
  
  'Set buddy control
  ToolbarControl1.SetBuddyControl PageLayoutControl1
  TOCControl1.SetBuddyControl PageLayoutControl1
    
  cmdSave.Enabled = False
  cmdSaveAs.Enabled = False</P>
<P>End Sub</P>
<P>Private Sub Form_Unload(Cancel As Integer)</P>
<P>  'Shut down the AoInitilaize object
  m_pAoInitialize.Shutdown</P>
<P>End Sub</P>
<P>Public Sub OpenDocument(sFilePath As String)
  
  'Create a new map document
  Set m_pMapDocument = New MapDocument
  'Open the map document selected
  m_pMapDocument.Open sFilePath
  'Set the PageLayoutControl page layout to the map document page layout
  Set PageLayoutControl1.PageLayout = m_pMapDocument.PageLayout
  txtMapDocument.Text = m_pMapDocument.DocumentFilename</P>
<P>End Sub</P>
<P>Public Sub SaveDocument()</P>
<P>  'Check that the document is not read only
  If m_pMapDocument.IsReadOnly(m_pMapDocument.DocumentFilename) = True Then
    MsgBox "This map document is read only!", , "Save Failed"
    Exit Sub
  End If
  'Save with the current relative path setting
  m_pMapDocument.Save m_pMapDocument.UsesRelativePaths
  MsgBox "Changes saved successfully!", , "Saved Document"</P>
<P>End Sub</P>
<P>
 </P>
[此贴子已经被作者于2005-4-30 21:29:16编辑过]
http://www.geostar.com.cn(吉奥 公司) http://www.waterblue.com.cn(水之灵,蓝之静 个人)
举报 回复(0) 喜欢(0)     评分
Yukang_eRen
路人甲
路人甲
  • 注册日期2004-11-12
  • 发帖数2
  • QQ
  • 铜币122枚
  • 威望0点
  • 贡献值0点
  • 银元0个
8楼#
发布于:2005-04-30 20:46
void SaveDocument()
  {
   if(m_MapDocument.get_IsReadOnly(m_MapDocument.DocumentFilename)==true)
   {
    MessageBox.Show("This Map Document is read only!");
    return;
   }
   m_MapDocument.Save(m_MapDocument.UsesRelativePaths,true);
   //MessageBox.Show("Changes saved successfuly!");
  }
举报 回复(0) 喜欢(0)     评分
wjhgis
路人甲
路人甲
  • 注册日期2005-03-11
  • 发帖数67
  • QQ
  • 铜币359枚
  • 威望0点
  • 贡献值0点
  • 银元0个
9楼#
发布于:2005-04-19 20:44
问题还是没有解决,希望大家提供帮助!!1
举报 回复(0) 喜欢(0)     评分
上一页
游客

返回顶部