Example #1
0
 public override void OnMouseUp(int button, int shift, int x, int y)
 {
     if (this.inewEnvelopeFeedback_0 != null)
     {
         IEnvelope geometry = this.inewEnvelopeFeedback_0.Stop();
         this.inewEnvelopeFeedback_0 = null;
         IElement element = new RectangleElement
         {
             Geometry = geometry
         };
         INewElementOperation operation = new NewElementOperation
         {
             ActiveView  = this._context.ActiveView,
             Element     = element,
             ContainHook = this.method_0()
         };
         this._context.OperationStack.Do(operation);
         //if (this._context.Hook is IApplication)
         //{
         //	if ((this._context.Hook as IApplication).ContainerHook != null)
         //	{
         //		DocumentManager.DocumentChanged((this._context.Hook as IApplication).ContainerHook);
         //	}
         //	else
         //	{
         //		DocumentManager.DocumentChanged((this._context.Hook as IApplication).Hook);
         //	}
         //}
         //else
         //{
         //	DocumentManager.DocumentChanged(this._context.Hook);
         //}
     }
 }
Example #2
0
        protected override void OnMouseDown(MouseEventArgs arg)
        {
            base.OnMouseDown(arg);

            if (Editor.ActiveLayer != null)
            {
                try
                {
                    Display.ClearElement(Editor.Selections.GetAllGraphicElements());
                    Editor.Selections.Clear();

                    IRgbColor color = new RgbColorClass();
                    color.Red   = 255;
                    color.Green = 255;
                    color.Blue  = 255;

                    ISimpleLineSymbol lineSymbol = new SimpleLineSymbolClass();
                    lineSymbol.Width = 1;
                    lineSymbol.Color = (IColor)color;

                    IPoint startCoor = Editor.ScreenCoor2MapCoor(arg.X, arg.Y);
                    newEnvelopeFeedback         = new NewEnvelopeFeedbackClass();
                    newEnvelopeFeedback.Display = ArcMap.Document.ActiveView.ScreenDisplay;
                    newEnvelopeFeedback.Symbol  = (ISymbol)lineSymbol;
                    newEnvelopeFeedback.Start(startCoor);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("Unfortunately, the application meets an error.\n\nSource: {0}\nSite: {1}\nMessage: {2}", ex.Source, ex.TargetSite, ex.Message), "Error");
                }
            }
        }
Example #3
0
        public override void OnMouseUp(int button, int shift, int x, int y)
        {
            if (!this._inZoom)
            {
                return;
            }

            this.m_cursor = this._cursor;
            this._inZoom  = false;
            IActiveView activeView = (IActiveView)this._context.FocusMap;
            IEnvelope   envelope;

            if (this._envelopeFeedback == null)
            {
                envelope = activeView.Extent;
                envelope.Expand(0.5, 0.5, true);
                envelope.CenterAt(this._iPoint);
            }
            else
            {
                envelope = this._envelopeFeedback.Stop();
                if (envelope.Width == 0.0 || envelope.Height == 0.0)
                {
                    envelope = activeView.Extent;
                    envelope.Expand(0.5, 0.5, true);
                    envelope.CenterAt(this._iPoint);
                }
            }
            activeView.Extent      = envelope;
            this._envelopeFeedback = null;
            activeView.Refresh();
        }
Example #4
0
        private void Reset()
        {
            if (m_pCursor != null)
            {
                m_pCursor = null;
            }
            if (m_pGraph != null)
            {
                if (m_pGraph != null)
                {
                    m_pGraph.SetEmpty();
                }
            }
            bBegineMove = false;

            m_bIsSelect = false;
            bBegineMove = false;
            button1     = 1;

            m_pFeedbackEnve = null;
            m_OriginFeatureArray.RemoveAll();

            m_pActiveView.GraphicsContainer.DeleteAllElements();
            m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, m_pEnvelope);            //视图刷新
            m_pEnvelope = null;

            m_pStatusBarService.SetStateMessage("就绪");
        }
Example #5
0
        public override void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            IActiveView activeView = this._context.ActiveView;

            if (activeView is IPageLayout)
            {
                this.bool_0 = false;
                IEnvelope envelope;
                if (this.inewEnvelopeFeedback_0 == null)
                {
                    envelope = activeView.Extent;
                    envelope.Expand(0.5, 0.5, true);
                    envelope.CenterAt(this._pPoint0);
                }
                else
                {
                    envelope = this.inewEnvelopeFeedback_0.Stop();
                    this.inewEnvelopeFeedback_0 = null;
                    if (envelope.Width == 0.0 || envelope.Height == 0.0)
                    {
                        envelope = activeView.Extent;
                        envelope.Expand(0.5, 0.5, true);
                        envelope.CenterAt(this._pPoint0);
                    }
                }
                activeView.Extent = envelope;
                activeView.Refresh();
            }
        }
Example #6
0
 private void axPageLayoutControl1_OnMouseDown(object sender, IPageLayoutControlEvents_OnMouseDownEvent e)
 {
     axPageLayoutControl1.Pan();
     try
     {
         if (_enumMapSurType != EnumMapSurroundType.None)
         {
             IActiveView pActiveView = null;
             pActiveView = axPageLayoutControl1.PageLayout as IActiveView;
             m_PointPt   = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y);
             if (pNewEnvelopeFeedback == null)
             {
                 pNewEnvelopeFeedback         = new NewEnvelopeFeedbackClass();
                 pNewEnvelopeFeedback.Display = pActiveView.ScreenDisplay;
                 pNewEnvelopeFeedback.Start(m_PointPt);
             }
             else
             {
                 pNewEnvelopeFeedback.MoveTo(m_PointPt);
             }
         }
     }
     catch
     {
     }
 }
