【AE】【显示操作】

//1局部刷新
    pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics,null, null);
    PartialRefresh
        参数                                  Map视图                       Layout视图
        esriViewBackground                   Map grids                   Page/snap grid
        esriViewGeography                     Layers                         Unused
        esriViewGeoSelection             Feature selection                   Unused
        esriViewGraphics                  Labels/graphics                   Graphics
        esriViewGraphicSelection         Graphic selection              Element selection
        esriViewForeground                     Unused                      Snap guides
//3TOC符号选择器  
      new ToolbarMenuClass()
        .AddItem(new RemoveLayer(), -1, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
        .AddItem(new ZoomToLayer(), -1, 1, true, esriCommandStyles.esriCommandStyleTextOnly);
        .AddItem(object item, int SubType = 0, int index = -1, bool beginGroup = false, esriCommandStyles Style = esriCommandStyles.esriCommandStyleIconAndText);
    
    axTOCControl1.HitTest(e.x, e.y, ref item, ref map, ref layer, ref other, ref index);
        esriTOCControlItem item=esriTOCControlItem.esriTOCControlItemNone;    
        IBasicMap map=null;//返回点击的Map	
            //返回点击的东西的类型(None:没有对象,Map对象,Layer对象,Heading对象的标题,LegendClass对象)
        ILayer layer=null;//返回点击的图层
        object other=null;//返回图例组对象LegendGroup
        object index=null;//返回图例组中图例类索引,根据索引和图例组可获得特定的图例类

//4鹰眼
        private  void  axMapControl1_OnExtentUpdated(object  sender ,IMapControlEvents2_OnExtentUpdatedEvent e)
        {			
            IGraphicsContainer pGC = axMapControl2.Map as IGraphicsContainer;
            pGC.DeleteAllElements();
            
            IRgbColor color=new RgbColorClass();
            color.Red=255;		
            ISimpleLineSymbol pSLS=new SimpleLineSymbolClass();
            pSLS.Color=color;
            
            ISimpleFillSymbol pSFS=new SimpleFillSymbolClass();
            color=new RgbColorClass();
            color.Transparency=0;
            pSFS.Color=color;
            pSFS.Outline=pSLS;
            
            IElement pE=new RectangleElementClass();
            pE.Geometry=(IEnvelope)e.newEnvelope;
            IFillShapeElement pFSE=pE as IFillShapeElement;
            pFSE.Symbol=pSFS;
            
            pGC.AddElement(pFSE as IElement,0);
            axMapControl2.Refresh();
        }
        
        private  void  axMapControl1_OnMapReplaced(object  sender ,IMapControlEvents2_OnMapReplacedEvent e)
        {
            if (axMapControl1.LayerCount > 0)
            {
                axMapControl2.Map = new MapClass();
                for (int i = 0; i <= axMapControl1.Map.LayerCount - 1; i++)
                {
                    axMapControl2.AddLayer(axMapControl1.get_Layer(i));
                }
                axMapControl2.Extent = axMapControl1.Extent;
                axMapControl2.Refresh();
            }
        }
        
        
        private  void  axMapControl2_OnMouseMove(object  sender ,IMapControlEvents2_OnMouseMoveEvent e)
        {
            if (e.button == 1)
            {
                IPoint pPoint = new PointClass();
                pPoint.PutCoords(e.mapX, e.mapY);
                axMapControl1.CenterAt(pPoint);
                axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null,
                null);
            }
        }
        
        private  void  axMapControl2_OnMouseDown(object  sender ,IMapControlEvents2_OnMouseDownEvent e)
        {
            if (axMapControl2.Map.LayerCount > 0)
            {
                if (e.button == 1)
                {
                IPoint pPoint = new PointClass();
                pPoint.PutCoords(e.mapX, e.mapY);
                axMapControl1.CenterAt(pPoint);
                axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null,
                null);
                }
                else if (e.button == 2)
                {
                    IEnvelope pEnv = axMapControl2.TrackRectangle();
                    axMapControl1.Extent = pEnv;
                    axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null,
                    null);
                }
            }
        }

//5屏幕坐标转地图坐标
    using ESRI.ArcGIS.Display;
        
    IScreenDisplay screenDisplay = activeView.ScreenDisplay;
    IDisplayTransformation displayTransformation = screenDisplay.DisplayTransformation;
    displayTransformation.ToMapPoint(screenPoint.X, screenPoint.Y);


//更新axPageLayoutControl
IObjectCopy objectCopy = new ObjectCopyClass();
object toOverwriteMap = axPageLayoutControl1.ActiveView.FocusMap;//axPageLayoutControl1的当前数据框
objectCopy.Overwrite(objectCopy.Copy(axMapControl1.Map), ref toOverwriteMap);//用当前axMapControl1的数据框替换axPageLayoutControl1的数据框

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值