AE开发中、放大、缩小、漫游、全图的实现
2017-04-17 09:53
344 查看
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Geometry;
namespace AEKF2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//窗体加载地图文档
private void Form1_Load(object sender, EventArgs e)
{
loadMapDocument();
}
int flag = 0;
//放大
private void button1_Click(object sender, EventArgs e)
{
axMapControl1.MousePointer = esriControlsMousePointer.esriPointerZoomIn;
flag = 2;
}
//缩小
private void button2_Click(object sender, EventArgs e)
{
axMapControl1.MousePointer = esriControlsMousePointer.esriPointerZoomOut;
flag = 1;
}
//漫游
private void button3_Click(object sender, EventArgs e)
{
axMapControl1.MousePointer = esriControlsMousePointer.esriPointerPan;
flag = 3;
}
//全图
private void button4_Click(object sender, EventArgs e)
{
axMapControl1.Extent = axMapControl1.FullExtent;
}
//打开地图方法
private void loadMapDocument()
{
System.Windows.Forms.OpenFileDialog openFileDialog;
openFileDialog = new OpenFileDialog();
openFileDialog.Title = "打开地图文档";
openFileDialog.Filter = "map document(*.mxd)|*.mxd";
openFileDialog.ShowDialog();
string filepath = openFileDialog.FileName;
if (filepath != "" && filepath != null)
{
if (axMapControl1.CheckMxFile(filepath))
{
axMapControl1.MousePointer = esriControlsMousePointer.esriPointerHourglass;
axMapControl1.LoadMxFile(filepath, 0, Type.Missing);
axMapControl1.MousePointer = esriControlsMousePointer.esriPointerDefault;
4000
}
else
{
MessageBox.Show(filepath+"不是有效地图");
}
}
}
private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
{
IEnvelope ipenv;
if (flag == 2)
{
ipenv = axMapControl1.TrackRectangle();
axMapControl1.Extent = ipenv;
}
else if (flag == 1)
{
ipenv = axMapControl1.TrackRectangle();
ipenv = axMapControl1.Extent;
ipenv.Expand(2, 2, true);
axMapControl1.Extent = ipenv;
}
else if (flag == 3)
{
ipenv = axMapControl1.Extent;
axMapControl1.Pan();
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Geometry;
namespace AEKF2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//窗体加载地图文档
private void Form1_Load(object sender, EventArgs e)
{
loadMapDocument();
}
int flag = 0;
//放大
private void button1_Click(object sender, EventArgs e)
{
axMapControl1.MousePointer = esriControlsMousePointer.esriPointerZoomIn;
flag = 2;
}
//缩小
private void button2_Click(object sender, EventArgs e)
{
axMapControl1.MousePointer = esriControlsMousePointer.esriPointerZoomOut;
flag = 1;
}
//漫游
private void button3_Click(object sender, EventArgs e)
{
axMapControl1.MousePointer = esriControlsMousePointer.esriPointerPan;
flag = 3;
}
//全图
private void button4_Click(object sender, EventArgs e)
{
axMapControl1.Extent = axMapControl1.FullExtent;
}
//打开地图方法
private void loadMapDocument()
{
System.Windows.Forms.OpenFileDialog openFileDialog;
openFileDialog = new OpenFileDialog();
openFileDialog.Title = "打开地图文档";
openFileDialog.Filter = "map document(*.mxd)|*.mxd";
openFileDialog.ShowDialog();
string filepath = openFileDialog.FileName;
if (filepath != "" && filepath != null)
{
if (axMapControl1.CheckMxFile(filepath))
{
axMapControl1.MousePointer = esriControlsMousePointer.esriPointerHourglass;
axMapControl1.LoadMxFile(filepath, 0, Type.Missing);
axMapControl1.MousePointer = esriControlsMousePointer.esriPointerDefault;
4000
}
else
{
MessageBox.Show(filepath+"不是有效地图");
}
}
}
private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
{
IEnvelope ipenv;
if (flag == 2)
{
ipenv = axMapControl1.TrackRectangle();
axMapControl1.Extent = ipenv;
}
else if (flag == 1)
{
ipenv = axMapControl1.TrackRectangle();
ipenv = axMapControl1.Extent;
ipenv.Expand(2, 2, true);
axMapControl1.Extent = ipenv;
}
else if (flag == 3)
{
ipenv = axMapControl1.Extent;
axMapControl1.Pan();
}
}
}
}
相关文章推荐
- AE开发中、放大、缩小、漫游、全图的实现
- Android开发--Matrix(一)--实现图片的动态放大缩小
- VC+MapX 地图的放大,缩小,漫游,归心功能的实现
- 实现MapObject放大,缩小,平移,全图常用功能
- ArcGIS Engine 开发(一)对地图放大、缩小、漫游、全局等功能
- 修改ArcMap默认的鼠标滚轮放大缩小,AE实现修改鼠标滚轮放大缩小
- 自己添加放大(zoomout),缩小(zoomin),全图(fullextent),漫游(pan)
- [Unity3D]Unity3D游戏开发之鼠标滚轮实现放大缩小
- arcims开发经验总结(2) (地图放大缩小、鹰眼实现逻辑)
- iPhone 开发中如何将制作图片放大缩小代码实现案例
- [Unity3D]Unity3D游戏开发之鼠标滚轮实现放大缩小
- Android开发_拖动效果,旋转效果,两点放大缩小的实现
- iOS开发——手势识别器(用手势实现图片旋转和缩小放大)
- 实现地图放大(拉框和单击)、缩小(拉框和单击)、漫游操作的简易代码
- Android开发--Matrix(一)--实现图片的动态放大缩小
- arcims开发经验总结(2) (地图放大缩小、鹰眼实现逻辑)
- [Unity3D]Unity3D游戏开发之鼠标滚轮实现放大缩小
- arcims开发经验总结(2) (地图放大缩小、鹰眼实现逻辑)
- arcims开发经验总结(2) (地图放大缩小、鹰眼实现逻辑)
- Delphi 开发Arcgis 之 放大缩小漫游 操作