예제 #1
0
        /// <summary>
        /// 当主图视野发生变化时,重新绘制鸟瞰图中的红色矩形框
        /// </summary>
        private void axMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
        {
            // 得到新范围
            IEnvelope          pEnvelope          = (IEnvelope)e.newEnvelope;
            IGraphicsContainer pGraphicsContainer = axMapControl2.Map as IGraphicsContainer;
            IActiveView        pActiveView        = pGraphicsContainer as IActiveView;

            //在绘制前,清除axMapControl2中的任何图形元素
            pGraphicsContainer.DeleteAllElements();
            IRectangleElement pRectangleEle = new RectangleElementClass();
            IElement          pElement      = pRectangleEle as IElement;

            pElement.Geometry = pEnvelope;
            //设置鹰眼图中的红线框
            IRgbColor pColor = new RgbColorClass();

            pColor.Red = 255; pColor.Green = 0; pColor.Blue = 0; pColor.Transparency = 255;
            //产生一个线符号对象
            ILineSymbol pOutline = new SimpleLineSymbolClass();

            pOutline.Width = 3; pOutline.Color = pColor;
            //设置颜色属性
            pColor     = new RgbColorClass();
            pColor.Red = 255; pColor.Green = 0; pColor.Blue = 0; pColor.Transparency = 0;
            //设置填充符号的属性
            IFillSymbol pFillSymbol = new SimpleFillSymbolClass();

            pFillSymbol.Color = pColor; pFillSymbol.Outline = pOutline;
            IFillShapeElement pFillShapeEle = pElement as IFillShapeElement;

            pFillShapeEle.Symbol = pFillSymbol;
            pGraphicsContainer.AddElement((IElement)pFillShapeEle, 0);
            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);//部分刷新
        }