Example #7
0
        private void SetNewLineFeedBack()
        {
            m_pEnvFeedback = new NewEnvelopeFeedback();
            IRgbColor pColor = new RgbColor();

            pColor.Red   = 0;
            pColor.Green = 0;
            pColor.Blue  = 0;

            m_LineSym       = new SimpleLineSymbol();
            m_LineSym.Color = pColor;
            m_LineSym.Width = 1;
            m_LineSym.Style = esriSimpleLineStyle.esriSLSSolid;

            ISymbol pSym = m_LineSym as ISymbol;

            pSym.ROP2             = esriRasterOpCode.esriROPNotXOrPen;
            m_pEnvFeedback.Symbol = pSym;

            m_hookHelper.ActiveView.ScreenDisplay.StartDrawing(m_hookHelper.ActiveView.ScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);
            m_hookHelper.ActiveView.ScreenDisplay.SetSymbol(pSym);
            m_hookHelper.ActiveView.ScreenDisplay.FinishDrawing();

            m_pEnvFeedback.Display = m_hookHelper.ActiveView.ScreenDisplay;
        }
Example #8
0
        public override void OnMouseUp(int button, int shift, int x, int y, double mapX, double mapY)
        {
            // TODO:  添加 ModifyPropertyMatch.OnMouseUp 实现
            base.OnMouseUp(button, shift, x, y, mapX, mapY);

            if (m_bIsUse)
            {
                IGeometry pEnv;
                m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                if (m_pFeedbackEnve != null)
                {
                    pEnv = m_pFeedbackEnve.Stop();
                    m_FocusMap.SelectByShape(pEnv, null, false);
                }
                else
                {
                    IEnvelope pRect;
                    double    dblConst;
                    dblConst   = CommonFunction.ConvertPixelsToMapUnits(m_pActiveView, 8); //    '8个象素大小
                    pRect      = new EnvelopeClass();
                    pRect.XMin = m_pPoint.X - dblConst;                                    // 调整边界的宽度为16个象素大小
                    pRect.YMin = m_pPoint.Y - dblConst;
                    pRect.XMax = m_pPoint.X + dblConst;
                    pRect.YMax = m_pPoint.Y + dblConst;
                    m_FocusMap.SelectByShape(pRect, null, false);
                }

                m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                m_pFeedbackEnve = null;
                m_bIsUse        = false;
            }
        }
Example #9
0
        public override void OnMouseDown(int button, int shift, int x, int y)
        {
            if (button != 1)
            {
                return;
            }
            if (this._context.ActiveView is IPageLayout)
            {
                IPoint location = this._context.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y);
                IMap   map      = this._context.ActiveView.HitTestMap(location);
                if (map == null)
                {
                    return;
                }
                if (map != this._context.FocusMap)
                {
                    this._context.ActiveView.FocusMap = map;
                    this._context.ActiveView.Refresh();
                }
            }
            IPoint point = ((IActiveView)this._context.FocusMap).ScreenDisplay.DisplayTransformation.ToMapPoint(x,
                                                                                                                y);

            if (pEnvelopeFeedback == null)
            {
                pEnvelopeFeedback         = new NewEnvelopeFeedback();
                pEnvelopeFeedback.Display = ((IActiveView)this._context.FocusMap).ScreenDisplay;
                pEnvelopeFeedback.Start(point);
            }
        }
Example #10
0
        public override void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            IGeometry pGeo = null;

            pGeo = m_EnvelopeFeedback.Stop();
            m_EnvelopeFeedback = null;
            CreateFeature(pGeo);
        }
Example #11
0
 public override void OnKeyDown(int keyCode, int Shift)
 {
     if (keyCode == (int)Keys.Escape)
     {
         m_pFeedback = null;
         m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
     }
 }
Example #12
0
 public override void OnKeyDown(int keyCode, int Shift)
 {
     if (_inZoom && keyCode == 27)
     {
         this._envelopeFeedback = null;
         this._inZoom           = false;
         base.m_cursor          = this._cursor1;
     }
 }
Example #13
0
 private void axMapControl1_OnMouseUp(object sender, IMapControlEvents2_OnMouseUpEvent e)
 {
     if (pNewEnvelopeFeedback != null)
     {
         IActiveView pActiveView = null;
         pActiveView = axMap.Map as IActiveView;
         IEnvelope pEnvelope = pNewEnvelopeFeedback.Stop();
         pNewEnvelopeFeedback = null;
     }
 }
        public void OnMouseUp(int button, int shift, int x, int y)
        {
            if (!m_isMouseDown)
            {
                return;
            }

            IEnvelope pEnvelope;
            IEnvelope pFeedEnvelope;

            double newWidth, newHeight;

            //Get the focus map
            IActiveView pActiveView = (IActiveView)m_pHookHelper.FocusMap;

            //If an envelope has not been tracked
            if (m_feedBack == null)
            {
                //Zoom out from the mouse click
                pEnvelope = pActiveView.Extent;
                pEnvelope.Expand(2, 2, true);
                pEnvelope.CenterAt(m_point);
            }
            else
            {
                //Stop the envelope feedback
                pFeedEnvelope = m_feedBack.Stop();

                //Exit if the envelope height or width is 0
                if (pFeedEnvelope.Width == 0 || pFeedEnvelope.Height == 0)
                {
                    m_feedBack    = null;
                    m_isMouseDown = false;
                }

                newWidth  = pActiveView.Extent.Width * (pActiveView.Extent.Width / pFeedEnvelope.Width);
                newHeight = pActiveView.Extent.Height * (pActiveView.Extent.Height / pFeedEnvelope.Height);

                //Set the new extent coordinates
                pEnvelope = new EnvelopeClass();
                pEnvelope.PutCoords(pActiveView.Extent.XMin - ((pFeedEnvelope.XMin - pActiveView.Extent.XMin) * (pActiveView.Extent.Width / pFeedEnvelope.Width)),
                                    pActiveView.Extent.YMin - ((pFeedEnvelope.YMin - pActiveView.Extent.YMin) * (pActiveView.Extent.Height / pFeedEnvelope.Height)),
                                    (pActiveView.Extent.XMin - ((pFeedEnvelope.XMin - pActiveView.Extent.XMin) * (pActiveView.Extent.Width / pFeedEnvelope.Width))) + newWidth,
                                    (pActiveView.Extent.YMin - ((pFeedEnvelope.YMin - pActiveView.Extent.YMin) * (pActiveView.Extent.Height / pFeedEnvelope.Height))) + newHeight);
            }

            //Set the new extent
            pActiveView.Extent = pEnvelope;

            //Refresh the active view
            pActiveView.Refresh();
            m_feedBack    = null;
            m_isMouseDown = false;
        }
 protected override void OnMouseUp(MouseEventArgs arg)
 {
     IPoint Point = getCursorLocation(arg);
     if (m_Feedback != null)
     {
         IEnvelope Env = m_Feedback.Stop();
         m_Feedback = null;
         DrawLegend(Env);
     }
     base.OnMouseUp(arg);
 }
