• 基础的Mapgis三维二次开发-插件式


    最近在做一个杭州石油的项目开发一个小系统。


    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; 
            }
        }
    }
    

  • 相关阅读:
    Python,文件修改
    Python,文件
    driver.find_element_by_xpath.clear()无法清空输入框默认值
    对于隐藏性质的非标准的动态 id 的下拉框,如何定位和选中
    driver.find_element_by_xpath() 带参数时的写法
    不能聚焦元素问题 WebDriverException: Message: unknown error: cannot focus element
    firefox56 版本中的 Selenium IDE 无法导出脚本问题
    元素无法定位问题 NoSuchElementException: Message: no such element: Unable to locate element 解决方法
    selenium python 脚本不支持中文问题
    关于 chromedriver、IEDriverServer、geckodriver 驱动器的几项注意点
  • 原文地址:https://www.cnblogs.com/lightmare/p/10398850.html
Copyright © 2020-2023  润新知