[vtkusers] Why I can't move the BorderWidget

Liu_tj tjlp at netease.com
Tue May 10 12:09:05 EDT 2016


Hi,


I use BorderWidget on the vtkImageViewer2 to select area. After I set the initial left bottom and right top corner and enable it, I can't move the borderWidget. Why?


And when I drag the left bottom corner, the right top corner will change automatically. Can any guy tell me what happens?


Below is the C# code for BorderWidget:



vtkBorderWidget m_areaSegment = vtkBorderWidget.New();

m_areaSegment.SetInteractor( m_renderWindow.GetInteractor() );

vtkBorderRepresentation rep = vtkBorderRepresentation.New();

rep.SetShowBorderToOn();

m_areaSegment.SetRepresentation( rep );

m_areaSegment.InteractionEvt += newvtkObject.vtkObjectEventHandler( area_segment_InteractionEvt );

m_areaSegment.SelectableOn();

vtkBorderRepresentation borderrep = vtkBorderRepresentation.SafeDownCast( m_areaSegment.GetRepresentation() );

m_renderer.WorldToView();

double[] viewpint1 = m_renderer.GetViewPoint();

m_renderer.SetWorldPoint(displaybounds[0], displaybounds[2], displaybounds[4], 1);

m_renderer.WorldToView();

double[] viewpint = m_renderer.GetViewPoint();

borderrep.GetPositionCoordinate().SetCoordinateSystemToView();

borderrep.GetPosition2Coordinate().SetCoordinateSystemToView();

borderrep.SetPosition(viewpint[0], viewpint[1]);

borderrep.SetPosition2(viewpint1[0], viewpint1[1]);

borderrep.GetBorderProperty().SetColor(0.0, 1.0, 0.0);

borderrep.SetShowBorderToOn();

borderrep.MovingOn();

m_renderWindow.Render();

m_areaSegment.On();



Thanks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160511/c89a13b2/attachment.html>


More information about the vtkusers mailing list