Example #16
0
        private void Reset()//取消所有操作
        {
            m_pFeedbackEnve = null;
            m_bIsUse        = false;
            m_OriginFeatureArray.RemoveAll();

            m_pActiveView.GraphicsContainer.DeleteAllElements();
            m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, m_pEnvelope);//视图刷新

            m_pStatusBarService.SetStateMessage("就绪");
        }
 protected override void OnMouseUp(MouseEventArgs arg)
 {
     IPoint Point = getCursorLocation(arg);
     if (m_Feedback != null)
     {
         IEnvelope Env = m_Feedback.Stop();
         m_Feedback = null;
         drawMapUnits.DrawStratCorDiagram(Env);
     }
     base.OnMouseUp(arg);
 }
        protected override void OnMouseUp(MouseEventArgs arg)
        {
            IPoint Point = getCursorLocation(arg);

            if (m_Feedback != null)
            {
                IEnvelope Env = m_Feedback.Stop();
                m_Feedback = null;
                drawMapUnits.DrawStratCorDiagram(Env);
            }
            base.OnMouseUp(arg);
        }
Example #19
0
        public override void OnMouseMove(int button, int shift, int x, int y, double mapX, double mapY)
        {
            // TODO:  添加 DrawTraceLine.OnMouseMove 实现
            base.OnMouseMove(button, shift, x, y, mapX, mapY);

            m_pPoint = m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y);

            //+++++++++++++开始捕捉+++++++++++++++++++++
            bool flag = CommonFunction.Snap(m_MapControl, m_App.CurrentConfig.cfgSnapEnvironmentSet, m_pPoint0, m_pPoint);

            if (m_bIsSelect && !bBegineMove)            //选择要素
            {
                if (m_pFeedbackEnve == null)
                {
                    m_pFeedbackEnve         = new NewEnvelopeFeedbackClass();
                    m_pFeedbackEnve.Display = m_pActiveView.ScreenDisplay;
                    m_pFeedbackEnve.Start(m_pPoint);
                }

                m_pFeedbackEnve.MoveTo(m_pPoint);
            }
            else             //跟踪地图元素
            {
                if (bBegineMove && button1 == 2)
                {
                    //Only create the trace every other time the mouse moves
                    m_lMoveCounter = m_lMoveCounter + 1;
                    if (m_lMoveCounter < 2)
                    {
                        return;
                    }

                    m_lMoveCounter = 0;

                    //Call refresh
                    RefreshTraceline();

                    if (m_pCursor.MoveTo(m_pPoint) == false)
                    {
                        m_pCursor.FinishMoveTo(m_pPoint);
                    }

                    m_pTraceLine = m_pCursor.CurrentTrace;

                    object a = esriConstructOffsetEnum.esriConstructOffsetSimple;
                    object b = System.Reflection.Missing.Value;
                    m_pOffsetTraceLine.ConstructOffset(m_pTraceLine, m_dOffsetDistance, ref a, ref b);

                    //Call refresh
                    RefreshTraceline();
                }
            }
        }
Example #20
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            //获得鼠标在控件上点击的位置,产生一个点对象
            IPoint pPt = m_MapControl.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);

            if (m_EnvelopeFeedback == null)
            {
                m_EnvelopeFeedback         = new NewEnvelopeFeedbackClass();
                m_EnvelopeFeedback.Display = m_MapControl.ActiveView.ScreenDisplay;
                m_EnvelopeFeedback.Start(pPt);
            }
        }
Example #21
0
 public void OnKeyDown(int keyCode, int shift)
 {
     if (m_isMouseDown)
     {
         if (keyCode == 27)
         {
             m_isMouseDown = false;
             m_feedBack    = null;
             m_pHookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewForeground, null, null);
         }
     }
 }
Example #22
0
        public override void OnMouseDown(int button, int shift, int x, int y)
        {
            IActiveView activeView = this._context.ActiveView;
            IPoint      point      = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y);

            if (this.inewEnvelopeFeedback_0 == null)
            {
                this.inewEnvelopeFeedback_0         = new NewEnvelopeFeedback();
                this.inewEnvelopeFeedback_0.Display = activeView.ScreenDisplay;
                this.inewEnvelopeFeedback_0.Start(point);
            }
        }
Example #23
0
        public void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            if (m_InUse == false)
            {
                return;
            }

            if (GetCapture() == this.hk.MapControl.ActiveView.ScreenDisplay.hWnd)
            {
                ReleaseCapture();
            }

            if (m_Feedback == null)
            {
                m_Feedback = null;
                m_InUse    = false;
                return;
            }
            IEnvelope envelope = m_Feedback.Stop();

            if ((envelope.IsEmpty) || (envelope.Width == 0) || (envelope.Height == 0))
            {
                m_Feedback = null;
                m_InUse    = false;
                return;
            }

            GetSymbol symbolForm = new GetSymbol(esriSymbologyStyleClass.esriStyleClassNorthArrows);

            symbolForm.Text = "选择指北针";
            IStyleGalleryItem styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassNorthArrows);

            symbolForm.Dispose();
            if (styleGalleryItem == null)
            {
                return;
            }

            IMapFrame         mapFrame         = (IMapFrame)this.hk.MapControl.ActiveView.GraphicsContainer.FindFrame(this.hk.MapControl.ActiveView.FocusMap);
            IMapSurroundFrame mapSurroundFrame = new MapSurroundFrameClass();

            mapSurroundFrame.MapFrame    = mapFrame;
            mapSurroundFrame.MapSurround = (IMapSurround)styleGalleryItem.Item;

            IElement element = (IElement)mapSurroundFrame;

            element.Geometry = envelope;

            this.hk.MapControl.ActiveView.GraphicsContainer.AddElement((IElement)mapSurroundFrame, 0);
            this.hk.MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, mapSurroundFrame, null);
            m_Feedback = null;
            m_InUse    = false;
        }
