[vtkusers] vtkInteractorStyle etc

James C. Robinson j.robinson at kepler-systems.com
Fri Mar 12 11:57:03 EST 2004


Charles,

Many thanks.

As with all things, they are simple if you have been presented them clearly.
The thing, therefore, with Delete() is that it doesn't delete but decrements
a counter until the counter is to 0 and then it does delete (?). You see, I
have hitherto used VTK in my application (v3.2 & v4.0) without having to
explicitly select a vtkInteractorStyle and therefore, if it ain't broke.....
However, I will obviously have to get at it now to circumvent the problems
with vtkInteractorObserver. Just to recap, do I have to then recast the
vtkInteractorObserver to a  vtkInteractorStyle get at the  methods in
vtkInteractorStyle?

Finally, do you have any ideas about the whole
AutoAdjustCameraClippingRangeOff method? I explained in my earlier e-mail
that the issue is because when it is on automatic the near clipping plane is
1% of the total dimension from the camera and in a large scene (say 4000m FE
mesh) this means that the near clipping plane is 40m from the camera.

Jim


______________________

James C. Robinson, PhD,
Chartered Engineer,
Kepler Simulation Systems Ltd.,
42 Rivergrove,
Glanmire, Co. Cork,
Eire

Tel:         +353-21-4822028
Tel:         +353-87-2393010
Fax:        +353-21-4822028
E-mail:     j.robinson at kepler-systems.com
______________________

-----Original Message-----
From: Charl P. Botha [mailto:c.p.botha at ewi.tudelft.nl]
Sent: 12 March 2004 14:54
To: j.robinson at kepler-systems.com
Cc: Vtkusers at Public. Kitware. Com
Subject: Re: [vtkusers] vtkInteractorStyle etc

On Fri, 2004-03-12 at 15:37, James C. Robinson wrote:
> As I haven't had any responses yet  in regard my queries, I am trying to
> investigate further. One logic that coccurred to me in regard the new
setup
> (vtkRenderWindowInteractor having a pointer to an vtkInteractorObsever
> instead of a vtkInteractorStyle) was the idea that, the very basic
> functionalities required must be in vtkInteractorObsever, and then the
> vtkInteractorStyle (and sub classes) are built upon this. You then put a
> pointer to the base class in the vtkRenderWindowInteractor and maybe
> recast(?) in your own code, depending on which subclass you use. This
would
> mean that one should have to new an instance of vtkInteractorStyle in
one's
> code explicitly and point the vtkRenderWindowInteractor at it (using
> this->SetInteractorStyle())??

Something like that, although it's far simpler than you make it sound.
:)  Just create the InteractorStyle you need, call the
SetInteractorStyle method of the relevant RenderWindowInteractor with
your instance pointer as parameter, and call Delete() again.  The RWI
will make sure it removes its reference when it dies.  Please continue
reading for a 3 sentence crash course on VTK reference counting.

>
> However, in the code for vtkRenderWindowInteractor, in its constructor we
> have:
>
>  this->RenderWindow    = NULL;
>   this->InteractorStyle = NULL;
>   this->SetInteractorStyle(vtkInteractorStyleSwitch::New());
>   this->InteractorStyle->Delete();
>
> I am probably not understanding this clearly, but, why does it create a
new
> instance of vtkInteractorStyleSwitch and then destroy it?

It creates it with a reference count of 1, sets it, which adds 1 more to
the ref count bringing it to 2 and then Delete()s it, bringing the ref
count back to 1.  This means it's not destroyed.

As with all things in life, references you give and references you take
away have to balance in the end.

>
> Is my understanding in the first paragraph correct? Should I be creating a
> new instance of my choice of vtkInteractorStyle in my MFCView?
>
> Please advise.
>
> Jim
> ______________________
>
> James C. Robinson, PhD,
> Chartered Engineer,
> Kepler Simulation Systems Ltd.,
> 42 Rivergrove,
> Glanmire, Co. Cork,
> Eire
>
> Tel:         +353-21-4822028
> Tel:         +353-87-2393010
> Fax:        +353-21-4822028
> E-mail:     j.robinson at kepler-systems.com
> ______________________
>
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
--
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/






More information about the vtkusers mailing list