-#include <plugins/Widgets/LineWidget.h>
+#include <Widgets/LineWidget.h>
#include <cpPlugins/DataObjects/Image.h>
#include <cpPlugins/DataObjects/Mesh.h>
#include <cpExtensions/Visualization/WindowLevelImageActor.h>
void cpPluginsWidgets::LineWidget::
SetEnabled( bool v )
{
+ auto wdg = this->GetVTK< vtkLineWidget2 >( );
+ if( wdg != NULL )
+ {
+ wdg->SetEnabled( v );
+ wdg->GetInteractor( )->Render( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+bool cpPluginsWidgets::LineWidget::
+GetEnabled( ) const
+{
+ auto wdg = this->GetVTK< const vtkLineWidget2 >( );
+ if( wdg != NULL )
+ {
+ vtkLineWidget2* w = const_cast< vtkLineWidget2* >( wdg );
+ return( w->GetEnabled( ) != 0 );
+ }
+ else
+ return( false );
}
// -------------------------------------------------------------------------
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 );