[vtkusers] How to remove points/handle from one vtkDistanceWidget or vtkAngleWidget?
Karthik Krishnan
karthik.krishnan at kitware.com
Mon Jul 19 14:44:06 EDT 2010
Arnaud:
I just pushed a bunch of changes. The class vtkDistanceWidget,
vtkAngleWidget and vtkBiDimensionalWidget all now have the following two
methods :
// Description:
// Set the state of the widget to "defined" (in case its widget and its
// representation were initialized programmatically). This must generally
// be followed by a Render() for things to visually take effect.
virtual void WidgetIsDefined();
// Description:
// Has the widget been defined completely yet ? ie. Have the end points
been
// laid and is it in Manipulate mode ?
virtual int IsWidgetDefined();
So what you can do is :
representation->SetPoint1WorldPosition(...)
representation->SetPoint2WorldPosition(...)
distanceWidget->SetRepresentation(representation);
distanceWidget->EnabledOn();
distanceWidget->WidgetIsDefined();
distanceWidget->Render();
Internally, the WidgetIsDefined() call, sets the widget state to
"manipulate", releases any focus that it may have grabbed during the define
phase, builds the representation and shows/hides the handles properly.
The same is the case for the other 2 widgets....
If I can slowly add it to a good number of widgets (several widgets have a
"define" phase during which their query is invalid), then I'd like to make
this a default no-op method in the base class, vtkAbstractWidget, so that
subclasses can implement it in whatever way they choose to.
Please let me know if you have any issues.
Thanks
--
karthik
On Fri, Jul 16, 2010 at 12:38 AM, Karthik Krishnan <
karthik.krishnan at kitware.com> wrote:
> Yes. That's missing and its an often needed feature. I'll add this
> functionality in tomorrow Arnaud.
>
> Thanks
> --
> karthik
>
>
> On Thu, Jul 15, 2010 at 7:37 PM, Arnaud GELAS <
> arnaud_gelas at hms.harvard.edu> wrote:
>
>> Actually I am more interested in being able to reinitialize these
>> widgets.
>> For instance, when you want to measure different objects that are far
>> apart, and I guess it would be faster to reinitialize the widget than to
>> drag these points to another part of my image (quite far from here).
>>
>> How should I proceed?
>>
>> Thanks,
>> Arnaud
>>
>>
>> On 07/15/2010 09:56 AM, Karthik Krishnan wrote:
>>
>> How can the widget exist in a valid state without its end points ? Do you
>> mean you want to re-define the widget from start in response to a key press
>> ?
>>
>> Please let us know.
>>
>> Thanks
>> --
>> karthik
>>
>> On Thu, Jul 15, 2010 at 7:21 PM, Arnaud GELAS <
>> arnaud_gelas at hms.harvard.edu> wrote:
>>
>>> Hi all,
>>>
>>> I would like to be able to
>>> * delete points/handles from these widgets with a key
>>> * reinitialize these widgets without any points/handle on the screen.
>>>
>>> I could not figure out how to proceed?
>>> Is it possible with the existing code?
>>>
>>> Thanks,
>>>
>>> Best Regards,
>>> Arnaud
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100720/30ea0f92/attachment.htm>
More information about the vtkusers
mailing list