Hi everyone.<div><br></div><div>I am working with vtkLineWidget2 and vtkLineRepresentation. I have a function that is to align the vtkLineWidget to some axis. The problem is that when I interact with the widget with the mouse, the streamlines that use the vtkLineWidget's polydata updates correctly. However when I call the function to set the Line Widget's positions, the streamlines do not update (the polydata is not getting updated - how do I invoke it to update?)</div>
<div><br></div><div><div>switch (axis)<span class="Apple-tab-span" style="white-space:pre">        </span>// Align to axis, keep original length</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>case flowModuleStreamlines::XAxis:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>start[0] += length;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>m_LineRep->SetPoint2WorldPosition(start);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>break;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>case flowModuleStreamlines::YAxis:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>start[1] += length;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>m_LineRep->SetPoint2WorldPosition(start);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>break;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>case flowModuleStreamlines::ZAxis:</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>start[2] += length;<span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>m_LineRep->SetPoint2WorldPosition(start);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>break;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>default:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>break;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>m_Callback->Execute(m_LineWidget,0,0); // Manually update widget's position - but streamlines don't update?!</div>
</div><div><br></div><div>I then manually call the callback for it to update - but it only updates the widget - my pipeline further down is not updated! If I click on the render window though, it updates again - this is probably because the widget itself needs an event to update internally? My question is how do I invoke this event, and is there a better way to do this?</div>
<div><br></div><div>Heres the callback:</div><div><br></div><div><div>class vtk2DLineCallback : public vtkCommand</div><div>{</div><div>public:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>static vtk2DLineCallback *New() </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>{ </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return new vtk2DLineCallback; </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
<div><br></div><div> virtual void Execute(vtkObject *caller, unsigned long, void*)</div><div> {</div><div> vtkLineWidget2 *lineWidget = reinterpret_cast<vtkLineWidget2*>(caller);</div><div> vtkLineRepresentation *rep = </div>
<div> reinterpret_cast<vtkLineRepresentation*>(lineWidget->GetRepresentation());</div><div> rep->GetPolyData(this->PolyData);</div><div> this->Actor->VisibilityOn();</div><div> }</div>
<div><br></div><div> vtk2DLineCallback():PolyData(0),Actor(0){}</div><div> vtkPolyData *PolyData;</div><div> vtkActor *Actor;</div><div>};</div></div><div><br></div><div>The callback is called on EndInteractionEvent...</div>
<div><br></div><div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>m_LineWidget->AddObserver(vtkCommand::EndInteractionEvent,m_Callback);</div><div><div><br></div><div>I've tried using the invokeEvent method, but have limited success and am not sure how to do it correctly.</div>
<div><br></div><div>Thanks!</div></div></div><div><br></div>