Example #24
0
        public override void OnMouseUp(int button, int shift, int x, int y, double mapX, double mapY)
        {
            // TODO:  添加 DrawTraceLine.OnMouseUp 实现
            base.OnMouseUp(button, shift, x, y, mapX, mapY);

            if (!m_bIsSelect)
            {
                return;
            }
            if (bBegineMove)
            {
                return;
            }

            IGeometry pEnv;

            if (m_pFeedbackEnve != null)
            {
                pEnv = m_pFeedbackEnve.Stop();
                m_FocusMap.SelectByShape(pEnv, null, false);
            }
            else
            {
                IEnvelope pRect;
                double    dblConst;
                dblConst = CommonFunction.ConvertPixelsToMapUnits(m_pActiveView, 8);              //8个象素大小
                pRect    = CommonFunction.NewRect(m_pPoint, dblConst);
                m_FocusMap.SelectByShape(pRect, null, false);
            }
            IArray tempArray = CommonFunction.GetSelectFeatureSaveToArray(m_FocusMap);

            for (int i = 0; i < tempArray.Count; i++)
            {
                m_OriginFeatureArray.Add((IFeature)tempArray.get_Element(i));
            }
            tempArray.RemoveAll();

            if (m_OriginFeatureArray.Count == 0)
            {
                //选择复位
                m_pFeedbackEnve = null;
                m_bIsSelect     = false;
                return;
            }

            m_MapControl.ActiveView.FocusMap.ClearSelection();                            //清空地图选择的要素

            CommonFunction.ShowSelectionFeatureArray(m_MapControl, m_OriginFeatureArray); //高亮显示选择的要素

            //选择复位
            m_pFeedbackEnve = null;
            m_bIsSelect     = false;
        }
Example #25
0
        public override void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            if (m_pNewEnvelope == null)
            {
                return;
            }

            IEnvelope pEnvelope     = m_pNewEnvelope.Stop();
            int       iPiexl        = 3;
            double    iMapTolerance = ConvertPixelsToMapUnits(m_MapControl.ActiveView, iPiexl);
            IGeometry pGeometry     = null;

            if (pEnvelope == null || pEnvelope.IsEmpty)
            {
                ITopologicalOperator pTopo = (ITopologicalOperator)m_pPoint;
                if (pTopo != null)
                {
                    pGeometry = pTopo.Buffer(iMapTolerance);
                }
            }
            else
            {
                pEnvelope.SpatialReference = m_MapControl.ActiveView.FocusMap.SpatialReference;
                pGeometry = pEnvelope;
            }
            m_pNewEnvelope = null;

            if (m_frmQuery == null)
            {
                m_frmQuery             = new frmQuery(m_MapControl, m_enumQueryMode);
                m_frmQuery.Owner       = m_mainFrm;
                m_frmQuery.FormClosed += new FormClosedEventHandler(frmQuery_FormClosed);
            }

            //m_frmQuery.Show();
            //m_frmQuery.FillData(m_MapControl.ActiveView.FocusMap, pGeometry);
            _QuerBar.m_pMapControl = m_MapControl;
            _QuerBar.EmergeQueryData(m_MapControl.ActiveView.FocusMap, pGeometry, esriSpatialRelEnum.esriSpatialRelIntersects);
            try
            {
                DevComponents.DotNetBar.Bar pBar = _QuerBar.Parent.Parent as DevComponents.DotNetBar.Bar;
                if (pBar != null)
                {
                    pBar.AutoHide = false;
                    //pBar.SelectedDockTab = 1;
                    int tmpindex = pBar.Items.IndexOf("dockItemDataCheck");
                    pBar.SelectedDockTab = tmpindex;
                }
            }
            catch
            { }
        }
Example #26
0
        public override void OnMouseUp(int int_0, int int_1, int int_2, int int_3)
        {
            IEnvelope envelope;
            IGeometry geometry;

            if (CmdSelectTopology.m_TopologyGraph != null)
            {
                this.bool_0 = false;
                if (this.idisplayFeedback_0 != null)
                {
                    IPoint         mapPoint      = this._context.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(int_2, int_3);
                    IWorkspaceEdit editWorkspace = Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace;
                    editWorkspace.StartEditOperation();
                    try
                    {
                        IAffineTransformation2D affineTransformation2DClass = new AffineTransformation2D() as IAffineTransformation2D;
                        affineTransformation2DClass.Move(mapPoint.X - this.ipoint_0.X, mapPoint.Y - this.ipoint_0.Y);
                        CmdSelectTopology.m_TopologyGraph.TransformSelection(esriTransformDirection.esriTransformForward, affineTransformation2DClass, false);
                        CmdSelectTopology.m_TopologyGraph.Post(out envelope);
                        this._context.ActiveView.Refresh();
                    }
                    catch (Exception exception)
                    {
                        CErrorLog.writeErrorLog(this, exception, "");
                    }
                    editWorkspace.StopEditOperation();
                    this.idisplayFeedback_0 = null;
                }
                else if (this.inewEnvelopeFeedback_0 != null)
                {
                    geometry = this.inewEnvelopeFeedback_0.Stop();
                    CmdSelectTopology.m_TopologyGraph.SelectByGeometry(3, esriTopologySelectionResultEnum.esriTopologySelectionResultNew, geometry);
                    this.inewEnvelopeFeedback_0 = null;
                }
                else
                {
                    double searchTolerance = 3.5;
                    if (this._context.Hook is IApplication)
                    {
                        searchTolerance = (double)(this._context.Hook as IApplication).SelectionEnvironment.SearchTolerance;
                    }
                    searchTolerance = Common.ConvertPixelsToMapUnits((IActiveView)this._context.FocusMap, searchTolerance);
                    geometry        = ((ITopologicalOperator)this.ipoint_0).Buffer(searchTolerance);
                    CmdSelectTopology.m_TopologyGraph.SelectByGeometry(1, esriTopologySelectionResultEnum.esriTopologySelectionResultNew, geometry);
                    if (CmdSelectTopology.m_TopologyGraph.NodeSelection.Count == 0)
                    {
                        CmdSelectTopology.m_TopologyGraph.SelectByGeometry(2, esriTopologySelectionResultEnum.esriTopologySelectionResultNew, geometry);
                    }
                }
                this._context.ActiveView.Refresh();
            }
        }
