]> Creatis software - creaMaracasVisu.git/commitdiff
#3351 creaMaracasVisu Bug New Normal - Refresh ViewerNV
authorEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Mon, 27 Jan 2020 09:54:53 +0000 (10:54 +0100)
committerEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Mon, 27 Jan 2020 09:54:53 +0000 (10:54 +0100)
bbtk/src/bbmaracasvisuPlotterView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx

index 4f3f520e30a41024dd055f07aaf02bec1cc20c5d..e3e61bad11061a5e80f15e47956e139715a7aa01 100644 (file)
@@ -39,13 +39,10 @@ BBTK_BLACK_BOX_IMPLEMENTATION(PlotterView,bbtk::WxBlackBox);
 //---------------------------------------------------
 void PlotterView::Process()
 {
-                       
-       if (bbGetInputInX().size()==bbGetInputInY().size() ) {
-
+       if (bbGetInputInX().size()==bbGetInputInY().size() ) 
+    {
                pGraphicalFunction *pGF  = mwxwidget->getFunction(0);
                pGraphicalFunction *pGF2 = mwxwidget->getFunction(1);
-
-
        // EED 2020-01-22
                if (pGF!=NULL)  
                { 
@@ -80,14 +77,11 @@ void PlotterView::Process()
                        mwxwidget->deleteFunction(pGF2); 
                        pGF2=NULL; 
                }
-
-
-               
+       
                        if ( (bbGetInputInY().size()!=0) && (pGF==NULL) )               
                        {
                                // avoid 'taking address of temporary '
                                //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
-                       
                                std::vector<double> inX;
                                if (bbGetInputInX().size()==0)
                                {
@@ -100,16 +94,25 @@ void PlotterView::Process()
                                        inX = bbGetInputInX();
                                } // if bbGetInputInX
                                std::vector<double> inY = bbGetInputInY();
-                        
-                               pGF = mwxwidget->getFunctionForVectors( &inX, &inY ); 
-                               mwxwidget->addFunction(pGF);            
+
+                               bool ok=false;
+                               int i, size = inY.size();
+                               for ( i=0 ; i<size ; i++ )
+                               {       
+                                       if (inY[i]!=0) {ok=true;}
+                               }// for
+                               if (ok==true) 
+                               {
+                                       pGF = mwxwidget->getFunctionForVectors( &inX, &inY ); 
+                                       mwxwidget->addFunction(pGF);            
+                               } // if ok
+
                        } // if bbGetInputInY
 
-                       if ((bbGetInputInY2().size()!=0)&& (pGF2==NULL)         )
+                       if ((bbGetInputInY2().size()!=0)&& (pGF2==NULL) )
                        {
                                // avoid 'taking address of temporary '
                                //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
-                       
                                std::vector<double> inX2;
                                if (bbGetInputInX().size()==0)
                                {
@@ -121,11 +124,22 @@ void PlotterView::Process()
                                } else {
                                        inX2 = bbGetInputInX();
                                } // if bbGetInputInX
-                               std::vector<double> inY2 = bbGetInputInY();
-                               pGF2 = mwxwidget->getFunctionForVectors( &inX2, &inY2 ); 
-                               mwxwidget->addFunction(pGF2);           
+                               std::vector<double> inY2 = bbGetInputInY2();
+
+                               bool ok2=false;
+                               int i, size = inY2.size();
+                               for ( i=0 ; i<size ; i++ )
+                               {       
+                                       if (inY2[i]!=0) {ok2=true;}
+                               }// for
+                               if (ok2==true) 
+                               {
+                                       pGF2 = mwxwidget->getFunctionForVectors( &inX2, &inY2 ); 
+                                       mwxwidget->addFunction(pGF2);           
+                               } // if ok
+
+
                        } // if bbGetInputInY
-                       
                
        /* EED 2020-01-22
 
@@ -180,9 +194,7 @@ void PlotterView::Process()
                        }  // for       
                }// if pGF
        */
-
                mwxwidget->UpdateAll();
-
        } else {
                printf("EED Warnning... PlotterView::Process()   Size of vecto X and Y is not coherent.\n");
        } // InX.size InY.size
index c899c9ba9d0bda21dce1ae74ef02d52f9400452d..b1cdee3530e10b67257efff1588725c7c55fb819 100644 (file)
                        wxwindow=panelClipping3D;
 
                } else if (type==6)             {
-                       panelClipping3D                                 = new wxSplitterWindow( panel , -1);
-                       mwxvtk3Dbaseview_Clipping3D             = new wxVtk3DBaseView( panelClipping3D , vtkmprbasedata);
-                       mwxvtkmpr3Dview                                 = new wxVtkMPR3DView( mwxvtk3Dbaseview_Clipping3D );
-                       vtkmpr3Ddataviewer                              = new vtkMPR3DDataViewer();
-                       wxWindow *window3D                              = mwxvtk3Dbaseview_Clipping3D->GetWxVTKRenderWindowInteractor();
-                       wxPanel *panelControl                   = new wxPanel(panelClipping3D,-1);
-                       wxPanel *controlPanelMPR3D              = mwxvtkmpr3Dview->CreateControlPanel(panelControl, true);
-                       wxFlexGridSizer  *sizerCtrol    = new wxFlexGridSizer(1);
+                       panelClipping3D                                         = new wxSplitterWindow( panel , -1);
+                       mwxvtk3Dbaseview_Clipping3D                     = new wxVtk3DBaseView( panelClipping3D , vtkmprbasedata);
+                       mwxvtkmpr3Dview                                         = new wxVtkMPR3DView( mwxvtk3Dbaseview_Clipping3D );
+                       vtkmpr3Ddataviewer                                      = new vtkMPR3DDataViewer();
+                       wxWindow                *window3D                       = mwxvtk3Dbaseview_Clipping3D->GetWxVTKRenderWindowInteractor();
+                       wxPanel                 *panelControl           = new wxPanel(panelClipping3D,-1);
+                       wxPanel                 *controlPanelMPR3D      = mwxvtkmpr3Dview->CreateControlPanel(panelControl, true);
+                       wxFlexGridSizer *sizerCtrol             = new wxFlexGridSizer(1);
                        sizerCtrol->Add(controlPanelMPR3D, 1, wxALL|wxEXPAND, 2);
 
                        panelControl->SetAutoLayout(true);
@@ -360,15 +360,16 @@ void wxMaracas_ViewerWidget::Refresh(bool eraseBackground ,const wxRect* rect  )
        //-------------------------------------------------------------------------
        void wxMaracas_ViewerWidget::RefreshView()
        {
-               if (mwxvtk3Dbaseview_Clipping3D !=NULL ){ mwxvtk3Dbaseview_Clipping3D->Refresh();        }
-               if (mwxvtkclipping3Dview                !=NULL ){ mwxvtkclipping3Dview->Refresh();                       }
-               if (mwxvtkmpr3Dview                             !=NULL ){ mwxvtkmpr3Dview->RefreshView();                        }
-               if (mvtk2Dbaseview                              !=NULL ){ mvtk2Dbaseview->Refresh();                             }
-               if (mvtkmpr2Dview_X                             !=NULL ){ mvtkmpr2Dview_X->Refresh();                            }
-               if (mvtkmpr2Dview_Y                             !=NULL ){ mvtkmpr2Dview_Y->Refresh();                            }
-               if (mvtkmpr2Dview_Z                             !=NULL ){ mvtkmpr2Dview_Z->Refresh();                            }
-               if (mvtkplane2Dview                             !=NULL ){ mvtkplane2Dview->Refresh();                            }
-               if (mwxsphereview                               !=NULL ){ mwxsphereview ->RefreshView();                         }
+//printf("EED wxMaracas_ViewerWidget::RefreshView %p\n", this);
+               if (mwxvtkmpr3Dview                             !=NULL ){ mwxvtkmpr3Dview                               ->RefreshView();        }
+               if (mwxvtkclipping3Dview                !=NULL ){ mwxvtkclipping3Dview                  ->Refresh();            }
+               if (mwxvtk3Dbaseview_Clipping3D !=NULL ){ mwxvtk3Dbaseview_Clipping3D   ->Refresh();            }
+               if (mvtk2Dbaseview                              !=NULL ){ mvtk2Dbaseview                                ->Refresh();            }
+               if (mvtkmpr2Dview_X                             !=NULL ){ mvtkmpr2Dview_X                               ->Refresh();            }
+               if (mvtkmpr2Dview_Y                             !=NULL ){ mvtkmpr2Dview_Y                               ->Refresh();            }
+               if (mvtkmpr2Dview_Z                             !=NULL ){ mvtkmpr2Dview_Z                               ->Refresh();            }
+               if (mvtkplane2Dview                             !=NULL ){ mvtkplane2Dview                               ->Refresh();            }
+               if (mwxsphereview                               !=NULL ){ mwxsphereview                                 ->RefreshView();        }
        }
 
        //-------------------------------------------------------------------------
@@ -525,34 +526,6 @@ void wxMaracas_ViewerWidget::SetColorWindowLevel(double colorWindow, double colo
 {
        mvtkmprbasedata->SetColorWindow(colorWindow);
        mvtkmprbasedata->SetColorLevel(colorLevel);
-//EED Borrame  
-/*     
- RefreshView();
-       if(mvtk2Dbaseview!=NULL)
-       {
-               mvtk2Dbaseview->SetColorWindow(level);
-       }
-       
-       if(mvtkmpr2Dview_X!=NULL)
-       {
-               mvtkmpr2Dview_X->SetColorWindow(level);
-       }
-       
-       if(mvtkmpr2Dview_Y!=NULL)
-       {
-               mvtkmpr2Dview_Y->SetColorWindow(level);
-       }
-       
-       if(mvtkmpr2Dview_Z!=NULL)
-       {
-               mvtkmpr2Dview_Z->SetColorWindow(level);
-       }
-       
-       if(mwxvtkmpr3Dview!=NULL)
-       {
-               mwxvtkmpr3Dview->SetColorWindow(level);
-       }
- */
 }
 
 
index 1842b32ab75ddcd4883915fb2c118bd147f5b136..93b56f1305b98effbe18a9dcaf5d296607fb35fe 100644 (file)
        //------------------------------------------------------------------------------------------------------------
 
        void setColorTransferFunction(vtkColorTransferFunction* colortable);
-
-  void SetColorWindowLevel(double colorWindow, double colorLevel);
-         
+       void SetColorWindowLevel(double colorWindow, double colorLevel);
   private:
                int                                                             mType;
-
                bool                            minternalVtkmprbasedata;
                vtkMPRBaseData                                  *mvtkmprbasedata;
-
-
                wxVtk2DBaseView                                 *mvtk2Dbaseview;
                wxVtkMPR2DView                                  *mvtkmpr2Dview_X;
                wxVtkMPR2DView                                  *mvtkmpr2Dview_Y;
                wxWidgetMesure2D_Plane_in_MPR   *mwidgetMesure;
                vtkPlane2DView                                  *mvtkplane2Dview;
                wxSphereView                                    *mwxsphereview;
-
                wxVtkClipping3DView                             *mwxvtkclipping3Dview;
                wxVtk3DBaseView                                 *mwxvtk3Dbaseview_Clipping3D;
                wxVtkMPR3DView                                  *mwxvtkmpr3Dview;
-
-
                vtkMPR3DDataViewer                              *vtkmpr3Ddataviewer;
-
   };
 
 #endif // __WX__MARACAS__VIEWERWIDGET__H__
index 334104671c35e4cb36e97ff588fc8a3098ea9d4b..d9c33391a9cfa152c4fe8de4cbf2998dd762ed02 100644 (file)
@@ -42,7 +42,6 @@ wxVtk3DBaseView::wxVtk3DBaseView(wxWindow *parent, vtkBaseData* vtkbasedata)
 //-------------------------------------------------------------------
 wxVtk3DBaseView::~wxVtk3DBaseView()
 {
-
        if (_aCamera!=NULL)             { _aCamera              -> Delete(); _aCamera=NULL;}
        if (_aRenderer!=NULL)   { _aRenderer    -> Delete(); _aRenderer=NULL;}
        if (_renWin!=NULL)              
@@ -81,16 +80,12 @@ void wxVtk3DBaseView::Refresh()
 // EED 27/05/2013
 void wxVtk3DBaseView::ResetCamera(int* ext, double* spc)
 {
-
-      GetRenderer()->ResetCameraClippingRange();
-
+    GetRenderer()->ResetCameraClippingRange();
        if(ext == NULL)
        {
-
                GetRenderer()->ResetCamera ();
                GetCamera()->Dolly(1.2);
-       }else{
-               
+       }else{  
                /*double x = (spc[0])*(origin[0]+(((double)ext[1]-(double)ext[0])/2.0));
                double y = (spc[1])*(origin[1]+(double)ext[3]);
                double z = (spc[2])*(origin[2]+(((double)ext[5]-(double)ext[4])/2.0));*/
@@ -100,25 +95,22 @@ void wxVtk3DBaseView::ResetCamera(int* ext, double* spc)
                double y1=(spc[1])*((double)ext[3]+origin[1]);
                double z0=(spc[2])*((double)ext[4]+origin[2]);
                double z1=(spc[2])*((double)ext[5]+origin[2]);*/
-               
                double x0=(spc[0])*((double)ext[0]);
                double x1=(spc[0])*((double)ext[1]);
                double y0=(spc[1])*((double)ext[2]);
                double y1=(spc[1])*((double)ext[3]);
                double z0=(spc[2])*((double)ext[4]);
                double z1=(spc[2])*((double)ext[5]);
-
                GetRenderer()->ResetCamera(x0,x1,y0,y1,z0,z1);
                //_wxvtk3Dbaseview->GetCamera()->SetPosition(x,y,z);
                GetCamera()->Dolly(1.5);        
-       }       
+       }// if ext
 }
 
 //-------------------------------------------------------------------
 void wxVtk3DBaseView::SetStereo(int type)
 {
        //EED 02/06/2012  
-       
        if (_renWin!=NULL)
        {
                if (type==0)
@@ -139,7 +131,6 @@ void wxVtk3DBaseView::SetStereo(int type)
                        // VTK_STEREO_ANAGLYPH     7
                        // VTK_STEREO_CHECKERBOARD 8            
                        _renWin->SetStereoType(type);      
-               
                } // if type
        } // _renWin
 }
index c32af32beebcf1a55bbb18e809e228ad4918f6f7..ff657c29a3f3435aa181c765e04677aa938bcfd4 100644 (file)
@@ -501,9 +501,9 @@ void wxVtkMPR3DView::RefreshView()   // virtual
 
        //double nx=1,ny=0,nz=0; // JPRx
        Refresh();
-       double x=GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX();
-       double y=GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY();
-       double z=GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ();
+       double x = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX();
+       double y = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY();
+       double z = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ();
 
        SetColorWindow( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow() );
        SetColorLevel( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel() );