Example #1
0
        void UserStyle_MultipleEventHandler(Kitware.VTK.vtkObject sender, Kitware.VTK.vtkObjectEventArgs e)
        {
            string keysym = this.Interactor.GetKeySym();

            Kitware.VTK.vtkCommand.EventIds eid = (Kitware.VTK.vtkCommand.EventIds)e.EventId;

            switch (eid)
            {
            case Kitware.VTK.vtkCommand.EventIds.KeyPressEvent:
            case Kitware.VTK.vtkCommand.EventIds.CharEvent:
            case Kitware.VTK.vtkCommand.EventIds.KeyReleaseEvent:
                if (keysym == "f")
                {
                    // Temporarily disable the interactor, so that the built-in 'f'
                    // handler does not get called:
                    //
                    this.Interactor.Disable();

                    // Turn on the timer, so we can re-enable the interactor
                    // after the processing of this event is over (one tenth
                    // of a second later...)
                    //
                    this.timer1.Enabled = true;
                }
                if (keysym.ToLower() == "j" || keysym.ToLower() == "k" || keysym.ToLower() == "l" || keysym.ToLower() == "i")
                {
                    WanderCamera(keysym);
                }
                break;
            }

            this.PrintEvent(sender, e);
        }
Example #2
0
        void ErrorWindow_ErrorHandler(Kitware.VTK.vtkObject sender, Kitware.VTK.vtkObjectEventArgs e)
        {
            string s = "unknown";

            if (e.CallData != IntPtr.Zero)
            {
                s = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(e.CallData);
            }

            System.Diagnostics.Debug.Write(System.String.Format(
                                               "ErrorWindow_ErrorHandler called: sender='{0}' e='{1}' s='{2}'", sender, e, s));
        }
Example #3
0
        void PrintEvent(Kitware.VTK.vtkObject sender, Kitware.VTK.vtkObjectEventArgs e)
        {
            int[]  pos     = this.Interactor.GetEventPosition();
            string keysym  = this.Interactor.GetKeySym();
            sbyte  keycode = this.Interactor.GetKeyCode();

            string line = String.Format("{0} ({1},{2}) ('{3}',{4}) {5} data='0x{6:x8}'{7}",
                                        Kitware.VTK.vtkCommand.GetStringFromEventId(e.EventId),
                                        pos[0], pos[1],
                                        keysym, keycode,
                                        e.Caller.GetClassName(), e.CallData.ToInt32(), System.Environment.NewLine);

            System.Diagnostics.Debug.Write(line);
            this.textEvents.AppendText(line);
        }
Example #4
0
 void Interactor_AnyEventHandler(Kitware.VTK.vtkObject sender, Kitware.VTK.vtkObjectEventArgs e)
 {
     this.PrintEvent(sender, e);
 }