[vtkusers] vtkPlaneWidget
Jeff Lee
jeff at cdnorthamerica.com
Thu Sep 16 07:40:01 EDT 2004
James Robinson wrote:
> Dear All,
>
> Many thanks to Goodwin (Lawlor) for his ideas. It is very much along
> the lines of what I was thinking. However, the issue is “where” does
> one do these operations? The correct place would be as part of the
> vtkPlaneWidget itself (ergo my comment “short of writing a new object”
> – which would be inherited form vtkPlaneWidget). What I am going to do
> is write something into the call back for the widget. If this works I
> will then consider writing it into the callback for the 3D axis that I
> have written (a triad that rotates to indicate the view orientation –
> which is linked to camera events). This would (I think) answer
> Goodwins’s need for the vtkPlaneWidget handles to resize dynamically
> (which I would have happen at the same time as the auto resizing of
> the plane itself).
>
> As an aside, I am delving into the vtk3DWidget code and in SizeHandles
> I noticed the following:
>
> float vtk3DWidget::SizeHandles(float factor)
>
> {
>
> int i;
>
> vtkRenderer *renderer;
>
> if ( !this->ValidPick || !(renderer=this->CurrentRenderer) ||
>
> !renderer->GetActiveCamera() )
>
> {
>
> return (this->HandleSize * factor * this->InitialLength);
>
> }
>
> Notice the 2^nd logical check is “renderer=this->CurrentRenderer”.
> This is an assignment and is always true (I think). Is this code
> correct, or should it be “renderer == this->CurrentRenderer”????
>
Hi James,
It is correct. It is just assigning the value of this->CurrentRenderer
to renderer and then the logical check is whether the renderer pointer
is null or not. I agree that the 3d widgets need another pass to add the
functionality of resizing the handles when the viewport changes, and I'm
thinking that a similar approach can be used to get your widget to reset
the bounds when the viewport changes. I think it would be as simple as
subclassing the widget in question and adding an observer to its
renderer's camera. In the observer callback, you can readjust the bounds
of the widget (or scale it) according to the size of the viewport in
world coordinates. I can see this getting tricky to change the bounds of
the widget without changing the plane, say if someone sets up their
plane just right and then pans left too far and all the sudden the plane
is moved from where they positioned it, but I may just not understand
what you are trying to do. Anyway, I think the camera observer is your
best bet. (I use the same method to keep certain glyphs in world
coordinates a constant pixel size on the screen).
-J
> Regards to all,
>
> Jim
>
> *Jim Robinson*
>
> + 42 Rivergrove,
>
> Glanmire,
>
> Co. Cork,
>
> Eire
>
> ' +353 21 4822028
>
> +353 87 2393010
>
> - jrobinson at eircom.net <mailto:jrobinson at eircom.net>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>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
>
>
More information about the vtkusers
mailing list