1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "OCCViewer_ViewModel.h"
24 #include "OCCViewer.h"
25 #include "OCCViewer_ViewWindow.h"
26 #include "OCCViewer_ViewFrame.h"
27 #include "OCCViewer_VService.h"
28 #include "OCCViewer_ViewPort3d.h"
29 #include "OCCViewer_ClippingDlg.h"
30 #include "OCCViewer_Utilities.h"
32 #include "SUIT_ViewWindow.h"
33 #include "SUIT_ViewManager.h"
34 #include "SUIT_Desktop.h"
35 #include "SUIT_Session.h"
36 #include "SUIT_ResourceMgr.h"
38 #include "ViewerData_AISShape.hxx"
40 #include <Basics_OCCTVersion.hxx>
42 #include "QtxActionToolMgr.h"
43 #include "QtxBackgroundTool.h"
46 #include <QApplication>
47 #include <QColorDialog>
48 #include <QFileDialog>
52 #include <QMouseEvent>
54 #include <QDesktopWidget>
56 #include <AIS_Axis.hxx>
57 #if OCC_VERSION_LARGE > 0x06080000
58 #include <Prs3d_Drawer.hxx>
60 #include <AIS_Drawer.hxx>
62 #include <AIS_ListIteratorOfListOfInteractive.hxx>
64 #include <Graphic3d_Texture2Dmanual.hxx>
65 #include <Graphic3d_MaterialAspect.hxx>
66 #include <Graphic3d_TextureParams.hxx>
68 #include <Geom_Axis2Placement.hxx>
69 #include <Prs3d_Drawer.hxx>
70 #include <Prs3d_DatumAspect.hxx>
71 #include <Prs3d_LineAspect.hxx>
72 #include <Prs3d_TextAspect.hxx>
74 #include <V3d_DirectionalLight.hxx>
75 #include <V3d_AmbientLight.hxx>
77 #if OCC_VERSION_MAJOR < 7
78 #include <Visual3d_View.hxx>
82 Get data for supported background modes: gradient types, identifiers and supported image formats
84 QString OCCViewer_Viewer::backgroundData( QStringList& gradList, QIntList& idList, QIntList& txtList )
86 gradList << tr("GT_HORIZONTALGRADIENT") << tr("GT_VERTICALGRADIENT") <<
87 tr("GT_FIRSTDIAGONALGRADIENT") << tr("GT_SECONDDIAGONALGRADIENT") <<
88 tr("GT_FIRSTCORNERGRADIENT") << tr("GT_SECONDCORNERGRADIENT") <<
89 tr("GT_THIRDCORNERGRADIENT") << tr("GT_FORTHCORNERGRADIENT");
90 idList << HorizontalGradient << VerticalGradient <<
91 Diagonal1Gradient << Diagonal2Gradient <<
92 Corner1Gradient << Corner2Gradient <<
93 Corner3Gradient << Corner4Gradient;
94 txtList << Qtx::CenterTexture << Qtx::TileTexture << Qtx::StretchTexture;
95 return tr("BG_IMAGE_FILES");
99 Get data for supported stereo pair modes: stereo types and identifiers
101 void OCCViewer_Viewer::stereoData( QStringList& typeList, QIntList& idList)
103 typeList << tr("ST_QUADBUFFER") << tr("ST_ANAGLYPH") <<
104 tr("ST_ROWINTERLACED") << tr("ST_COLUMNINTERLACED") <<
105 tr("ST_CHESSBOARD") << tr("ST_SIDEBYSIDE") <<
107 idList << QuadBufferType << AnaglyphType <<
108 RowInterlacedType << ColumnInterlacedType <<
109 ChessBoardType << SideBySideType <<
115 \param DisplayTrihedron - is trihedron displayed
117 OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron)
119 myBackgrounds(4, Qtx::BackgroundData( Qt::black )),
122 myTrihedronSize(100),
125 // init CasCade viewers
126 myV3dViewer = OCCViewer_VService::CreateViewer( TCollection_ExtendedString("Viewer3d").ToExtString() );
127 //myV3dViewer->Init(); // to avoid creation of the useless perspective view (see OCCT issue 0024267)
131 myAISContext = new AIS_InteractiveContext( myV3dViewer );
132 #if OCC_VERSION_LARGE > 0x07000000
133 myAISContext->ChangeSelectionStyle()->SetColor( Quantity_NOC_WHITE );
135 myAISContext->SelectionColor( Quantity_NOC_WHITE );
138 // display isoline on planar faces (box for ex.)
139 myAISContext->IsoOnPlane( true );
141 /* create trihedron */
142 if ( DisplayTrihedron )
144 Handle(Geom_Axis2Placement) anAxis = new Geom_Axis2Placement(gp::XOY());
145 myTrihedron = new AIS_Trihedron(anAxis);
146 myTrihedron->SetInfiniteState( Standard_True );
148 Quantity_Color Col(193/255., 205/255., 193/255., Quantity_TOC_RGB);
149 //myTrihedron->SetColor( Col );
150 myTrihedron->SetArrowColor( Col.Name() );
151 myTrihedron->SetSize(100);
152 #if OCC_VERSION_LARGE > 0x06080000
153 Handle(Prs3d_Drawer) drawer = myTrihedron->Attributes();
154 if (drawer->HasOwnDatumAspect()) {
156 Handle(AIS_Drawer) drawer = myTrihedron->Attributes();
157 if (drawer->HasDatumAspect()) {
159 Handle(Prs3d_DatumAspect) daspect = drawer->DatumAspect();
160 daspect->FirstAxisAspect()->SetColor(Quantity_Color(1.0, 0.0, 0.0, Quantity_TOC_RGB));
161 daspect->SecondAxisAspect()->SetColor(Quantity_Color(0.0, 1.0, 0.0, Quantity_TOC_RGB));
162 daspect->ThirdAxisAspect()->SetColor(Quantity_Color(0.0, 0.0, 1.0, Quantity_TOC_RGB));
166 // set interaction style to standard
167 myInteractionStyle = 0;
169 // set zooming style to standard
173 myPreselectionEnabled = true;
176 mySelectionEnabled = true;
177 myMultiSelectionEnabled = true;
179 // set projection type to orthographic
180 myProjectionType = 0;
181 // set stereo parameters
183 myAnaglyphFilter = 0;
184 myToReverseStereo = 0;
186 myQuadBufferSupport = 0;
187 myStereographicFocusType = 1;
188 myInterocularDistanceType = 1;
189 myStereographicFocusValue = 1.0;
190 myInterocularDistanceValue = 0.05;
191 //set clipping color and texture to standard
192 myClippingColor = QColor( 50, 50, 50 );
193 myDefaultTextureUsed = true;
194 myClippingTexture = QString();
195 myTextureModulated = true;
196 myClippingTextureScale = 1.0;
203 OCCViewer_Viewer::~OCCViewer_Viewer()
205 myAISContext.Nullify();
206 myV3dViewer.Nullify();
211 \return background color of viewer
213 QColor OCCViewer_Viewer::backgroundColor() const
215 return backgroundColor(0);
219 \return background data of viewer
221 Qtx::BackgroundData OCCViewer_Viewer::background() const
223 return background(0);
227 Sets background color [obsolete]
228 \param c - new background color
230 void OCCViewer_Viewer::setBackgroundColor( const QColor& c )
232 setBackgroundColor( 0, c );
237 \param d - new background data
239 void OCCViewer_Viewer::setBackground( const Qtx::BackgroundData& theBackground )
241 setBackground( 0, theBackground );
245 Start initialization of view window
246 \param view - view window to be initialized
248 void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view )
252 view->initSketchers();
253 view->setInteractionStyle( interactionStyle() );
254 view->setProjectionType( projectionType() );
255 view->setStereoType( stereoType() );
256 view->setAnaglyphFilter( anaglyphFilter() );
257 view->setStereographicFocus( stereographicFocusType(), stereographicFocusValue() );
258 view->setInterocularDistance( interocularDistanceType(), interocularDistanceValue() );
259 view->setReverseStereo( isReverseStereo() );
260 view->setVSync( isVSync() );
261 view->setQuadBufferSupport( isQuadBufferSupport() );
262 view->setZoomingStyle( zoomingStyle() );
263 view->enablePreselection( isPreselectionEnabled() );
264 view->enableSelection( isSelectionEnabled() );
266 OCCViewer_ViewPort3d* vp3d = view->getViewPort();
269 #if OCC_VERSION_LARGE <= 0x07000000
270 vp3d->getView()->SetSurfaceDetail(V3d_TEX_ALL);
272 // connect signal from viewport
273 connect(vp3d, SIGNAL(vpClosed(OCCViewer_ViewPort3d*)), this, SLOT(onViewClosed(OCCViewer_ViewPort3d*)));
274 connect(vp3d, SIGNAL(vpMapped(OCCViewer_ViewPort3d*)), this, SLOT(onViewMapped(OCCViewer_ViewPort3d*)));
280 Creates new view window
281 \param theDesktop - main window of application
283 SUIT_ViewWindow* OCCViewer_Viewer::createView( SUIT_Desktop* theDesktop )
286 OCCViewer_ViewFrame* view = new OCCViewer_ViewFrame(theDesktop, this);
287 // get main view window (created by view frame)
288 OCCViewer_ViewWindow* vw = view->getView(OCCViewer_ViewFrame::MAIN_VIEW);
289 // initialize main view window
291 // set default background for view window
292 vw->setBackground( background(0) ); // 0 means MAIN_VIEW (other views are not yet created here)
298 Sets new view manager
299 \param theViewManager - new view manager
301 void OCCViewer_Viewer::setViewManager(SUIT_ViewManager* theViewManager)
303 SUIT_ViewModel::setViewManager(theViewManager);
304 if (theViewManager) {
305 connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)),
306 this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
308 connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)),
309 this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));
311 connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)),
312 this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
314 connect(theViewManager, SIGNAL(keyPress(SUIT_ViewWindow*, QKeyEvent*)),
315 this, SLOT(onKeyPress(SUIT_ViewWindow*, QKeyEvent*)));
320 SLOT: called on mouse button press, stores current mouse position as start point for transformations
322 void OCCViewer_Viewer::onMousePress(SUIT_ViewWindow* theWindow, QMouseEvent* theEvent)
324 myStartPnt.setX(theEvent->x()); myStartPnt.setY(theEvent->y());
328 SLOT: called on mouse move, processes transformation or hilighting
330 void OCCViewer_Viewer::onMouseMove(SUIT_ViewWindow* theWindow, QMouseEvent* theEvent)
332 if (!mySelectionEnabled) return;
333 if (!theWindow->inherits("OCCViewer_ViewWindow")) return;
335 OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*) theWindow;
337 myCurPnt.setX(theEvent->x()); myCurPnt.setY(theEvent->y());
339 if ( isSelectionEnabled() && isPreselectionEnabled() ) {
340 if (aView->getViewPort()->isBusy()) {
341 QCoreApplication::processEvents();
342 return; // Check that the ViewPort initialization completed
343 // To Prevent call move event if the View port is not initialized
346 Handle(V3d_View) aView3d = aView->getViewPort()->getView();
347 if ( !aView3d.IsNull() ) {
348 myAISContext->MoveTo(theEvent->x(), theEvent->y(), aView3d);
355 SLOT: called on mouse button release, finishes transformation or selection
357 void OCCViewer_Viewer::onMouseRelease(SUIT_ViewWindow* theWindow, QMouseEvent* theEvent)
359 if (!mySelectionEnabled) return;
360 if (theEvent->button() != Qt::LeftButton) return;
361 if (!theWindow->inherits("OCCViewer_ViewWindow")) return;
363 OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*) theWindow;
367 myEndPnt.setX(theEvent->x()); myEndPnt.setY(theEvent->y());
368 bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
371 myAISContext->ClearCurrents( false );
375 if (myStartPnt == myEndPnt)
377 if ( !isPreselectionEnabled() ) {
378 Handle(V3d_View) aView3d = aView->getViewPort()->getView();
379 if ( !aView3d.IsNull() ) {
380 myAISContext->MoveTo(myEndPnt.x(), myEndPnt.y(), aView3d);
384 if (aHasShift && myMultiSelectionEnabled)
385 myAISContext->ShiftSelect();
387 myAISContext->Select();
391 if (aHasShift && myMultiSelectionEnabled)
392 myAISContext->ShiftSelect(myStartPnt.x(), myStartPnt.y(),
393 myEndPnt.x(), myEndPnt.y(),
394 aView->getViewPort()->getView(), Standard_False );
396 myAISContext->Select(myStartPnt.x(), myStartPnt.y(),
397 myEndPnt.x(), myEndPnt.y(),
398 aView->getViewPort()->getView(), Standard_False );
400 int Nb = myAISContext->NbSelected();
401 if( Nb>1 && !myMultiSelectionEnabled )
403 myAISContext->InitSelected();
404 Handle( SelectMgr_EntityOwner ) anOwner = myAISContext->SelectedOwner();
405 if( !anOwner.IsNull() )
407 myAISContext->ClearSelected( Standard_False );
408 myAISContext->AddOrRemoveSelected( anOwner, Standard_False );
412 myAISContext->UpdateCurrentViewer();
414 emit selectionChanged();
418 SLOT: called on key press, processes selection in "key free" interaction style
420 void OCCViewer_Viewer::onKeyPress(SUIT_ViewWindow* theWindow, QKeyEvent* theEvent)
422 if (!mySelectionEnabled) return;
424 OCCViewer_ViewWindow* aView = qobject_cast<OCCViewer_ViewWindow*>( theWindow );
425 if ( !aView ) return;
427 bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
429 switch ( theEvent->key() ) {
432 myAISContext->ClearCurrents( false );
436 if ( !isPreselectionEnabled() ) {
437 Handle(V3d_View) aView3d = aView->getViewPort()->getView();
438 if ( !aView3d.IsNull() ) {
439 myAISContext->MoveTo(myCurPnt.x(), myCurPnt.y(), aView3d);
443 if (aHasShift && myMultiSelectionEnabled)
444 myAISContext->ShiftSelect();
446 myAISContext->Select();
448 emit selectionChanged();
452 if ( isPreselectionEnabled() ) {
453 if ( getAISContext()->HasOpenedContext() )
454 getAISContext()->HilightNextDetected( aView->getViewPort()->getView() );
458 if ( isPreselectionEnabled() ) {
459 if ( getAISContext()->HasOpenedContext() )
460 getAISContext()->HilightPreviousDetected( aView->getViewPort()->getView() );
468 void OCCViewer_Viewer::onViewClosed(OCCViewer_ViewPort3d*)
470 Standard_Integer aViewsNb = 0;
471 for ( myV3dViewer->InitActiveViews(); myV3dViewer->MoreActiveViews(); myV3dViewer->NextActiveViews())
473 if ( aViewsNb < 2 ) {
474 //clean up presentations before last view is closed
475 myAISContext->RemoveAll(Standard_False);
479 void OCCViewer_Viewer::onViewMapped(OCCViewer_ViewPort3d* viewPort)
481 setTrihedronShown( true );
482 bool showStaticTrihedron = true;
483 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
484 if ( resMgr ) showStaticTrihedron = resMgr->booleanValue( "3DViewer", "show_static_trihedron", true );
485 viewPort->showStaticTrihedron( showStaticTrihedron );
488 int OCCViewer_Viewer::getTopLayerId()
490 if ( myTopLayerId == 0 && !myAISContext->CurrentViewer().IsNull() )
491 myAISContext->CurrentViewer()->AddZLayer( myTopLayerId );
497 \return interaction style
499 int OCCViewer_Viewer::interactionStyle() const
501 return myInteractionStyle;
505 Sets interaction style: 0 - standard, 1 - keyboard free interaction
506 \param theStyle - new interaction style
508 void OCCViewer_Viewer::setInteractionStyle( const int theStyle )
510 myInteractionStyle = theStyle;
511 //!! To be done for view windows
512 if ( !myViewManager )
515 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
516 for ( int i = 0; i < (int)wins.count(); i++ )
518 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
520 win->setInteractionStyle( theStyle );
525 \return projection type
527 int OCCViewer_Viewer::projectionType() const
529 return myProjectionType;
533 Sets projection type: 0 - orthographic, 1 - perspective
534 \param theType - new projection type
536 void OCCViewer_Viewer::setProjectionType( const int theType )
538 if ( myProjectionType != theType ) {
539 if ( theType != OCCViewer_ViewWindow::Stereo )
540 myProjectionType = theType;
542 if ( !myViewManager )
545 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
546 for ( int i = 0; i < (int)wins.count(); i++ )
548 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
550 win->setProjectionType( (OCCViewer_ViewWindow::ProjectionType)theType );
558 int OCCViewer_Viewer::stereoType() const
565 \param theType - new stereo type
567 void OCCViewer_Viewer::setStereoType( const int theType )
569 myStereoType = theType;
571 if ( !myViewManager )
574 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
575 for ( int i = 0; i < (int)wins.count(); i++ )
577 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
579 win->setStereoType( (OCCViewer_ViewWindow::StereoType)theType );
584 \return stereographic focus type
586 int OCCViewer_Viewer::stereographicFocusType() const
588 return myStereographicFocusType;
592 \return stereographic focus value
594 double OCCViewer_Viewer::stereographicFocusValue() const
596 return myStereographicFocusValue;
600 Sets stereographic focus parameters
601 \param theType - new stereographic focus type
602 \param theValue - new stereographic focus value
604 void OCCViewer_Viewer::setStereographicFocus( const int theType, const double theValue )
606 myStereographicFocusType = theType;
607 myStereographicFocusValue = theValue;
609 if ( !myViewManager )
612 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
613 for ( int i = 0; i < (int)wins.count(); i++ )
615 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
617 win->setStereographicFocus( (OCCViewer_ViewWindow::FocusIODType)theType, theValue );
622 \return stereographic focus type
624 int OCCViewer_Viewer::interocularDistanceType() const
626 return myInterocularDistanceType;
630 \return stereographic focus value
632 double OCCViewer_Viewer::interocularDistanceValue() const
634 return myInterocularDistanceValue;
638 Sets interocular distance parameters
639 \param theType - new IOD type
640 \param theValue - new IOD value
642 void OCCViewer_Viewer::setInterocularDistance( const int theType, const double theValue )
644 myInterocularDistanceType = theType;
645 myInterocularDistanceValue = theValue;
647 if ( !myViewManager )
650 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
651 for ( int i = 0; i < (int)wins.count(); i++ )
653 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
655 win->setInterocularDistance( (OCCViewer_ViewWindow::FocusIODType)theType, theValue );
660 \return anaglyph filter
662 int OCCViewer_Viewer::anaglyphFilter() const
664 return myAnaglyphFilter;
669 \param theType - new anaglyph filter
671 void OCCViewer_Viewer::setAnaglyphFilter( const int theType )
673 myAnaglyphFilter = theType;
675 if ( !myViewManager )
678 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
679 for ( int i = 0; i < (int)wins.count(); i++ )
681 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
683 win->setAnaglyphFilter( (OCCViewer_ViewWindow::AnaglyphFilter)theType );
688 \return reverse stereo
690 bool OCCViewer_Viewer::isReverseStereo() const
692 return myToReverseStereo;
697 \param theReverse - enable/disable reverse mode
699 void OCCViewer_Viewer::setReverseStereo( const bool theReverse )
701 myToReverseStereo = theReverse;
703 if ( !myViewManager )
706 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
707 for ( int i = 0; i < (int)wins.count(); i++ )
709 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
711 win->setReverseStereo( theReverse );
718 bool OCCViewer_Viewer::isVSync() const
725 \param theEnable - enable/disable V-Sync mode
727 void OCCViewer_Viewer::setVSync( const bool theEnable )
729 myVSyncMode = theEnable;
731 if ( !myViewManager )
734 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
735 for ( int i = 0; i < (int)wins.count(); i++ )
737 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
739 win->setVSync( theEnable );
744 \return support quad-buffered stereo
746 bool OCCViewer_Viewer::isQuadBufferSupport() const
748 return myQuadBufferSupport;
752 Set support quad-buffered stereo
753 \param theEnable - enable/disable support quad-buffered stereo
755 void OCCViewer_Viewer::setQuadBufferSupport( const bool theEnable )
757 myQuadBufferSupport = theEnable;
759 if ( !myViewManager )
762 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
763 for ( int i = 0; i < (int)wins.count(); i++ )
765 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
767 win->setQuadBufferSupport( theEnable );
772 \return zooming style
774 int OCCViewer_Viewer::zoomingStyle() const
776 return myZoomingStyle;
780 Sets zooming style: 0 - standard, 1 - advanced (at cursor)
781 \param theStyle - new zooming style
783 void OCCViewer_Viewer::setZoomingStyle( const int theStyle )
785 myZoomingStyle = theStyle;
786 //!! To be done for view windows
787 if ( !myViewManager )
790 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
791 for ( int i = 0; i < (int)wins.count(); i++ )
793 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
795 win->setZoomingStyle( theStyle );
800 \return true if preselection is enabled
802 bool OCCViewer_Viewer::isPreselectionEnabled() const
804 return myPreselectionEnabled;
808 Enables/disables preselection
809 \param isEnabled - new status
811 void OCCViewer_Viewer::enablePreselection(bool isEnabled)
813 myPreselectionEnabled = isEnabled;
815 if ( !myViewManager )
818 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
819 for ( int i = 0; i < (int)wins.count(); i++ )
821 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
823 win->enablePreselection( isEnabled );
829 \return true if selection is enabled
831 bool OCCViewer_Viewer::isSelectionEnabled() const
833 return mySelectionEnabled;
837 Enables/disables selection
838 \param isEnabled - new status
840 void OCCViewer_Viewer::enableSelection(bool isEnabled)
842 mySelectionEnabled = isEnabled;
844 //!! To be done for view windows
845 if ( !myViewManager )
848 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
849 for ( int i = 0; i < (int)wins.count(); i++ )
851 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
853 win->updateEnabledDrawMode();
854 win->enableSelection( isEnabled );
859 //clear current selection in the viewer
861 myAISContext->ClearSelected( Standard_True );
867 Sets multiselection enabled status
868 \param isEnabled - new status
870 void OCCViewer_Viewer::enableMultiselection(bool isEnable)
872 myMultiSelectionEnabled = isEnable;
873 //!! To be done for view windows
874 if ( !myViewManager )
877 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
878 for ( int i = 0; i < (int)wins.count(); i++ )
880 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
882 win->updateEnabledDrawMode();
887 Sets a color of the clipped region
888 \param theColor - a new color of the clipped region
890 void OCCViewer_Viewer::setClippingColor( const QColor& theColor )
892 myClippingColor = theColor;
894 if( myInternalClipPlanes.IsEmpty() )
897 Graphic3d_MaterialAspect aMaterialAspect = Graphic3d_MaterialAspect();
898 aMaterialAspect.SetColor( Quantity_Color( theColor.redF(), theColor.greenF(),
899 theColor.blueF(), Quantity_TOC_RGB ) );
901 for( int i = 1; i <= myInternalClipPlanes.Size(); i++ )
902 myInternalClipPlanes.Value(i)->SetCappingMaterial( aMaterialAspect );
908 \return clipping color
910 QColor OCCViewer_Viewer::clippingColor() const
912 return myClippingColor;
915 // initialize a texture for clipped region
916 Handle(Graphic3d_Texture2Dmanual) initClippingTexture( const bool isDefault, const QString& theTexture,
917 const bool isModulate, const double theScale )
919 QString aTextureFile = isDefault ? ":images/hatch.png" : theTexture;
920 QPixmap px( aTextureFile );
921 const Handle(Image_PixMap) aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage() );
922 Handle(Graphic3d_Texture2Dmanual) aTexture = new Graphic3d_Texture2Dmanual( aPixmap );
923 if( aTexture->IsDone() ) {
924 aTexture->EnableRepeat();
925 isModulate ? aTexture->EnableModulate() : aTexture->DisableModulate();
926 aTexture->GetParams()->SetScale( Graphic3d_Vec2( 1/( theScale*100 ), -1 / ( theScale*100 ) ) );
932 Sets default texture parameters
933 \param isDefault - use/non-use default texture
934 \param theTexture - new texture of the clipped region
935 \param isModulate - enable/disable texture modulate mode
936 \param theScale - scale factor.
938 void OCCViewer_Viewer::setClippingTextureParams( const bool isDefault, const QString& theTexture,
939 const bool isModulate, const double theScale )
941 myDefaultTextureUsed = isDefault;
942 myClippingTexture = theTexture;
943 myTextureModulated = isModulate;
944 myClippingTextureScale = theScale;
946 if( myInternalClipPlanes.IsEmpty() )
949 Handle(Graphic3d_Texture2Dmanual) aTexture =
950 initClippingTexture( myDefaultTextureUsed, myClippingTexture,
951 myTextureModulated, myClippingTextureScale );
953 for( int i = 1; i <= myInternalClipPlanes.Size(); i++ )
954 myInternalClipPlanes.Value(i)->SetCappingTexture( aTexture );
960 \return true if default texture is used
962 bool OCCViewer_Viewer::isDefaultTextureUsed() const
964 return myDefaultTextureUsed;
968 \return clipping texture
970 QString OCCViewer_Viewer::clippingTexture() const
972 return myClippingTexture;
976 \return true if texture is modulated
978 bool OCCViewer_Viewer::isTextureModulated() const
980 return myTextureModulated;
984 \return scale factor of texture
986 double OCCViewer_Viewer::clippingTextureScale() const
988 return myClippingTextureScale;
992 Builds popup for occ viewer
994 void OCCViewer_Viewer::contextMenuPopup(QMenu* thePopup)
996 thePopup->addAction( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
997 thePopup->addAction( tr( "MEN_CHANGE_BACKGROUND" ), this, SLOT( onChangeBackground() ) );
999 thePopup->addSeparator();
1001 OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
1003 //Support of several toolbars in the popup menu
1004 QList<QToolBar*> lst = aView->findChildren<QToolBar*>();
1005 QList<QToolBar*>::const_iterator it = lst.begin(), last = lst.end();
1006 for ( ; it!=last; it++ ) {
1007 if ( (*it)->parentWidget()->isVisible() )
1008 thePopup->addAction( (*it)->toggleViewAction() );
1013 SLOT: called on dump view operation is activated, stores scene to raster file
1015 void OCCViewer_Viewer::onDumpView()
1017 OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
1019 aView->onDumpView();
1023 SLOT: called if background color is to be changed changed, passes new color to view port
1025 void OCCViewer_Viewer::onChangeBackground()
1027 OCCViewer_ViewWindow* aView = dynamic_cast<OCCViewer_ViewWindow*>(myViewManager->getActiveView());
1031 // get supported gradient types
1032 QStringList gradList;
1033 QIntList idList, txtList;
1034 QString formats = backgroundData( gradList, idList, txtList );
1036 // invoke dialog box
1037 Qtx::BackgroundData bgData = QtxBackgroundDialog::getBackground( aView->background(), // initial background
1038 aView, // parent for dialog box
1039 txtList, // allowed texture modes
1040 true, // enable solid color mode
1041 true, // enable gradient mode
1042 false, // disable custom gradient mode
1043 !txtList.isEmpty(), // enable/disable texture mode
1044 gradList, // gradient names
1045 idList, // gradient identifiers
1046 formats ); // image formats
1048 // set chosen background data to the viewer
1049 if ( bgData.isValid() )
1050 aView->setBackground( bgData );
1054 Updates OCC 3D viewer
1056 void OCCViewer_Viewer::update()
1058 if (!myV3dViewer.IsNull())
1059 myV3dViewer->Update();
1061 OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
1063 aView->updateGravityCoords();
1067 \return objects selected in 3D viewer
1068 \param theList - list to be filled with selected objects
1070 void OCCViewer_Viewer::getSelectedObjects(AIS_ListOfInteractive& theList)
1073 for (myAISContext->InitSelected(); myAISContext->MoreSelected(); myAISContext->NextSelected())
1074 theList.Append(myAISContext->SelectedInteractive());
1078 Selects objects in 3D viewer. Other selected objects are left as selected
1079 \param theList - list objects to be selected
1081 void OCCViewer_Viewer::setObjectsSelected(const AIS_ListOfInteractive& theList)
1083 AIS_ListIteratorOfListOfInteractive aIt;
1084 for (aIt.Initialize(theList); aIt.More(); aIt.Next())
1085 myAISContext->AddOrRemoveSelected(aIt.Value(), false);
1086 myAISContext->UpdateCurrentViewer();
1090 Auxiliary method to emit signal selectionChanged()
1092 void OCCViewer_Viewer::performSelectionChanged()
1094 emit selectionChanged();
1098 * Defines default lights
1100 void OCCViewer_Viewer::setDefaultLights()
1102 // clear all light sources
1103 myV3dViewer->InitDefinedLights();
1104 while ( myV3dViewer->MoreDefinedLights() )
1106 myV3dViewer->DelLight( myV3dViewer->DefinedLight() );
1107 myV3dViewer->InitDefinedLights();
1110 // get light source parameters from preferences
1111 QColor aColor = SUIT_Session::session()->resourceMgr()->colorValue( "OCCViewer", "light_color", QColor( 0, 0, 0 ) );
1112 double aDx = SUIT_Session::session()->resourceMgr()->doubleValue( "OCCViewer", "light_dx", 0.0 );
1113 double aDy = SUIT_Session::session()->resourceMgr()->doubleValue( "OCCViewer", "light_dy", 0.0 );
1114 double aDz = SUIT_Session::session()->resourceMgr()->doubleValue( "OCCViewer", "light_dz", -1.0 );
1116 Handle(V3d_DirectionalLight) aLight =
1117 new V3d_DirectionalLight( myV3dViewer, V3d_Zneg, OCCViewer::color( aColor ).Name(), Standard_True );
1118 if( !( aDx == 0 && aDy == 0 && aDz == 0 ) )
1119 aLight->SetDirection( aDx, aDy, aDz );
1120 myV3dViewer->SetLightOn( aLight );
1121 myV3dViewer->SetLightOn( new V3d_AmbientLight( myV3dViewer ) );
1125 Hilights/unhilights object in viewer
1126 \param obj - object to be updated
1127 \param hilight - if it is true, object will be hilighted, otherwise it will be unhilighted
1128 \param update - update current viewer
1130 bool OCCViewer_Viewer::highlight( const Handle(AIS_InteractiveObject)& obj,
1131 bool hilight, bool update )
1133 bool isInLocal = myAISContext->HasOpenedContext();
1137 if ( hilight && !myAISContext->IsSelected( obj ) )
1138 myAISContext->AddOrRemoveCurrentObject( obj, false );
1139 else if ( !hilight && myAISContext->IsSelected( obj ) )
1140 myAISContext->AddOrRemoveCurrentObject( obj, false );
1144 myV3dViewer->Redraw();
1150 Unhilights all objects in viewer
1151 \param updateviewer - update current viewer
1153 bool OCCViewer_Viewer::unHighlightAll( bool updateviewer, bool unselect )
1155 if ( myAISContext->HasOpenedContext() ) {
1157 myAISContext->ClearSelected( updateviewer );
1159 myAISContext->UnhilightSelected( updateviewer );
1163 myAISContext->ClearCurrents( updateviewer );
1165 myAISContext->UnhilightCurrents( updateviewer );
1173 \return true if object is in viewer or in collector
1174 \param obj - object to be checked
1175 \param onlyInViewer - search object only in viewer (so object must be displayed)
1177 bool OCCViewer_Viewer::isInViewer( const Handle(AIS_InteractiveObject)& obj,
1180 AIS_ListOfInteractive List;
1181 myAISContext->DisplayedObjects(List);
1183 AIS_ListIteratorOfListOfInteractive ite(List);
1184 for ( ; ite.More(); ite.Next() )
1185 if( ite.Value()==obj )
1192 \return true if object is displayed in viewer
1193 \param obj - object to be checked
1195 bool OCCViewer_Viewer::isVisible( const Handle(AIS_InteractiveObject)& obj )
1197 return myAISContext->IsDisplayed( obj );
1201 Sets color of object
1202 \param obj - object to be updated
1203 \param color - new color
1204 \param update - update current viewer
1206 void OCCViewer_Viewer::setColor( const Handle(AIS_InteractiveObject)& obj,
1207 const QColor& color,
1212 Quantity_Color CSFColor = Quantity_Color ( color.red() / 255.,
1213 color.green() / 255.,
1214 color.blue() / 255.,
1216 obj->SetColor( CSFColor );
1220 myV3dViewer->Update();
1224 Changes display mode of object
1225 \param obj - object to be processed
1226 \param mode - new display mode
1227 \param update - update current viewer
1229 void OCCViewer_Viewer::switchRepresentation( const Handle(AIS_InteractiveObject)& obj,
1230 int mode, bool update )
1232 myAISContext->SetDisplayMode( obj, (Standard_Integer)mode, update );
1234 myV3dViewer->Update();
1238 Changes transparency of object
1239 \param obj - object to be processed
1240 \param trans - new transparency
1241 \param update - update current viewer
1243 void OCCViewer_Viewer::setTransparency( const Handle(AIS_InteractiveObject)& obj,
1244 float trans, bool update )
1246 myAISContext->SetTransparency( obj, trans, false );
1247 myAISContext->Redisplay( obj, Standard_False, Standard_True );
1249 myV3dViewer->Update();
1253 Changes visibility of trihedron to opposite
1255 void OCCViewer_Viewer::toggleTrihedron()
1257 setTrihedronShown( !isTrihedronVisible() );
1261 \return true if trihedron is visible
1263 bool OCCViewer_Viewer::isTrihedronVisible() const
1265 return !myTrihedron.IsNull() && !myAISContext.IsNull() && myAISContext->IsDisplayed( myTrihedron );
1269 Sets visibility state of trihedron
1270 \param on - new state
1273 void OCCViewer_Viewer::setTrihedronShown( const bool on )
1275 if ( myTrihedron.IsNull() )
1279 myAISContext->Display( myTrihedron,
1281 -1 /* selection mode */,
1282 Standard_True /* update viewer*/,
1283 Standard_False /* allow decomposition */,
1284 AIS_DS_Displayed /* display status */);
1285 myAISContext->Deactivate( myTrihedron );
1288 myAISContext->Erase( myTrihedron );
1293 \return trihedron size
1295 double OCCViewer_Viewer::trihedronSize() const
1298 if ( !myTrihedron.IsNull() )
1299 sz = myTrihedron->Size();
1304 Changes trihedron size
1305 \param sz - new size
1307 void OCCViewer_Viewer::setTrihedronSize( const double sz, bool isRelative )
1309 if ( myTrihedronSize != sz || isRelative != myIsRelative) {
1310 myTrihedronSize = sz;
1311 myIsRelative = isRelative;
1317 Set number of isolines
1318 \param u - u-isolines (first parametric co-ordinate)
1319 \param v - v-isolines (second parametric co-ordinate)
1321 void OCCViewer_Viewer::setIsos( const int u, const int v )
1323 Handle(AIS_InteractiveContext) ic = getAISContext();
1327 ic->SetIsoNumber( u, AIS_TOI_IsoU );
1328 ic->SetIsoNumber( v, AIS_TOI_IsoV );
1332 \return number of isolines
1333 \param u - to return u-isolines (first parametric co-ordinate)
1334 \param v - to return v-isolines (second parametric co-ordinate)
1336 void OCCViewer_Viewer::isos( int& u, int& v ) const
1338 Handle(AIS_InteractiveContext) ic = getAISContext();
1341 u = ic->IsoNumber( AIS_TOI_IsoU );
1342 v = ic->IsoNumber( AIS_TOI_IsoV );
1347 * Returns a new OCCViewer_ViewWindow instance which will be placed as a sub window in ViewFrame
1349 OCCViewer_ViewWindow* OCCViewer_Viewer::createSubWindow()
1351 return new OCCViewer_ViewWindow(0, this);
1355 QColor OCCViewer_Viewer::backgroundColor( int theViewId ) const
1357 return background( theViewId ).color();
1360 Qtx::BackgroundData OCCViewer_Viewer::background( int theViewId ) const
1362 return ( theViewId >= 0 && theViewId < myBackgrounds.count() ) ? myBackgrounds[theViewId] : Qtx::BackgroundData();
1366 void OCCViewer_Viewer::setBackgroundColor( int theViewId, const QColor& theColor )
1368 if ( theColor.isValid() ) {
1369 Qtx::BackgroundData bg = background( theViewId );
1370 bg.setColor( theColor );
1371 setBackground( theViewId, bg );
1375 void OCCViewer_Viewer::setBackground( int theViewId, const Qtx::BackgroundData& theBackground )
1377 if ( theBackground.isValid() && theViewId >= 0 && theViewId < myBackgrounds.count() )
1378 myBackgrounds[theViewId] = theBackground;
1383 Set the show static trihedron flag
1385 void OCCViewer_Viewer::setStaticTrihedronDisplayed(const bool on)
1387 OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
1388 if ( aView ) aView->showStaticTrihedron( on );
1392 Get new and current trihedron size corresponding to the current model size
1394 bool OCCViewer_Viewer::computeTrihedronSize( double& theNewSize, double& theSize )
1399 //SRN: BUG IPAL8996, a usage of method ActiveView without an initialization
1400 Handle(V3d_Viewer) viewer = getViewer3d();
1401 viewer->InitActiveViews();
1402 if(!viewer->MoreActiveViews()) return false;
1404 Handle(V3d_View) view3d = viewer->ActiveView();
1407 if ( view3d.IsNull() )
1410 double aMaxSide = computeSceneSize( view3d );
1413 // The boundary box of the view may be initialized but nullified
1414 // (case of infinite objects)
1415 if ( aMaxSide < Precision::Confusion() )
1418 float aSizeInPercents = SUIT_Session::session()->resourceMgr()->doubleValue("3DViewer","trihedron_size", 100.);
1420 static float EPS = 5.0E-3;
1421 theSize = getTrihedron()->Size();
1422 theNewSize = aMaxSide*aSizeInPercents / 100.0;
1424 return fabs( theNewSize - theSize ) > theSize * EPS ||
1425 fabs( theNewSize - theSize ) > theNewSize * EPS;
1429 * Compute scene size
1431 double OCCViewer_Viewer::computeSceneSize(const Handle(V3d_View)& view3d) const
1433 double aMaxSide = 0;
1434 double Xmin = 0, Ymin = 0, Zmin = 0, Xmax = 0, Ymax = 0, Zmax = 0;
1436 #if OCC_VERSION_LARGE > 0x06070100
1437 Bnd_Box aBox = view3d->View()->MinMaxValues();
1438 Xmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().X();
1439 Ymin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Y();
1440 Zmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Z();
1441 Xmax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().X();
1442 Ymax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().Y();
1443 Zmax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().Z();
1445 view3d->View()->MinMaxValues( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax );
1448 if ( Xmin != RealFirst() && Ymin != RealFirst() && Zmin != RealFirst() &&
1449 Xmax != RealLast() && Ymax != RealLast() && Zmax != RealLast() )
1451 aMaxSide = Xmax - Xmin;
1452 if ( aMaxSide < Ymax -Ymin ) aMaxSide = Ymax -Ymin;
1453 if ( aMaxSide < Zmax -Zmin ) aMaxSide = Zmax -Zmin;
1460 * Update the size of the trihedron
1462 void OCCViewer_Viewer::updateTrihedron() {
1463 if ( myTrihedron.IsNull() )
1467 double newSz, oldSz;
1469 if(computeTrihedronSize(newSz, oldSz))
1470 myTrihedron->SetSize(newSz);
1472 } else if(myTrihedron->Size() != myTrihedronSize) {
1473 myTrihedron->SetSize(myTrihedronSize);
1478 Set number of isolines
1479 \param u - u-isolines (first parametric co-ordinate)
1480 \param v - v-isolines (second parametric co-ordinate)
1482 void OCCViewer_Viewer::setSelectionOptions( bool isPreselectionEnabled, bool isSelectionEnabled )
1484 myPreselectionEnabled = isPreselectionEnabled;
1485 mySelectionEnabled = isSelectionEnabled;
1486 //clear current selection in the viewer
1488 if(!mySelectionEnabled) {
1489 myAISContext->ClearSelected( Standard_True );
1494 Creates clipping plane based on the incoming plane
1496 Handle(Graphic3d_ClipPlane) OCCViewer_Viewer::createClipPlane(const gp_Pln& thePlane, const Standard_Boolean theIsOn)
1498 Handle(Graphic3d_ClipPlane) aGraphic3dPlane = new Graphic3d_ClipPlane( thePlane );
1499 aGraphic3dPlane->SetOn( theIsOn );
1500 aGraphic3dPlane->SetCapping( Standard_True );
1502 // set capping color
1503 Graphic3d_MaterialAspect aMaterialAspect = Graphic3d_MaterialAspect();
1504 aMaterialAspect.SetColor( Quantity_Color( myClippingColor.redF(), myClippingColor.greenF(),
1505 myClippingColor.blueF(), Quantity_TOC_RGB ) );
1506 aGraphic3dPlane->SetCappingMaterial( aMaterialAspect );
1508 // set capping texture
1509 aGraphic3dPlane->SetCappingTexture( initClippingTexture( myDefaultTextureUsed, myClippingTexture,
1510 myTextureModulated, myClippingTextureScale ) );
1512 return aGraphic3dPlane;
1515 Applies clipping planes to clippable objects
1517 void OCCViewer_Viewer::setClipPlanes(ClipPlanesList theList)
1519 // 1. Remove existing clipping planes
1520 myClipPlanes.clear();
1521 myInternalClipPlanes.Clear();
1523 // 2. Create new clipping planes
1524 ClipPlanesList::iterator inIt = theList.begin();
1525 for (;inIt != theList.end(); inIt++ )
1527 OCCViewer_ClipPlane aPlane = *inIt;
1529 double aDx = 0.0, aDy = 0.0, aDz = 0.0;
1530 aPlane.OrientationToXYZ( aDx, aDy, aDz );
1532 gp_Pnt anOrigin( aPlane.X, aPlane.Y, aPlane.Z );
1533 gp_Dir aDirection( aDx, aDy, aDz );
1535 myInternalClipPlanes.Append( createClipPlane( gp_Pln( anOrigin, aDirection ), aPlane.IsOn ) );
1536 myClipPlanes.push_back( aPlane );
1539 // 3. Apply clipping planes
1540 AIS_ListOfInteractive aList;
1541 myAISContext->DisplayedObjects (aList);
1542 for ( AIS_ListIteratorOfListOfInteractive anIter (aList); anIter.More(); anIter.Next() ) {
1543 Handle(AIS_InteractiveObject) anObj = anIter.Value();
1544 Handle(ViewerData_AISShape) aShape = Handle(ViewerData_AISShape)::DownCast (anObj);
1545 if (!aShape.IsNull() && aShape->IsClippable()) {
1546 aShape->SetClipPlanes(myInternalClipPlanes);
1552 Returns the clipping planes applied to the displayed objects.
1554 ClipPlanesList OCCViewer_Viewer::getClipPlanes() const {
1555 return myClipPlanes;
1558 Applies clipping planes to given object objects
1560 void OCCViewer_Viewer::applyExistingClipPlanesToObject (const Handle(AIS_InteractiveObject)& theObject)
1562 Handle(ViewerData_AISShape) aShape = Handle(ViewerData_AISShape)::DownCast (theObject);
1563 if (!aShape.IsNull() && aShape->IsClippable())
1565 aShape->SetClipPlanes (myInternalClipPlanes);
1570 Returns the pointer to the clipping dialog box.
1572 OCCViewer_ClippingDlg* OCCViewer_Viewer::getClippingDlg() const{
1573 return myClippingDlg;
1578 Stores pointer to the clipping dialog box.
1580 void OCCViewer_Viewer::setClippingDlg(OCCViewer_ClippingDlg* theDlg) {
1581 if(myClippingDlg != theDlg) {
1582 myClippingDlg = theDlg;
1587 bool OCCViewer_Viewer::enableDrawMode( bool on )
1589 //!! To be done for view windows
1590 if ( !myViewManager )
1594 QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
1595 for ( int i = 0; i < (int)wins.count(); i++ )
1597 OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
1599 prev = prev || win->enableDrawMode( on );