+ if(aCollection)
+ aCollection->InitTraversal();
+ else
+ return;
+
+ int UIso = 0;
+ int VIso = 0;
+
+ vtkActor* anAct = aCollection->GetNextActor();
+ if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct))
+ anActor->GetNbIsos(UIso,VIso);
+ else
+ return;
+
+ int newNbUIso = -1;
+ int newNbVIso = -1;
+
+ if ( actionType == SHOWDLG ) {
+ GEOMToolsGUI_NbIsosDlg* NbIsosDlg =
+ new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
+
+ NbIsosDlg->setU( UIso );
+ NbIsosDlg->setV( VIso );
+
+ if ( NbIsosDlg->exec() ) {
+ SUIT_OverrideCursor();
+
+ newNbUIso = NbIsosDlg->getU();
+ newNbVIso = NbIsosDlg->getV();
+ } else
+ return; //Cancel case
+ }
+ else if ( actionType == INCR || actionType == DECR ) {
+ int delta = 1;
+ if (actionType == DECR)
+ delta = -1;
+
+ newNbUIso = UIso + delta;
+ newNbVIso = VIso + delta;
+
+ if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 )
+ return;
+ }
+
+ while( anAct!=NULL ) {
+ if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)){
+ // There are no casting to needed actor.
+ int aIsos[2]={newNbUIso,newNbVIso};
+ anActor->SetNbIsos(aIsos);
+
+ QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso);
+ int aMgrId = window->getViewManager()->getGlobalId();
+ aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), ISOS_PROP, anIsos);
+ }
+ anAct = aCollection->GetNextActor();
+ }
+ view->Repaint();
+ GeometryGUI::Modified();
+ } // end vtkviewer
+}
+
+void GEOMToolsGUI::OnDeflection()
+{
+ SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+
+
+ bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type());
+ bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type());
+ int mgrId = window->getViewManager()->getGlobalId();
+
+ if (isOCC) { // if is OCCViewer
+ OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>(window->getViewManager()->getViewModel());
+ Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+
+ ic->InitCurrent();
+ if (ic->MoreCurrent()) {
+ Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
+
+ Standard_Real aDC, aPrevDC;
+ Standard_Boolean isOwnDC = CurObject->OwnDeviationCoefficient(aDC, aPrevDC);
+ if (!isOwnDC)
+ aDC = ic->DeviationCoefficient();
+
+ GEOMToolsGUI_DeflectionDlg * DeflectionDlg = new GEOMToolsGUI_DeflectionDlg
+ (SUIT_Session::session()->activeApplication()->desktop());
+ DeflectionDlg->setTheDC(aDC);
+ double aNewDC = 0.0;
+ bool ok = false;
+ while (!ok) {
+ if (DeflectionDlg->exec()) {
+ SUIT_OverrideCursor();
+ aNewDC = DeflectionDlg->getTheDC();
+ ok = (1e-07 <= aNewDC && aNewDC <= 1.0); // spinbox can return zero
+ if (ok) {
+ for (; ic->MoreCurrent(); ic->NextCurrent()) {
+ CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
+ ic->SetDeviationCoefficient(CurObject, aNewDC, Standard_True);
+ ic->Redisplay(CurObject);
+ appStudy->setObjectProperty(mgrId,CurObject->getIO()->getEntry(), DEFLECTION_COEFF_PROP, aNewDC);
+ }
+ }
+ }
+ else {
+ ok = true;
+ }
+ }
+ }
+ GeometryGUI::Modified();
+ }
+ else if (isVTK) { // if is VTKViewer
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
+ (SUIT_Session::session()->activeApplication());
+ if (!app)
+ return;
+
+ LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+ if (!aSelMgr)
+ return;
+
+ SALOME_ListIO selected;
+ aSelMgr->selectedObjects(selected);
+ if (selected.IsEmpty())
+ return;
+
+ SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>(window);
+ if (!vtkVW)
+ return;
+
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
+
+ vtkActorCollection* aCollection = vtkActorCollection::New();
+
+ for (SALOME_ListIteratorOfListIO It (selected); It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject) anIObject = It.Value();
+ SALOME_Prs* aPrs = view->CreatePrs(anIObject->getEntry());
+ SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>(aPrs);
+ if (vtkPrs) {
+ vtkActorCollection* anActors = vtkPrs->GetObjects();
+ anActors->InitTraversal();
+ vtkActor* anAct = anActors->GetNextActor();
+ aCollection->AddItem(anAct);
+ }
+ }
+
+ if (aCollection)
+ aCollection->InitTraversal();
+ else
+ return;
+
+ double aDC = 0.;