Beispiel #1
0
        public override void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add Pan.OnMouseUp implementation

            //判断是否鼠标左键
            if (Button != 1)
            {
                return;
            }
            //是否漫游状态
            if (!m_PanOperation)
            {
                return;
            }
            IEnvelope pExtent = m_focusScreenDisplay.PanStop();

            //判断移动区域是否为空
            if (pExtent != null)
            {
                m_focusScreenDisplay.DisplayTransformation.VisibleBounds = pExtent;
                m_focusScreenDisplay.Invalidate(null, true, (short)esriScreenCache.esriAllScreenCaches);
            }
            //关闭漫游状态
            m_PanOperation = false;
        }
Beispiel #2
0
        public override void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add Pan.OnMouseUp implementation
            //ÅжÏÊÇ·ñÊó±ê×ó¼ü
            if (Button != 1)
            {
                return;
            }
            //ÊÇ·ñÂþÓÎ״̬
            if (!m_PanOperation)
            {
                return;
            }

            IEnvelope pExtent = m_focusScreenDisplay.PanStop();

            //ÅжÏÒƶ¯ÇøÓòÊÇ·ñΪ¿Õ
            if (pExtent != null)
            {
                m_focusScreenDisplay.DisplayTransformation.VisibleBounds = pExtent;
                m_focusScreenDisplay.Invalidate(null, true, (short)esriScreenCache.esriAllScreenCaches);
            }
            //¹Ø±ÕÂþÓÎ״̬
            m_PanOperation = false;
        }
Beispiel #3
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            m_logoPath = GetLogoPath();
            IMap        map        = m_hookHelper.FocusMap;
            IDynamicMap dynamicMap = map as IDynamicMap;

            IActiveView activeView = map as IActiveView;

            /*IActiveViewEvents_Event */ avEvents = activeView as IActiveViewEvents_Event;
            IDynamicMapEvents_Event dynamicMapEvents = dynamicMap as IDynamicMapEvents_Event;
            IScreenDisplay          screenDisplay    = activeView.ScreenDisplay;

            if (!m_bIsOn)
            {
                avEvents.AfterDraw += new IActiveViewEvents_AfterDrawEventHandler(avEvents_AfterDraw);
                dynamicMapEvents.AfterDynamicDraw += new IDynamicMapEvents_AfterDynamicDrawEventHandler(dynamicMapEvents_AfterDynamicDraw);
            }
            else
            {
                dynamicMapEvents.AfterDynamicDraw -= new IDynamicMapEvents_AfterDynamicDrawEventHandler(dynamicMapEvents_AfterDynamicDraw);
                avEvents.AfterDraw -= new IActiveViewEvents_AfterDrawEventHandler(avEvents_AfterDraw);
            }
            m_bIsOn = !m_bIsOn;
            screenDisplay.Invalidate(null, true, (short)esriScreenCache.esriNoScreenCache);
            screenDisplay.UpdateWindow();
        }
Beispiel #4
0
        public static void FlashGeometry(IScreenDisplay display, IEnumerable <IGeometry> geometries)
        {
            IRgbColor color = new RgbColor();

            color.Green = color.Blue = 0;
            color.Red   = 255;

            short cacheId = display.AddCache();

            display.StartDrawing(display.hDC, cacheId);

            geometries.ToList().ForEach(geometry =>
            {
                if (symbolsToFlash.ContainsKey(geometry.GeometryType))
                {
                    var symbol = symbolsToFlash[geometry.GeometryType].Invoke(color);
                    display.SetSymbol(symbol);
                    actionToFlash[geometry.GeometryType].Invoke(display, geometry);
                }
                else
                {
                    throw new KeyNotFoundException("{0} cannot be found in the Symbol dictionary".InvariantFormat(geometry.GeometryType));
                }
            });

            display.FinishDrawing();

            tagRECT rect = new tagRECT();

            display.DrawCache(display.hDC, cacheId, ref rect, ref rect);
            System.Threading.Thread.Sleep(300);
            display.Invalidate(rect: null, erase: true, cacheIndex: cacheId);
            display.RemoveCache(cacheId);
        }
Beispiel #5
0
        public void OnMouseUp(int button, int shift, int x, int y)
        {
            if (button != 1)
            {
                return;
            }

            if (!m_PanOperation)
            {
                return;
            }

            IEnvelope extent = m_focusScreenDisplay.PanStop();

            //Check if user dragged a rectangle or just clicked.
            //If a rectangle was dragged, m_ipFeedback in non-NULL
            if (extent != null)
            {
                m_focusScreenDisplay.DisplayTransformation.VisibleBounds = extent;
                m_focusScreenDisplay.Invalidate(null, true, (short)esriScreenCache.esriAllScreenCaches);
            }

            m_PanOperation = false;
        }
        ///<summary>Flash geometry on the display.</summary>
        ///<param name="geometry"> The input IGeometry to flash.  Supported geometry types are GeometryBag, Polygon, Polyline, Point and Multipoint.</param>
        ///<param name="screenDisplay">An IScreenDisplay reference</param>
        ///<param name="delay">An integer that is the time in milliseconds to wait.</param>
        public static void FlashGeometry(IGeometry geometry, IScreenDisplay screenDisplay, int delay, int times)
        {
            if (geometry == null || screenDisplay == null)
            {
                return;
            }
            bool continueFlashing = true;

            using (ComReleaser comReleaser = new ComReleaser())
            {
                ITrackCancel cancelTracker = new CancelTrackerClass();
                comReleaser.ManageLifetime(cancelTracker);
                screenDisplay.CancelTracker = cancelTracker;
                short cacheID = screenDisplay.AddCache();
                int cacheMemDC = screenDisplay.get_CacheMemDC(cacheID);
                
                IRgbColor fillColor = new RgbColorClass();
                comReleaser.ManageLifetime(fillColor);
                fillColor.Green = 128;
                IRgbColor lineColor = new RgbColorClass();
                comReleaser.ManageLifetime(lineColor);

                screenDisplay.StartDrawing(cacheMemDC, cacheID);
                DrawGeometry(geometry, fillColor, lineColor, (IDisplay)screenDisplay, cancelTracker);
                ESRI.ArcGIS.esriSystem.tagRECT RECT = new tagRECT();
                screenDisplay.FinishDrawing();

                for (int j = 0; j < times; j++)
                {
                    if (continueFlashing == true)
                    {
                        screenDisplay.DrawCache(screenDisplay.hDC, cacheID, ref RECT, ref RECT);
                        if (delay > 0)
                        {
                            System.Threading.Thread.Sleep(delay);
                            screenDisplay.Invalidate(null, true, cacheID);
                            screenDisplay.UpdateWindow();
                            System.Threading.Thread.Sleep(delay);
                        }
                    }
                }
                //---------------------------------------------------------------------

                screenDisplay.RemoveCache(cacheID);
                cancelTracker.Reset();
            }
        }