#include "OCCViewer_Utilities.h"
+#include "OCCViewer_ViewWidget.h"
#include <OCCViewer_ViewFrame.h>
#include <OCCViewer_ViewModel.h>
break;
}
}
+
+void OCCViewer_Utilities::setViewWidget2DMode( OCCViewer_ViewWidget* theViewWidget,
+ const OCCViewer_ViewWidget::Mode2dType& theMode )
+{
+ if ( !theViewWidget )
+ return;
+
+ // set a view mode
+ theViewWidget->set2dMode( theMode );
+ bool is2dMode = theMode != OCCViewer_ViewWindow::No2dMode;
+
+ // enable/disable view actions
+ QList<OCCViewer_ViewWidget::ButtonsType> aNo2dActions;
+ aNo2dActions << OCCViewer_ViewWidget::RotationId
+ << OCCViewer_ViewWidget::FrontId
+ << OCCViewer_ViewWidget::BackId
+ << OCCViewer_ViewWidget::TopId
+ << OCCViewer_ViewWidget::BottomId
+ << OCCViewer_ViewWidget::LeftId
+ << OCCViewer_ViewWidget::RightId;
+
+ QAction* anAction;
+ for ( int i = 0, aNb = aNo2dActions.size(); i < aNb; i++ ) {
+ anAction = theViewWidget->action( aNo2dActions[i] );
+ if ( anAction )
+ anAction->setVisible( !is2dMode );
+ }
+
+ // change view position
+ switch ( theMode ) {
+ case OCCViewer_ViewWindow::XYPlane:
+ theViewWidget->onTopView();
+ break;
+ case OCCViewer_ViewWindow::XZPlane:
+ theViewWidget->onLeftView();
+ break;
+ case OCCViewer_ViewWindow::YZPlane:
+ theViewWidget->onFrontView();
+ break;
+ }
+}