Example #27
0
        public override void OnMouseMove(int int_0, int int_1, int int_2, int int_3)
        {
            IEnumTGHitInfo   enumTGHitInfo;
            ITopologyElement topologyElement;
            IPoint           point;

            if (CmdSelectTopology.m_TopologyGraph != null)
            {
                IPoint mapPoint = this._context.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(int_2, int_3);
                if (this.idisplayFeedback_0 != null)
                {
                    this.idisplayFeedback_0.MoveTo(mapPoint);
                }
                else if (!this.bool_0)
                {
                    double searchTolerance = 3.5;
                    if (this._context.Hook is IApplication)
                    {
                        searchTolerance = (double)(this._context.Hook as IApplication).SelectionEnvironment.SearchTolerance;
                    }
                    searchTolerance = Common.ConvertPixelsToMapUnits((IActiveView)this._context.FocusMap, searchTolerance);
                    CmdSelectTopology.m_TopologyGraph.EnumHitTest(3, mapPoint, searchTolerance, out enumTGHitInfo);
                    enumTGHitInfo.Reset();
                    enumTGHitInfo.Next(out topologyElement, out point, ref searchTolerance);
                    while (topologyElement != null)
                    {
                        if (topologyElement.IsSelected)
                        {
                            this.bool_1 = true;
                            return;
                        }
                        else
                        {
                            enumTGHitInfo.Next(out topologyElement, out point, ref searchTolerance);
                        }
                    }
                    this.bool_1 = false;
                }
                else
                {
                    if (this.inewEnvelopeFeedback_0 == null)
                    {
                        this.inewEnvelopeFeedback_0 = new NewEnvelopeFeedback()
                        {
                            Display = this._context.ActiveView.ScreenDisplay
                        };
                        this.inewEnvelopeFeedback_0.Start(this.ipoint_0);
                    }
                    this.inewEnvelopeFeedback_0.MoveTo(mapPoint);
                }
            }
        }
        protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
        {
            IPoint Point = getCursorLocation(arg);
            if (m_Feedback == null)
            {
                m_Feedback = new NewEnvelopeFeedbackClass();
                m_Feedback.Display = ArcMap.Document.ActiveView.ScreenDisplay;
                m_Feedback.Start(Point);
            }
            m_isMouseDown = true;

            base.OnMouseDown(arg);
        }
Example #29
0
 /// <summary>
 /// 释放资源
 /// </summary>
 public void Dispose()
 {
     if (elementEnums != null)
     {
         elementEnums.Reset();
     }
     envelope          = null;
     rectangleFeedback = null;
     if (listElements != null)
     {
         listElements.Clear();
     }
     listElements = null;
 }
Example #30
0
        protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
        {
            IPoint Point = getCursorLocation(arg);

            if (m_Feedback == null)
            {
                m_Feedback         = new NewEnvelopeFeedbackClass();
                m_Feedback.Display = ArcMap.Document.ActiveView.ScreenDisplay;
                m_Feedback.Start(Point);
            }
            m_isMouseDown = true;

            base.OnMouseDown(arg);
        }
Example #31
0
 public override void OnMouseMove(int Button, int Shift, int x, int y)
 {
     if (this._inZoom)
     {
         IActiveView activeView = (IActiveView)this._context.FocusMap;
         if (this._envelopeFeedback == null)
         {
             this._envelopeFeedback         = new NewEnvelopeFeedback();
             this._envelopeFeedback.Display = activeView.ScreenDisplay;
             this._envelopeFeedback.Start(this._iPoint);
         }
         this._envelopeFeedback.MoveTo(activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y));
     }
 }
Example #32
0
        public override void OnMouseMove(int Button, int Shift, int X, int Y)
        {
            if (m_InUse == false)
            {
                return;
            }
            if (m_Feedback == null)
            {
                m_Feedback         = new NewEnvelopeFeedbackClass();
                m_Feedback.Display = m_HookHelper.ActiveView.ScreenDisplay;
                m_Feedback.Start(m_Point);
            }

            m_Feedback.MoveTo(m_HookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y));
        }
Example #33
0
 public override void OnMouseMove(int int_0, int int_1, int int_2, int int_3)
 {
     if (this.bool_0)
     {
         IActiveView activeView = (IActiveView)_context.FocusMap;
         if (this.inewEnvelopeFeedback_0 == null)
         {
             this.inewEnvelopeFeedback_0         = new NewEnvelopeFeedback();
             this.inewEnvelopeFeedback_0.Display = activeView.ScreenDisplay;
             this.inewEnvelopeFeedback_0.Start(this.ipoint_0);
         }
         this.inewEnvelopeFeedback_0.MoveTo(activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(int_2,
                                                                                                      int_3));
     }
 }
