在PIE SDK中,全部的製圖元素、視圖範圍以及排版等均可以保存成一個模板,以供屢次重複使用。使用時只須要打開該模板,加載相應數據,就能夠直接出圖了,省去了重複製做圖幅的麻煩,方便快捷。ide
每一個地圖模板都是一個地圖文檔(PmdContents),它被保存爲*.pmd文件。spa
[模板文件] [植被指數模板]3d
在PIE中,每一個顯示的地圖都是一個地圖文檔(PmdContents),它能夠保存爲*.pmd文件。用IMapDocument接口的Open方法能夠直接打開地圖文檔。另外咱們還能夠從地圖文檔中得到製圖對象。code
2.2 實現思路及原理說明orm
第一步視頻 |
選擇模板文件對象 |
第二步blog |
建立一個mapDocument,並打開(open)模板文件教程 |
第三步接口 |
調用IPageLayoutControl的LoadPmdFile方法 |
第四步 |
刷新視圖 |
接口/類 |
方法 |
說明 |
MapDocument |
Open () |
打開一個地圖文檔 |
IPageLayoutControl |
LoadPmdFile() |
加載地圖文檔 |
項目路徑 |
百度雲盤地址下/PIE示例程序/09.專題製圖/01打開模板 |
代碼位置 |
FormPagelayoutDemo. barButtonItem_Open_ItemClick方法 |
視頻路徑 |
百度雲盤地址下/PIE視頻教程/09.專題製圖/01打開模板.avi |
示例代碼 |
|
![]() 1 /// <summary> 2 /// 打開模板 3 /// </summary> 4 /// <param name="sender"></param> 5 /// <param name="e"></param> 6 private void barButtonItem_Open_ItemClick (object sender,ItemClickEventArgs e) 7 { 8 //1.選擇模板文件 9 OpenFileDialog openFileDialog = new OpenFileDialog(); 10 openFileDialog.Title = "請選擇要打開的模板:"; 11 openFileDialog.Multiselect = false; 12 openFileDialog.Filter = "pmd|*.pmd|All Files|*.*"; 13 if (openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; 14 15 string filePath = openFileDialog.FileName; 16 string fileName = System.IO.Path.GetFileNameWithoutExtension(filePath); 17 //2.打開模板 18 IMapDocument mapDocument = new MapDocument(); 19 if (!mapDocument.Open(filePath)) return; 20 //3 load 21 m_pageLayoutControl.LoadPmdFile(filePath); 22 (m_pageLayoutControl as Control).Tag = mapDocument; 23 //4.刷新視圖 m_pageLayoutControl.ActiveView.PartialRefresh(ViewDrawPhaseType.ViewAll); 24 } |