From e3083810e3333db2789341d52a5828df74e6d51e Mon Sep 17 00:00:00 2001 From: ouv Date: Wed, 20 Apr 2011 13:08:02 +0000 Subject: [PATCH] 0021243: EDF GEOM: Problem with minimize/maximize icon --- .../OCCViewer_CreateRestoreViewDlg.cxx | 7 +- .../OCCViewer_CreateRestoreViewDlg.h | 3 +- src/OCCViewer/OCCViewer_ViewModel.cxx | 44 ----------- src/OCCViewer/OCCViewer_ViewModel.h | 77 ------------------- src/OCCViewer/OCCViewer_ViewWindow.cxx | 72 ++++++++++++----- src/OCCViewer/OCCViewer_ViewWindow.h | 74 +++++++++++++++++- 6 files changed, 130 insertions(+), 147 deletions(-) diff --git a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx index 95a4a96da..a7fe97644 100755 --- a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx +++ b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx @@ -21,7 +21,6 @@ // #include "OCCViewer_CreateRestoreViewDlg.h" -#include "OCCViewer_ViewModel.h" #include "OCCViewer_ViewPort3d.h" #include @@ -34,12 +33,12 @@ /*! Constructor */ -OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, OCCViewer_Viewer* curModel ) +OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, OCCViewer_ViewWindow* theViewWindow ) : QDialog( aWin ) { setWindowTitle( tr( "CAPTION" ) ); - myParametersMap = curModel->getViewAspects(); + myParametersMap = theViewWindow->getViewAspects(); myKeyFlag = 0; @@ -59,7 +58,7 @@ OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, O myListBox = new QListWidget( aWidget1 ); myListBox->installEventFilter( this ); - myCurViewPort = new OCCViewer_ViewPort3d( aWidget1, curModel->getViewer3d(), V3d_ORTHOGRAPHIC ); + myCurViewPort = new OCCViewer_ViewPort3d( aWidget1, theViewWindow->getViewPort()->getViewer(), V3d_ORTHOGRAPHIC ); myCurViewPort->getView()->SetBackgroundColor( Quantity_NOC_BLACK ); myListBox->setEditTriggers( QAbstractItemView::DoubleClicked ); diff --git a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h index a0688f2db..b505d77d8 100755 --- a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h +++ b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h @@ -25,7 +25,6 @@ #include "OCCViewer.h" -#include "OCCViewer_ViewModel.h" #include "OCCViewer_ViewWindow.h" #include @@ -47,7 +46,7 @@ class OCCVIEWER_EXPORT OCCViewer_CreateRestoreViewDlg : public QDialog Q_OBJECT public: - OCCViewer_CreateRestoreViewDlg( QWidget*, OCCViewer_Viewer* ); + OCCViewer_CreateRestoreViewDlg( QWidget*, OCCViewer_ViewWindow* ); virtual ~OCCViewer_CreateRestoreViewDlg(); const viewAspectList& parameters() const; diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index 32fdc73a4..de5086a99 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -92,8 +92,6 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron, bool DisplayStaticTri drawer->AngleAspect()->SetTextAspect(ta); drawer->LengthAspect()->SetTextAspect(ta); - clearViewAspects(); - /* create trihedron */ if( DisplayTrihedron ) { @@ -491,48 +489,6 @@ void OCCViewer_Viewer::performSelectionChanged() emit selectionChanged(); } -/*! - SLOT, clears view aspects -*/ -void OCCViewer_Viewer::onClearViewAspects() -{ - clearViewAspects(); -} - -/*! - Clears view aspects -*/ -void OCCViewer_Viewer::clearViewAspects() -{ - myViewAspects.clear(); -} - -/*! - \return const reference to list of view aspects -*/ -const viewAspectList& OCCViewer_Viewer::getViewAspects() -{ - return myViewAspects; -} - -/*! - Appends new view aspect - \param aParams - new view aspects -*/ -void OCCViewer_Viewer::appendViewAspect( const viewAspect& aParams ) -{ - myViewAspects.append( aParams ); -} - -/*! - Replaces old view aspects by new ones - \param aViewList - list of new view aspects -*/ -void OCCViewer_Viewer::updateViewAspects( const viewAspectList& aViewList ) -{ - myViewAspects = aViewList; -} - /*! Hilights/unhilights object in viewer \param obj - object to be updated diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index b46752e58..dbb0100da 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -44,73 +44,6 @@ class OCCViewer_ViewWindow; class AIS_ListOfInteractive; -struct viewAspect -{ -public: - double scale; - double centerX; - double centerY; - double projX; - double projY; - double projZ; - double twist; - double atX; - double atY; - double atZ; - double eyeX; - double eyeY; - double eyeZ; - double scaleX; - double scaleY; - double scaleZ; - QString name; - bool isVisible; - double size; - // graduated trihedron - bool gtIsVisible; - bool gtDrawNameX; - bool gtDrawNameY; - bool gtDrawNameZ; - QString gtNameX; - QString gtNameY; - QString gtNameZ; - int gtNameColorRX; - int gtNameColorGX; - int gtNameColorBX; - int gtNameColorRY; - int gtNameColorGY; - int gtNameColorBY; - int gtNameColorRZ; - int gtNameColorGZ; - int gtNameColorBZ; - bool gtDrawValuesX; - bool gtDrawValuesY; - bool gtDrawValuesZ; - int gtNbValuesX; - int gtNbValuesY; - int gtNbValuesZ; - int gtOffsetX; - int gtOffsetY; - int gtOffsetZ; - int gtColorRX; - int gtColorGX; - int gtColorBX; - int gtColorRY; - int gtColorGY; - int gtColorBY; - int gtColorRZ; - int gtColorGZ; - int gtColorBZ; - bool gtDrawTickmarksX; - bool gtDrawTickmarksY; - bool gtDrawTickmarksZ; - int gtTickmarkLengthX; - int gtTickmarkLengthY; - int gtTickmarkLengthZ; -}; - -typedef QList viewAspectList; - #ifdef WIN32 #pragma warning( disable:4251 ) #endif @@ -141,11 +74,6 @@ public: void performSelectionChanged(); // emit signal selectionChanged - virtual const viewAspectList& getViewAspects(); - virtual void appendViewAspect( const viewAspect& ); - virtual void updateViewAspects( const viewAspectList& ); - virtual void clearViewAspects(); - QColor backgroundColor() const; void setBackgroundColor( const QColor& ); @@ -164,9 +92,6 @@ public: virtual OCCViewer_ViewWindow* createSubWindow(); -public slots: - void onClearViewAspects(); - public: Handle(V3d_Viewer) getViewer3d() const { return myV3dViewer;} Handle(V3d_Viewer) getCollector3d() const { return myV3dCollector; } @@ -224,8 +149,6 @@ private: Handle(AIS_Trihedron) myTrihedron; Handle(AIS_InteractiveContext) myAISContext; - viewAspectList myViewAspects; - int myInteractionStyle; int myZoomingStyle; diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index de4bef638..5184337bb 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -228,6 +228,8 @@ OCCViewer_ViewWindow::OCCViewer_ViewWindow( SUIT_Desktop* theDesktop, my2dMode = No2dMode; myInteractionStyle = SUIT_ViewModel::STANDARD; + + clearViewAspects(); } /*! @@ -1250,7 +1252,7 @@ void OCCViewer_ViewWindow::createToolBar() #if OCC_VERSION_LARGE > 0x0603000A // available only with OCC-6.3-sp11 and higher version toolMgr()->append( SwitchZoomingStyleId, tid ); #endif - if( myModel->trihedronActivated() && (my2dMode == No2dMode) ) + if( myModel->trihedronActivated() ) toolMgr()->append( TrihedronShowId, tid ); QtxMultiAction* aScaleAction = new QtxMultiAction( this ); @@ -1281,26 +1283,25 @@ void OCCViewer_ViewWindow::createToolBar() toolMgr()->append( ClockWiseId, tid ); toolMgr()->append( ResetId, tid ); + } - QtxMultiAction* aMemAction = new QtxMultiAction( this ); - aMemAction->insertAction( toolMgr()->action( MemId ) ); - aMemAction->insertAction( toolMgr()->action( RestoreId ) ); - toolMgr()->append( aMemAction, tid ); + QtxMultiAction* aMemAction = new QtxMultiAction( this ); + aMemAction->insertAction( toolMgr()->action( MemId ) ); + aMemAction->insertAction( toolMgr()->action( RestoreId ) ); + toolMgr()->append( aMemAction, tid ); - toolMgr()->append( toolMgr()->separator(), tid ); - toolMgr()->append( CloneId, tid ); + toolMgr()->append( toolMgr()->separator(), tid ); + toolMgr()->append( CloneId, tid ); - toolMgr()->append( toolMgr()->separator(), tid ); - toolMgr()->append( ClippingId, tid ); - toolMgr()->append( AxialScaleId, tid ); + toolMgr()->append( toolMgr()->separator(), tid ); + toolMgr()->append( ClippingId, tid ); + toolMgr()->append( AxialScaleId, tid ); #if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version - toolMgr()->append( GraduatedAxesId, tid ); + toolMgr()->append( GraduatedAxesId, tid ); #endif - toolMgr()->append( AmbientId, tid ); - } else { - toolMgr()->append( AxialScaleId, tid ); - } - toolMgr()->append( MaximizedId, tid); + toolMgr()->append( AmbientId, tid ); + + toolMgr()->append( MaximizedId, tid); } /*! @@ -1554,7 +1555,7 @@ void OCCViewer_ViewWindow::onAmbientToogle() */ void OCCViewer_ViewWindow::onMemorizeView() { - myModel->appendViewAspect( getViewParams() ); + appendViewAspect( getViewParams() ); } /*! @@ -1562,10 +1563,10 @@ void OCCViewer_ViewWindow::onMemorizeView() */ void OCCViewer_ViewWindow::onRestoreView() { - OCCViewer_CreateRestoreViewDlg* aDlg = new OCCViewer_CreateRestoreViewDlg( centralWidget(), myModel ); + OCCViewer_CreateRestoreViewDlg* aDlg = new OCCViewer_CreateRestoreViewDlg( centralWidget(), this ); connect( aDlg, SIGNAL( dlgOk() ), this, SLOT( setRestoreFlag() ) ); aDlg->exec(); - myModel->updateViewAspects( aDlg->parameters() ); + updateViewAspects( aDlg->parameters() ); if( myRestoreFlag && aDlg->parameters().count() ) performRestoring( aDlg->currentItem() ); } @@ -2383,3 +2384,36 @@ void OCCViewer_ViewWindow::setBackgroundColor( const QColor& theColor) if ( myViewPort ) myViewPort->setBackgroundColor( theColor ); } +/*! + Clears view aspects +*/ +void OCCViewer_ViewWindow::clearViewAspects() +{ + myViewAspects.clear(); +} + +/*! + \return const reference to list of view aspects +*/ +const viewAspectList& OCCViewer_ViewWindow::getViewAspects() +{ + return myViewAspects; +} + +/*! + Appends new view aspect + \param aParams - new view aspects +*/ +void OCCViewer_ViewWindow::appendViewAspect( const viewAspect& aParams ) +{ + myViewAspects.append( aParams ); +} + +/*! + Replaces old view aspects by new ones + \param aViewList - list of new view aspects +*/ +void OCCViewer_ViewWindow::updateViewAspects( const viewAspectList& aViewList ) +{ + myViewAspects = aViewList; +} diff --git a/src/OCCViewer/OCCViewer_ViewWindow.h b/src/OCCViewer/OCCViewer_ViewWindow.h index 5dbbf3d1c..c25388a61 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.h +++ b/src/OCCViewer/OCCViewer_ViewWindow.h @@ -37,9 +37,75 @@ class OCCViewer_AxialScaleDlg; class OCCViewer_SetRotationPointDlg; class OCCViewer_Viewer; class OCCViewer_CubeAxesDlg; -struct viewAspect; class QtxAction; +struct viewAspect +{ +public: + double scale; + double centerX; + double centerY; + double projX; + double projY; + double projZ; + double twist; + double atX; + double atY; + double atZ; + double eyeX; + double eyeY; + double eyeZ; + double scaleX; + double scaleY; + double scaleZ; + QString name; + bool isVisible; + double size; + // graduated trihedron + bool gtIsVisible; + bool gtDrawNameX; + bool gtDrawNameY; + bool gtDrawNameZ; + QString gtNameX; + QString gtNameY; + QString gtNameZ; + int gtNameColorRX; + int gtNameColorGX; + int gtNameColorBX; + int gtNameColorRY; + int gtNameColorGY; + int gtNameColorBY; + int gtNameColorRZ; + int gtNameColorGZ; + int gtNameColorBZ; + bool gtDrawValuesX; + bool gtDrawValuesY; + bool gtDrawValuesZ; + int gtNbValuesX; + int gtNbValuesY; + int gtNbValuesZ; + int gtOffsetX; + int gtOffsetY; + int gtOffsetZ; + int gtColorRX; + int gtColorGX; + int gtColorBX; + int gtColorRY; + int gtColorGY; + int gtColorBY; + int gtColorRZ; + int gtColorGZ; + int gtColorBZ; + bool gtDrawTickmarksX; + bool gtDrawTickmarksY; + bool gtDrawTickmarksZ; + int gtTickmarkLengthX; + int gtTickmarkLengthY; + int gtTickmarkLengthZ; +}; + +typedef QList viewAspectList; + #ifdef WIN32 #pragma warning( disable:4251 ) #endif @@ -115,6 +181,10 @@ public: virtual QColor backgroundColor() const; virtual void setBackgroundColor( const QColor& ); + virtual const viewAspectList& getViewAspects(); + virtual void appendViewAspect( const viewAspect& ); + virtual void updateViewAspects( const viewAspectList& ); + virtual void clearViewAspects(); public slots: virtual void onFrontView(); @@ -252,6 +322,8 @@ private: Mode2dType my2dMode; Handle(V3d_Plane) myReserveClippingPlane; + + viewAspectList myViewAspects; }; #ifdef WIN32 -- 2.39.2