Example #34
0
        public override void OnMouseMove(int Button, int Shift, int X, int Y)
        {
            if (m_InUse == false) return;

            //Start an envelope feedback
            if (m_Feedback == null )
            {
                m_Feedback = new NewEnvelopeFeedbackClass();
                m_Feedback.Display = m_HookHelper.ActiveView.ScreenDisplay;
                m_Feedback.Start(m_Point);
            }

            //Move the envelope feedback
            m_Feedback.MoveTo(m_HookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y));
        }
    protected override void OnMouseDown(MouseEventArgs Args)
    {
      //initialize all the variables.
      feedbackEnv = new EnvelopeClass();
      feedbackStartPoint = new ESRI.ArcGIS.Geometry.PointClass();
      feedbackMovePoint = new ESRI.ArcGIS.Geometry.PointClass();
      feedbackLineSymbol = new SimpleLineSymbolClass();
      feedbackScreenDisplay = ArcMap.Document.ActiveView.ScreenDisplay;

      feedbackLineSymbol.Style = esriSimpleLineStyle.esriSLSDashDotDot;

      //initialize a new Envelope feedback class and pass it the symbol and display
      NewEnvelopeFeedback = new NewEnvelopeFeedbackClass();
      NewEnvelopeFeedback.Display = feedbackScreenDisplay;
      NewEnvelopeFeedback.Symbol = feedbackLineSymbol as ISymbol;


      //pass the start point from the mouse position, transforming it to an appropriate map point.
      feedbackStartPoint = feedbackScreenDisplay.DisplayTransformation.ToMapPoint(Args.X, Args.Y) as ESRI.ArcGIS.Geometry.Point;
      NewEnvelopeFeedback.Start(feedbackStartPoint);
    }
		public void OnMouseUp(int button, int shift, int x, int y)
		{
			if(!m_isMouseDown) return;

			//Get the focus map
			IActiveView pActiveView = (IActiveView) m_pHookHelper.FocusMap;

			//If an envelope has not been tracked
			IEnvelope pEnvelope;

			if(m_feedBack == null)
			{
				//Zoom in from mouse click
				pEnvelope = pActiveView.Extent;
				pEnvelope.Expand(0.5, 0.5, true);
				pEnvelope.CenterAt(m_point);
			}
			else
			{
				//Stop the envelope feedback
				pEnvelope = m_feedBack.Stop();

				//Exit if the envelope height or width is 0
				if(pEnvelope.Width ==0 || pEnvelope.Height == 0)
				{
					m_feedBack = null;
					m_isMouseDown = false;
				}
			}
			//Set the new extent
			pActiveView.Extent = pEnvelope;
			//Refresh the active view
			pActiveView.Refresh();
			m_feedBack = null;
			m_isMouseDown = false;
		}
		public override void OnMouseMove(int Button, int Shift, int X, int Y)
		{
			if(!m_bInUse) return;

            //Get the focus map
            IActiveView pActiveView = (IActiveView)m_pSceneHookHelper.Scene;

            //Start an envelope feedback
            if (m_feedBack == null)
            {
                m_feedBack = new NewEnvelopeFeedbackClass();
                m_feedBack.Display = pActiveView.ScreenDisplay;
                m_feedBack.Start(m_point);
            }

            //Move the envelope feedback
            m_feedBack.MoveTo(pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y));

		}
Example #38
0
        /// <summary>
        /// Start to track the rectangle when mouse down.
        /// </summary>
        /// <param name="arg"></param>
        protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
        {
            base.OnMouseDown(arg);

            activeLayer = ArcMapApp.GetRasterLayer();

            if (activeLayer != null)
            {
                try
                {
                    Display.ClearElement(Editor.Selections.GetAllGraphicElements());
                    Editor.Selections.Clear();

                    // Define the selection symbol.
                    IRgbColor color = new RgbColorClass();
                    color.Red = 255;
                    color.Green = 255;
                    color.Blue = 255;

                    ISimpleLineSymbol lineSymbol = new SimpleLineSymbolClass();
                    lineSymbol.Width = 1;
                    lineSymbol.Color = (IColor)color;

                    IPoint startCoor = Raster.ScreenCoor2MapCoor(arg.X, arg.Y);
                    newEnvelopeFeedback = new NewEnvelopeFeedbackClass();
                    newEnvelopeFeedback.Display = ArcMap.Document.ActiveView.ScreenDisplay;
                    newEnvelopeFeedback.Symbol = (ISymbol)lineSymbol;
                    newEnvelopeFeedback.Start(startCoor);

                    // Get the maximum extent of the active layer.
                    IRasterProps rasterProps = (IRasterProps)activeLayer.Raster;
                    maxExtent = new Position(rasterProps.Width, rasterProps.Height);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("Unfortunately, the application meets an error.\n\nSource: {0}\nSite: {1}\nMessage: {2}", ex.Source, ex.TargetSite, ex.Message), "Error");
                }
            }
        }