예제 #2
0
        /// <summary>
        /// 主窗体视图范围变化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void axMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
        {
            //获得当前地图视图的外包矩形
            IEnvelope pEnvelope = (IEnvelope)e.newEnvelope;

            //获得GraphicsContainer对象用来管理元素对象
            IGraphicsContainer pGraphicsContainer = axMapControl2.Map as IGraphicsContainer;

            //清除对象中的所有图形元素
            pGraphicsContainer.DeleteAllElements();

            //获得矩形图形元素
            IRectangleElement pRectangleEle = new RectangleElementClass();
            IElement          pElement      = pRectangleEle as IElement;

            pElement.Geometry = pEnvelope;


            //设置FillShapeElement对象的symbol
            IFillShapeElement pFillShapeEle = pElement as IFillShapeElement;

            pFillShapeEle.Symbol = this.Presenter.getFillSymbol();

            //进行填充
            pGraphicsContainer.AddElement((IElement)pFillShapeEle, 0);

            //刷新视图
            IActiveView pActiveView = pGraphicsContainer as IActiveView;

            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
예제 #3
0
        private void axMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
        {
            //定义边界对象
            IEnvelope pEnv;

            pEnv = e.newEnvelope as IEnvelope;
            IGraphicsContainer pGraphicsContainer;
            IActiveView        pActiveView;

            //获取鹰眼图地图数据的图形容器句柄
            try
            {
                pGraphicsContainer = axMapEve.Map as IGraphicsContainer;
                pActiveView        = pGraphicsContainer as IActiveView;
                pGraphicsContainer.DeleteAllElements();
                RectangleElement pRectangleEle;
                pRectangleEle = new RectangleElement();
                IElement pEle;
                pEle          = pRectangleEle as IElement;
                pEle.Geometry = pEnv;
                IRgbColor pColor;
                pColor = new RgbColor();
                pColor.Transparency = 255;
                pColor.Red          = 255;
                ILineSymbol pOutline;
                pOutline            = new SimpleLineSymbol();
                pOutline.Width      = 1;
                pOutline.Color      = pColor;
                pColor              = new RgbColor();
                pColor.Transparency = 0;
                IFillSymbol pFillSymbol;
                pFillSymbol         = new SimpleFillSymbol();
                pFillSymbol.Color   = pColor;
                pFillSymbol.Outline = pOutline;
                IFillShapeElement pFillshapeEle;
                pFillshapeEle        = pEle as IFillShapeElement;
                pFillshapeEle.Symbol = pFillSymbol;
                pEle = pFillshapeEle as IElement;
                pGraphicsContainer.AddElement(pEle, 0);
                pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
            }
            catch (Exception exception)
            {
            }
        }
예제 #4
0
        private void axMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
        {
            IEnvelope          pEnvelope          = (IEnvelope)e.newEnvelope;
            IGraphicsContainer pGraphicsContainer = axMapControl2.Map as IGraphicsContainer;
            IActiveView        pActiveView        = pGraphicsContainer as IActiveView;

            pGraphicsContainer.DeleteAllElements();
            IRectangleElement pRectangleEle = new RectangleElementClass();
            IElement          pElement      = pRectangleEle as IElement;

            pElement.Geometry = pEnvelope;
            IRgbColor pColor = new RgbColorClass();

            pColor.Red          = 255;
            pColor.Green        = 0;
            pColor.Blue         = 0;
            pColor.Transparency = 255;
            ILineSymbol pOutline = new SimpleLineSymbolClass();

            pOutline.Width = 3;
            pOutline.Color = pColor;
            //设置颜色属性
            pColor              = new RgbColorClass();
            pColor.Red          = 255;
            pColor.Green        = 0;
            pColor.Blue         = 0;
            pColor.Transparency = 0;

            IFillSymbol pFillSymbol = new SimpleFillSymbolClass();

            pFillSymbol.Color   = pColor;
            pFillSymbol.Outline = pOutline;
            IFillShapeElement pFillShapeEle = pElement as IFillShapeElement;

            pFillShapeEle.Symbol = pFillSymbol;
            pGraphicsContainer.AddElement((IElement)pFillShapeEle, 0);
            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

            IPoint ll, Ur;

            ll = axMapControl1.Extent.LowerLeft;
            Ur = axMapControl1.Extent.LowerRight;
            toolStripStatusLabel1.Text = "(" + Convert.ToString(ll.X) + "," + Convert.ToString(ll.Y) + ")";
        }
예제 #5
0
        /// <summary>
        /// 主窗体视图范围变化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void axMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
        {
            ////获得当前地图视图的外包矩形
            //IEnvelope pEnvelope = (IEnvelope)e.newEnvelope;

            ////获得GraphicsContainer对象用来管理元素对象
            //IGraphicsContainer pGraphicsContainer = axMapControl2.Map as IGraphicsContainer;

            ////清除对象中的所有图形元素
            //pGraphicsContainer.DeleteAllElements();

            ////获得矩形图形元素
            //IRectangleElement pRectangleEle = new RectangleElementClass();
            //IElement pElement = pRectangleEle as IElement;
            //pElement.Geometry = pEnvelope;


            ////设置FillShapeElement对象的symbol
            //IFillShapeElement pFillShapeEle = pElement as IFillShapeElement;
            //pFillShapeEle.Symbol = this.Presenter.getFillSymbol();

            ////进行填充
            //pGraphicsContainer.AddElement((IElement)pFillShapeEle, 0);

            ////刷新视图
            //IActiveView pActiveView = pGraphicsContainer as IActiveView;
            //pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

            //创建矩形元素
            IFillShapeElement fillShapeElement = ElementsHelper.GetRectangleElement(e.newEnvelope as IGeometry);

            //刷新总览窗体的mapcontrol
            if (m_FormOverview != null && !m_FormOverview.IsDisposed)
            {
                m_FormOverview.UpdateMapControlGraphics(fillShapeElement as IElement);
            }
        }
예제 #6
0
 void m_axmap_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
 {
     toolLabelBLC.Text = "1:" + Math.Round(m_axmap.MapScale, 0).ToString();
 }
예제 #7
0
 private void axMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
 {
     pEnvelope = (IEnvelope)e.newEnvelope;
     DrawRectangle(pEnvelope);
 }
예제 #8
0
 private void axMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
 {
     axMapControl2.Refresh();
 }