OCCViewer_AxialScaleDlg.h \
OCCViewer_SetRotationPointDlg.h \
OCCViewer_Trihedron.h \
- OCCViewer_ToolTip.h
+ OCCViewer_ToolTip.h \
+ OCCViewer_ViewFrame.h
dist_libOCCViewer_la_SOURCES = \
OCCViewer_AISSelector.cxx \
OCCViewer_ClippingDlg.cxx \
OCCViewer_AxialScaleDlg.cxx \
OCCViewer_Trihedron.cxx \
- OCCViewer_ToolTip.cxx
+ OCCViewer_ToolTip.cxx \
+ OCCViewer_ViewFrame.cxx
MOC_FILES = \
OCCViewer_AISSelector_moc.cxx \
OCCViewer_SetRotationPointDlg_moc.cxx \
OCCViewer_ClippingDlg_moc.cxx \
OCCViewer_AxialScaleDlg_moc.cxx \
- OCCViewer_ToolTip_moc.cxx
-
+ OCCViewer_ToolTip_moc.cxx \
+ OCCViewer_ViewFrame_moc.cxx
+
nodist_libOCCViewer_la_SOURCES = $(MOC_FILES)
dist_salomeres_DATA = \
resources/occ_view_top.png \
resources/occ_view_triedre.png \
resources/occ_view_zoom.png \
- resources/occ_view_rotation_point.png
+ resources/occ_view_rotation_point.png \
+ resources/occ_view_maximized.png \
+ resources/occ_view_minimized.png
nodist_salomeres_DATA = \
OCCViewer_images.qm \
#include "OCCViewer_ViewModel.h"
#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewFrame.h"
#include "OCCViewer_VService.h"
#include "OCCViewer_ViewPort3d.h"
myAISContext->Display(myTrihedron);
myAISContext->Deactivate(myTrihedron);
- }
+ }
// set interaction style to standard
myInteractionStyle = 0;
*/
SUIT_ViewWindow* OCCViewer_Viewer::createView( SUIT_Desktop* theDesktop )
{
- OCCViewer_ViewWindow* view = new OCCViewer_ViewWindow(theDesktop, this);
- initView( view );
+ //OCCViewer_ViewWindow* view = new OCCViewer_ViewWindow(theDesktop, this);
+ OCCViewer_ViewFrame* view = new OCCViewer_ViewFrame(theDesktop, this);
+ initView( view->getView(OCCViewer_ViewFrame::MAIN_VIEW) );
return view;
}
OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*) theWindow;
if ( isSelectionEnabled() ) {
- if (aView->getViewPort()->isBusy()) return; // Check that the ViewPort initialization completed
+ if (aView->getViewPort()->isBusy()) {
+ QCoreApplication::processEvents();
+ return; // Check that the ViewPort initialization completed
// To Prevent call move event if the View port is not initialized
// IPAL 20883
+ }
Handle(V3d_View) aView3d = aView->getViewPort()->getView();
- if ( !aView3d.IsNull() )
+ if ( !aView3d.IsNull() ) {
myAISContext->MoveTo(theEvent->x(), theEvent->y(), aView3d);
+ }
}
}
OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
if( !aView )
return;
- OCCViewer_ViewPort3d* aViewPort3d = aView->getViewPort();
- if( !aViewPort3d )
- return;
- QColor aColorActive = aViewPort3d->backgroundColor();
-
+ QColor aColorActive = aView->backgroundColor();
QColor selColor = QColorDialog::getColor( aColorActive, aView);
if ( selColor.isValid() )
- aViewPort3d->setBackgroundColor(selColor);
+ aView->setBackgroundColor(selColor);
}
/*!
v = ic->IsoNumber( AIS_TOI_IsoV );
}
}
+
+/*
+ * Returns a new OCCViewer_ViewWindow instance which will be placed as a sub window in ViewFrame
+ */
+OCCViewer_ViewWindow* OCCViewer_Viewer::createSubWindow()
+{
+ return new OCCViewer_ViewWindow( 0, this);
+}
double trihedronSize() const;
virtual void setTrihedronSize( const double );
+ virtual OCCViewer_ViewWindow* createSubWindow();
+
public slots:
void onClearViewAspects();
void setIsos( const int u, const int v ); // number of isolines
void isos( int& u, int& v ) const;
+ void initView( OCCViewer_ViewWindow* view );
+
signals:
void selectionChanged();
void deselection();
protected:
- void initView( OCCViewer_ViewWindow* view );
protected slots:
void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
}
/* create static trihedron (16551: EDF PAL 501) */
- OCCViewer_ViewWindow* aVW = dynamic_cast<OCCViewer_ViewWindow*>( parentWidget() );
+ OCCViewer_ViewWindow* aVW = dynamic_cast<OCCViewer_ViewWindow*>( parentWidget()->parentWidget()->parentWidget() );
if ( aVW ) {
OCCViewer_Viewer* aViewModel = dynamic_cast<OCCViewer_Viewer*>( aVW->getViewManager()->getViewModel() );
if ( aViewModel && aViewModel->isStaticTrihedronDisplayed() ){
mypSketcher = 0;
myCurSketch = -1;
+ my2dMode = No2dMode;
myInteractionStyle = SUIT_ViewModel::STANDARD;
}
createActions();
createToolBar();
+ switch (my2dMode) {
+ case XYPlane:
+ onTopView();
+ break;
+ case XZPlane:
+ onLeftView();
+ break;
+ case YZPlane:
+ onFrontView();
+ break;
+ }
}
/*!
(theEvent->buttons() == SUIT_ViewModel::myButtonMap[aStyle][SUIT_ViewModel::PAN]) )
aOp = PANVIEW;
else if( (theEvent->modifiers() == SUIT_ViewModel::myStateMap[aStyle][SUIT_ViewModel::ROTATE]) &&
- (theEvent->buttons() == SUIT_ViewModel::myButtonMap[aStyle][SUIT_ViewModel::ROTATE]) )
+ (theEvent->buttons() == SUIT_ViewModel::myButtonMap[aStyle][SUIT_ViewModel::ROTATE]) &&
+ (my2dMode == No2dMode))
aOp = ROTATE;
return aOp;
aAction->setCheckable(true);
connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onSwitchInteractionStyle(bool)));
toolMgr()->registerAction( aAction, SwitchInteractionStyleId );
+
+ // Maximized view
+ aAction = new QtxAction(tr("MNU_MINIMIZE_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MINIMIZE" ) ),
+ tr( "MNU_MINIMIZE_VIEW" ), 0, this );
+ aAction->setStatusTip(tr("DSC_MINIMIZE_VIEW"));
+ connect(aAction, SIGNAL(triggered()), this, SLOT(onMaximizedView()));
+ toolMgr()->registerAction( aAction, MaximizedId );
}
/*!
aPanningAction->insertAction( toolMgr()->action( GlobalPanId ) );
toolMgr()->append( aPanningAction, tid );
- toolMgr()->append( ChangeRotationPointId, tid );
- toolMgr()->append( RotationId, tid );
-
- QtxMultiAction* aViewsAction = new QtxMultiAction( this );
- aViewsAction->insertAction( toolMgr()->action( FrontId ) );
- aViewsAction->insertAction( toolMgr()->action( BackId ) );
- aViewsAction->insertAction( toolMgr()->action( TopId ) );
- aViewsAction->insertAction( toolMgr()->action( BottomId ) );
- aViewsAction->insertAction( toolMgr()->action( LeftId ) );
- aViewsAction->insertAction( toolMgr()->action( RightId ) );
- toolMgr()->append( aViewsAction, tid );
-
- toolMgr()->append( ResetId, tid );
+ if (my2dMode == No2dMode) {
+ toolMgr()->append( ChangeRotationPointId, tid );
+ toolMgr()->append( RotationId, tid );
+
+ QtxMultiAction* aViewsAction = new QtxMultiAction( this );
+ aViewsAction->insertAction( toolMgr()->action( FrontId ) );
+ aViewsAction->insertAction( toolMgr()->action( BackId ) );
+ aViewsAction->insertAction( toolMgr()->action( TopId ) );
+ aViewsAction->insertAction( toolMgr()->action( BottomId ) );
+ aViewsAction->insertAction( toolMgr()->action( LeftId ) );
+ aViewsAction->insertAction( toolMgr()->action( RightId ) );
+ toolMgr()->append( aViewsAction, 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 );
+ }
toolMgr()->append( AmbientId, tid );
+ toolMgr()->append( MaximizedId, tid);
}
/*!
view->Redraw();
}
+void OCCViewer_ViewWindow::setCuttingPlane( bool on, const gp_Pln pln )
+{
+ gp_Dir aDir = pln.Axis().Direction();
+ gp_Pnt aPnt = pln.Location();
+ setCuttingPlane(on, aPnt.X(), aPnt.Y(), aPnt.Z(), aDir.X(), aDir.Y(), aDir.Z());
+}
+
+
/*!
\brief Check if any cutting plane is enabled
\return \c true if at least one cutting plane is enabled
{
return myStatus.contains( id ) ? myStatus[ id ] : true;
}
+
+void OCCViewer_ViewWindow::onMaximizedView()
+{
+ setMaximized(!isMaximized());
+}
+
+
+void OCCViewer_ViewWindow::setMaximized(bool toMaximize, bool toSendSignal)
+{
+ QAction* anAction = toolMgr()->action( MaximizedId );
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ if ( toMaximize ) {
+ anAction->setText( tr( "MNU_MINIMIZE_VIEW" ) );
+ anAction->setIcon( aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MINIMIZE" ) ) );
+ anAction->setStatusTip( tr( "DSC_MINIMIZE_VIEW" ) );
+ if (toSendSignal) {
+ printf("### OCCViewer_ViewWindow::emitMaximised\n");
+ emit maximized( this, true );
+ }
+ }
+ else {
+ anAction->setText( tr( "MNU_MAXIMIZE_VIEW" ) );
+ anAction->setIcon( aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MAXIMIZE" ) ) );
+ anAction->setStatusTip( tr( "DSC_MAXIMIZE_VIEW" ) );
+ if (toSendSignal) {
+ printf("### OCCViewer_ViewWindow::emitMinimised\n");
+ emit maximized( this, false );
+ }
+ }
+}
+
+
+bool OCCViewer_ViewWindow::isMaximized() const
+{
+ return !(toolMgr()->action( MaximizedId )->text() == tr( "MNU_MAXIMIZE_VIEW" ));
+}
+
+
+void OCCViewer_ViewWindow::set2dMode(Mode2dType theType)
+{
+ my2dMode = theType;
+}
+
+QColor OCCViewer_ViewWindow::backgroundColor() const
+{
+ if( !myViewPort )
+ return Qt::black;
+ return myViewPort->backgroundColor();
+}
+
+void OCCViewer_ViewWindow::setBackgroundColor( const QColor& theColor)
+{
+ if( !myViewPort )
+ return;
+ myViewPort->setBackgroundColor(theColor);
+}
enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId,
ChangeRotationPointId, RotationId,
FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, ClippingId, MemId, RestoreId,
- TrihedronShowId, AxialScaleId, AmbientId, SwitchInteractionStyleId };
+ TrihedronShowId, AxialScaleId, AmbientId, SwitchInteractionStyleId, MaximizedId, UserId };
enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE,
PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW,
enum SketchingType { NoSketching, Rect, Polygon };
+ enum Mode2dType { No2dMode, XYPlane, XZPlane, YZPlane};
+
+
OCCViewer_ViewWindow(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel);
virtual ~OCCViewer_ViewWindow();
- OCCViewer_ViewPort3d* getViewPort();
+ virtual OCCViewer_ViewPort3d* getViewPort();
- bool eventFilter(QObject* watched, QEvent* e);
+ virtual bool eventFilter(QObject* watched, QEvent* e);
- void performRestoring( const viewAspect& );
+ virtual void performRestoring( const viewAspect& );
virtual void initLayout();
- void updateEnabledDrawMode();
+ virtual void updateEnabledDrawMode();
- void setCuttingPlane( bool on, const double x = 0 , const double y = 0 , const double z = 0,
+ virtual void setCuttingPlane( bool on, const double x = 0 , const double y = 0 , const double z = 0,
const double dx = 0, const double dy = 0, const double dz = 1);
- bool isCuttingPlane();
+ virtual void setCuttingPlane( bool on, const gp_Pln thePln );
+
+ virtual bool isCuttingPlane();
virtual QString getVisualParameters();
virtual void setVisualParameters( const QString& parameters );
virtual void initSketchers();
- OCCViewer_ViewSketcher* getSketcher( const int );
+ virtual OCCViewer_ViewSketcher* getSketcher( const int );
- void activateSketching( int );
+ virtual void activateSketching( int );
- int interactionStyle() const;
- void setInteractionStyle( const int );
+ virtual int interactionStyle() const;
+ virtual void setInteractionStyle( const int );
void setTransformEnabled( const OperationType, const bool );
bool transformEnabled( const OperationType ) const;
+
+ void set2dMode(Mode2dType theType);
+ Mode2dType get2dMode() const {return my2dMode; }
+
+ void setMaximized(bool toMaximize, bool toSendSignal = true);
+ bool isMaximized() const;
+
+ virtual QColor backgroundColor() const;
+ virtual void setBackgroundColor( const QColor& );
+
public slots:
- void onFrontView();
- void onViewFitAll();
- void onBackView();
- void onTopView();
- void onBottomView();
- void onLeftView();
- void onRightView();
- void onResetView();
- void onFitAll();
- void activateZoom();
- void activateWindowFit();
- void activateRotation();
- void activatePanning();
- void activateGlobalPanning();
- void onSetRotationPoint( bool on );
- void onCloneView();
- void onClipping( bool on );
- void onAxialScale();
- void onAmbientToogle();
- void onMemorizeView();
- void onRestoreView();
- void onTrihedronShow();
- void setRestoreFlag();
- void onSwitchInteractionStyle( bool on );
-
- void activateSetRotationGravity();
- void activateSetRotationSelected( double theX, double theY, double theZ );
- void activateStartPointSelection();
- void updateGravityCoords();
+ virtual void onFrontView();
+ virtual void onViewFitAll();
+ virtual void onBackView();
+ virtual void onTopView();
+ virtual void onBottomView();
+ virtual void onLeftView();
+ virtual void onRightView();
+ virtual void onResetView();
+ virtual void onFitAll();
+ virtual void activateZoom();
+ virtual void activateWindowFit();
+ virtual void activateRotation();
+ virtual void activatePanning();
+ virtual void activateGlobalPanning();
+ virtual void onSetRotationPoint( bool on );
+ virtual void onCloneView();
+ virtual void onClipping( bool on );
+ virtual void onAxialScale();
+ virtual void onAmbientToogle();
+ virtual void onMemorizeView();
+ virtual void onRestoreView();
+ virtual void onTrihedronShow();
+ virtual void setRestoreFlag();
+ virtual void onSwitchInteractionStyle( bool on );
+
+ virtual void activateSetRotationGravity();
+ virtual void activateSetRotationSelected( double theX, double theY, double theZ );
+ virtual void activateStartPointSelection();
+ virtual void updateGravityCoords();
virtual void showEvent( QShowEvent * );
virtual void hideEvent( QHideEvent * );
+ void onMaximizedView();
+
signals:
void vpTransformationStarted(OCCViewer_ViewWindow::OperationType type);
void Show( QShowEvent * );
void Hide( QHideEvent * );
+ void maximized( OCCViewer_ViewWindow*, bool );
protected:
virtual QImage dumpView();
typedef QMap<OperationType, bool> MapOfTransformStatus;
MapOfTransformStatus myStatus;
+
+ Mode2dType my2dMode;
};
#ifdef WIN32