Example #39
0
        protected override void OnMouseDown(MouseEventArgs arg)
        {
            base.OnMouseDown(arg);

            if (Editor.ActiveLayer != null)
            {
                try
                {
                    Display.ClearElement(Editor.Selections.GetAllGraphicElements());
                    Editor.Selections.Clear();

                    IPoint startCoor = Raster.ScreenCoor2MapCoor(arg.X, arg.Y);
                    newEnvelopeFeedback = new NewEnvelopeFeedbackClass();
                    newEnvelopeFeedback.Display = ArcMap.Document.ActiveView.ScreenDisplay;
                    newEnvelopeFeedback.Symbol = (ISymbol)Display.GetDefaultSelectLineSymbol();
                    newEnvelopeFeedback.Start(startCoor);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("Unfortunately, the application meets an error.\n\nSource: {0}\nSite: {1}\nMessage: {2}", ex.Source, ex.TargetSite, ex.Message), "Error");
                }
            }
        }
 /// <summary>
 /// ����¼�
 /// </summary>
 public override void OnClick()
 {
     DataEditCommon.InitEditEnvironment();
     DataEditCommon.CheckEditState();
     m_pCurrentLayer = DataEditCommon.g_pLayer;
     IFeatureLayer featureLayer = m_pCurrentLayer as IFeatureLayer;
     if (featureLayer == null)
     {
         MessageBox.Show(@"��ѡ�����ͼ�㡣", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
         return;
     }
     else
     {
         if (featureLayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolyline && featureLayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolygon||featureLayer.FeatureClass.FeatureType==esriFeatureType.esriFTAnnotation)
         {
             MessageBox.Show(@"��ѡ����״����״ͼ�㡣", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
             DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
             return;
         }
     }
     m_pFeedback = null;
 }
Example #41
0
 public override void OnKeyDown(int keyCode, int Shift)
 {
     if (keyCode == (int)Keys.Escape)
     {
         m_pFeedback = null;
         m_pEllipticArc = null;
         m_pEnvFeedback = null;
         m_lMouseDownCount = 0;
         m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
     }
 }
Example #42
0
        private void SetNewLineFeedBack()
        {
            m_pEnvFeedback = new NewEnvelopeFeedback();
            IRgbColor pColor = new RgbColor();
            pColor.Red = 0;
            pColor.Green = 0;
            pColor.Blue = 0;

            m_LineSym = new SimpleLineSymbol();
            m_LineSym.Color = pColor;
            m_LineSym.Width = 1;
            m_LineSym.Style = esriSimpleLineStyle.esriSLSSolid;

            ISymbol pSym = m_LineSym as ISymbol;
            pSym.ROP2 = esriRasterOpCode.esriROPNotXOrPen;
            m_pEnvFeedback.Symbol = pSym;

            m_hookHelper.ActiveView.ScreenDisplay.StartDrawing(m_hookHelper.ActiveView.ScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);
            m_hookHelper.ActiveView.ScreenDisplay.SetSymbol(pSym);
            m_hookHelper.ActiveView.ScreenDisplay.FinishDrawing();

            m_pEnvFeedback.Display = m_hookHelper.ActiveView.ScreenDisplay;
        }
Example #43
0
        public void OnMouseMove(int Button, int Shift, int X, int Y)
        {
            if (m_InUse == false) return;
            if (m_Feedback == null)
            {
                m_Feedback = new NewEnvelopeFeedbackClass();
                m_Feedback.Display = this.hk.MapControl.ActiveView.ScreenDisplay;
                m_Feedback.Start(m_Point);
            }

            m_Feedback.MoveTo(this.hk.MapControl.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y));
        }
Example #44
0
        public void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            if (m_InUse == false) return;

            if (GetCapture() == this.hk.MapControl.ActiveView.ScreenDisplay.hWnd)
                ReleaseCapture();

            if (m_Feedback == null)
            {
                m_Feedback = null;
                m_InUse = false;
                return;
            }
            IEnvelope envelope = m_Feedback.Stop();
            if ((envelope.IsEmpty) || (envelope.Width == 0) || (envelope.Height == 0))
            {
                m_Feedback = null;
                m_InUse = false;
                return;
            }

            GetSymbol symbolForm = new GetSymbol(esriSymbologyStyleClass.esriStyleClassNorthArrows);
            symbolForm.Text = "ѡ��ָ����";
            IStyleGalleryItem styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassNorthArrows);
            symbolForm.Dispose();
            if (styleGalleryItem == null) return;

            IMapFrame mapFrame = (IMapFrame)this.hk.MapControl.ActiveView.GraphicsContainer.FindFrame(this.hk.MapControl.ActiveView.FocusMap);
            IMapSurroundFrame mapSurroundFrame = new MapSurroundFrameClass();
            mapSurroundFrame.MapFrame = mapFrame;
            mapSurroundFrame.MapSurround = (IMapSurround)styleGalleryItem.Item;

            IElement element = (IElement)mapSurroundFrame;
            element.Geometry = envelope;

            this.hk.MapControl.ActiveView.GraphicsContainer.AddElement((IElement)mapSurroundFrame, 0);
            this.hk.MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, mapSurroundFrame, null);
            m_Feedback = null;
            m_InUse = false;
        }
		public void OnMouseUp(int button, int shift, int x, int y)
		{
			if(!m_isMouseDown) return;

			IEnvelope pEnvelope;
			IEnvelope pFeedEnvelope;

			double newWidth, newHeight;
			
			//Get the focus map
			IActiveView pActiveView = (IActiveView) m_pHookHelper.FocusMap;

			//If an envelope has not been tracked
			if(m_feedBack == null)
			{
				//Zoom out from the mouse click
				pEnvelope = pActiveView.Extent;
				pEnvelope.Expand(2, 2, true);
				pEnvelope.CenterAt(m_point);
			}
			else
			{
				//Stop the envelope feedback
				pFeedEnvelope = m_feedBack.Stop();

				//Exit if the envelope height or width is 0
				if(pFeedEnvelope.Width == 0 || pFeedEnvelope.Height == 0)
				{
					m_feedBack = null;
					m_isMouseDown = false;
				}

				newWidth = pActiveView.Extent.Width * (pActiveView.Extent.Width / pFeedEnvelope.Width);
				newHeight = pActiveView.Extent.Height * (pActiveView.Extent.Height / pFeedEnvelope.Height);

				//Set the new extent coordinates
				pEnvelope = new EnvelopeClass();
				pEnvelope.PutCoords(pActiveView.Extent.XMin - ((pFeedEnvelope.XMin - pActiveView.Extent.XMin) * (pActiveView.Extent.Width / pFeedEnvelope.Width)), 
					pActiveView.Extent.YMin - ((pFeedEnvelope.YMin - pActiveView.Extent.YMin) * (pActiveView.Extent.Height / pFeedEnvelope.Height)),
					(pActiveView.Extent.XMin - ((pFeedEnvelope.XMin - pActiveView.Extent.XMin) * (pActiveView.Extent.Width / pFeedEnvelope.Width))) + newWidth,
					(pActiveView.Extent.YMin - ((pFeedEnvelope.YMin - pActiveView.Extent.YMin) * (pActiveView.Extent.Height / pFeedEnvelope.Height))) + newHeight);
			}

			//Set the new extent
			pActiveView.Extent = pEnvelope;

			//Refresh the active view
			pActiveView.Refresh();
			m_feedBack = null;
			m_isMouseDown = false;
		}
        public override void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            if (m_InUse == false) return;

            //Stop capturing mouse events
            if (GetCapture() == m_HookHelper.ActiveView.ScreenDisplay.hWnd)
                ReleaseCapture();

            //If an envelope has not been tracked or its height/width is 0
            if (m_Feedback == null)
            {
                m_Feedback = null;
                m_InUse = false;
                return;
            }
            IEnvelope envelope = m_Feedback.Stop();
            if ((envelope.IsEmpty) || (envelope.Width == 0) || (envelope.Height == 0))
            {
                m_Feedback = null;
                m_InUse = false;
                return;
            }

            //Create the form with the SymbologyControl
            SymbolForm symbolForm = new SymbolForm();
            //Get the IStyleGalleryItem
            IStyleGalleryItem styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassScaleBars);
            //Release the form
            symbolForm.Dispose();
            if (styleGalleryItem == null) return;

            Common.MapPrintCommon.GraphicsContainClearSelection();
            string unit= Common.MapPrintCommon.GetMapUnits();

            //Get the map frame of the focus map
            IMapFrame mapFrame = (IMapFrame) m_HookHelper.ActiveView.GraphicsContainer.FindFrame(m_HookHelper.ActiveView.FocusMap);

            //Create a map surround frame
            IMapSurroundFrame mapSurroundFrame = new MapSurroundFrameClass();
            //Set its map frame and map surround
            mapSurroundFrame.MapFrame = mapFrame;
            mapSurroundFrame.MapSurround = (IMapSurround) styleGalleryItem.Item;

            //QI to IElement and set its geometry
            IElement element = (IElement) mapSurroundFrame;
            element.Geometry = envelope;

            //Add the element to the graphics container
            m_HookHelper.ActiveView.GraphicsContainer.AddElement((IElement)mapSurroundFrame, 0);

            ESRI.ArcGIS.Carto.IScaleBar markerScaleBar = ((ESRI.ArcGIS.Carto.IScaleBar)(mapSurroundFrame.MapSurround));
            markerScaleBar.LabelPosition = ESRI.ArcGIS.Carto.esriVertPosEnum.esriBelow;
            markerScaleBar.UseMapSettings();
            markerScaleBar.UnitLabel = unit;

            //Refresh
            m_HookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, mapSurroundFrame, null);

            m_Feedback = null;
            m_InUse = false;
            Common.MapPrintCommon.g_axPageLayoutControl.CurrentTool = Common.MapPrintCommon.SetControlsSelectCommand();
        }
		public void OnMouseMove(int button, int shift, int x, int y)
		{
			if(!m_isMouseDown) return;

			//Get the focus map
			IActiveView pActiveView = (IActiveView) m_pHookHelper.FocusMap;

			//Start an envelope feedback
			if(m_feedBack == null)
			{
				m_feedBack = new NewEnvelopeFeedbackClass();
				m_feedBack.Display = pActiveView.ScreenDisplay;
				m_feedBack.Start(m_point);
			}

			//Move the envelope feedback
			m_feedBack.MoveTo(pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y));
		}
