Exemplo n.º 1
0
        public override void Unload()
        {
            if (m_TheInputDevice != null)
                m_TheInputDevice.Disconnect();

            if ((m_KeyEventHandler != null) && (s_TheKeyBoard != null))
                s_TheKeyBoard.KeyboardEventDOWN -= m_KeyEventHandler;
            if ((m_SensorEventHandler != null) && (s_TheSensor != null))
                s_TheSensor.SensorInput -= m_SensorEventHandler;

            m_KeyEventHandler = null;
            m_SensorEventHandler = null;
            s_TheSensor = null;
            s_TheCamera = null;

            s_dLastHeight = 0;
            s_dDeltaHeight = 0;
            s_stopWatch = null;  //check event interval of the input device
            s_TheCamera = null;
            s_WW = null;

            if (m_TheInputDevice != null)
                m_TheInputDevice.Release();

            m_TheInputDevice = null;

            // Clean up, remove menu item
            // JBTODO: m_app.MenuStrip.Items.Remove(menuItem);
            base.Unload();
        }
Exemplo n.º 2
0
        public override void Load()
        {
            base.Load();

            // Add our plugin to the World Wind Tools menu
            menuItem = new System.Windows.Forms.ToolStripMenuItem();
            menuItem.Text = "3Dconnexion Input Device";
            menuItem.Click += new System.EventHandler(menuItem_Click);
            s_stopWatch = new Stopwatch();
            s_WW = m_Application.WorldWindow;

            s_TheCamera = s_WW.DrawArgs.WorldCamera;

            m_TheInputDevice = new TDconnexion.TDxDeviceWrapper();
            if (m_TheInputDevice != null)
            {
                    if (m_TheInputDevice.InitializationSuccessful)
                    {
                        // JBTODO: m_app.MenuStrip.Items.Add(menuItem);

                        s_TheSensor = m_TheInputDevice.Sensor;
                        s_TheKeyBoard = m_TheInputDevice.Keyboard;
                        s_Position = new Point3d();
                        SetCameraMode();
                        m_KeyEventHandler = new TDconnexion.TDxKeyboardEvent(KeyboardEventHandler);
                        s_TheKeyBoard.KeyboardEventDOWN += m_KeyEventHandler;
                        m_TheInputDevice.Connect();
                    }
                    else
                    {
                        m_TheInputDevice = null;
                    }
            }
        }