云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > C#二次开发ArcGIS查询功能

C#二次开发ArcGIS查询功能

  • 62 次阅读
  • 3 次下载
  • 2025/6/3 4:14:39

[地理信息系统课程设计报告]

//获取鼠标点击位置 m_point =

m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); m_isMouseDown = true;

// TODO: Add ZoomIn.OnMouseDown implementation }

publicoverridevoid OnMouseMove(int Button, int Shift, int X, int Y) {

//MouseDown为发生时返回 if (!m_isMouseDown) return;

IActiveView pActiveView = m_hookHelper.ActiveView; //m_feedBack追踪鼠标移动 if (m_feedBack == null) {

m_feedBack = newNewEnvelopeFeedbackClass(); m_feedBack.Display = pActiveView.ScreenDisplay; //开始追踪

m_feedBack.Start(m_point); }

//追踪鼠标移动位置

m_feedBack.MoveTo(pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y));

}

publicoverridevoid OnMouseUp(int Button, int Shift, int X, int Y) {

//MouseDown为发生时返回 if (!m_isMouseDown) return;

IActiveView pActiveView = m_hookHelper.ActiveView; //获取MouseUp发生时的范围并放大 IEnvelope pEnvelope;

if (m_feedBack == null)//鼠标未拉框时进行固定比例尺放大 {

pEnvelope = pActiveView.Extent; pEnvelope.Expand(0.5, 0.5, true); pEnvelope.CenterAt(m_point); } else

{ //停止追踪

pEnvelope = m_feedBack.Stop();

//判断新的范围的高度和宽度是否为零

if (pEnvelope.Width == 0 || pEnvelope.Height == 0) {

[地理信息系统课程设计报告]33 / 38

[地理信息系统课程设计报告]

m_feedBack = null; m_isMouseDown = false; } } //获取新的范围

pActiveView.Extent = pEnvelope; //刷新视图

pActiveView.Refresh();

m_feedBack = null; m_isMouseDown = false;

// TODO: Add ZoomIn.OnMouseUp implementation }

#endregion } }

9、ZoomOut类源码

namespace MyMap.Classes {

///

/// Summary description for ZoomOut. ///

[Guid(\)] [ClassInterface(ClassInterfaceType.None)] [ProgId(\)] publicsealedclassZoomOut : BaseTool {

#region COM Registration Function(s) [ComRegisterFunction()] [ComVisible(false)]

staticvoid RegisterFunction(Type registerType) {

// Required for ArcGIS Component Category Registrar support ArcGISCategoryRegistration(registerType); }

[ComUnregisterFunction()] [ComVisible(false)]

staticvoid UnregisterFunction(Type registerType) {

// Required for ArcGIS Component Category Registrar support ArcGISCategoryUnregistration(registerType); }

#region ArcGIS Component Category Registrar generated code

[地理信息系统课程设计报告]34 / 38

[地理信息系统课程设计报告]

privatestaticvoid ArcGISCategoryRegistration(Type registerType) {

string regKey = string.Format(\, registerType.GUID);

ControlsCommands.Register(regKey);

}

privatestaticvoid ArcGISCategoryUnregistration(Type registerType) {

string regKey = string.Format(\, registerType.GUID);

ControlsCommands.Unregister(regKey); }

#endregion #endregion //记录鼠标位置

privateIPoint m_point; //标记MouseDown是否发生

privateBoolean m_isMouseDown; //追踪鼠标移动产生新的Envelope

privateINewEnvelopeFeedback m_feedBack;

privateIHookHelper m_hookHelper;

public ZoomOut() {

base.m_category = \; //localizable text base.m_caption = \缩小\; //localizable text base.m_message = \缩小\; //localizable text base.m_toolTip = \缩小\; //localizable text

base.m_name = \; //unique id, non-localizable (e.g. \ try

{

string bitmapResourceName = GetType().Name + \;

base.m_bitmap = newBitmap(GetType(), bitmapResourceName);

base.m_cursor = newSystem.Windows.Forms.Cursor(GetType(), GetType().Name + \); }

catch (Exception ex) {

System.Diagnostics.Trace.WriteLine(ex.Message, \); } }

#region Overridden Class Methods publicoverridevoid OnCreate(object hook) {

[地理信息系统课程设计报告]35 / 38

[地理信息系统课程设计报告]

if (m_hookHelper == null)

m_hookHelper = newHookHelperClass(); m_hookHelper.Hook = hook;

// TODO: Add ZoomOut.OnCreate implementation }

publicoverridevoid OnClick() {

// TODO: Add ZoomOut.OnClick implementation }

publicoverridevoid OnMouseDown(int Button, int Shift, int X, int Y) {

// TODO: Add ZoomOut.OnMouseDown implementation //当前地图视图为空时返回

if (m_hookHelper.ActiveView == null) return;

//获取鼠标点击位置 m_point =

m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); m_isMouseDown = true; }

publicoverridevoid OnMouseMove(int Button, int Shift, int X, int Y) {

// TODO: Add ZoomOut.OnMouseMove implementation //MouseDown为发生时返回 if (!m_isMouseDown) return;

IActiveView pActiveView = m_hookHelper.ActiveView; //m_feedBack追踪鼠标移动 if (m_feedBack == null) {

m_feedBack = newNewEnvelopeFeedbackClass(); m_feedBack.Display = pActiveView.ScreenDisplay; //开始追踪

m_feedBack.Start(m_point); }

//追踪鼠标移动位置

m_feedBack.MoveTo(pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y));

}

publicoverridevoid OnMouseUp(int Button, int Shift, int X, int Y) {

// TODO: Add ZoomOut.OnMouseUp implementation //MouseDown为发生时返回 if (!m_isMouseDown) return;

IActiveView pActiveView = m_hookHelper.ActiveView;

[地理信息系统课程设计报告]36 / 38

搜索更多关于: C#二次开发ArcGIS查询功能 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

[地理信息系统课程设计报告] //获取鼠标点击位置 m_point = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); m_isMouseDown = true; // TODO: Add ZoomIn.OnMouseDown implementation } publicoverridevoid OnMouseMove(int Button, int Shift, int X, int Y) { //MouseDown为发生时返回 if (!m_isMouseDown) return; IActiveView p

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com