[vtk-developers] subclassing vtkInteractorStyle error C#

Jian Fu fujay at ymail.com
Fri Jul 31 20:59:46 EDT 2009


Hi Everyone,


I am new to vtk. Currently working on a study assignment which useing vtk. Here is my problem: I am trying to implement my own interactor style, and  let the vtkRenderWindowInteractor to use the new derived style class, but got some error when compiling the new style, below is my code( in C#)

using System;
using System.Collections.Generic;
using System.Text;
using vtk;
namespace Assignment2
{
    class vtkInteractorStyleMyCamera:vtkInteractorStyle
    {
        public override void OnChar()
        {
            switch (this.GetInteractor().GetKeyCode().ToString())
            {
                case "w": break;
                case "s": break;
             }
        }
     }
}

the erro message is:

Error 2 'Assignment2.vtkInteractorStyleMyCamera.OnChar()': cannot override inherited member 'vtk.vtkInteractorStyle.OnChar()' because it is not marked virtual, abstract, or override D:\Assignment2\vtkInteractorStyleMyCamera.cs 10 30 Assignment2

Seems overriding methods from vtkInteractorStyle is not allowed in its subclasses, but vtk help document says we can do so. And if  I only create an empty(no members) interactorstyle subclass, and let my program use it, it certainly does not respone to any mouse motions, but the key 'w' and 's' are still functional. seems key 's' and 'w' are handled somewhere else rathan than in the style class. Did I miss anything in the code segment? how can I solve it? could anyone explain how vtk handles window events?

 By the way, is there anyway we can stop vtk interpolating window events so that standard C#.net window event handling will be back on track? 

Thank you, appreciate your time..

Jay


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20090731/cebbd2c1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stat4886.jpg
Type: image/gif
Size: 21362 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20090731/cebbd2c1/attachment-0001.gif>


More information about the vtk-developers mailing list