]> Creatis software - creaMaracasVisu.git/commitdiff
Comments
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 25 Jul 2013 14:26:23 +0000 (16:26 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 25 Jul 2013 14:26:23 +0000 (16:26 +0200)
bbtk/src/bbmaracasvisuShowNPoints.cxx
bbtk/src/bbmaracasvisuShowNPoints.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx

index 764e2a9cde244ec8d926825dd1d732cf441a06a9..b33daa47a187c337002ca084e8fcf6f5cf680a34 100644 (file)
@@ -164,6 +164,7 @@ WidgetShowNPoints::~WidgetShowNPoints()
 {
 }
 
+//------------------------------------------------------------------------
 void WidgetShowNPoints::SetRadio(double radio)
 {
        this->mradio=radio;
@@ -212,7 +213,7 @@ void WidgetShowNPoints::SetOpacity(double opacity)
 {
        this->mopacity=opacity;
        //NTU: For Slider
-       sdrOpacity->SetValue(this->mopacity/100.0);
+       sdrOpacity->SetValue(this->mopacity*100.0);
 }
 
 //------------------------------------------------------------------------
@@ -632,12 +633,15 @@ void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event)
        }
 
        //NTU: For updating
-       SetOutputBox();
+//EED  SetOutputBox();
+        renderer->GetRenderWindow()->Render();
+
 }
 
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ShowNPoints)
 BBTK_BLACK_BOX_IMPLEMENTATION(ShowNPoints,bbtk::WxBlackBox);
 
+//-----------------------------------------------------------------
 void ShowNPoints::Process()
 {
        if (mwxwidget!=NULL)
@@ -653,20 +657,23 @@ void ShowNPoints::Process()
                bbSetOutputlstPointsY( mwxwidget->GetLstPointsY() );
                bbSetOutputlstPointsZ( mwxwidget->GetLstPointsZ() );
                bbSetOutputlstLabels( mwxwidget->GetLstLabels() );
+
        } // mwxwidget
 }
 
+//-----------------------------------------------------------------
 void ShowNPoints::CreateWidget(wxWindow* parent)
 {
        mwxwidget = new WidgetShowNPoints( parent, this);
     bbSetOutputWidget( mwxwidget );
 }
 
+//-----------------------------------------------------------------
 void ShowNPoints::bbUserSetDefaultValues()
 {
        mwxwidget = NULL;
 
-       bbSetInputRadio(1);
+       bbSetInputRadio(10);
        bbSetInputOpacity(1);
 
        std::vector<double> colour;
index 86812890a9410dd36ecda92e69a3ae81bc28a3d1..d9eccccd0c09ef45998adaac1691d59c7da683fc 100644 (file)
@@ -69,8 +69,9 @@ namespace bbcreaMaracasVisu
          std::vector<int> GetLstPointsZ();
          std::vector<std::string> GetLstLabels();
 
-         void                  AddPoint(int x, int y, int z, std::string label);
-         
+         void AddPoint(int x, int y, int z, std::string label);
+
+
   private:
 
          std::string           CleanSpaces(std::string ss);
@@ -102,6 +103,7 @@ namespace bbcreaMaracasVisu
          wxStaticText          *txtNrPoints;
          wxSlider              *sdrOpacity;
          wxSlider              *sdrRadio;
+
   };
 
 class /*BBTK_EXPORT*/ ShowNPoints
@@ -138,8 +140,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ShowNPoints,bbtk::WxBlackBox);
   BBTK_INPUT(ShowNPoints,Renderer,"Renderer",vtkRenderer*,"");
   BBTK_INPUT(ShowNPoints,Image,"vktkImageData",vtkImageData*,"");
   BBTK_INPUT(ShowNPoints,Colour,"Colour of the actor",std::vector<double>,"colour");
-  BBTK_INPUT(ShowNPoints,Opacity,"Opacity of the actor",double,"");
-  BBTK_INPUT(ShowNPoints,Radio,"Radio of the spheres",double,"");
+  BBTK_INPUT(ShowNPoints,Opacity,"Opacity of the actor 0..1 (default 1)",double,"");
+  BBTK_INPUT(ShowNPoints,Radio,"Radio of the spheres 1..50 (default 10)",double,"");
   BBTK_INPUT(ShowNPoints,Type,"Type of the widget. 0(default): N-points, 1:Just one point",int,"");
   BBTK_OUTPUT(ShowNPoints , lstPointsX , " list of points X ", std::vector<int> ,"");
   BBTK_OUTPUT(ShowNPoints , lstPointsY , " list of points Y ", std::vector<int> ,"");
