1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #include "SMESHGUI_VTKUtils.h"
22 #include "SMESHGUI_Utils.h"
23 #include "SMESHGUI_Filter.h"
25 #include <vtkRenderer.h>
26 #include <vtkActorCollection.h>
28 #include <TColStd_IndexedMapOfInteger.hxx>
30 #include <SUIT_Desktop.h>
31 #include <SUIT_Session.h>
32 #include <SUIT_Study.h>
34 #include "LightApp_SelectionMgr.h"
36 #include "SVTK_Selector.h"
37 #include "SVTK_ViewModel.h"
38 #include "SVTK_ViewWindow.h"
40 #include "utilities.h"
42 #include "SALOMEconfig.h"
43 #include CORBA_CLIENT_HEADER(SMESH_Gen)
44 #include CORBA_CLIENT_HEADER(SMESH_Mesh)
45 #include CORBA_CLIENT_HEADER(SMESH_Group)
46 #include CORBA_CLIENT_HEADER(SMESH_Hypothesis)
49 #include "SMESH_Actor.h"
50 #include "SMESH_ObjectDef.h"
52 #include <SalomeApp_Application.h>
53 #include <LightApp_SelectionMgr.h>
54 #include <SalomeApp_Study.h>
56 #include <SALOMEDSClient_Study.hxx>
57 #include <SALOMEDSClient_SObject.hxx>
59 #include <SALOME_ListIO.hxx>
60 #include <SALOME_ListIteratorOfListIO.hxx>
67 typedef map<TKeyOfVisualObj,TVisualObjPtr> TVisualObjCont;
68 static TVisualObjCont VISUAL_OBJ_CONT;
70 TVisualObjPtr GetVisualObj(int theStudyId, const char* theEntry){
71 TVisualObjPtr aVisualObj;
73 TVisualObjCont::key_type aKey(theStudyId,theEntry);
74 TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
75 if(anIter != VISUAL_OBJ_CONT.end()){
76 aVisualObj = anIter->second;
78 SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SMESHGUI::activeStudy()->application() );
79 _PTR(Study) aStudy = SMESHGUI::activeStudy()->studyDS();
80 _PTR(SObject) aSObj = aStudy->FindObjectID(theEntry);
82 _PTR(GenericAttribute) anAttr;
83 if(aSObj->FindAttribute(anAttr,"AttributeIOR")){
84 _PTR(AttributeIOR) anIOR = anAttr;
85 CORBA::String_var aVal = anIOR->Value().c_str();
86 CORBA::Object_var anObj = app->orb()->string_to_object( aVal.in() );
87 if(!CORBA::is_nil(anObj)){
88 //Try narrow to SMESH_Mesh interafce
89 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
90 if(!aMesh->_is_nil()){
91 aVisualObj.reset(new SMESH_MeshObj(aMesh));
93 TVisualObjCont::value_type aValue(aKey,aVisualObj);
94 VISUAL_OBJ_CONT.insert(aValue);
97 //Try narrow to SMESH_Group interafce
98 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObj);
99 if(!aGroup->_is_nil()){
100 _PTR(SObject) aFatherSObj = aSObj->GetFather();
101 if(!aFatherSObj) return aVisualObj;
102 aFatherSObj = aFatherSObj->GetFather();
103 if(!aFatherSObj) return aVisualObj;
104 CORBA::String_var anEntry = aFatherSObj->GetID().c_str();
105 TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
106 if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
107 aVisualObj.reset(new SMESH_GroupObj(aGroup,aMeshObj));
108 aVisualObj->Update();
109 TVisualObjCont::value_type aValue(aKey,aVisualObj);
110 VISUAL_OBJ_CONT.insert(aValue);
114 //Try narrow to SMESH_subMesh interafce
115 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj);
116 if(!aSubMesh->_is_nil()){
117 _PTR(SObject) aFatherSObj = aSObj->GetFather();
118 if(!aFatherSObj) return aVisualObj;
119 aFatherSObj = aFatherSObj->GetFather();
120 if(!aFatherSObj) return aVisualObj;
121 CORBA::String_var anEntry = aFatherSObj->GetID().c_str();
122 TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
123 if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
124 aVisualObj.reset(new SMESH_subMeshObj(aSubMesh,aMeshObj));
125 aVisualObj->Update();
126 TVisualObjCont::value_type aValue(aKey,aVisualObj);
127 VISUAL_OBJ_CONT.insert(aValue);
136 INFOS("GetMeshObj - There is no SMESH_Mesh object for the SALOMEDS::Strudy and Entry!!!");
143 GetViewWindow(const SalomeApp_Module* theModule)
145 if (SalomeApp_Application* anApp = theModule->getApp())
146 return dynamic_cast<SVTK_ViewWindow*>(anApp->desktop()->activeWindow());
150 SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager* theMgr,
151 SUIT_ViewWindow* theWindow )
156 QPtrVector<SUIT_ViewWindow> views = theMgr->getViews();
157 if( views.containsRef( theWindow ) )
158 return GetVtkViewWindow( theWindow );
164 SVTK_ViewWindow* GetVtkViewWindow(SUIT_ViewWindow* theWindow){
165 return dynamic_cast<SVTK_ViewWindow*>(theWindow);
169 /* SUIT_ViewWindow* GetActiveWindow()
171 SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
174 SUIT_ViewManager* mgr = app->activeViewManager();
176 return mgr->getActiveView();
181 SVTK_ViewWindow* GetCurrentVtkView(){
182 return GetVtkViewWindow( GetActiveWindow() );
185 void RepaintViewWindow(SVTK_ViewWindow* theWindow)
187 theWindow->Repaint();
190 void RenderViewWindow(SVTK_ViewWindow* theWindow)
192 theWindow->getRenderer()->Render();
193 theWindow->Repaint();
196 SMESH_Actor* FindActorByEntry(SUIT_ViewWindow *theWindow,
197 const char* theEntry)
199 if(SVTK_ViewWindow* aViewWindow = GetVtkViewWindow(theWindow)){
200 vtkRenderer *aRenderer = aViewWindow->getRenderer();
201 vtkActorCollection *aCollection = aRenderer->GetActors();
202 aCollection->InitTraversal();
203 while(vtkActor *anAct = aCollection->GetNextActor()){
204 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
205 if(anActor->hasIO()){
206 Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
207 if(anIO->hasEntry() && strcmp(anIO->getEntry(),theEntry) == 0){
218 SMESH_Actor* FindActorByEntry(const char* theEntry){
219 return FindActorByEntry(GetActiveWindow(),theEntry);
223 SMESH_Actor* FindActorByObject(CORBA::Object_ptr theObject){
224 SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
228 if(!CORBA::is_nil(theObject)){
229 _PTR(Study) aStudy = GetActiveStudyDocument();
230 CORBA::String_var anIOR = app->orb()->object_to_string( theObject );
231 _PTR(SObject) aSObject = aStudy->FindObjectIOR(anIOR.in());
233 CORBA::String_var anEntry = aSObject->GetID().c_str();
234 return FindActorByEntry(anEntry.in());
241 SMESH_Actor* CreateActor(_PTR(Study) theStudy,
242 const char* theEntry,
245 SMESH_Actor *anActor = NULL;
246 CORBA::Long anId = theStudy->StudyId();
247 if(TVisualObjPtr aVisualObj = GetVisualObj(anId,theEntry)){
248 _PTR(SObject) aSObj = theStudy->FindObjectID(theEntry);
250 _PTR(GenericAttribute) anAttr;
251 if(aSObj->FindAttribute(anAttr,"AttributeName")){
252 _PTR(AttributeName) aName = anAttr;
253 std::string aNameVal = aName->Value();
254 anActor = SMESH_Actor::New(aVisualObj,theEntry,aNameVal.c_str(),theIsClear);
262 void DisplayActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){
263 if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){
264 vtkWnd->AddActor(theActor);
270 void RemoveActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){
271 if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){
272 vtkWnd->RemoveActor(theActor);
273 if(theActor->hasIO()){
274 Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
275 if(anIO->hasEntry()){
276 std::string anEntry = anIO->getEntry();
277 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( vtkWnd->getViewManager()->study() );
278 int aStudyId = aStudy->id();
279 TVisualObjCont::key_type aKey(aStudyId,anEntry);
280 VISUAL_OBJ_CONT.erase(aKey);
290 if(SVTK_ViewWindow* wnd = GetCurrentVtkView() ){
296 vtkRenderer* GetCurrentRenderer(){
297 if(SVTK_ViewWindow* wnd = GetCurrentVtkView() )
298 return wnd->getRenderer();
302 void RepaintCurrentView(){
303 if(SVTK_ViewWindow* wnd = GetCurrentVtkView() )
305 wnd->getRenderer()->Render();
310 void UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry)
312 if(SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd)){
313 vtkRenderer *aRenderer = aViewWnd->getRenderer();
314 vtkActorCollection *aCollection = aRenderer->GetActors();
315 aCollection->InitTraversal();
318 while(vtkActor *anAct = aCollection->GetNextActor()){
319 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
320 anActor->SetVisibility(true);
327 while(vtkActor *anAct = aCollection->GetNextActor()){
328 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
329 anActor->SetVisibility(false);
334 if(SMESH_Actor *anActor = FindActorByEntry(theWnd,theEntry)){
338 anActor->SetVisibility(true);
339 if (theAction == eDisplayOnly) aRenderer->ResetCameraClippingRange();
342 anActor->SetVisibility(false);
349 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( theWnd->getViewManager()->study() );
350 _PTR(Study) aDocument = aStudy->studyDS();
351 if((anActor = CreateActor(aDocument,theEntry,true))) {
352 DisplayActor(theWnd,anActor);
365 void UpdateView(EDisplaing theAction, const char* theEntry){
366 SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( GetActiveStudy() );
367 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( aStudy->application() );
368 SUIT_ViewWindow *aWnd = app->activeViewManager()->getActiveView();
369 UpdateView(aWnd,theAction,theEntry);
373 if(SVTK_ViewWindow* aWnd = SMESH::GetCurrentVtkView()){
374 LightApp_SelectionMgr* mgr = SMESHGUI::selectionMgr();
375 SALOME_ListIO selected; mgr->selectedObjects( selected );
377 if( selected.Extent() == 0){
378 vtkRenderer* aRenderer = aWnd->getRenderer();
379 vtkActorCollection *aCollection = aRenderer->GetActors();
380 aCollection->InitTraversal();
381 while(vtkActor *anAct = aCollection->GetNextActor()){
382 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
384 Update(anActor->getIO(),anActor->GetVisibility());
388 SALOME_ListIteratorOfListIO anIter( selected );
389 for(; anIter.More(); anIter.Next()){
390 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
394 RepaintCurrentView();
399 void Update(const Handle(SALOME_InteractiveObject)& theIO,
402 _PTR(Study) aStudy = GetActiveStudyDocument();
403 CORBA::Long anId = aStudy->StudyId();
404 TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,theIO->getEntry());
406 aVisualObj->Update();
408 UpdateView(SMESH::eDisplay,theIO->getEntry());
412 void UpdateSelectionProp( SMESHGUI* theModule ) {
416 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( theModule->application() );
419 MESSAGE( "UpdateSelectionProp: Application is null" );
423 SUIT_ViewManager* vm = app->activeViewManager();
426 MESSAGE( "UpdateSelectionProp: View manager is null" );
430 QPtrVector<SUIT_ViewWindow> views = vm->getViews();
432 SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( theModule );
435 MESSAGE( "UpdateSelectionProp: Resource manager is null" );
439 QColor aHiColor = mgr->colorValue( "SMESH", "selection_object_color", Qt::white ),
440 aSelColor = mgr->colorValue( "SMESH", "selection_element_color", Qt::yellow ),
441 aPreColor = mgr->colorValue( "SMESH", "highlight_color", Qt::cyan );
443 int SW = mgr->integerValue( "SMESH", "selection_width", 5 ),
444 PW = mgr->integerValue( "SMESH", "highlight_width", 5 );
446 double SP1 = mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ),
447 SP2 = mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 );
449 for ( int i=0, n=views.count(); i<n; i++ ){
450 // update VTK viewer properties
451 if(SVTK_ViewWindow* aVtkView = GetVtkViewWindow( views[i] )){
452 // mesh element selection
453 aVtkView->SetSelectionProp(aSelColor.red()/255.,
454 aSelColor.green()/255.,
455 aSelColor.blue()/255.,
458 aVtkView->SetSelectionTolerance(SP1, SP2);
461 aVtkView->SetPreselectionProp(aPreColor.red()/255.,
462 aPreColor.green()/255.,
463 aPreColor.blue()/255.,
466 vtkRenderer* aRenderer = aVtkView->getRenderer();
467 vtkActorCollection *aCollection = aRenderer->GetActors();
468 aCollection->InitTraversal();
469 while(vtkActor *anAct = aCollection->GetNextActor()){
470 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
471 anActor->SetHighlightColor(aHiColor.red()/255.,
472 aHiColor.green()/255.,
473 aHiColor.blue()/255.);
474 anActor->SetPreHighlightColor(aPreColor.red()/255.,
475 aPreColor.green()/255.,
476 aPreColor.blue()/255.);
484 //----------------------------------------------------------------------------
486 GetSelector(SUIT_ViewWindow *theWindow)
488 if(SVTK_ViewWindow* aWnd = GetVtkViewWindow(theWindow))
489 return aWnd->GetSelector();
494 void SetFilter(const Handle(VTKViewer_Filter)& theFilter,
495 SVTK_Selector* theSelector)
498 theSelector->SetFilter(theFilter);
501 Handle(VTKViewer_Filter) GetFilter(int theId, SVTK_Selector* theSelector)
503 return theSelector->GetFilter(theId);
506 bool IsFilterPresent(int theId, SVTK_Selector* theSelector)
508 return theSelector->IsFilterPresent(theId);
511 void RemoveFilter(int theId, SVTK_Selector* theSelector)
513 theSelector->RemoveFilter(theId);
516 void RemoveFilters(SVTK_Selector* theSelector)
518 for ( int id = SMESHGUI_NodeFilter; theSelector && id < SMESHGUI_LastFilter; id++ )
519 theSelector->RemoveFilter( id );
522 bool IsValid(SALOME_Actor* theActor, int theCellId,
523 SVTK_Selector* theSelector)
525 return theSelector->IsValid(theActor,theCellId);
529 //----------------------------------------------------------------------------
530 void SetPointRepresentation(bool theIsVisible){
531 if(SVTK_ViewWindow* aViewWindow = GetCurrentVtkView()){
532 vtkRenderer *aRenderer = aViewWindow->getRenderer();
533 vtkActorCollection *aCollection = aRenderer->GetActors();
534 aCollection->InitTraversal();
535 while(vtkActor *anAct = aCollection->GetNextActor()){
536 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
537 if(anActor->GetVisibility()){
538 anActor->SetPointRepresentation(theIsVisible);
542 RepaintCurrentView();
547 void SetPickable(SMESH_Actor* theActor){
548 if(SVTK_ViewWindow* aWnd = GetCurrentVtkView()){
549 int anIsAllPickable = (theActor == NULL);
550 vtkRenderer *aRenderer = aWnd->getRenderer();
551 vtkActorCollection *aCollection = aRenderer->GetActors();
552 aCollection->InitTraversal();
553 while(vtkActor *anAct = aCollection->GetNextActor()){
554 if(SALOME_Actor *anActor = dynamic_cast<SALOME_Actor*>(anAct)){
555 if(anActor->GetVisibility()){
556 anActor->SetPickable(anIsAllPickable);
561 theActor->SetPickable(!anIsAllPickable);
562 RepaintCurrentView();
567 //----------------------------------------------------------------------------
568 int GetNameOfSelectedNodes(SVTK_Selector* theSelector,
569 const Handle(SALOME_InteractiveObject)& theIO,
573 TColStd_IndexedMapOfInteger aMapIndex;
574 theSelector->GetIndex(theIO,aMapIndex);
576 for(int i = 1; i <= aMapIndex.Extent(); i++)
577 theName += QString(" %1").arg(aMapIndex(i));
579 return aMapIndex.Extent();
582 int GetNameOfSelectedElements(SVTK_Selector* theSelector,
583 const Handle(SALOME_InteractiveObject)& theIO,
587 TColStd_IndexedMapOfInteger aMapIndex;
588 theSelector->GetIndex(theIO,aMapIndex);
590 typedef std::set<int> TIdContainer;
591 TIdContainer anIdContainer;
592 for( int i = 1; i <= aMapIndex.Extent(); i++)
593 anIdContainer.insert(aMapIndex(i));
595 TIdContainer::const_iterator anIter = anIdContainer.begin();
596 for(; anIter != anIdContainer.end(); anIter++)
597 theName += QString(" %1").arg(*anIter);
599 return aMapIndex.Extent();
603 int GetEdgeNodes(SVTK_Selector* theSelector,
604 const TVisualObjPtr& theVisualObject,
608 const SALOME_ListIO& selected = theSelector->StoredIObjects();
610 if ( selected.Extent() != 1 )
613 Handle(SALOME_InteractiveObject) anIO = selected.First();
614 if ( anIO.IsNull() || !anIO->hasEntry() )
617 TColStd_IndexedMapOfInteger aMapIndex;
618 theSelector->GetIndex( anIO, aMapIndex );
619 if ( aMapIndex.Extent() != 2 )
622 int anObjId = -1, anEdgeNum = -1;
623 for ( int i = 1; i <= aMapIndex.Extent(); i++ ) {
624 int aVal = aMapIndex( i );
628 anEdgeNum = abs( aVal ) - 1;
631 if ( anObjId == -1 || anEdgeNum == -1 )
634 return theVisualObject->GetEdgeNodes( anObjId, anEdgeNum, theId1, theId2 ) ? 1 : -1;
637 //----------------------------------------------------------------------------
638 int GetNameOfSelectedNodes(LightApp_SelectionMgr *theMgr,
639 const Handle(SALOME_InteractiveObject)& theIO,
643 if(theIO->hasEntry()){
644 if(FindActorByEntry(theIO->getEntry())){
645 TColStd_IndexedMapOfInteger aMapIndex;
646 theMgr->GetIndexes(theIO,aMapIndex);
647 for(int i = 1; i <= aMapIndex.Extent(); i++){
648 theName += QString(" %1").arg(aMapIndex(i));
650 return aMapIndex.Extent();
656 int GetNameOfSelectedNodes(LightApp_SelectionMgr *theMgr, QString& theName){
658 SALOME_ListIO selected; theMgr->selectedObjects( selected );
659 if(selected.Extent() == 1){
660 Handle(SALOME_InteractiveObject) anIO = selected.First();
661 return GetNameOfSelectedNodes(theMgr,anIO,theName);
667 int GetNameOfSelectedElements(LightApp_SelectionMgr *theMgr,
668 const Handle(SALOME_InteractiveObject)& theIO,
672 if(theIO->hasEntry()){
673 if(FindActorByEntry(theIO->getEntry())){
674 TColStd_IndexedMapOfInteger aMapIndex;
675 theMgr->GetIndexes(theIO,aMapIndex);
676 typedef set<int> TIdContainer;
677 TIdContainer anIdContainer;
678 for( int i = 1; i <= aMapIndex.Extent(); i++)
679 anIdContainer.insert(aMapIndex(i));
680 TIdContainer::const_iterator anIter = anIdContainer.begin();
681 for(; anIter != anIdContainer.end(); anIter++){
682 theName += QString(" %1").arg(*anIter);
684 return aMapIndex.Extent();
691 int GetNameOfSelectedElements(LightApp_SelectionMgr *theMgr, QString& theName)
694 SALOME_ListIO selected; theMgr->selectedObjects( selected );
696 if( selected.Extent() == 1){
697 Handle(SALOME_InteractiveObject) anIO = selected.First();
698 return GetNameOfSelectedElements(theMgr,anIO,theName);
703 int GetSelected(LightApp_SelectionMgr* theMgr,
704 TColStd_IndexedMapOfInteger& theMap,
705 const bool theIsElement)
708 SALOME_ListIO selected; theMgr->selectedObjects( selected );
710 if ( selected.Extent() == 1 )
712 Handle(SALOME_InteractiveObject) anIO = selected.First();
713 if ( anIO->hasEntry() ) {
714 theMgr->GetIndexes( anIO, theMap );
717 return theMap.Extent();
721 int GetEdgeNodes( LightApp_SelectionMgr* theMgr, int& theId1, int& theId2 )
723 SALOME_ListIO selected; theMgr->selectedObjects( selected );
725 if ( selected.Extent() != 1 )
728 Handle(SALOME_InteractiveObject) anIO = selected.First();
729 if ( anIO.IsNull() || !anIO->hasEntry() )
732 SMESH_Actor *anActor = SMESH::FindActorByEntry( anIO->getEntry() );
736 TColStd_IndexedMapOfInteger aMapIndex;
737 theMgr->GetIndexes( anIO, aMapIndex );
738 if ( aMapIndex.Extent() != 2 )
741 int anObjId = -1, anEdgeNum = -1;
742 for ( int i = 1; i <= aMapIndex.Extent(); i++ ) {
743 int aVal = aMapIndex( i );
747 anEdgeNum = abs( aVal );
750 if ( anObjId == -1 || anEdgeNum == -1 )
753 return anActor->GetObject()->GetEdgeNodes( anObjId, anEdgeNum, theId1, theId2 ) ? 1 : -1;
756 void SetControlsPrecision( const long theVal )
758 if( SVTK_ViewWindow* aWnd = SMESH::GetCurrentVtkView() )
760 vtkRenderer *aRenderer = aWnd->getRenderer();
761 vtkActorCollection *aCollection = aRenderer->GetActors();
762 aCollection->InitTraversal();
764 while ( vtkActor *anAct = aCollection->GetNextActor())
766 if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>( anAct ) )
768 anActor->SetControlsPrecision( theVal );
769 anActor->SetControlMode( anActor->GetControlMode() );