#ifndef DISABLE_OCCVIEWER
#include <OCCViewer_ViewManager.h>
+ #include <OCCViewer_ViewFrame.h>
#ifndef DISABLE_SALOMEOBJECT
#include <SOCC_ViewModel.h>
#else
#else
vm = new OCCViewer_Viewer( true, resMgr->booleanValue( "OCCViewer", "static_trihedron", true ) );
#endif
- vm->setBackgroundColor( resMgr->colorValue( "OCCViewer", "background", vm->backgroundColor() ) );
+ vm->setBackgroundColor( OCCViewer_ViewFrame::TOP_LEFT,
+ resMgr->colorValue( "OCCViewer", "xz_background", vm->backgroundColor() ) );
+ vm->setBackgroundColor( OCCViewer_ViewFrame::TOP_RIGHT,
+ resMgr->colorValue( "OCCViewer", "yz_background", vm->backgroundColor() ) );
+
+ vm->setBackgroundColor( OCCViewer_ViewFrame::BOTTOM_LEFT,
+ resMgr->colorValue( "OCCViewer", "xy_background", vm->backgroundColor() ) );
+ vm->setBackgroundColor( OCCViewer_ViewFrame::BOTTOM_RIGHT,
+ resMgr->colorValue( "OCCViewer", "background", vm->backgroundColor() ) );
+
vm->setTrihedronSize( resMgr->doubleValue( "OCCViewer", "trihedron_size", vm->trihedronSize() ) );
int u( 1 ), v( 1 );
vm->isos( u, v );
pref->setItemProperty( "min", 1.0E-06, occTS );
pref->setItemProperty( "max", 1000, occTS );
+ int occStyleMode = pref->addPreference( tr( "PREF_NAVIGATION" ), occGroup,
+ LightApp_Preferences::Selector, "OCCViewer", "navigation_mode" );
+
int isoU = pref->addPreference( tr( "PREF_ISOS_U" ), occGroup,
LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_u" );
pref->setItemProperty( "min", 0, isoU );
pref->setItemProperty( "max", 100000, isoU );
- pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup,
- LightApp_Preferences::Color, "OCCViewer", "background" );
-
int isoV = pref->addPreference( tr( "PREF_ISOS_V" ), occGroup,
LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_v" );
pref->setItemProperty( "min", 0, isoV );
pref->setItemProperty( "max", 100000, isoV );
- int occStyleMode = pref->addPreference( tr( "PREF_NAVIGATION" ), occGroup,
- LightApp_Preferences::Selector, "OCCViewer", "navigation_mode" );
+ //pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup,
+ // LightApp_Preferences::Color, "OCCViewer", "background" );
+ pref->addPreference( tr( "PREF_XZVIEWER_BACKGROUND" ), occGroup,
+ LightApp_Preferences::Color, "OCCViewer", "xz_background" );
+ pref->addPreference( tr( "PREF_YZVIEWER_BACKGROUND" ), occGroup,
+ LightApp_Preferences::Color, "OCCViewer", "yz_background" );
+
+ pref->addPreference( tr( "PREF_XYVIEWER_BACKGROUND" ), occGroup,
+ LightApp_Preferences::Color, "OCCViewer", "xy_background" );
+ pref->addPreference( tr( "PREF_3DVIEWER_BACKGROUND" ), occGroup,
+ LightApp_Preferences::Color, "OCCViewer", "background" );
+
QStringList aStyleModeList;
aStyleModeList.append( tr("PREF_STANDARD_STYLE") );
aStyleModeList.append( tr("PREF_KEYFREE_STYLE") );
</section>
<section name="OCCViewer" >
<!-- OCC viewer preferences -->
- <parameter name="background" value="35, 136, 145" />
+ <parameter name="xz_background" value="35, 136, 145" />
+ <parameter name="yz_background" value="35, 136, 145" />
+ <parameter name="xy_background" value="35, 136, 145" />
+ <parameter name="background" value="35, 136, 145" />
<parameter name="iso_number_u" value="1" />
<parameter name="iso_number_v" value="1" />
<parameter name="trihedron_size" value="100" />
<source>PREF_VIEWER_BACKGROUND</source>
<translation>Background color</translation>
</message>
+ <message>
+ <source>PREF_XYVIEWER_BACKGROUND</source>
+ <translation>XY View background color</translation>
+ </message>
+ <message>
+ <source>PREF_XZVIEWER_BACKGROUND</source>
+ <translation>XZ View background color</translation>
+ </message>
+ <message>
+ <source>PREF_YZVIEWER_BACKGROUND</source>
+ <translation>YZ View background color</translation>
+ </message>
+ <message>
+ <source>PREF_3DVIEWER_BACKGROUND</source>
+ <translation>3D View background color</translation>
+ </message>
<message>
<source>PREF_FONT</source>
<translation>Font</translation>
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 \
\param view - view window
\param parent - parent widget
*/
-OCCViewer_AxialScaleDlg::OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow* view, QWidget* parent )
- : QDialog( parent ),
+OCCViewer_AxialScaleDlg::OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow* view )
+ : QDialog( view ),
myView( view )
{
setWindowTitle( tr( "DLG_SCALING" ) );
Q_OBJECT
public:
- OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow*, QWidget* = 0 );
+ OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow* );
~OCCViewer_AxialScaleDlg();
void Update();
\param modal - is this dialog modal
\param fl - flags
*/
-OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl )
-: QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
+OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, const char* name, bool modal, Qt::WindowFlags fl )
+: QDialog( view, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
myView( view )
{
setObjectName( "OCCViewer_ClippingDlg" );
erasePreview();
// Set the clipping plane back
- Handle(V3d_View) aView3d = myView->getViewPort()->getView();
+ /*Handle(V3d_View) aView3d = myView->getViewPort()->getView();
if ( !aView3d.IsNull() && !myClippingPlane.IsNull() )
- aView3d->SetPlaneOn( myClippingPlane );
+ aView3d->SetPlaneOn( myClippingPlane );*/
myAction->setChecked( false );
*/
void OCCViewer_ClippingDlg::showEvent( QShowEvent* e )
{
- ReserveClippingPlane();
+ //ReserveClippingPlane();
QDialog::showEvent( e );
onPreview( PreviewChB->isChecked() );
erasePreview();
// Set the clipping plane back
- Handle(V3d_View) aView3d = myView->getViewPort()->getView();
+ /*Handle(V3d_View) aView3d = myView->getViewPort()->getView();
if ( !aView3d.IsNull() && !myClippingPlane.IsNull() )
aView3d->SetPlaneOn( myClippingPlane );
-
+ */
myAction->setChecked( false );
reject();
erasePreview();
- ReserveClippingPlane();
+ //ReserveClippingPlane();
}
/*!
myPreviewPlane->SetSize( aSize, aSize );
// Deactivate clipping planes
- myView->getViewPort()->getView()->SetPlaneOff();
+ //myView->getViewPort()->getView()->SetPlaneOff();
+ //myView->setPlaneOff();
ic->Display( myPreviewPlane, 1, -1, false );
ic->SetWidth( myPreviewPlane, 10, false );
*/
void OCCViewer_ClippingDlg::ReserveClippingPlane()
{
- Handle(V3d_View) aView3d = myView->getViewPort()->getView();
+ /*Handle(V3d_View) aView3d = myView->getViewPort()->getView();
if ( !aView3d.IsNull() )
{
aView3d->InitActivePlanes();
if ( aView3d->MoreActivePlanes() )
myClippingPlane = aView3d->ActivePlane();
- }
+ }*/
}
void OCCViewer_ClippingDlg::onViewShow()
Q_OBJECT
public:
- OCCViewer_ClippingDlg(OCCViewer_ViewWindow* , QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
+ OCCViewer_ClippingDlg(OCCViewer_ViewWindow* , const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
~OCCViewer_ClippingDlg();
void SetAction( QtxAction* theAction ) { myAction = theAction; }
OCCViewer_ViewWindow* myView;
Handle(AIS_Plane) myPreviewPlane;
- Handle(V3d_Plane) myClippingPlane;
+ //Handle(V3d_Plane) myClippingPlane;
bool myBusy;
\param modal - is this dialog modal
\param fl - flags
*/
-OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWindow* view, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl )
-: QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
+OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWindow* view, const char* name, bool modal, Qt::WindowFlags fl )
+: QDialog( view, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
myView( view )
{
setObjectName( "OCCViewer_SetRotationPointDlg" );
Q_OBJECT
public:
- OCCViewer_SetRotationPointDlg(OCCViewer_ViewWindow* , QWidget* parent = 0,
+ OCCViewer_SetRotationPointDlg(OCCViewer_ViewWindow* ,
const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
~OCCViewer_SetRotationPointDlg();
--- /dev/null
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "OCCViewer_ViewFrame.h"
+#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewModel.h"
+
+#include <SUIT_ViewManager.h>
+
+#include <QFrame>
+#include <QLayout>
+#include <QApplication>
+
+OCCViewer_ViewFrame::OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel)
+ : OCCViewer_ViewWindow( theDesktop, theModel ), myPopupRequestedView(0)
+{
+ QFrame* centralFrame = new QFrame( this );
+ setCentralWidget( centralFrame );
+
+ OCCViewer_ViewWindow* view0 = theModel->createSubWindow();
+ view0->setParent( centralFrame );
+ myViews.append( view0 ); // MAIN_VIEW
+
+ myLayout = new QGridLayout( centralFrame );
+ myLayout->setMargin( 0 );
+ myLayout->setSpacing( 1 );
+
+ myLayout->addWidget( view0, 1, 1 );
+ connectViewSignals(view0);
+}
+
+OCCViewer_ViewFrame::~OCCViewer_ViewFrame()
+{
+}
+
+//**************************************************************************************
+OCCViewer_ViewWindow* OCCViewer_ViewFrame::getView( const int i ) const
+{
+ return ( i < myViews.count() ) ? myViews.at( i ) : 0 ;
+}
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::setViewManager( SUIT_ViewManager* theMgr )
+{
+ OCCViewer_ViewWindow::setViewManager(theMgr);
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->setViewManager(theMgr);
+ }
+}
+
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::onMaximizedView( OCCViewer_ViewWindow* theView, bool isMaximized)
+{
+ if (isMaximized) {
+ if (myViews.count() <= 1)
+ return;
+
+ myLayout->setColumnStretch(0 , 0);
+ myLayout->setColumnStretch(1, 0);
+ int i = 0;
+ OCCViewer_ViewWindow* aView = 0;
+ for ( i = BOTTOM_RIGHT; i <= TOP_RIGHT; i++) {
+ aView = myViews.at(i);
+ if (aView != theView)
+ aView->hide();
+ }
+ }
+ else {
+ OCCViewer_Viewer* aModel = dynamic_cast<OCCViewer_Viewer*>(myManager->getViewModel());
+ if (!aModel) return;
+
+ myLayout->setColumnStretch(0 , 10);
+ myLayout->setColumnStretch(1, 10);
+
+ int i = 0;
+ if (myViews.count() == 1) {
+ //QColor aColor = myViews.at( MAIN_VIEW )->backgroundColor();
+ OCCViewer_ViewWindow* view = 0;
+ for ( i = BOTTOM_LEFT; i <= TOP_RIGHT; i++) {
+ view = aModel->createSubWindow();
+ view->set2dMode( (Mode2dType) i );
+ view->setParent( centralWidget() );
+ view->setViewManager(myManager);
+ myViews.append( view );
+ aModel->initView(view);
+ view->setMaximized(false, false);
+ connectViewSignals(view);
+ view->setBackgroundColor(aModel->backgroundColor(i));
+ }
+ myLayout->addWidget( myViews.at(BOTTOM_LEFT), 1, 0 );
+ myLayout->addWidget( myViews.at(TOP_LEFT), 0, 0 );
+ myLayout->addWidget( myViews.at(TOP_RIGHT), 0, 1 );
+ }
+ OCCViewer_ViewWindow* view = 0;
+ for ( i = BOTTOM_RIGHT; i <= TOP_RIGHT; i++) {
+ view = myViews.at(i);
+ view->show();
+ QApplication::processEvents();
+ if (view != theView)
+ view->onViewFitAll();
+ }
+ }
+ myLayout->invalidate();
+}
+
+OCCViewer_ViewPort3d* OCCViewer_ViewFrame::getViewPort(int theView)
+{
+ return getView(theView)? getView(theView)->getViewPort() : 0;
+}
+
+void OCCViewer_ViewFrame::updateEnabledDrawMode()
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->updateEnabledDrawMode();
+ }
+}
+
+void OCCViewer_ViewFrame::setCuttingPlane( bool on, const double x , const double y , const double z,
+ const double dx, const double dy, const double dz)
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->setCuttingPlane(on, x, y, z, dx, dy, dz);
+ aView->update();
+ }
+}
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::setCuttingPlane( bool on, const gp_Pln thePln )
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->setCuttingPlane(on, thePln);
+ aView->update();
+ }
+}
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::setInteractionStyle( const int i )
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->setInteractionStyle(i);
+ }
+}
+
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::connectViewSignals(OCCViewer_ViewWindow* theView)
+{
+ connect( theView, SIGNAL( maximized( OCCViewer_ViewWindow*, bool ) ),
+ this, SLOT( onMaximizedView( OCCViewer_ViewWindow*, bool ) ) );
+
+ connect( theView, SIGNAL( wheeling(SUIT_ViewWindow*, QWheelEvent*) ),
+ this, SIGNAL( wheeling(SUIT_ViewWindow*, QWheelEvent*) ) );
+
+ connect( theView, SIGNAL( keyReleased(SUIT_ViewWindow*, QKeyEvent*) ),
+ this, SIGNAL( keyReleased(SUIT_ViewWindow*, QKeyEvent*) ) );
+ connect( theView, SIGNAL( keyPressed(SUIT_ViewWindow*, QKeyEvent*) ),
+ this, SIGNAL( keyPressed(SUIT_ViewWindow*, QKeyEvent*) ) );
+
+ connect( theView, SIGNAL( mouseDoubleClicked(SUIT_ViewWindow*, QMouseEvent*) ),
+ this, SIGNAL( mouseDoubleClicked(SUIT_ViewWindow*, QMouseEvent*) ) );
+ connect( theView, SIGNAL( mousePressed(SUIT_ViewWindow*, QMouseEvent*) ),
+ this, SIGNAL( mousePressed(SUIT_ViewWindow*, QMouseEvent*) ) );
+ connect( theView, SIGNAL( mouseReleased(SUIT_ViewWindow*, QMouseEvent*) ),
+ this, SIGNAL( mouseReleased(SUIT_ViewWindow*, QMouseEvent*) ) );
+ connect( theView, SIGNAL( mouseMoving(SUIT_ViewWindow*, QMouseEvent*) ),
+ this, SIGNAL( mouseMoving(SUIT_ViewWindow*, QMouseEvent*) ) );
+
+ // The signal is used to process get/set bacgrounf\d color from popup
+ connect( theView, SIGNAL( contextMenuRequested(QContextMenuEvent*) ),
+ this, SLOT( onContextMenuRequested(QContextMenuEvent*) ) );
+
+ connect( theView, SIGNAL( contextMenuRequested(QContextMenuEvent*) ),
+ this, SIGNAL( contextMenuRequested(QContextMenuEvent*) ) );
+}
+
+void OCCViewer_ViewFrame::setBackgroundColor( const QColor& theColor)
+{
+ if (myPopupRequestedView)
+ myPopupRequestedView->setBackgroundColor(theColor);
+ else {
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ if (aView->isVisible())
+ aView->setBackgroundColor(theColor);
+ }
+ }
+}
+
+
+void OCCViewer_ViewFrame::onViewFitAll()
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->onViewFitAll();
+ }
+}
+
+void OCCViewer_ViewFrame::onFitAll()
+{
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ aView->onFitAll();
+ }
+}
+
+QColor OCCViewer_ViewFrame::backgroundColor() const
+{
+ if (myPopupRequestedView)
+ return myPopupRequestedView->backgroundColor();
+
+ foreach (OCCViewer_ViewWindow* aView, myViews) {
+ if (aView->isVisible())
+ return aView->backgroundColor();
+ }
+ return getView(MAIN_VIEW)->backgroundColor();
+}
+
+void OCCViewer_ViewFrame::onContextMenuRequested(QContextMenuEvent*)
+{
+ myPopupRequestedView = dynamic_cast<OCCViewer_ViewWindow*>(sender());
+}
+
+void OCCViewer_ViewFrame::onDumpView()
+{
+ if (myPopupRequestedView) {
+ myPopupRequestedView->onDumpView();
+ }
+ else {
+ getView(MAIN_VIEW)->onDumpView();
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef OCCVIEWER_VIEWFRAME_H
+#define OCCVIEWER_VIEWFRAME_H
+
+#include "OCCViewer.h"
+#include "OCCViewer_ViewWindow.h"
+
+#include <gp_Pln.hxx>
+
+class SUIT_Desktop;
+class OCCViewer_Viewer;
+class QGridLayout;
+
+class OCCVIEWER_EXPORT OCCViewer_ViewFrame : public OCCViewer_ViewWindow
+{
+ Q_OBJECT
+public:
+ enum { MAIN_VIEW, BOTTOM_RIGHT=MAIN_VIEW, BOTTOM_LEFT, TOP_LEFT, TOP_RIGHT };
+
+ OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel);
+ virtual ~OCCViewer_ViewFrame();
+
+ OCCViewer_ViewWindow* getView( const int ) const;
+
+ virtual OCCViewer_ViewPort3d* getViewPort() { return getView(MAIN_VIEW)->getViewPort(); }
+ OCCViewer_ViewPort3d* getViewPort(int theView);
+
+ virtual void performRestoring( const viewAspect& theAspect) { getView(MAIN_VIEW)->performRestoring(theAspect); }
+ virtual void initLayout() {}
+
+ virtual void updateEnabledDrawMode();
+ 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);
+
+ virtual void setCuttingPlane( bool on, const gp_Pln thePln );
+
+ virtual bool isCuttingPlane() { return getView(MAIN_VIEW)->isCuttingPlane(); }
+
+ virtual QString getVisualParameters() { return getView(MAIN_VIEW)->getVisualParameters(); }
+ virtual void setVisualParameters( const QString& parameters ) { getView(MAIN_VIEW)->setVisualParameters(parameters); }
+
+ virtual void initSketchers() { getView(MAIN_VIEW)->initSketchers(); }
+ virtual OCCViewer_ViewSketcher* getSketcher( const int i) { return getView(MAIN_VIEW)->getSketcher(i); }
+ virtual void activateSketching( int i ) { getView(MAIN_VIEW)->activateSketching(i); }
+
+ virtual int interactionStyle() const { return getView(MAIN_VIEW)->interactionStyle(); }
+ virtual void setInteractionStyle( const int i );
+
+ virtual void setViewManager( SUIT_ViewManager* );
+
+ virtual bool eventFilter(QObject* watched, QEvent* e) { return SUIT_ViewWindow::eventFilter(watched, e); }
+
+ virtual QColor backgroundColor() const;
+ virtual void setBackgroundColor( const QColor& );
+
+
+public slots:
+ virtual void onFrontView() { getView(MAIN_VIEW)->onFrontView(); }
+ virtual void onViewFitAll();
+ virtual void onBackView() { getView(MAIN_VIEW)->onBackView(); }
+ virtual void onTopView() { getView(MAIN_VIEW)->onTopView(); }
+ virtual void onBottomView() { getView(MAIN_VIEW)->onBottomView(); }
+ virtual void onLeftView() { getView(MAIN_VIEW)->onLeftView(); }
+ virtual void onRightView() { getView(MAIN_VIEW)->onRightView(); }
+ virtual void onResetView() { getView(MAIN_VIEW)->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 onAxialScale() {}
+ virtual void onAmbientToogle() {}
+ virtual void onMemorizeView() {}
+ virtual void onRestoreView() {}
+ virtual void onSwitchInteractionStyle( bool on ) {}
+
+ virtual void activateSetRotationGravity() {}
+ virtual void activateSetRotationSelected( double theX, double theY, double theZ ) {}
+ virtual void activateStartPointSelection() {}
+ virtual void updateGravityCoords() {}
+
+ void onMaximizedView( OCCViewer_ViewWindow*, bool );
+
+ virtual void onDumpView();
+
+private slots:
+ void onContextMenuRequested(QContextMenuEvent*);
+
+private:
+ void connectViewSignals(OCCViewer_ViewWindow* theView);
+
+
+ QList<OCCViewer_ViewWindow*> myViews;
+ QGridLayout* myLayout;
+
+ OCCViewer_ViewWindow* myPopupRequestedView;
+};
+
+#endif
#include "OCCViewer_ViewModel.h"
#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewFrame.h"
#include "OCCViewer_VService.h"
#include "OCCViewer_ViewPort3d.h"
*/
OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron, bool DisplayStaticTrihedron )
: SUIT_ViewModel(),
- myBgColor( Qt::black ),
- myShowStaticTrihedron( DisplayStaticTrihedron )
+ myShowStaticTrihedron( DisplayStaticTrihedron ),
+ myColors(4, Qt::black)
{
// init CasCade viewers
myV3dViewer = OCCViewer_VService::Viewer3d( "", (short*) "Viewer3d", "", 1000.,
myAISContext->Display(myTrihedron);
myAISContext->Deactivate(myTrihedron);
- }
+ }
// set interaction style to standard
myInteractionStyle = 0;
*/
QColor OCCViewer_Viewer::backgroundColor() const
{
- return myBgColor;
+ return myColors[0];
}
/*!
*/
void OCCViewer_Viewer::setBackgroundColor( const QColor& c )
{
- if ( c.isValid() )
- myBgColor = c;
+ setBackgroundColor( 0, c );
}
/*!
OCCViewer_ViewPort3d* vp3d = view->getViewPort();
if ( vp3d )
- vp3d->setBackgroundColor( myBgColor );
+ vp3d->setBackgroundColor( myColors[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);
+ }
}
}
*/
void OCCViewer_Viewer::onChangeBgColor()
{
- OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
- if( !aView )
- return;
- OCCViewer_ViewPort3d* aViewPort3d = aView->getViewPort();
- if( !aViewPort3d )
+ OCCViewer_ViewWindow* aView = dynamic_cast<OCCViewer_ViewWindow*>(myViewManager->getActiveView());
+ if ( !aView )
return;
- QColor aColorActive = aViewPort3d->backgroundColor();
-
- QColor selColor = QColorDialog::getColor( aColorActive, aView);
+ QColor selColor = QColorDialog::getColor( aView->backgroundColor(), 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);
+}
+
+QColor OCCViewer_Viewer::backgroundColor(int theViewId) const
+{
+ return ( theViewId >= 0 && theViewId < myColors.count() ) ? myColors[theViewId] : Qt::black;
+}
+
+void OCCViewer_Viewer::setBackgroundColor( int theViewId, const QColor& theColor)
+{
+ if ( theColor.isValid() && theViewId >= 0 && theViewId < myColors.count() )
+ myColors[theViewId] = theColor;
+}
#include <QColor>
#include <QPoint>
+#include <QVector>
#include "OCCViewer.h"
QColor backgroundColor() const;
void setBackgroundColor( const QColor& );
+ QColor backgroundColor(int theViewId) const;
+ void setBackgroundColor( int theViewId, const QColor& );
+
//! returns true if 3d Trihedron in viewer was created
bool trihedronActivated() const { return !myTrihedron.IsNull(); }
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*);
bool mySelectionEnabled;
bool myMultiSelectionEnabled;
- QColor myBgColor;
+ //QColor myBgColor;
QPoint myStartPnt, myEndPnt;
bool myShowStaticTrihedron;
+
+ QVector<QColor> myColors;
};
#ifdef WIN32
}
/* 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 );
}
/*!
*/
void OCCViewer_ViewWindow::createToolBar()
{
- int tid = toolMgr()->createToolBar( tr( "LBL_TOOLBAR_LABEL" ), false );
+ QString aToolbarName;
+ switch (my2dMode) {
+ case XYPlane:
+ aToolbarName = tr( "LBL_XYTOOLBAR_LABEL" );
+ break;
+ case XZPlane:
+ aToolbarName = tr( "LBL_XZTOOLBAR_LABEL" );
+ break;
+ case YZPlane:
+ aToolbarName = tr( "LBL_YZTOOLBAR_LABEL" );
+ break;
+ default:
+ aToolbarName = tr( "LBL_3DTOOLBAR_LABEL" );
+ }
+
+ int tid = toolMgr()->createToolBar( aToolbarName, false );
toolMgr()->append( DumpId, tid );
toolMgr()->append( SwitchInteractionStyleId, tid );
- if( myModel->trihedronActivated() )
+ if( myModel->trihedronActivated() && (my2dMode == No2dMode) )
toolMgr()->append( TrihedronShowId, tid );
QtxMultiAction* aScaleAction = new QtxMultiAction( this );
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( AmbientId, tid );
+ toolMgr()->append( toolMgr()->separator(), tid );
+ toolMgr()->append( ClippingId, tid );
+ toolMgr()->append( AxialScaleId, tid );
+ toolMgr()->append( AmbientId, tid );
+ } else {
+ toolMgr()->append( AxialScaleId, tid );
+ }
+ toolMgr()->append( MaximizedId, tid);
}
/*!
{
if (!mySetRotationPointDlg)
{
- mySetRotationPointDlg = new OCCViewer_SetRotationPointDlg (this, myDesktop);
+ mySetRotationPointDlg = new OCCViewer_SetRotationPointDlg (this);
mySetRotationPointDlg->SetAction(mySetRotationPointAction);
}
else
myActionsMap[ ClippingId ]->setIcon(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" )));
*/
+ OCCViewer_ViewWindow* aParent = dynamic_cast<OCCViewer_ViewWindow*>(parent()->parent());
+ if (!aParent)
+ aParent = this;
if ( on )
- {
- if ( !myClippingDlg )
{
- myClippingDlg = new OCCViewer_ClippingDlg( this, myDesktop );
- myClippingDlg->SetAction( myClippingAction );
- }
+ if ( !myClippingDlg )
+ {
+ myClippingDlg = new OCCViewer_ClippingDlg( aParent );
+ myClippingDlg->SetAction( myClippingAction );
+ }
- if ( !myClippingDlg->isVisible() )
- myClippingDlg->show();
- }
+ if ( !myClippingDlg->isVisible() )
+ myClippingDlg->show();
+ }
else
- {
- if ( myClippingDlg->isVisible() )
- myClippingDlg->hide();
- setCuttingPlane(false);
- }
+ {
+ if ( myClippingDlg->isVisible() )
+ myClippingDlg->hide();
+ aParent->setCuttingPlane(false);
+ }
}
/*!
void OCCViewer_ViewWindow::onAxialScale()
{
if ( !myScalingDlg )
- myScalingDlg = new OCCViewer_AxialScaleDlg( this, myDesktop );
+ myScalingDlg = new OCCViewer_AxialScaleDlg( this );
if ( !myScalingDlg->isVisible() )
myScalingDlg->show();
Handle(V3d_View) view = myViewPort->getView();
if ( view.IsNull() )
return QImage();
+
int aWidth = myViewPort->width();
int aHeight = myViewPort->height();
QApplication::syncX();
- view->Update();
+ view->Redraw(); // In order to reactivate GL context
+ //view->Update();
OpenGLUtils_FrameBuffer aFrameBuffer;
if( aFrameBuffer.init( aWidth, aHeight ) )
{
+ QImage anImage( aWidth, aHeight, QImage::Format_RGB32 );
+
glPushAttrib( GL_VIEWPORT_BIT );
glViewport( 0, 0, aWidth, aHeight );
aFrameBuffer.bind();
aFrameBuffer.unbind();
glPopAttrib();
- QImage anImage( aWidth, aHeight, QImage::Format_RGB32 );
-
aFrameBuffer.bind();
glReadPixels( 0, 0, aWidth, aHeight, GL_RGBA, GL_UNSIGNED_BYTE, anImage.bits() );
aFrameBuffer.unbind();
anImage = anImage.mirrored();
return anImage;
}
-
// if frame buffers are unsupported, use old functionality
- view->Redraw();
+ //view->Redraw();
unsigned char* data = new unsigned char[ aWidth*aHeight*4 ];
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->setToolTip( tr( "MNU_MINIMIZE_VIEW" ) );
+ anAction->setIcon( aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MINIMIZE" ) ) );
+ anAction->setStatusTip( tr( "DSC_MINIMIZE_VIEW" ) );
+ if (toSendSignal) {
+ emit maximized( this, true );
+ }
+ }
+ else {
+ anAction->setText( tr( "MNU_MAXIMIZE_VIEW" ) );
+ anAction->setToolTip( tr( "MNU_MAXIMIZE_VIEW" ) );
+ anAction->setIcon( aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MAXIMIZE" ) ) );
+ anAction->setStatusTip( tr( "DSC_MAXIMIZE_VIEW" ) );
+ if (toSendSignal) {
+ 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
+{
+ return myViewPort ? myViewPort->backgroundColor() : Qt::black;
+}
+
+void OCCViewer_ViewWindow::setBackgroundColor( const QColor& theColor)
+{
+ if ( myViewPort ) myViewPort->setBackgroundColor( theColor );
+}
+
#include "OCCViewer.h"
#include "SUIT_ViewWindow.h"
#include <gp_Pnt.hxx>
+#include <V3d_Plane.hxx>
class QtxRectRubberBand;
class SUIT_Desktop;
class OCCViewer_AxialScaleDlg;
class OCCViewer_SetRotationPointDlg;
class OCCViewer_Viewer;
-class viewAspect;
+struct viewAspect;
class QtxAction;
#ifdef WIN32
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();
+
+ 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);
- 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);
+ virtual void setCuttingPlane( bool on, const gp_Pln thePln );
- bool isCuttingPlane();
+ virtual bool isCuttingPlane();
virtual QString getVisualParameters();
virtual void setVisualParameters( const QString& parameters );
- virtual void initSketchers();
- OCCViewer_ViewSketcher* getSketcher( const int );
+ virtual void initSketchers();
+ 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 );
+ Mode2dType get2dMode() const { return my2dMode; }
+
+ void setMaximized( bool, bool = 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;
+
+ Handle(V3d_Plane) myReserveClippingPlane;
};
#ifdef WIN32
<source>ICON_OCCVIEWER_STYLE_SWITCH</source>
<translation>occ_view_style_switch.png</translation>
</message>
+ <message>
+ <source>ICON_OCCVIEWER_MAXIMIZE</source>
+ <translation>occ_view_maximized.png</translation>
+ </message>
+ <message>
+ <source>ICON_OCCVIEWER_MINIMIZE</source>
+ <translation>occ_view_minimized.png</translation>
+ </message>
</context>
</TS>
<translation>Restore view</translation>
</message>
<message>
- <source>LBL_TOOLBAR_LABEL</source>
- <translation>View Operations</translation>
+ <source>LBL_XYTOOLBAR_LABEL</source>
+ <translation>XY View Operations</translation>
+ </message>
+ <message>
+ <source>LBL_XZTOOLBAR_LABEL</source>
+ <translation>XZ View Operations</translation>
+ </message>
+ <message>
+ <source>LBL_YZTOOLBAR_LABEL</source>
+ <translation>YZ View Operations</translation>
+ </message>
+ <message>
+ <source>LBL_3DTOOLBAR_LABEL</source>
+ <translation>3D View Operations</translation>
</message>
<message>
<source>DSC_BACK_VIEW</source>
<source>OCC_IMAGE_FILES</source>
<translation>Images Files (*.bmp *.png *.jpg *.jpeg)</translation>
</message>
+ <message>
+ <source>DSC_MAXIMIZE_VIEW</source>
+ <translation>Maximize view</translation>
+ </message>
+ <message>
+ <source>DSC_MINIMIZE_VIEW</source>
+ <translation>Set axonometric projections</translation>
+ </message>
+ <message>
+ <source>MNU_MAXIMIZE_VIEW</source>
+ <translation>Maximize</translation>
+ </message>
+ <message>
+ <source>MNU_MINIMIZE_VIEW</source>
+ <translation>Axonometric views</translation>
+ </message>
</context>
<context>
<name>OCCViewer_CreateRestoreViewDlg</name>
/*!
create SOCC_ViewWindow
*/
-SUIT_ViewWindow* SOCC_Viewer::createView( SUIT_Desktop* theDesktop )
+/*SUIT_ViewWindow* SOCC_Viewer::createView( SUIT_Desktop* theDesktop )
{
SOCC_ViewWindow* view = new SOCC_ViewWindow(theDesktop, this);
- initView( view );
+ //initView( view );
+ initView( view->getView(OCCViewer_ViewFrame::MAIN_VIEW) );
return view;
+ }*/
+
+/*
+ * Returns a new OCCViewer_ViewWindow instance which will be placed as a sub window in ViewFrame
+ */
+OCCViewer_ViewWindow* SOCC_Viewer::createSubWindow()
+{
+ return new SOCC_ViewWindow( 0, this);
}
void rename( const Handle(SALOME_InteractiveObject)&, const QString& );
- virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
+ //virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
+ virtual OCCViewer_ViewWindow* createSubWindow();
/* Reimplemented from SALOME_View */
virtual void Display( const SALOME_OCCPrs* );
#endif
#include "SOCC.h"
-#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewFrame.h"
class SOCC_EXPORT SOCC_ViewWindow : public OCCViewer_ViewWindow
{
setObjectName( name );
setModal( modal );
QString env;
- if ( ::getenv( "TRIPOLI_ROOT_DIR" ) )
- env = ::getenv( "TRIPOLI_ROOT_DIR" );
+ if ( ::getenv( "SALOME_LICENSE_FILE" ) )
+ env = ::getenv( "SALOME_LICENSE_FILE" );
- QFile file( env + "/share/salome/resources/License.txt" ); // Read the text from a file
+ QFile file( env ); // Read the text from a file
if ( !file.exists() || !file.open( QIODevice::ReadOnly ) )
return;
for ( SelectorList::const_iterator it = mySelectors.begin(); it != mySelectors.end(); ++it )
{
+ if ( !(*it)->isEnabled() )
+ continue;
if ( !type.isEmpty() && (*it)->type() != type )
continue;
*/
void SUIT_ViewWindow::onDumpView()
{
- QApplication::postEvent( this, new QPaintEvent( QRect( 0, 0, width(), height() ) ) );
+ // VSV (TRIPOLI dev): next line commented: causes error messages
+ //QApplication::postEvent( this, new QPaintEvent( QRect( 0, 0, width(), height() ) ) );
QApplication::postEvent( this, new QEvent( (QEvent::Type)DUMP_EVENT ) );
}
bool bOk = false;
if ( myManager && myManager->study() && myManager->study()->application() )
{
- QImage im = dumpView();
-
// get file name
SUIT_Application* app = myManager->study()->application();
QString fileName = app->getFileName( false, QString(), filter(), tr( "TLT_DUMP_VIEW" ), 0 );
if ( !fileName.isEmpty() )
{
- QString fmt = SUIT_Tools::extension( fileName ).toUpper();
- bOk = dumpViewToFormat( im, fileName, fmt );
+ QImage im = dumpView();
+ QString fmt = SUIT_Tools::extension( fileName ).toUpper();
+ bOk = dumpViewToFormat( im, fileName, fmt );
}
else
- bOk = true; // cancelled
+ bOk = true; // cancelled
}
if ( !bOk )
SUIT_MessageBox::critical( this, tr( "ERROR" ), tr( "ERR_CANT_DUMP_VIEW" ) );
SUIT_ViewWindow( SUIT_Desktop* );
virtual ~SUIT_ViewWindow();
- void setViewManager( SUIT_ViewManager* );
+ virtual void setViewManager( SUIT_ViewManager* );
SUIT_ViewManager* getViewManager() const;
bool event(QEvent*);
</section>
<section name="OCCViewer" >
<!-- OCC viewer preferences -->
- <parameter name="background" value="35, 136, 145" />
+ <parameter name="xz_background" value="35, 136, 145" />
+ <parameter name="yz_background" value="35, 136, 145" />
+ <parameter name="xy_background" value="35, 136, 145" />
+ <parameter name="background" value="35, 136, 145" />
<parameter name="iso_number_u" value="1" />
<parameter name="iso_number_v" value="1" />
<parameter name="trihedron_size" value="100" />