void cpPluginsWidgets::LineWidget::
SetEnabled( bool v )
{
+ auto wdg = this->GetVTK< vtkLineWidget2 >( );
+ if( wdg != NULL )
+ {
+ wdg->SetEnabled( v );
+ wdg->GetInteractor( )->Render( );
+
+ } // fi
}
// -------------------------------------------------------------------------
vtkSmartPointer< vtkLineWidget2 > wdg = this->GetVTK< vtkLineWidget2 >( );
if( wdg.GetPointer( ) == NULL )
{
- auto rep = vtkSmartPointer< vtkLineRepresentation >::New( );
+ auto vIt = valid_props.begin( );
+ auto actor = dynamic_cast< vtkImageSlice* >( *( vIt->second.begin( ) ) );
+
+ double bnds[ 6 ];
+ actor->GetBounds( bnds );
+ double p0[ 3 ], p1[ 3 ];
+ p0[ 0 ] = bnds[ 0 ];
+ p0[ 1 ] = bnds[ 2 ];
+ p0[ 2 ] = bnds[ 4 ];
+ p1[ 0 ] = bnds[ 1 ];
+ p1[ 1 ] = bnds[ 3 ];
+ p1[ 2 ] = bnds[ 5 ];
- /* TODO
- p[ 0 ] = 0.0; p[ 1 ] = -1.0; p[ 2 ] = 0.0;
- rep->SetPoint1WorldPosition( p );
- p[ 0 ] = 0.0; p[ 1 ] = 1.0; p[ 2 ] = 0.0;
- rep->SetPoint2WorldPosition( p );
- rep->PlaceWidget( pl3d_block0->GetBounds( ) );
- rep->GetPolyData( seeds );
- rep->DistanceAnnotationVisibilityOn( );
- */
+ auto rep = vtkSmartPointer< vtkLineRepresentation >::New( );
+ rep->SetPoint1WorldPosition( p0 );
+ rep->SetPoint2WorldPosition( p1 );
+ rep->PlaceWidget( bnds );
wdg = this->_CreateVTK< vtkLineWidget2 >( );
wdg->SetInteractor( valid_props.begin( )->first );
void cpPluginsWidgets::SeedWidget::
SetEnabled( bool v )
{
+ for( auto w = this->m_Widgets.begin( ); w != this->m_Widgets.end( ); ++w )
+ {
+ if( v ) w->second->RestartInteraction( );
+ else w->second->CompleteInteraction( );
+ w->second->SetEnabled( v );
+ w->second->Render( );
+
+ } // rof
}
// -------------------------------------------------------------------------
act->AddObserver( vtkCommand::InteractionEvent, this->m_Command );
wdg->AddObserver( vtkCommand::PlacePointEvent, this->m_Command );
wdg->AddObserver( vtkCommand::CursorChangedEvent, this->m_Command );
- wdg->EnabledOn( );
this->m_Widgets[ *inIt ] = wdg;
} // fi