欢迎来到天天文库
浏览记录
ID:1195894
大小:35.00 KB
页数:6页
时间:2017-11-08
《ae开发之地图操作》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingESRI.ArcGIS.Carto;usingESRI.ArcGIS.Geometry;usingESRI.ArcGIS.Display;usingESRI.ArcGIS.Controls;namespaceGISExercise{classOperateGeomap{//定义鼠标与控件交互式操作的公共方法publicvoidOperateGeomaP1(AxMapControlaxMapControl1,IMapControl
2、Events2_OnMouseDownEvente,stringstrOperType1){switch(strOperType1){//用鼠标拖曳确定地图显示范围case"LKXS":{axMapControl1.MousePointer=esriControlsMousePointer.esriPointerCrosshair;//改变鼠标样式axMapControl1.Extent=axMapControl1.TrackRectangle();//将地图控件显示范围设置为当前拖曳的矩形区域axMapControl1.ActiveView.PartialRefresh(esriViewD
3、rawPhase.esriViewGeography,null,null);//刷新地图break;}//移动地图、地图漫游case"DTMY":{axMapControl1.Pan();break;}//绘制点case"HZD":{IMappMap;IActiveViewpActiveView;pMap=axMapControl1.Map;pActiveView=pMapasIActiveView;//新建点对象IPointpPt;pPt=newPointClass();pPt.PutCoords(e.mapX,e.mapY);//产生一个Market元素IMarkerElementpMa
4、rkerElement;pMarkerElement=newMarkerElementClass();//产生修饰Marker元素的SymbolISimpleMarkerSymbolpMarkerSymbol;pMarkerSymbol=newSimpleMarkerSymbolClass();//设置符号颜色IRgbColorpColor;pColor=newRgbColorClass();pColor.Red=150;pColor.Blue=200;pColor.Green=250;pMarkerSymbol.Color=pColor;//用户动态设定//设置符号大小pMarkerSym
5、bol.Size=10;//设置符号类型pMarkerSymbol.Style=esriSimpleMarkerStyle.esriSMSDiamond;//点符号也由用户动态选择IElementpElement;pElement=pMarkerElementasIElement;//得到Element的接口对象,用于设置元素的GeometrypElement.Geometry=pPt;pMarkerElement.Symbol=pMarkerSymbol;IGraphicsContainerpGraphicsContainer;pGraphicsContainer=pMapasIGraph
6、icsContainer;//将元素添加到Map中pGraphicsContainer.AddElement(pMarkerElementasIElement,0);pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics,null,null);break;}//绘制线case"HZX":{IMappMap;IActiveViewpActiveView;pMap=axMapControl1.Map;pActiveView=pMapasIActiveView;IPolylinepPolyline;pPolyline=axMapC
7、ontrol1.TrackLine()asIPolyline;//产生一个SimpleLineSymbol符号ISimpleLineSymbolpSimpleLineSym;pSimpleLineSym=newSimpleLineSymbolClass();pSimpleLineSym.Style=esriSimpleLineStyle.esriSLSSolid;//需要用户动态选择IRgbColorpCol
此文档下载收益归作者所有