Пример #1
0
        //移动元素到新的位置
        public void ElementMoveTo(IPoint point)
        {
            //移动元素
            m_movePointFeedback.MoveTo(point);
            IGeometry p_geometry = null;

            if (m_element_snap != null)
            {
                p_geometry = m_movePointFeedback.Stop();
                m_element_snap.Geometry = p_geometry;
                //更新该元素的位置
                axMapControl1.ActiveView.GraphicsContainer.UpdateElement(m_element_snap);
                //重新移动元素
                m_movePointFeedback.Stop();
                //刷新视图
                axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
            }
        }
Пример #2
0
        //移动元素到新的位置
        public void ElementMoveTo(IPoint point)
        {
            //移动元素
            movePointFeedback.MoveTo(point);
            IGeometry geometry1 = null;
            IGeometry geometry2 = null;

            if (m_element != null)
            {
                geometry1          = m_element.Geometry;
                geometry2          = movePointFeedback.Stop();
                m_element.Geometry = geometry2;
                //更新该元素的位置
                this.axMapControl1.ActiveView.GraphicsContainer.UpdateElement(m_element);
                //重新移动元素
                movePointFeedback.Stop();//(geometry1 as IPoint, point);
                this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
            }
        }
Пример #3
0
        public override void OnMouseMove(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add ToolModefyTINNode.OnMouseMove implementation
            ITin         pTin         = pTinLayer.Dataset;
            ITinEdit     pTinEdit     = pTin as ITinEdit;
            ITinAdvanced pTinAdvanced = (ITinAdvanced)pTin;
            IMapControl2 pMapCtr      = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IMapControl2;

            if (pMapCtr != null)
            {
                IPoint   mapPoint = pMapCtr.ToMapPoint(X, Y);
                ITinNode pTINNode = new TinNodeClass();
                double   distance = 0;
                pTinAdvanced.QueryNearestNode(mapPoint, pTINNode, ref distance);
                pNode = pTINNode;
                IPoint pt = new PointClass();
                pt.PutCoords(pNode.X, pNode.Y);
                pMovePtFeedBack.MoveTo(pt);
            }
        }
Пример #4
0
        private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e)
        {
            IPoint point = new PointClass();

            switch (strOperator)
            {
            case "move":
                if (m_Feature.Shape.GeometryType == esriGeometryType.esriGeometryPoint)
                {
                    if (m_MovePointFeedback != null)
                    {
                        //将当前鼠标位置的点转换为地图上的坐标
                        point = m_activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y);
                        //移动对象到当前鼠标位置
                        m_MovePointFeedback.MoveTo(point);
                    }
                }
                else if (m_Feature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline)
                {
                    if (m_MoveLineFeedback != null)
                    {
                        //将当前鼠标位置的点转换为地图上的坐标
                        point = m_activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y);
                        //移动对象到当前鼠标位置
                        m_MoveLineFeedback.MoveTo(point);
                    }
                }
                else if (m_Feature.Shape.GeometryType == esriGeometryType.esriGeometryPolygon)
                {
                    if (m_MovePolygonFeedback != null)
                    {
                        //将当前鼠标位置的点转换为地图上的坐标
                        point = m_activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y);
                        //移动对象到当前鼠标位置
                        m_MovePolygonFeedback.MoveTo(point);
                    }
                }
                break;
            }
        }
Пример #5
0
        public override void OnMouseMove(int Button, int Shift, int X, int Y)
        {
            //IDisplayTransformation
            try
            {
                pt = ((m_hookHelper.ActiveView.ScreenDisplay).DisplayTransformation).ToMapPoint(X, Y);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            bool ddd = snapEnvironment.SnapPoint(pt);

            if (pMPfeedback != null)
            {
                pMPfeedback.MoveTo(pt);
            }
            if (ddd)
            {
                // MessageBox.Show("catched!");
            }
        }