C#制作Arcgis Engine鹰眼全过程(引自ESRI中国社区)
1.? axMapControl1是主控件,axMapControl2是鷹眼控件 ??
2.? 1.鷹眼地圖資源載入 ??
3.? private?void?axMapControl1_OnMapReplaced(object?sender,?IMapControlEvents2_OnMapReplacedEvent?e) ??
4.? ????????{ ??
5.? ????????????//當主地圖顯示控件的地圖更換時,鷹眼中的地圖也跟隨更換 ??
6.? ???????????axMapControl2.LoadMxFile(axMapControl1.DocumentFilename); ??
7.? ????????????axMapControl2.Extent?=?axMapControl2.FullExtent; ??
8.? ????????} ??
9.? 2.繪制鷹眼矩形框 ??
10.private?void?axMapControl1_OnExtentUpdated(object?sender,?IMapControlEvents2_OnExtentUpdatedEvent?e) ??
11.????????{ ??
12.????????????//?得到新范圍 ??
13.???????????IEnvelope?pEnv?=?(IEnvelope)e.newEnvelope; ??
14.???????????IGraphicsContainer?pGra?=?axMapControl2.Map?as?IGraphicsContainer; ??
15.???????????IActiveView?pAv?=?pGra?as?IActiveView; ??
16.???????????//在繪制前,清除axMapControl2中的任何圖形元素 ??
17.???????????pGra.DeleteAllElements(); ??
18.?????????IRectangleElement?pRectangleEle?=?new?RectangleElementClass(); ??
19.??????????IElement?pEle?=?pRectangleEle?as?IElement; ??
20.??????????pEle.Geometry?=?pEnv; ??
21.??????????//設置鷹眼圖中的紅線框 ??
22.??????????IRgbColor?pColor?=?new?RgbColorClass(); ??
23.???????????pColor.Red?=?255; ??
24.???????????pColor.Green?=?0; ??
25.??????????pColor.Blue?=?0; ??
26.???????????pColor.Transparency?=?255; ??
27.???????????//產生一個線符號對象 ??
28.???????????ILineSymbol?pOutline?=?new?SimpleLineSymbolClass(); ??
29.???????????pOutline.Width?=?2; ??
30.???????????pOutline.Color?=?pColor; ??
31.????????????//設置顏色屬性 ??
32.???????????pColor?=?new?RgbColorClass(); ??
33.???????????pColor.Red?=?255; ??
34.????????????pColor.Green?=?0; ??
35.???????????pColor.Blue?=?0; ??
36.????????????pColor.Transparency?=?0; ??
37.????????????//設置填充符號的屬性 ??
38.????????????IFillSymbol?pFillSymbol?=?new?SimpleFillSymbolClass(); ??
39.????????????pFillSymbol.Color?=?pColor; ??
40.????????????pFillSymbol.Outline?=?pOutline; ??
41.????????????IFillShapeElement?pFillShapeEle?=?pEle?as?IFillShapeElement; ??
42.????????????pFillShapeEle.Symbol?=?pFillSymbol; ??
43.???????????pGra.AddElement((IElement)pFillShapeEle,?0); ??
44.???????????pAv.PartialRefresh(esriViewDrawPhase.esriViewGraphics,?null,?null); ??
45.????????} ??
46.3.?實現互動 ??
47.???private?void?axMapControl2_OnMouseDown(object?sender,?IMapControlEvents2_OnMouseDownEvent?e) ??
48.????????{ ??
49.???????????IPoint?pPt=new?PointClass?(); ??
50.???????????pPt.PutCoords?(e.mapX?,e.mapY?); ??
51.????????????//改變主控件的視圖范圍 ??
52.??????????axMapControl1?.CenterAt?(pPt?); ??
53.????????}??
總結
以上是生活随笔為你收集整理的C#制作Arcgis Engine鹰眼全过程(引自ESRI中国社区)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CF1142C U2(计算几何,凸包)
- 下一篇: 【SR汇总】基于深度学习方法