基础的Mapgis三维二次开发-插件式
2024-09-07 23:28:01
最近在做一个杭州石油的项目开发一个小系统。
1.命令必须是 ICommand 的派生类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using MapGIS.PluginEngine;
using System.Windows.Forms;
using MapGIS.Scene3D;
namespace ThreeDimenModeling
{
class IsoheightModeling : ICommand
{
//应用框架对象
IApplication hock = null;
//场景视图控件
SceneControl sceneCtrl = null;
#region ICommand成员
public Bitmap Bitmap
{
get { return null; }
}
public string Caption
{
get { return "等高线建模"; }
}
public string Category
{
get { return "ThreeDimenModeling"; }
}
public bool Checked
{
get { return false; }
}
public bool Enabled
{
get { return true; }
}
public string Message
{
get { return ""; }
}
public string Name
{
get { return "等高线建模"; }
}
public string Tooltip
{
get { return ""; }
}
public void OnClick()
{
sceneCtrl = (this.hock.ActiveContentsView as ISceneContentsView).SceneControl;
IsoheightModelingForm IsoHeiMoForm = new IsoheightModelingForm(sceneCtrl );
if (IsoHeiMoForm.ShowDialog() != DialogResult.OK) return;
}
public void OnCreate(IApplication hook)
{
if (hook != null)
{
this.hock = hook;
this.hock.StateManager.StateChangedEvent += new StateChangedHandler(StateManager_StateChangedEvent);
}
}
void StateManager_StateChangedEvent(object sender, StateEventArgs e)
{
this.hock.PluginContainer.PluginEnable(this, false);
bool bEnable = false;
if (this.hock.ActiveContentsView != null && this.hock.ActiveContentsView is ISceneContentsView)
{
//当存在当前编辑状态的图层时,才可以进行查询
SceneControl ctr = (this.hock.ActiveContentsView as ISceneContentsView).SceneControl;
if (ctr != null && ctr.GetSceneNum() > 0)
{
bEnable = true;
}
}
this.hock.PluginContainer.PluginEnable(this, bEnable);
return;
}
private void PluginContainer_ContentsViewClosingEvent(IContentsView contentsView, ContentsViewClosingEventArgs args)
{
if (contentsView is ISceneContentsView)
{
SceneControl ctr = (this.hock.ActiveContentsView as ISceneContentsView).SceneControl;
}
}
#endregion
}
}
2.弹出Form
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 MapGIS.Scene3D;
namespace ThreeDimenModeling
{
public partial class IsoheightModelingForm : Form
{
//场景控件
SceneControl sceneCtrl = null;
public IsoheightModelingForm(SceneControl sCtrl )
{
InitializeComponent();
this.sceneCtrl = sCtrl;
}
}
}
最新文章
- GPU硬件加速相关
- w3m常用快捷键
- bash: 避免命令重复执行的简单脚本
- FlatBuffers与protobuf性能比较
- 实验一DOS报告
- NSLayoutConstraint-代码实现自己主动布局的函数使用方法说明
- WAS下获取包路径下所有类
- 推荐一款JavaScript日历控件:kimsoft-jscalendar
- Android4种网络连接方式HttpClient、HttpURLConnection、OKHttp和Volley优缺点和性能对比
- 已实现乐观锁功能,FreeSql.DbContext 准备起航
- visual studio中各文件的输出路径
- nginx [alert] 12339#0: 1024 worker_connections are not enough
- glVertexAttribPointer 用法简介
- Sub-Processes and Call Activities
- LeetCode--066--加一
- Postman简明教程
- nginx_upstream_check_module-master对nginx的后端机器进行健康状态检查报403错误【转】
- bzoj 2152
- Fiddler实现手机抓包——小白入门 - 做一个不动声色的大人
- Linux安装vsftpd
热门文章
- 截取HTML中的JSON数据并利用GSON进行解析(Android)
- maven - 初识
- Django + Vue cli 3.0 访问静态资源问题
- 分享| 语义SLAM的未来与思考(泡泡机器人)
- 《SQL 进阶教程》 case:练习题1-1-1 多列数据的最大值
- [LOJ 2022]「AHOI / HNOI2017」队长快跑
- 关于企业邮箱无法提醒解决办法(未安装邮件客户端可添加至网易邮箱大师/qq邮箱等)
- Ubuntu 下修改Tomcat和Jetty默认的JDK和初始内存
- Spring Boot自动配置原理与实践(一)
- vue2.0:(九)、外卖App弹窗部分星星评分