Salome HOME
Copyright update 2020
[modules/shaper.git] / src / SHAPERGUI / SHAPERGUI_SalomeViewer.cpp
1 // Copyright (C) 2014-2020  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "SHAPERGUI_SalomeViewer.h"
21 #include "SHAPERGUI_OCCSelector.h"
22
23 #include <OCCViewer_ViewPort3d.h>
24 #include <OCCViewer_ViewFrame.h>
25 #include <SOCC_ViewModel.h>
26 #include <SUIT_ViewManager.h>
27
28 #include <QtxActionToolMgr.h>
29 #include <SALOME_AISShape.hxx>
30
31 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
32
33 #include <QMouseEvent>
34 #include <QContextMenuEvent>
35
36 #if OCC_VERSION_HEX < 0x070400
37   #define SALOME_PATCH_FOR_CTRL_WHEEL
38 #endif
39
40 SHAPERGUI_SalomeView::SHAPERGUI_SalomeView(OCCViewer_Viewer* theViewer)
41 : ModuleBase_IViewWindow(), myCurrentView(0)
42 {
43   myViewer = theViewer;
44 }
45
46
47 Handle(V3d_View) SHAPERGUI_SalomeView::v3dView() const
48 {
49   Handle(V3d_View) aView;
50   if (myCurrentView) {
51     OCCViewer_ViewWindow* aWnd = static_cast<OCCViewer_ViewWindow*>(myCurrentView);
52     aView = aWnd->getViewPort()->getView();
53   }
54   return aView;
55 }
56
57 QWidget* SHAPERGUI_SalomeView::viewPort() const
58 {
59   QWidget* aViewPort = 0;
60   if (myCurrentView) {
61     OCCViewer_ViewWindow* aWnd = static_cast<OCCViewer_ViewWindow*>(myCurrentView);
62     aViewPort = aWnd->getViewPort();
63   }
64   return aViewPort;
65 }
66
67 //**********************************************
68 //**********************************************
69 //**********************************************
70
71
72
73 SHAPERGUI_SalomeViewer::SHAPERGUI_SalomeViewer(QObject* theParent)
74     : ModuleBase_IViewer(theParent),
75       mySelector(0), myView(0), myIsSelectionChanged(false)
76 {
77 }
78
79 SHAPERGUI_SalomeViewer::~SHAPERGUI_SalomeViewer()
80 {
81   if (myView)
82     delete myView;
83 }
84
85
86 //**********************************************
87 Handle(AIS_InteractiveContext) SHAPERGUI_SalomeViewer::AISContext() const
88 {
89   if (mySelector && mySelector->viewer())
90     return mySelector->viewer()->getAISContext();
91   Handle(AIS_InteractiveContext) aNull;
92   return aNull;
93 }
94
95 //**********************************************
96 Handle(V3d_Viewer) SHAPERGUI_SalomeViewer::v3dViewer() const
97 {
98   if (mySelector)
99     return mySelector->viewer()->getViewer3d();
100   return Handle(V3d_Viewer)();
101 }
102
103 //**********************************************
104 Handle(AIS_Trihedron) SHAPERGUI_SalomeViewer::trihedron() const
105 {
106   return mySelector->viewer()->getTrihedron();
107 }
108
109 //**********************************************
110 Handle(V3d_View) SHAPERGUI_SalomeViewer::activeView() const
111 {
112   if (mySelector) {
113     OCCViewer_Viewer* aViewer = mySelector->viewer();
114     SUIT_ViewManager* aMgr = aViewer->getViewManager();
115     OCCViewer_ViewWindow* aWnd = static_cast<OCCViewer_ViewWindow*>(aMgr->getActiveView());
116     return aWnd->getViewPort()->getView();
117   }
118   return Handle(V3d_View)();
119 }
120
121 //**********************************************
122 QWidget* SHAPERGUI_SalomeViewer::activeViewPort() const
123 {
124   QWidget* aViewPort = 0;
125   if (mySelector) {
126     OCCViewer_Viewer* aViewer = mySelector->viewer();
127     SUIT_ViewManager* aMgr = aViewer->getViewManager();
128     OCCViewer_ViewWindow* aWnd = static_cast<OCCViewer_ViewWindow*>(aMgr->getActiveView());
129     aViewPort = aWnd->getViewPort();
130   }
131   return aViewPort;
132 }
133
134 //**********************************************
135 void SHAPERGUI_SalomeViewer::setSelector(SHAPERGUI_OCCSelector* theSel)
136 {
137   if (mySelector) {
138     if (mySelector == theSel)
139       return;
140     else {
141       mySelector->viewer()->getViewManager()->disconnect(this);
142       OCCViewer_Viewer* aViewer = mySelector->viewer();
143       if (aViewer)
144         aViewer->disconnect(this);
145     }
146   }
147   mySelector = theSel;
148   if (!mySelector)
149     return;
150   OCCViewer_Viewer* aViewer = mySelector->viewer();
151   SUIT_ViewManager* aMgr = aViewer->getViewManager();
152
153   myView = new SHAPERGUI_SalomeView(mySelector->viewer());
154
155   // TODO: Provide ModuleBase_IViewWindow interface
156   connect(aMgr, SIGNAL(lastViewClosed(SUIT_ViewManager*)), this, SIGNAL(lastViewClosed()));
157
158   connect(aMgr, SIGNAL(tryCloseView(SUIT_ViewWindow*)),
159           this, SLOT(onTryCloseView(SUIT_ViewWindow*)));
160   connect(aMgr, SIGNAL(deleteView(SUIT_ViewWindow*)),
161           this, SLOT(onDeleteView(SUIT_ViewWindow*)));
162   connect(aMgr, SIGNAL(viewCreated(SUIT_ViewWindow*)),
163           this, SLOT(onViewCreated(SUIT_ViewWindow*)));
164   connect(aMgr, SIGNAL(activated(SUIT_ViewManager*)),
165           this, SLOT(onActivated(SUIT_ViewManager*)));
166
167   connect(aMgr, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), this,
168           SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
169   connect(aMgr, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), this,
170           SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
171   connect(aMgr, SIGNAL(mouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*)), this,
172           SLOT(onMouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*)));
173   connect(aMgr, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), this,
174           SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));
175
176   connect(aMgr, SIGNAL(keyPress(SUIT_ViewWindow*, QKeyEvent*)), this,
177           SLOT(onKeyPress(SUIT_ViewWindow*, QKeyEvent*)));
178   connect(aMgr, SIGNAL(keyRelease(SUIT_ViewWindow*, QKeyEvent*)), this,
179           SLOT(onKeyRelease(SUIT_ViewWindow*, QKeyEvent*)));
180
181   connect(aViewer, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
182 }
183
184 //**********************************************
185 void SHAPERGUI_SalomeViewer::onSelectionChanged()
186 {
187   // Selection event must be sent only after mouse release
188   myIsSelectionChanged = true;
189 }
190
191 //**********************************************
192 void SHAPERGUI_SalomeViewer::onMousePress(SUIT_ViewWindow* theView, QMouseEvent* theEvent)
193 {
194   myView->setCurrentView(theView);
195   emit mousePress(myView, theEvent);
196 }
197
198 //**********************************************
199 void SHAPERGUI_SalomeViewer::onMouseRelease(SUIT_ViewWindow* theView, QMouseEvent* theEvent)
200 {
201   myView->setCurrentView(theView);
202   emit mouseRelease(myView, theEvent);
203   if (myIsSelectionChanged) {
204     emit selectionChanged();
205     myIsSelectionChanged = false;
206   }
207 }
208
209 //**********************************************
210 void SHAPERGUI_SalomeViewer::onMouseDoubleClick(SUIT_ViewWindow* theView, QMouseEvent* theEvent)
211 {
212   myView->setCurrentView(theView);
213   emit mouseDoubleClick(myView, theEvent);
214 }
215
216 //**********************************************
217 void SHAPERGUI_SalomeViewer::onMouseMove(SUIT_ViewWindow* theView, QMouseEvent* theEvent)
218 {
219   myView->setCurrentView(theView);
220   emit mouseMove(myView, theEvent);
221 }
222
223 //**********************************************
224 bool SHAPERGUI_SalomeViewer::canDragByMouse() const
225 {
226   OCCViewer_Viewer* aViewer = mySelector->viewer();
227   SUIT_ViewWindow* aWnd = aViewer->getViewManager()->getActiveView();
228   OCCViewer_ViewWindow* aViewWnd = dynamic_cast<OCCViewer_ViewWindow*>(aWnd);
229   if (aViewWnd) {
230     return (aViewWnd->interactionStyle() == 0);
231   }
232   return true;
233 }
234
235
236 //**********************************************
237 void SHAPERGUI_SalomeViewer::onKeyPress(SUIT_ViewWindow* theView, QKeyEvent* theEvent)
238 {
239   emit keyPress(myView, theEvent);
240 }
241
242 //**********************************************
243 void SHAPERGUI_SalomeViewer::onKeyRelease(SUIT_ViewWindow* theView, QKeyEvent* theEvent)
244 {
245   emit keyRelease(myView, theEvent);
246 }
247
248 //**********************************************
249 void SHAPERGUI_SalomeViewer::onTryCloseView(SUIT_ViewWindow*)
250 {
251   emit tryCloseView(myView);
252 }
253
254 //**********************************************
255 void SHAPERGUI_SalomeViewer::onDeleteView(SUIT_ViewWindow*)
256 {
257   if(myWindowScale.contains(myView->v3dView()))
258     myWindowScale.remove(myView->v3dView());
259   emit deleteView(myView);
260 }
261
262 //**********************************************
263 void SHAPERGUI_SalomeViewer::onViewCreated(SUIT_ViewWindow* theView)
264 {
265   myView->setCurrentView(theView);
266
267   OCCViewer_ViewFrame* aView = dynamic_cast<OCCViewer_ViewFrame*>(theView);
268
269   OCCViewer_ViewWindow* aWnd = aView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
270   if (aWnd) {
271     connect(aWnd, SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)),
272       this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType)));
273     OCCViewer_ViewPort3d* aViewPort = aWnd->getViewPort();
274     if (aViewPort)
275       connect(aViewPort, SIGNAL(vpMapped(OCCViewer_ViewPort3d*)), this, SLOT(onViewPortMapped()));
276   }
277   reconnectActions(aWnd, true);
278
279   myWindowScale.insert(aView->getViewPort()->getView(),
280                        aView->getViewPort()->getView()->Camera()->Scale());
281
282   emit viewCreated(myView);
283
284
285 }
286
287 //**********************************************
288 void SHAPERGUI_SalomeViewer::onActivated(SUIT_ViewManager* theMgr)
289 {
290   myView->setCurrentView(theMgr->getActiveView());
291   emit activated(myView);
292 }
293
294 //**********************************************
295 void SHAPERGUI_SalomeViewer::enableSelection(bool isEnabled)
296 {
297   if (mySelector)
298     if (mySelector->viewer()->isSelectionEnabled() != isEnabled)
299       mySelector->viewer()->enableSelection(isEnabled);
300   // The enableSelection() in SALOME 7.5 cause of forced Viewer update(we have blinking)
301   // After this is corrected, the first row should be recommented, the last - removed
302     //mySelector->viewer()->setInteractionStyle(isEnabled ? SUIT_ViewModel::STANDARD
303     //                                                    : SUIT_ViewModel::KEY_FREE);
304 }
305
306 //**********************************************
307 bool SHAPERGUI_SalomeViewer::isSelectionEnabled() const
308 {
309   if (mySelector)
310     return mySelector->viewer()->isSelectionEnabled();
311   return false;
312 }
313
314 //**********************************************
315 void SHAPERGUI_SalomeViewer::enableMultiselection(bool isEnable)
316 {
317   if (mySelector)
318     mySelector->viewer()->enableMultiselection(isEnable);
319 }
320
321 //**********************************************
322 bool SHAPERGUI_SalomeViewer::isMultiSelectionEnabled() const
323 {
324   if (mySelector)
325     return mySelector->viewer()->isMultiSelectionEnabled();
326   return false;
327 }
328
329 //**********************************************
330 bool SHAPERGUI_SalomeViewer::enableDrawMode(bool isEnabled)
331 {
332   // TODO: Has to be replaced when SALOME patch become available
333   if (mySelector)
334     return mySelector->viewer()->enableDrawMode(isEnabled);
335   return false;
336 }
337
338 //**********************************************
339 void SHAPERGUI_SalomeViewer::reconnectActions(SUIT_ViewWindow* theWindow,
340                                             const bool theUseSHAPERSlot)
341 {
342   OCCViewer_ViewWindow* aWindow = dynamic_cast<OCCViewer_ViewWindow*>(theWindow);
343   if (!aWindow)
344     return;
345
346   QAction* anAction = theWindow->toolMgr()->action(OCCViewer_ViewWindow::TrihedronShowId);
347   if (!anAction)
348     return;
349
350   if (theUseSHAPERSlot) {
351     anAction->disconnect(anAction, SIGNAL(toggled(bool)),
352                          theWindow, SLOT(onTrihedronShow(bool)));
353     anAction->connect(anAction, SIGNAL(toggled(bool)),
354                       this, SIGNAL(trihedronVisibilityChanged(bool)));
355   }
356   else {
357     anAction->connect(anAction, SIGNAL(toggled(bool)),
358                       theWindow, SLOT(onTrihedronShow(bool)));
359     anAction->disconnect(anAction, SIGNAL(toggled(bool)),
360                          this, SIGNAL(trihedronVisibilityChanged(bool)));
361   }
362 }
363
364 //**********************************************
365 void SHAPERGUI_SalomeViewer::fitAll()
366 {
367   if (mySelector) {
368     SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager();
369     OCCViewer_ViewFrame* aVFrame = dynamic_cast<OCCViewer_ViewFrame*>(aMgr->getActiveView());
370     if (aVFrame) {
371       aVFrame->onFitAll();
372     }
373   }
374 }
375
376 //**********************************************
377 void SHAPERGUI_SalomeViewer::eraseAll()
378 {
379   Handle(AIS_InteractiveContext) aContext = AISContext();
380   if (aContext.IsNull())
381     return;
382   AIS_ListOfInteractive aList;
383   aContext->DisplayedObjects(aList);
384   AIS_ListIteratorOfListOfInteractive aLIt;
385   Handle(AIS_InteractiveObject) anAISIO;
386   for (aLIt.Initialize(aList); aLIt.More(); aLIt.Next()) {
387     anAISIO = aLIt.Value();
388     Handle(Standard_Type) aType = anAISIO->DynamicType();
389     if (anAISIO->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
390       aContext->Erase(anAISIO, false);
391     }
392   }
393 }
394
395 //**********************************************
396 void SHAPERGUI_SalomeViewer::setViewProjection(double theX, double theY,
397                                                double theZ, double theTwist)
398 {
399   if (!mySelector)
400     return;
401
402   SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager();
403   OCCViewer_ViewFrame* aVFrame = dynamic_cast<OCCViewer_ViewFrame*>(aMgr->getActiveView());
404   if (aVFrame) {
405     Handle(V3d_View) aView3d = aVFrame->getViewPort()->getView();
406     if (!aView3d.IsNull()) {
407       aView3d->SetProj(theX, theY, theZ);
408       aView3d->SetTwist( theTwist );
409       aView3d->FitAll(0.01, false);
410       //aView3d->SetZSize(0.);
411       if (aView3d->Depth() < 0.1)
412         aView3d->DepthFitAll();
413     }
414   }
415 }
416
417 //***************************************
418 void SHAPERGUI_SalomeViewer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
419 {
420   Handle(AIS_InteractiveContext) aContext = AISContext();
421   if (!aContext.IsNull()) {
422     aContext->AddFilter(theFilter);
423   }
424 }
425
426 //***************************************
427 void SHAPERGUI_SalomeViewer::removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
428 {
429   Handle(AIS_InteractiveContext) aContext = AISContext();
430   if (!aContext.IsNull()) {
431     aContext->RemoveFilter(theFilter);
432   }
433 }
434
435 //***************************************
436 bool SHAPERGUI_SalomeViewer::hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
437 {
438   bool aFoundFilter = false;
439   Handle(AIS_InteractiveContext) aContext = AISContext();
440   if (!aContext.IsNull()) {
441     const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
442     SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
443     for (; aIt.More() && !aFoundFilter; aIt.Next()) {
444       aFoundFilter = theFilter.get() == aIt.Value().get();
445     }
446   }
447   return aFoundFilter;
448 }
449
450 //***************************************
451 void SHAPERGUI_SalomeViewer::clearSelectionFilters()
452 {
453   Handle(AIS_InteractiveContext) aContext = AISContext();
454   if (!aContext.IsNull()) {
455     aContext->RemoveFilters();
456   }
457 }
458
459 //***************************************
460 void SHAPERGUI_SalomeViewer::update()
461 {
462   Handle(AIS_InteractiveContext) aContext = AISContext();
463   if (!aContext.IsNull()) {
464     aContext->UpdateCurrentViewer();
465   }
466 }
467
468 //***************************************
469 void SHAPERGUI_SalomeViewer::onViewTransformed(OCCViewer_ViewWindow::OperationType theType)
470 {
471   emit viewTransformed((int) theType);
472 }
473
474 //***************************************
475 void SHAPERGUI_SalomeViewer::onViewPortMapped()
476 {
477   emit trihedronVisibilityChanged(true);
478 }
479
480 //***************************************
481 void SHAPERGUI_SalomeViewer::activateViewer(bool toActivate)
482 {
483   if (!mySelector || !mySelector->viewer())
484     return;
485   SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager();
486 #ifdef SALOME_PATCH_FOR_CTRL_WHEEL
487   OCCViewer_Viewer* aViewer = dynamic_cast<OCCViewer_Viewer*>(aMgr->getViewModel());
488   if (aViewer)
489     aViewer->setUseLocalSelection(toActivate);
490 #endif
491   QVector<SUIT_ViewWindow*> aViews = aMgr->getViews();
492   if (toActivate) {
493     foreach (SUIT_ViewWindow* aView, aViews) {
494       OCCViewer_ViewFrame* aOCCView = dynamic_cast<OCCViewer_ViewFrame*>(aView);
495       OCCViewer_ViewWindow* aWnd = aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
496       connect(aWnd, SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)),
497         this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType)));
498       reconnectActions(aWnd, true);
499     }
500   } else {
501     foreach (SUIT_ViewWindow* aView, aViews) {
502       OCCViewer_ViewFrame* aOCCView = dynamic_cast<OCCViewer_ViewFrame*>(aView);
503       OCCViewer_ViewWindow* aWnd = aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
504       disconnect((OCCViewer_ViewWindow*)aWnd,
505                  SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)),
506         this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType)));
507       reconnectActions(aWnd, false);
508     }
509   }
510 }
511
512 bool SHAPERGUI_SalomeViewer::isColorScaleVisible() const
513 {
514   if (mySelector) {
515     return mySelector->viewer()->isColorScaleVisible();
516   }
517   return false;
518 }
519
520 void SHAPERGUI_SalomeViewer::setColorScaleShown(bool on)
521 {
522   if (mySelector) {
523     mySelector->viewer()->setColorScaleShown(on);
524   }
525 }
526
527 void SHAPERGUI_SalomeViewer::setColorScalePosition(double theX, double theY)
528 {
529   if (mySelector) {
530     QWidget* aWindow = activeViewPort();
531     mySelector->viewer()->getColorScale()->SetPosition(aWindow->width() * theX,
532       aWindow->height() * theY);
533   }
534 }
535
536 void SHAPERGUI_SalomeViewer::setColorScaleSize(double theW, double theH)
537 {
538   if (mySelector) {
539     QWidget* aWindow = activeViewPort();
540     mySelector->viewer()->getColorScale()->SetSize(aWindow->width() * theW,
541       aWindow->height() * theH);
542   }
543 }
544
545 void SHAPERGUI_SalomeViewer::setColorScaleRange(double theMin, double theMax)
546 {
547   if (mySelector) {
548     mySelector->viewer()->getColorScale()->SetRange(theMin, theMax);
549   }
550 }
551
552 void SHAPERGUI_SalomeViewer::setColorScaleIntervals(int theNb)
553 {
554   if (mySelector) {
555     mySelector->viewer()->getColorScale()->SetNumberOfIntervals(theNb);
556   }
557 }
558
559 void SHAPERGUI_SalomeViewer::setColorScaleTextHeigth(int theH)
560 {
561   if (mySelector) {
562     mySelector->viewer()->getColorScale()->SetTextHeight(theH);
563   }
564 }
565
566 void SHAPERGUI_SalomeViewer::setColorScaleTextColor(const QColor& theColor)
567 {
568   if (mySelector) {
569     Quantity_Color aColor(theColor.redF(), theColor.greenF(), theColor.blueF(), Quantity_TOC_RGB);
570     mySelector->viewer()->getColorScale()->SetColor(aColor);
571   }
572 }
573
574 void SHAPERGUI_SalomeViewer::setColorScaleTitle(const QString& theText)
575 {
576   if (mySelector) {
577     mySelector->viewer()->getColorScale()->SetTitle(theText.toStdString().c_str());
578   }
579 }
580
581 void SHAPERGUI_SalomeViewer::setFitter(OCCViewer_Fitter* theFitter)
582 {
583   if (mySelector)
584     mySelector->viewer()->setFitter(theFitter);
585 }
586
587 OCCViewer_Fitter* SHAPERGUI_SalomeViewer::fitter() const
588 {
589   if (mySelector)
590     return mySelector->viewer()->fitter();
591   return 0;
592 }
593
594
595 //void SHAPERGUI_SalomeViewer::Zfitall()
596 //{
597 //  if (!mySelector || !mySelector->viewer())
598 //    return;
599 //  SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager();
600 //  /// WORKAROUND for issue #1798. SUIT_ViewManager::closeAllViews() should nullify myActiveView
601 //  /// As a result, we need to check views count in manager
602 //  if (aMgr->getViews().size() > 0) {
603 //    OCCViewer_ViewFrame* aView = dynamic_cast<OCCViewer_ViewFrame*>(aMgr->getActiveView());
604 //    if (aView) {
605 //      OCCViewer_ViewWindow* aWnd = aView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
606 //      Handle(V3d_View) aView3d = aWnd->getViewPort()->getView();
607 //      aView3d->ZFitAll();
608 //      if (aView3d->Depth() < 0.1)
609 //        aView3d->DepthFitAll();
610 //    }
611 //  }
612 //}