Example #48
0
        public override void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            if (m_InUse == false) return;

            //Stop capturing mouse events
            if (GetCapture() == m_HookHelper.ActiveView.ScreenDisplay.hWnd)
                ReleaseCapture();

            //If an envelope has not been tracked or its height/width is 0
            if (m_Feedback == null)
            {
                m_Feedback = null;
                m_InUse = false;
                return;
            }
            IEnvelope envelope = m_Feedback.Stop();
            if ((envelope.IsEmpty) || (envelope.Width == 0) || (envelope.Height == 0))
            {
                m_Feedback = null;
                m_InUse = false;
                return;
            }

            //Create the form with the SymbologyControl
            SymbolForm symbolForm = new SymbolForm();
            //Get the IStyleGalleryItem
            IStyleGalleryItem styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassScaleBars);
            //Release the form
            symbolForm.Dispose();
            if (styleGalleryItem == null) return;

            //Get the map frame of the focus map
            IMapFrame mapFrame = (IMapFrame) m_HookHelper.ActiveView.GraphicsContainer.FindFrame(m_HookHelper.ActiveView.FocusMap);

            //Create a map surround frame
            IMapSurroundFrame mapSurroundFrame = new MapSurroundFrameClass();
            //Set its map frame and map surround
            mapSurroundFrame.MapFrame = mapFrame;
            mapSurroundFrame.MapSurround = (IMapSurround) styleGalleryItem.Item;

            //QI to IElement and set its geometry
            IElement element = (IElement) mapSurroundFrame;
            element.Geometry = envelope;

            //Add the element to the graphics container
            m_HookHelper.ActiveView.GraphicsContainer.AddElement((IElement)mapSurroundFrame, 0);
            //Refresh
            m_HookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, mapSurroundFrame, null);

            m_Feedback = null;
            m_InUse = false;
        }
		public void OnKeyDown(int keyCode, int shift)
		{
			if(m_isMouseDown)
			{
				if(keyCode == 27) //ESC key
				{
					m_feedBack = null;
					m_isMouseDown = false;
					m_pHookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewForeground, null, null);
				}
			}
		}
Example #50
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (Button == 2)
            {
                return;
            }

            m_Feedback = null;
            //Get the focus map
            IActiveView activeView = (IActiveView)m_pMap;
            //Get the point to start the feedback with
            m_Point = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
            m_InUse = true;
            SetCapture(m_pActiveView.ScreenDisplay.hWnd);
        }
Example #51
0
        public override void OnMouseMove(int Button, int Shift, int X, int Y)
        {
            if (Button == 2)
            {
                return;
            }

            if (!m_InUse) return;

            IActiveView activeView = (IActiveView)m_pMap;
            //Start the feedback if this is the first mouse move event
            if (m_Feedback == null)
            {
                m_Feedback = new NewEnvelopeFeedbackClass();
                m_Feedback.Display = activeView.ScreenDisplay;
                m_Feedback.Start(m_Point);
            }
            //Move the feedback to the new mouse coordinates
            m_Feedback.MoveTo(activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y));
        }
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (Button == 2)
                return;

                if (m_pFeedback == null)//�����ǵ�
                {
                    IPoint m_FirstPoint = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
                    m_FirstPoint = GIS.GraphicEdit.SnapSetting.getSnapPoint(m_FirstPoint);
                    m_pFeedback = new NewEnvelopeFeedbackClass();
                    m_pFeedback.Display = m_hookHelper.ActiveView.ScreenDisplay;
                    m_pFeedback.Start(m_FirstPoint);

                }
                else//����ҽǵ�
                {
                    IPoint m_SecondPoint = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
                    m_SecondPoint = GIS.GraphicEdit.SnapSetting.getSnapPoint(m_SecondPoint);
                    IGeometry pgeo=m_pFeedback.Stop();
                    DrawRectangular(m_pCurrentLayer, pgeo);
                    m_pFeedback = null;
                }
        }