Arnaud:<br><br>The attached example works. <br><br>Please make sure you &quot;git pull&quot; now. I just fixed a bug (thanks to your use case) when the widget is defined prior to enabling it. <br><br>I rearranged a few lines in your example code, (removed the interactor-&gt;Start() being called twice etc, added a prop so the camera doesn&#39;t go out of whack), nothing significant.<br>
<br>--------<br>  commit d832206da3502f395281e447e28305d11ff301c6<br>  Author: Karthik Krishnan &lt;<a href="mailto:karthik.krishnan@kitware.com">karthik.krishnan@kitware.com</a>&gt;<br>  Date:   Tue Jul 20 23:10:00 2010 +0530<br>
<br>      ENH: The interactor must be set before enabling the widget.<br>    <br>      When the method WidgetIsDefined() is called (ie the widget is defined<br>      programmatically) and then the method SetEnabled is invoked, we run<br>
      into a bug, in that the internal HandleWidgets are enabled without<br>      having their interactors set. Hence propagate the interactor from self<br>      into the child widgets always.<br>---------<br><br>Thanks for the feedback.<br>
--<br>karthik<br><br><br><div class="gmail_quote">On Tue, Jul 20, 2010 at 9:52 PM, Arnaud GELAS <span dir="ltr">&lt;<a href="mailto:arnaud_gelas@hms.harvard.edu">arnaud_gelas@hms.harvard.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">



  

<div bgcolor="#ffffff" text="#000000">
Hi Karthik,<br>
<br>
Thanks for looking at it!<br>
<br>
I have been trying it (by modifying the example from the wiki), but
it&#39;s still not clear to me what has changed in the behaviour of the
window? and how to &quot;reinitialize the widget&quot;?<br>
I guess I may have made mistakes in the code. Can you have a look and
tell me what I am doing wrong, please?<br>
<br>
Thanks,<br><font color="#888888">
Arnaud</font><div><div></div><div class="h5"><br>
<br>
<br>
On 07/19/2010 02:44 PM, Karthik Krishnan wrote:
<blockquote type="cite">Arnaud:<br>
  <br>
I just pushed a bunch of changes. The class vtkDistanceWidget,
vtkAngleWidget and vtkBiDimensionalWidget all now have the following
two methods :<br>
  <br>
  // Description:<br>
  // Set the state of the widget to &quot;defined&quot; (in case its widget and
its <br>
  // representation were initialized programmatically). This must
generally<br>
  // be followed by a Render() for things to visually take effect.<br>
  virtual void WidgetIsDefined();<br>
  <br>
  // Description:<br>
  // Has the widget been defined completely yet ? ie. Have the end
points been<br>
  // laid and is it in Manipulate mode ?<br>
  virtual int IsWidgetDefined(); <br>
  <br>
  <br>
So what you can do is :<br>
  <br>
 representation-&gt;SetPoint1WorldPosition(...)<br>
 representation-&gt;SetPoint2WorldPosition(...)<br>
 distanceWidget-&gt;SetRepresentation(representation);<br>
 distanceWidget-&gt;EnabledOn();<br>
 distanceWidget-&gt;WidgetIsDefined();<br>
 distanceWidget-&gt;Render();<br>
  <br>
Internally, the WidgetIsDefined() call, sets the widget state to
&quot;manipulate&quot;, releases any focus that it may have grabbed during the
define phase, builds the representation and shows/hides the handles
properly.<br>
  <br>
The same is the case for the other 2 widgets....<br>
  <br>
If I can slowly add it to a good number of widgets (several widgets
have a &quot;define&quot; phase during which their query is invalid), then I&#39;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.<br>
  <br>
Please let me know if you have any issues.<br>
  <br>
Thanks<br>
--<br>
karthik<br>
  <br>
  <br>
  <div class="gmail_quote">On Fri, Jul 16, 2010 at 12:38 AM, Karthik
Krishnan <span dir="ltr">&lt;<a href="mailto:karthik.krishnan@kitware.com" target="_blank">karthik.krishnan@kitware.com</a>&gt;</span>
wrote:<br>
  <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Yes.
That&#39;s missing and its an often needed feature. I&#39;ll add this
functionality in tomorrow Arnaud.<br>
    <br>
Thanks<br>
--<br>
    <font color="#888888">karthik</font>
    <div>
    <div><br>
    <br>
    <div class="gmail_quote">On Thu, Jul 15, 2010 at 7:37 PM, Arnaud
GELAS <span dir="ltr">&lt;<a href="mailto:arnaud_gelas@hms.harvard.edu" target="_blank">arnaud_gelas@hms.harvard.edu</a>&gt;</span>
wrote:<br>
    <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
      <div bgcolor="#ffffff" text="#000000">
Actually I am more interested in being able to reinitialize these
widgets.<br>
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).<br>
      <br>
How should I proceed?<br>
      <br>
Thanks,<br>
      <font color="#888888">Arnaud</font>
      <div>
      <div><br>
      <br>
On 07/15/2010 09:56 AM, Karthik Krishnan wrote:
      <blockquote type="cite">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 ?<br>
        <br>
Please let us know.<br>
        <br>
Thanks<br>
--<br>
karthik<br>
        <br>
        <div class="gmail_quote">On Thu, Jul 15, 2010 at 7:21 PM,
Arnaud
GELAS <span dir="ltr">&lt;<a href="mailto:arnaud_gelas@hms.harvard.edu" target="_blank">arnaud_gelas@hms.harvard.edu</a>&gt;</span>
wrote:<br>
        <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi
all,<br>
          <br>
I would like to be able to<br>
 * delete points/handles from these widgets with a key<br>
 * reinitialize these widgets without any points/handle on the screen.<br>
          <br>
I could not figure out how to proceed?<br>
Is it possible with the existing code?<br>
          <br>
Thanks,<br>
          <br>
Best Regards,<br>
Arnaud<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
          <br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
          <br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
          <br>
Follow this link to subscribe/unsubscribe:<br>
          <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
        </blockquote>
        </div>
        <br>
      </blockquote>
      <br>
      </div>
      </div>
      </div>
    </blockquote>
    </div>
    <br>
    </div>
    </div>
  </blockquote>
  </div>
  <br>
</blockquote>
<br>
</div></div></div>

</blockquote></div><br>