第一范文网 - 专业文章范例文档资料分享平台

C#二次开发ArcGIS查询功能

来源:用户分享 时间:2025/5/23 16:53:58 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

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

ArcGISCategoryUnregistration(registerType); }

#region ArcGIS Component Category Registrar generated code 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 //获取视图范围

privateIScreenDisplay m_focusScreenDisplay = null; //标记操作进程

privatebool m_PanOperation;

privateIHookHelper m_hookHelper; public Pan() {

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) {

if (m_hookHelper == null)

m_hookHelper = newHookHelperClass();

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

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

m_hookHelper.Hook = hook;

// TODO: Add Pan.OnCreate implementation }

publicoverridevoid OnClick() {

// TODO: Add Pan.OnClick implementation }

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

//判断是否鼠标左键

if (Button != 1) return; //获取视图范围并开始漫游

IActiveView pActiveView = m_hookHelper.ActiveView;

m_focusScreenDisplay = pActiveView.ScreenDisplay;

IPoint pPoint = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); m_focusScreenDisplay.PanStart(pPoint); //标记漫游操作为真

m_PanOperation = true;

// TODO: Add Pan.OnMouseDown implementation }

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

//判断是否鼠标左键

if (Button != 1) return; //是否漫游状态

if (!m_PanOperation) return; //追踪鼠标

IPoint pPoint = m_focusScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); m_focusScreenDisplay.PanMoveTo(pPoint); // TODO: Add Pan.OnMouseMove implementation }

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

//判断是否鼠标左键

if (Button != 1) return; //是否漫游状态

if (!m_PanOperation) return;

IEnvelope pExtent = m_focusScreenDisplay.PanStop(); //判断移动区域是否为空 if (pExtent != null) {

m_focusScreenDisplay.DisplayTransformation.VisibleBounds = pExtent; m_focusScreenDisplay.Invalidate(null, true, (short)esriScreenCache.esriAllScreenCaches); }

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

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

//关闭漫游状态

m_PanOperation = false;

// TODO: Add Pan.OnMouseUp implementation }

#endregion } }

8、ZoomIn类源码

namespace MyMap.Classes {

[Guid(\)] [ClassInterface(ClassInterfaceType.None)] [ProgId(\)] publicsealedclassZoomIn : 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 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);

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

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

}

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

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

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

privateINewEnvelopeFeedback m_feedBack; privateIHookHelper m_hookHelper; public ZoomIn() {

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) {

if (m_hookHelper == null)

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

// TODO: Add ZoomIn.OnCreate implementation }

publicoverridevoid OnClick() {

// TODO: Add ZoomIn.OnClick implementation }

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

//当前地图视图为空时返回

if (m_hookHelper.ActiveView == null) return;

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

搜索更多关于: C#二次开发ArcGIS查询功能 的文档
C#二次开发ArcGIS查询功能.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c19whw7d81f2r4yi9c8hj79c964hjsm00lc8_8.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top