]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 6 Oct 2016 02:40:47 +0000 (21:40 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 6 Oct 2016 02:40:47 +0000 (21:40 -0500)
plugins/Widgets/LineWidget.cxx
plugins/Widgets/SeedWidget.cxx

index f73e100ae28645067dad3862eabe5ad5840cd6b0..8887463e1252e9a175bdf7ac8cbdc9d2eafcf24b 100644 (file)
@@ -21,6 +21,13 @@ Clear( )
 void cpPluginsWidgets::LineWidget::
 SetEnabled( bool v )
 {
+  auto wdg = this->GetVTK< vtkLineWidget2 >( );
+  if( wdg != NULL )
+  {
+    wdg->SetEnabled( v );
+    wdg->GetInteractor( )->Render( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
@@ -118,17 +125,23 @@ _GD_Image( vtkImageData* image )
   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 );
index dc5b6a56ad596abb5927fa8d75a444e309a6a14e..f0c9094e80e639b3494e1b51c5c7cf5a1155c5c2 100644 (file)
@@ -26,6 +26,14 @@ Clear( )
 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
 }
 
 // -------------------------------------------------------------------------
@@ -130,7 +138,6 @@ _GD0_Image( vtkImageData* image )
           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