]> Creatis software - bbtk.git/blobdiff - packages/vtk/src/bbvtkPolyDataToActor.cxx
#3008 BBTK Feature New Normal - Active option in box vtk::IsoSurfaceExtractor
[bbtk.git] / packages / vtk / src / bbvtkPolyDataToActor.cxx
index d49a2949b670e82ad829317b29e209f6b70ad5d4..58852e83ed9df71d7b01f60835d83c4e7aff505b 100644 (file)
@@ -54,13 +54,14 @@ namespace bbvtk
 
    void PolyDataToActor::bbUserSetDefaultValues() 
    { 
-          firsttime=true;
+          actorAdded=false;
           std::vector<double> colour;
           colour.push_back(1.0);
           colour.push_back(1.0);
           colour.push_back(0.5);
           bbSetInputColour(colour);
 
+          bbSetInputActive(true);
           bbSetInputIn(NULL);
           bbSetInputRenderer(NULL);
           bbSetInputTransform(NULL);
@@ -104,42 +105,50 @@ namespace bbvtk
        
 //---------------------------------------------------------------------
 
-   void PolyDataToActor::DoProcess()
-   {      
-     polydatamapper->SetInput( bbGetInputIn() );
-     
-        vtkactor->GetProperty()->SetRepresentation( bbGetInputRepresentation() );
-        vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
-          
-     vtkactor->GetProperty()->SetColor( bbGetInputColour()[0],  
-                                       bbGetInputColour()[1], 
-                                       bbGetInputColour()[2] );
-          
-     vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
-     
-     if ( bbGetInputTransform()!=NULL )
-     {
-        vtkactor->SetUserTransform( bbGetInputTransform() );
-     }
-
-     bbSetOutputOut( vtkactor );
-
-     // Interface Update
-     if ((firsttime==true) && (bbGetInputRenderer()!=NULL ))
-     {
-       firsttime=false;
-       bbGetInputRenderer()->AddActor( vtkactor );
-     }  // firsttime
-
-     if (bbGetInputScalarVisibility()==true )
-     {
-            polydatamapper->ScalarVisibilityOn();
-     } else {
-            polydatamapper->ScalarVisibilityOff();
-     } // ScalarVisibility
+       void PolyDataToActor::DoProcess()
+       {
 
-
-   }
+               if (bbGetInputActive()==true)
+               {
+                        polydatamapper->SetInput( bbGetInputIn() );
+                        vtkactor->GetProperty()->SetRepresentation( bbGetInputRepresentation() );
+                        vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
+                          
+                        vtkactor->GetProperty()->SetColor( bbGetInputColour()[0],  
+                                                       bbGetInputColour()[1], 
+                                                       bbGetInputColour()[2] );
+                                 
+                        vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
+                        
+                        if ( bbGetInputTransform()!=NULL )
+                        {
+                               vtkactor->SetUserTransform( bbGetInputTransform() );
+                        }
+
+                        bbSetOutputOut( vtkactor );
+
+                        // Interface Update
+                        if ((actorAdded==false) && (bbGetInputRenderer()!=NULL ))
+                        {
+                          actorAdded=true;
+                          bbGetInputRenderer()->AddActor( vtkactor );
+                        }  // actorAdded
+
+                        if (bbGetInputScalarVisibility()==true )
+                        {
+                                polydatamapper->ScalarVisibilityOn();
+                        } else {
+                                polydatamapper->ScalarVisibilityOff();
+                        } // ScalarVisibility
+               } else {
+                        // Interface Update
+                        if ((actorAdded==true) && (bbGetInputRenderer()!=NULL ))
+                        {
+                          actorAdded=false;
+                          bbGetInputRenderer()->RemoveActor( vtkactor );
+                        }  // actorAdded
+               } // Active
+       }