ArcEngine——视图操作 缩放平移前后视图

缩放平移

/***************************
 Write by Chn gzGISer Tst
 CSDN blog Ricardo.M.Tan
 **************************/
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.SystemUI;
using Chn.SpatialDataProcessing.Common;

namespace Chn.SpatialDataProcessing.Tool.ViewOperator {
    /// 
    /// 视图操作类
    /// 
    public class ViewPanAndZoom {

        private IMapControl3 _mapControl;
        /// 
        /// 视图操作
        /// 
        /// 
        public ViewPanAndZoom(IMapControl3 mapControl) {
            _mapControl = mapControl;
        }
        /// 
        /// 平移
        /// 
        public void Pan() {
            ICommand zoomIn = new ControlsMapPanToolClass();
            zoomIn.OnCreate(_mapControl.Object);
            zoomIn.OnClick();
            ITool tool = zoomIn as ITool;
            _mapControl.CurrentTool = tool;
        }
        /// 
        /// 放大
        /// 
        public void ZoomIn() {
            ICommand zoomIn = new ControlsMapZoomInToolClass();
            zoomIn.OnCreate(_mapControl.Object);
            zoomIn.OnClick();
            ITool tool = zoomIn as ITool;
            _mapControl.CurrentTool = tool;
        }
        /// 
        /// 缩小
        /// 
        public void ZoomOut() {
            ICommand zoomIn = new ControlsMapZoomOutToolClass();
            zoomIn.OnCreate(_mapControl.Object);
            zoomIn.OnClick();
            ITool tool = zoomIn as ITool;
            _mapControl.CurrentTool = tool;
        }
    }
}

 

前后视图、全图 

/***************************
 Write by Chn gzGISer Tst
 CSDN blog Ricardo.M.Tan
 **************************/
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Controls;
using Chn.SpatialDataProcessing.Common;

namespace Chn.SpatialDataProcessing.Tool.ViewOperator {
    /// 
    /// 视图操作
    /// 
    public class ViewDisplay {
        private IMapControl3 _mapControl;
        /// 
        /// 视图操作
        /// 
        /// 
        public ViewDisplay(IMapControl3 mapControl) {
            _mapControl = mapControl;
        }

        /// 
        /// 全图
        /// 
        public void FullExten() {
            ICommand fullExten = new ControlsMapFullExtentCommandClass();
            fullExten.OnCreate(_mapControl.Object);
            fullExten.OnClick();
            _mapControl.CurrentTool = fullExten as ITool; 
        }
        /// 
        /// 前一视图
        /// 
        public void PreviousExten() {
            ICommand fullExten = new ControlsMapZoomToLastExtentBackCommandClass();
            fullExten.OnCreate(_mapControl.Object);
            fullExten.OnClick();
            _mapControl.CurrentTool = fullExten as ITool;
        }
        /// 
        /// 后一视图
        /// 
        public void NextExten() {
            ICommand fullExten = new ControlsMapZoomToLastExtentForwardCommandClass();
            fullExten.OnCreate(_mapControl.Object);
            fullExten.OnClick();
            _mapControl.CurrentTool = fullExten as ITool;
        }
    }
}

 

你可能感兴趣的:(Esri,ArcEngine,ArcEngine)