+
+//***************************************
+void NewGeom_SalomeViewer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
+{
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ if (!aContext.IsNull()) {
+ aContext->AddFilter(theFilter);
+ }
+}
+
+//***************************************
+void NewGeom_SalomeViewer::removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
+{
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ if (!aContext.IsNull()) {
+ aContext->RemoveFilter(theFilter);
+ }
+}
+
+//***************************************
+bool NewGeom_SalomeViewer::hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
+{
+ bool aFoundFilter = false;
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ if (!aContext.IsNull()) {
+ const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
+ SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
+ for (; aIt.More() && !aFoundFilter; aIt.Next()) {
+ aFoundFilter = theFilter.Access() == aIt.Value().Access();
+ }
+ }
+ return aFoundFilter;
+}
+
+//***************************************
+void NewGeom_SalomeViewer::clearSelectionFilters()
+{
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ if (!aContext.IsNull()) {
+ aContext->RemoveFilters();
+ }
+}
+
+//***************************************
+void NewGeom_SalomeViewer::update()
+{
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ if (!aContext.IsNull()) {
+ aContext->UpdateCurrentViewer();
+ }
+}
+
+//***************************************
+void NewGeom_SalomeViewer::onViewTransformed(OCCViewer_ViewWindow::OperationType theType)
+{
+ emit viewTransformed((int) theType);
+}
+
+//***************************************
+void NewGeom_SalomeViewer::activateViewer(bool toActivate)
+{
+ if (!mySelector || !mySelector->viewer())
+ return;
+ SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager();
+ QVector<SUIT_ViewWindow*> aViews = aMgr->getViews();
+ if (toActivate) {
+ foreach (SUIT_ViewWindow* aView, aViews) {
+ OCCViewer_ViewFrame* aOCCView = dynamic_cast<OCCViewer_ViewFrame*>(aView);
+ OCCViewer_ViewWindow* aWnd = aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
+ connect(aWnd, SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)),
+ this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType)));
+ }
+ } else {
+ foreach (SUIT_ViewWindow* aView, aViews) {
+ OCCViewer_ViewFrame* aOCCView = dynamic_cast<OCCViewer_ViewFrame*>(aView);
+ OCCViewer_ViewWindow* aWnd = aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
+ disconnect((OCCViewer_ViewWindow*)aWnd, SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)),
+ this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType)));
+ }
+ }
+}
+
+void NewGeom_SalomeViewer::Zfitall()
+{
+ if (!mySelector || !mySelector->viewer())
+ return;
+ SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager();
+ OCCViewer_ViewFrame* aView = dynamic_cast<OCCViewer_ViewFrame*>(aMgr->getActiveView());
+ if (aView) {
+ OCCViewer_ViewWindow* aWnd = aView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
+ Handle(V3d_View) aView3d = aWnd->getViewPort()->getView();
+ aView3d->ZFitAll();
+ if (aView3d->Depth() < 0.1)
+ aView3d->DepthFitAll();
+ }
+}
\ No newline at end of file