怎么实现在ArcGIS Engine中画图

 我来答
匿名用户
2016-07-17
展开全部
在AE中这叫点选查询,其中你可以用你自己的坐标来替换下面的IMappMap=axMapControl1.Map;IActiveViewpActiveView=pMapasIActiveView;IFeatureLayerpFeatureLayer=pMap.get_Layer(0)asIFeatureLayer;IFeatureClasspFeatureClass=pFeatureLayer.FeatureClass;//设置点击点的位置IPointpoint=pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x,e.y);ITopologicalOperatorpTOpo=pointasITopologicalOperator;doublelength;length=ConvertPixelsToMapUnits(pActiveView,4);IGeometrypBuffer=pTOpo.Buffer(length);IGeometrypGeomentry=pBuffer.Envelope;//空间滤过器ISpatialFilterpSpatialFilter=newSpatialFilter();pSpatialFilter.Geometry=pGeomentry;//根据被选择要素的不同,设置不同的空间滤过关系switch(pFeatureClass.ShapeType){caseesriGeometryType.esriGeometryPoint:pSpatialFilter.SpatialRel=esriSpatialRelEnum.esriSpatialRelContains;break;caseesriGeometryType.esriGeometryPolyline:pSpatialFilter.SpatialRel=esriSpatialRelEnum.esriSpatialRelCrosses;break;caseesriGeometryType.esriGeometryPolygon:pSpatialFilter.SpatialRel=esriSpatialRelEnum.esriSpatialRelIntersects;break;}IFeatureSelectionpFSelection=pFeatureLayerasIFeatureSelection;pFSelection.SelectFeatures(pSpatialFilter,esriSelectionResultEnum.esriSelectionResultNew,false);ISelectionSetpSelectionset=pFSelection.SelectionSet;ICursorpCursor;pSelectionset.Search(null,true,outpCursor);IFeatureCursorpFeatCursor=pCursorasIFeatureCursor;IFeaturepFeature=pFeatCursor.NextFeature();while(pFeature!=null){pMap.SelectFeature(pFeatureLayer,pFeature);pFeature=pFeatCursor.NextFeature();pFeture.get_value("");//在这里你可以写上想要获取的属性的字段}pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphicSelection,null,null);上述的自定义函数是将距离的转换privatedoubleConvertPixelsToMapUnits(IActiveViewpActiveView,doublepixelUnits){//UsestheratioofthesizeofthemapinpixelstomapunitstodotheconversionIPointp1=pActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds.UpperLeft;IPointp2=pActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds.UpperRight;intx1,x2,y1,y2;pActiveView.ScreenDisplay.DisplayTransformation.FromMapPoint(p1,outx1,outy1);pActiveView.ScreenDisplay.DisplayTransformation.FromMapPoint(p2,outx2,outy2);doublepixelExtent=x2-x1;doublerealWorldDisplayExtent=pActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds.Width;doublesizeOfOnePixel=realWorldDisplayExtent/pixelExtent;returnpixelUnits*sizeOfOnePixel;}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
博思aippt
2024-07-20 广告
博思AIPPT是基于ai制作PPT的智能在线工具,它提供了4种AI制作PPT的方式,包括AI生成大纲、AI直接生成PPT、文本生成PPT、AI提炼文档生成PPT,一站式集成多种AI生成PPT的方式,可满足办公用户的不同需求和使用场景。ai生... 点击进入详情页
本回答由博思aippt提供
就烦条0o
2016-07-17 · 知道合伙人软件行家
就烦条0o
知道合伙人软件行家
采纳数:33315 获赞数:46492
从事多年系统运维,喜欢编写各种小程序和脚本。

向TA提问 私信TA
展开全部
画点

IPoint pt;
pt = axMapControl1.ToMapPoint(e.x, e.y);
IMarkerElement pMarkerElement;
pMarkerElement = new MarkerElementClass();
IElement pElement;
pElement = pMarkerElement as IElement;
pElement.Geometry = pt;
pGraphicsContainer = pMap as IGraphicsContainer;
pGraphicsContainer.AddElement((IElement)pMarkerElement, 0);
pActiveView.Refresh();

画线

IGeometry polyline;
polyline = axMapControl1.TrackLine();
ILineElement pLineElement;
pLineElement = new LineElementClass();
IElement pElement;
pElement = pLineElement as IElement;
pElement.Geometry = polyline;
pGraphicsContainer = pMap as IGraphicsContainer;
pGraphicsContainer.AddElement((IElement)pLineElement, 0);
pActiveView.Refresh();

画面

IGeometry Polygon;
Polygon = axMapControl1.TrackPolygon();
IPolygonElement PolygonElement;
PolygonElement = new PolygonElementClass();
IElement pElement;
pElement = PolygonElement as IElement;
pElement.Geometry = Polygon;
pGraphicsContainer = pMap as IGraphicsContainer;
pGraphicsContainer.AddElement((IElement)PolygonElement, 0);
pActiveView.Refresh();
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式