index 6bdef1c10575013b16d158e0aee15f168e9ccc89..e67cc22c0b5b7b4898c38685eaf9de4657c8f699 100644 (file)
@@ -387,6 +387,9 @@ vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey,
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::SetFreePlanesOrtho()
 {
+
+       
+
        _planeWidgetX->SetPlaneOrientationToXAxes();
        _planeWidgetY->SetPlaneOrientationToYAxes();
        _planeWidgetZ->SetPlaneOrientationToZAxes();
@@ -400,13 +403,44 @@ void wxVtkMPR3DView::FreePlaneVisible(int plane, bool ok)
 {
        if(_planeWidgetX)
        {
-               if ((plane==1) && (ok==true)) _planeWidgetX->EnabledOn();
-               if ((plane==2) && (ok==true)) _planeWidgetY->EnabledOn();
-               if ((plane==3) && (ok==true)) _planeWidgetZ->EnabledOn();
+               if (ok==true)
+               {
+//EED 21/07/2013
+//                     1. Make backup of actors
+//                     2. Putting out all the actors
+//                     3. Add vtkImagageActor in first place
+//                     4. Putting again the originals actors
+//                     5. Refresh
+
+                       // step 1, step 2
+                       vtkActorCollection *tmpCollection    = vtkActorCollection::New();
+                       vtkActorCollection *collectionActors =  _wxvtk3Dbaseview->GetRenderer()->GetActors();
+                       int i,size=collectionActors->GetNumberOfItems();
+                       for (i=0; i<size; i++)
+                       {
+                               tmpCollection->AddItem ( (vtkActor*)collectionActors->GetItemAsObject(0)  );                    
+                               _wxvtk3Dbaseview->GetRenderer()->RemoveActor( (vtkProp*)tmpCollection->GetItemAsObject(i) );
+                       } // for
+
+                       // step 3
+                       if ((plane==1) && (ok==true)) _planeWidgetX->EnabledOn();
+                       if ((plane==2) && (ok==true)) _planeWidgetY->EnabledOn();
+                       if ((plane==3) && (ok==true)) _planeWidgetZ->EnabledOn();
+
+                       // step 4
+                        for (i=0; i<size; i++)
+                       {
+                               _wxvtk3Dbaseview->GetRenderer()->AddActor( (vtkProp*)tmpCollection->GetItemAsObject(i) );
+                       } // for
+                       tmpCollection->Delete();
+
+                       // step 5 Refresh
+                       _wxvtk3Dbaseview->GetRenderer()->GetRenderWindow()->Render();
+               } // if ok
                if ((plane==1) && (ok==false)) _planeWidgetX->EnabledOff();
                if ((plane==2) && (ok==false)) _planeWidgetY->EnabledOff();
                if ((plane==3) && (ok==false)) _planeWidgetZ->EnabledOff();
-       }
+       } // if  _planeWidgetX
 }
 
 //-------------------------------------------------------------------
@@ -544,7 +578,36 @@ void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){
                if (visible==false){
                        _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition)  );
                } else {
+//EED 21/07/2013
+//                     1. Make backup of actors
+//                     2. Putting out all the actors
+//                     3. Add vtkImagageActor in first place
+//                     4. Putting again the originals actors
+//                     5. Refresh
+
+                       // step 1, step 2
+                       vtkActorCollection *tmpCollection    = vtkActorCollection::New();
+                       vtkActorCollection *collectionActors =  _wxvtk3Dbaseview->GetRenderer()->GetActors();
+                       int i,size=collectionActors->GetNumberOfItems();
+                       for (i=0; i<size; i++)
+                       {
+                               tmpCollection->AddItem ( (vtkActor*)collectionActors->GetItemAsObject(0)  );                    
+                               _wxvtk3Dbaseview->GetRenderer()->RemoveActor( (vtkProp*)tmpCollection->GetItemAsObject(i) );
+                       } // for
+
+                       // step 3
                        _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition)  );
+
+                       // step 4
+                        for (i=0; i<size; i++)
+                       {
+                               _wxvtk3Dbaseview->GetRenderer()->AddActor( (vtkProp*)tmpCollection->GetItemAsObject(i) );
+                       } // for
+                       tmpCollection->Delete();
+
+                       // step 5 Refresh
+                       _wxvtk3Dbaseview->GetRenderer()->GetRenderWindow()->Render();
+
                }
                _vtkmpr3Ddataviewer->SetVisiblePosition(idPosition,visible);
        }