From 80b04dc9e3b981e24fe9ae0d81cdeb8af6e6f8c1 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Tue, 21 Jan 2020 10:39:20 +0100 Subject: [PATCH] #3347 creaMaracasVisu Bug New Normal - ViewerMPR2D Reset back position when set new image --- bbtk/src/bbmaracasvisuViewerNV.cxx | 40 ++++++++++++++----- .../wxWindows/widgets/wxMPRBaseData.h | 2 + .../widgets/wxMaracas_N_ViewersWidget.cxx | 1 - .../widgets/wxMaracas_ViewerWidget.cxx | 3 ++ .../wxWindows/widgets/wxVtkMPR2DView.cxx | 30 ++++++++------ .../wxWindows/widgets/wxVtkMPR2DView.h | 3 +- 6 files changed, 53 insertions(+), 26 deletions(-) diff --git a/bbtk/src/bbmaracasvisuViewerNV.cxx b/bbtk/src/bbmaracasvisuViewerNV.cxx index 4a8cd28..262107d 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.cxx +++ b/bbtk/src/bbmaracasvisuViewerNV.cxx @@ -83,8 +83,8 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ViewerNV,bbtk::WxBlackBox); //------------------------------------------------------------- void ViewerNV::Process() { - vtkImageData* img = bbGetInputIn(); - std::vector type = bbGetInputnTypeView(); + vtkImageData* img = bbGetInputIn(); + std::vector type = bbGetInputnTypeView(); if(img != NULL && _mwxwidget != NULL) { if(!compareVectors(type, _currenttype)) @@ -98,15 +98,15 @@ void ViewerNV::Process() _currenttype = type; _currentimg = img; _point.clear(); - _point.push_back((int)_mwxwidget->GetX()); - _point.push_back((int)_mwxwidget->GetY()); - _point.push_back((int)_mwxwidget->GetZ()); - bbSetOutputPoint(_point); - - wxVtkBaseView *wvbv1 = _mwxwidget->GetwxVtkBaseView(1); - wxVtkBaseView *wvbv2 = _mwxwidget->GetwxVtkBaseView(2); - wxVtkBaseView *wvbv3 = _mwxwidget->GetwxVtkBaseView(3); - wxVtkBaseView *wvbv4 = _mwxwidget->GetwxVtkBaseView(4); + _point.push_back( (int)_mwxwidget->GetX() ); + _point.push_back( (int)_mwxwidget->GetY() ); + _point.push_back( (int)_mwxwidget->GetZ() ); + bbSetOutputPoint( _point ); + + wxVtkBaseView *wvbv1 = _mwxwidget->GetwxVtkBaseView( 1 ); + wxVtkBaseView *wvbv2 = _mwxwidget->GetwxVtkBaseView( 2 ); + wxVtkBaseView *wvbv3 = _mwxwidget->GetwxVtkBaseView( 3 ); + wxVtkBaseView *wvbv4 = _mwxwidget->GetwxVtkBaseView( 4 ); //wxwidget->RefreshView(); bbSetOutputwxVtkBaseView1( wvbv1 ); bbSetOutputwxVtkBaseView2( wvbv2 ); @@ -135,6 +135,24 @@ void ViewerNV::Process() } } _mwxwidget->SetInterpolate( bbGetInputInterpolate() ); + +/* Borrame + if (wvbv1!=NULL) + { + wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh + //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 + #if wxMAJOR_VERSION <= 2 + wvbv1->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent ); + #else + wvbv1->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent ); + #endif + } + +*/ + + + + }// mwxwidget != NULL } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h index a77e08e..d2124d8 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h @@ -109,6 +109,8 @@ protected: private: double _x,_y; vtkTransform *_transformOrientation; +//EED 2020-01-21 + double _xBack,_yBack; }; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx index a40409e..5fe704d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx @@ -175,7 +175,6 @@ void wxMaracas_N_ViewersWidget::RefreshView() { - if (wxwindow1!=NULL) {wxwindow1->RefreshView(); } if (wxwindow2!=NULL) {wxwindow2->RefreshView(); } if (wxwindow3!=NULL) {wxwindow3->RefreshView(); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx index a9e9e1d..c899c9b 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx @@ -425,14 +425,17 @@ void wxMaracas_ViewerWidget::SetImage( vtkImageData *image ) if (mvtkmpr2Dview_X!=NULL) { mvtkmpr2Dview_X->SetImageToVtkViewer(image); + mvtkmpr2Dview_X->ResetBackXYZ(); } if (mvtkmpr2Dview_Y!=NULL) { mvtkmpr2Dview_Y->SetImageToVtkViewer(image); + mvtkmpr2Dview_Y->ResetBackXYZ(); } if (mvtkmpr2Dview_Z!=NULL) { mvtkmpr2Dview_Z->SetImageToVtkViewer(image); + mvtkmpr2Dview_Z->ResetBackXYZ(); } if (mvtkplane2Dview!=NULL) { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx index d4752bd..517ca87 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx @@ -232,9 +232,9 @@ void wxVtkMPR2DView::Configure() void wxVtkMPR2DView::SetVisibleAxis(bool ok) { - if (ok!=_visibleAxis) + if (ok != _visibleAxis) { - _visibleAxis=ok; + _visibleAxis = ok; if (_visibleAxis==true) { _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor ); @@ -248,6 +248,16 @@ void wxVtkMPR2DView::SetVisibleAxis(bool ok) } // ok } + +//------------------------------------------------------------------- +void wxVtkMPR2DView::ResetBackXYZ() +{ + _backX=-9999; + _backY=-9999; + _backZ=-9999; +} + + //------------------------------------------------------------------- void wxVtkMPR2DView::Refresh() { @@ -274,12 +284,12 @@ void wxVtkMPR2DView::Refresh() y2 += origin[1]; z1 += origin[2]; z2 += origin[2]; - xx1 = x1*spc[0]; - yy1 = y1*spc[1]; - zz1 = z1*spc[2]; - xx2 = x2*spc[0]; - yy2 = y2*spc[1]; - zz2 = z2*spc[2]; + xx1 = x1*spc[0]; + yy1 = y1*spc[1]; + zz1 = z1*spc[2]; + xx2 = x2*spc[0]; + yy2 = y2*spc[1]; + zz2 = z2*spc[2]; x1 = (int)(x1*spc[0]); y1 = (int)(y1*spc[1]); z1 = (int)(z1*spc[2]); @@ -289,10 +299,6 @@ void wxVtkMPR2DView::Refresh() xx = (int)(GetVtkmprbasedata()->GetX()); yy = (int)(GetVtkmprbasedata()->GetY()); zz = (int)(GetVtkmprbasedata()->GetZ()); -//EED 02/08/2013 -// x = round(xx*spc[0]); -// y = round(yy*spc[1]); -// z = round(zz*spc[2]); x = xx*spc[0]; y = yy*spc[1]; z = zz*spc[2]; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.h index 4f5e226..56bb7bb 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.h @@ -57,15 +57,14 @@ public: virtual void TransFromCoordScreenToWorld(double &X, double &Y, double &Z, bool keepNormalDirection=false, int type=2); void SetVisibleAxis(bool ok); virtual int GetDirection(); + void ResetBackXYZ(); private: int _backX; int _backY; int _backZ; - bool _backFixAxis2D; double _backOpacityAxis; - bool _visibleAxis; int _direction; vtkPoints *_ptsA; -- 2.47.1