PIE SDK圖片元素的繪製

 

1. 功能簡介ide

    在數據的處理中會用到圖片元素的繪製,利用IPictureElement圖片元素接口進行繪製,目前PIE SDK支持IPictureElement元素接口的繪製,下面對圖片元素的繪製進行介紹。spa

2. 功能實現說明code

2.1.1. 實現思路及原理說明

第一步視頻

設置圖片的Geometry信息blog

第二步教程

獲取或設置圖片的信息接口

第三步圖片

添加繪製元素ip

2.1.2. 核心接口與方法

接口/類ci

方法/屬性

說明

IGraphicsContainer

AddElement(IElement element)

添加元素

 

IPictureElement

SetImage()

設置圖片

SetVisibility()

設置可見性

Geometry屬性

獲取或設置Geometry

2.1.3. 示例代碼

項目路徑

百度雲盤地址下/PIE示例程序/08元素繪製/05圖片元素的繪製

視頻路徑

百度雲盤地址下/PIE視頻教程/08元素繪製/05圖片元素的繪製.avi

示例代碼

 1         /// <summary>
 2         /// 圖片元素的繪製
 3         /// </summary>
 4         /// <param name="sender"></param>
 5         /// <param name="e"></param>
 6         private void toolStripButton_DrawPicElemnet_Click(object sender, EventArgs e)
 7         {
 8             //1.設置空間位置
 9             IPointCollection polygon = new PIE.Geometry.Polygon();
10             polygon.AddPoint(100, 100);
11             polygon.AddPoint(100, 200);
12             polygon.AddPoint(200, 200);
13             polygon.AddPoint(200, 100);
14             polygon.AddPoint(100, 100);
15 
16             //2.獲得圖片
17             OpenFileDialog openFileDialog = new OpenFileDialog();
18             openFileDialog.Filter = "Picture File|*.bmp";
19             if (openFileDialog.ShowDialog() != DialogResult.OK) return;
20 
21             //3.設置元素的顯示
22             IPictureElement picElement = new PictureElement();
23             picElement.SetImage(openFileDialog.FileName);
24             picElement.SetVisibility(true);
25 
26             //4.在地圖控件中顯示圖片元素
27             picElement.Geometry = polygon as IGeometry;            mapControlMain.ActiveView.GraphicsContainer.AddElement(picElement);            mapControlMain.PartialRefresh(ViewDrawPhaseType.ViewAll);
28         }   
View Code 

2.1.4. 示例截圖

相關文章
相關標籤/搜索