From: Eduardo DAVILA Date: Mon, 27 Jan 2020 09:54:53 +0000 (+0100) Subject: #3351 creaMaracasVisu Bug New Normal - Refresh ViewerNV X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=526a0ca77dbcf5ef9a23aa7d69cfd293287002e1;p=creaMaracasVisu.git #3351 creaMaracasVisu Bug New Normal - Refresh ViewerNV --- diff --git a/bbtk/src/bbmaracasvisuPlotterView.cxx b/bbtk/src/bbmaracasvisuPlotterView.cxx index 4f3f520..e3e61ba 100644 --- a/bbtk/src/bbmaracasvisuPlotterView.cxx +++ b/bbtk/src/bbmaracasvisuPlotterView.cxx @@ -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 inX; if (bbGetInputInX().size()==0) { @@ -100,16 +94,25 @@ void PlotterView::Process() inX = bbGetInputInX(); } // if bbGetInputInX std::vector inY = bbGetInputInY(); - - pGF = mwxwidget->getFunctionForVectors( &inX, &inY ); - mwxwidget->addFunction(pGF); + + bool ok=false; + int i, size = inY.size(); + for ( i=0 ; igetFunctionForVectors( &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 inX2; if (bbGetInputInX().size()==0) { @@ -121,11 +124,22 @@ void PlotterView::Process() } else { inX2 = bbGetInputInX(); } // if bbGetInputInX - std::vector inY2 = bbGetInputInY(); - pGF2 = mwxwidget->getFunctionForVectors( &inX2, &inY2 ); - mwxwidget->addFunction(pGF2); + std::vector inY2 = bbGetInputInY2(); + + bool ok2=false; + int i, size = inY2.size(); + for ( i=0 ; igetFunctionForVectors( &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 diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx index c899c9b..b1cdee3 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx @@ -187,14 +187,14 @@ 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); - } - */ } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h index 1842b32..93b56f1 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h @@ -102,16 +102,11 @@ //------------------------------------------------------------------------------------------------------------ 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; @@ -119,14 +114,10 @@ wxWidgetMesure2D_Plane_in_MPR *mwidgetMesure; vtkPlane2DView *mvtkplane2Dview; wxSphereView *mwxsphereview; - wxVtkClipping3DView *mwxvtkclipping3Dview; wxVtk3DBaseView *mwxvtk3Dbaseview_Clipping3D; wxVtkMPR3DView *mwxvtkmpr3Dview; - - vtkMPR3DDataViewer *vtkmpr3Ddataviewer; - }; #endif // __WX__MARACAS__VIEWERWIDGET__H__ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx index 3341046..d9c3339 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx @@ -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 } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index c32af32..ff657c2 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -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() );