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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
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 "QAD_Config.h"
31 #include "QAD_Desktop.h"
32 #include "QAD_Study.h"
33 #include "QAD_Settings.h"
34 #include "QAD_RightFrame.h"
36 #include "SALOME_Selection.h"
37 #include "SALOME_ListIteratorOfListIO.hxx"
39 #include "VTKViewer_ViewFrame.h"
40 #include "VTKViewer_RenderWindow.h"
41 #include "VTKViewer_InteractorStyleSALOME.h"
42 #include "VTKViewer_RenderWindowInteractor.h"
44 #include "utilities.h"
46 #include "SALOMEconfig.h"
47 #include CORBA_CLIENT_HEADER(SMESH_Gen)
48 #include CORBA_CLIENT_HEADER(SMESH_Mesh)
49 #include CORBA_CLIENT_HEADER(SMESH_Group)
50 #include CORBA_CLIENT_HEADER(SMESH_Hypothesis)
51 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
53 #include "SMESH_Actor.h"
54 #include "SMESH_ObjectDef.h"
60 typedef map<TKeyOfVisualObj,TVisualObjPtr> TVisualObjCont;
61 static TVisualObjCont VISUAL_OBJ_CONT;
63 TVisualObjPtr GetVisualObj(int theStudyId, const char* theEntry){
64 TVisualObjPtr aVisualObj;
66 TVisualObjCont::key_type aKey(theStudyId,theEntry);
67 TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
68 if(anIter != VISUAL_OBJ_CONT.end()){
69 aVisualObj = anIter->second;
71 SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
72 SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theEntry);
73 if(!CORBA::is_nil(aSObj)){
74 SALOMEDS::GenericAttribute_var anAttr;
75 if(aSObj->FindAttribute(anAttr,"AttributeIOR")){
76 SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
77 CORBA::String_var aVal = anIOR->Value();
78 CORBA::Object_var anObj = aStudy->ConvertIORToObject(aVal.in());
79 if(!CORBA::is_nil(anObj)){
80 //Try narrow to SMESH_Mesh interafce
81 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
82 if(!aMesh->_is_nil()){
83 aVisualObj.reset(new SMESH_MeshObj(aMesh));
85 TVisualObjCont::value_type aValue(aKey,aVisualObj);
86 VISUAL_OBJ_CONT.insert(aValue);
89 //Try narrow to SMESH_Group interafce
90 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObj);
91 if(!aGroup->_is_nil()){
92 SALOMEDS::SObject_var aFatherSObj = aSObj->GetFather();
93 if(aFatherSObj->_is_nil()) return aVisualObj;
94 aFatherSObj = aFatherSObj->GetFather();
95 if(aFatherSObj->_is_nil()) return aVisualObj;
96 CORBA::String_var anEntry = aFatherSObj->GetID();
97 TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
98 if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
99 aVisualObj.reset(new SMESH_GroupObj(aGroup,aMeshObj));
100 aVisualObj->Update();
101 TVisualObjCont::value_type aValue(aKey,aVisualObj);
102 VISUAL_OBJ_CONT.insert(aValue);
106 //Try narrow to SMESH_subMesh interafce
107 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj);
108 if(!aSubMesh->_is_nil()){
109 SALOMEDS::SObject_var aFatherSObj = aSObj->GetFather();
110 if(aFatherSObj->_is_nil()) return aVisualObj;
111 aFatherSObj = aFatherSObj->GetFather();
112 if(aFatherSObj->_is_nil()) return aVisualObj;
113 CORBA::String_var anEntry = aFatherSObj->GetID();
114 TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
115 if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
116 aVisualObj.reset(new SMESH_subMeshObj(aSubMesh,aMeshObj));
117 aVisualObj->Update();
118 TVisualObjCont::value_type aValue(aKey,aVisualObj);
119 VISUAL_OBJ_CONT.insert(aValue);
128 INFOS("GetMeshObj - There is no SMESH_Mesh object for the SALOMEDS::Strudy and Entry!!!");
134 VTKViewer_ViewFrame* FindVtkViewFrame(QAD_Study* theStudy,
135 QAD_StudyFrame* theStudyFrame)
137 QList<QAD_Study>& aStudies =
138 QAD_Application::getDesktop()->getActiveApp()->getStudies();
139 if(aStudies.containsRef(theStudy)){
140 const QList<QAD_StudyFrame>& aStudyFrames = theStudy->getStudyFrames();
141 if(aStudyFrames.containsRef(theStudyFrame)){
142 return GetVtkViewFrame(theStudyFrame);
149 VTKViewer_ViewFrame* GetVtkViewFrame(QAD_StudyFrame* theStudyFrame){
150 QAD_ViewFrame* aViewFrame = theStudyFrame->getRightFrame()->getViewFrame();
151 return dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame);
155 VTKViewer_ViewFrame* GetCurrentVtkView(){
156 return GetVtkViewFrame(GetActiveStudy()->getActiveStudyFrame());
160 void RepaintViewFrame(VTKViewer_ViewFrame* theFrame)
166 void RenderViewFrame(VTKViewer_ViewFrame* theFrame)
168 theFrame->getRW()->getRenderWindow()->Render();
173 SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame,
174 const char* theEntry)
176 if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
177 vtkRenderer *aRenderer = aViewFrame->getRenderer();
178 vtkActorCollection *aCollection = aRenderer->GetActors();
179 aCollection->InitTraversal();
180 while(vtkActor *anAct = aCollection->GetNextActor()){
181 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
182 if(anActor->hasIO()){
183 Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
184 if(anIO->hasEntry() && strcmp(anIO->getEntry(),theEntry) == 0){
195 SMESH_Actor* FindActorByEntry(const char* theEntry){
196 return FindActorByEntry(GetActiveStudy()->getActiveStudyFrame(),theEntry);
200 SMESH_Actor* FindActorByObject(CORBA::Object_ptr theObject){
201 if(!CORBA::is_nil(theObject)){
202 SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
203 CORBA::String_var anIOR = aStudy->ConvertObjectToIOR(theObject);
204 SALOMEDS::SObject_var aSObject = aStudy->FindObjectIOR(anIOR.in());
205 if(!aSObject->_is_nil()){
206 CORBA::String_var anEntry = aSObject->GetID();
207 return FindActorByEntry(anEntry.in());
214 SMESH_Actor* CreateActor(SALOMEDS::Study_ptr theStudy,
215 const char* theEntry,
218 SMESH_Actor *anActor = NULL;
219 CORBA::Long anId = theStudy->StudyId();
220 if(TVisualObjPtr aVisualObj = GetVisualObj(anId,theEntry)){
221 SALOMEDS::SObject_var aSObj = theStudy->FindObjectID(theEntry);
222 if(!aSObj->_is_nil()){
223 SALOMEDS::GenericAttribute_var anAttr;
224 if(aSObj->FindAttribute(anAttr,"AttributeName")){
225 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
226 CORBA::String_var aVal = aName->Value();
227 string aNameVal = aVal.in();
228 anActor = SMESH_Actor::New(aVisualObj,theEntry,aNameVal.c_str(),theIsClear);
236 void DisplayActor(QAD_StudyFrame *theStudyFrame, SMESH_Actor* theActor){
237 if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
238 aViewFrame->AddActor(theActor);
239 aViewFrame->Repaint();
244 void RemoveActor(QAD_StudyFrame *theStudyFrame, SMESH_Actor* theActor){
245 if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
246 aViewFrame->RemoveActor(theActor);
247 if(theActor->hasIO()){
248 Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
249 if(anIO->hasEntry()){
250 std::string anEntry = anIO->getEntry();
251 QAD_Study* aStudy = theStudyFrame->getStudy();
252 int aStudyId = aStudy->getStudyId();
253 TVisualObjCont::key_type aKey(aStudyId,anEntry);
254 VISUAL_OBJ_CONT.erase(aKey);
258 aViewFrame->Repaint();
264 if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(GetActiveStudy()->getActiveStudyFrame())){
265 aViewFrame->onViewFitAll();
266 aViewFrame->Repaint();
270 vtkRenderer* GetCurrentRenderer(){
271 if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(GetActiveStudy()->getActiveStudyFrame()))
272 return aViewFrame->getRenderer();
276 void RepaintCurrentView(){
277 if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(GetActiveStudy()->getActiveStudyFrame())){
278 aViewFrame->getRW()->getRenderWindow()->Render();
279 //aViewFrame->Repaint();
284 void UpdateView(QAD_StudyFrame *theStudyFrame, EDisplaing theAction, const char* theEntry)
286 if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
287 vtkRenderer *aRenderer = aViewFrame->getRenderer();
288 vtkActorCollection *aCollection = aRenderer->GetActors();
289 aCollection->InitTraversal();
292 while(vtkActor *anAct = aCollection->GetNextActor()){
293 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
294 anActor->SetVisibility(true);
301 while(vtkActor *anAct = aCollection->GetNextActor()){
302 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
303 anActor->SetVisibility(false);
308 if(SMESH_Actor *anActor = FindActorByEntry(theStudyFrame,theEntry)){
312 anActor->SetVisibility(true);
315 anActor->SetVisibility(false);
322 QAD_Study* aStudy = theStudyFrame->getStudy();
323 SALOMEDS::Study_var aDocument = aStudy->getStudyDocument();
324 if((anActor = CreateActor(aDocument,theEntry,true))) {
325 DisplayActor(theStudyFrame,anActor);
338 void UpdateView(EDisplaing theAction, const char* theEntry){
339 QAD_Study* aStudy = GetActiveStudy();
340 QAD_StudyFrame *aStudyFrame = aStudy->getActiveStudyFrame();
341 UpdateView(aStudyFrame,theAction,theEntry);
345 if(VTKViewer_ViewFrame* aViewFrame = SMESH::GetCurrentVtkView()){
346 SALOME_Selection *aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
347 if(aSel->IObjectCount() == 0){
348 vtkRenderer* aRenderer = aViewFrame->getRenderer();
349 vtkActorCollection *aCollection = aRenderer->GetActors();
350 aCollection->InitTraversal();
351 while(vtkActor *anAct = aCollection->GetNextActor()){
352 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
354 Update(anActor->getIO(),anActor->GetVisibility());
358 SALOME_ListIteratorOfListIO anIter(aSel->StoredIObjects());
359 for(; anIter.More(); anIter.Next()){
360 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
364 RepaintCurrentView();
369 void Update(const Handle(SALOME_InteractiveObject)& theIO,
372 SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
373 CORBA::Long anId = aStudy->StudyId();
374 TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,theIO->getEntry());
375 aVisualObj->Update();
377 UpdateView(SMESH::eDisplay,theIO->getEntry());
381 void UpdateSelectionProp() {
382 QAD_Study* aStudy = GetActiveStudy();
383 QList<QAD_StudyFrame> aFrameList = aStudy->getStudyFrames();
385 QString SCr, SCg, SCb;
386 SCr = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorRed");
387 SCg = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorGreen");
388 SCb = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorBlue");
389 QColor aHiColor = Qt::white;
390 if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
391 aHiColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
393 SCr = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorRed");
394 SCg = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorGreen");
395 SCb = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorBlue");
396 QColor aSelColor = Qt::yellow;
397 if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
398 aSelColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
399 QString SW = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectWidth");
400 if (SW.isEmpty()) SW = "5";
402 SCr = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorRed");
403 SCg = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorGreen");
404 SCb = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorBlue");
405 QColor aPreColor = Qt::cyan;
406 if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
407 aPreColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
408 QString PW = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectWidth");
409 if (PW.isEmpty()) PW = "5";
411 QString SP1 = QAD_CONFIG->getSetting("SMESH:SettingsNodeSelectTol");
412 if (SP1.isEmpty()) SP1 = "0.025";
413 QString SP2 = QAD_CONFIG->getSetting("SMESH:SettingsElementsSelectTol");
414 if (SP2.isEmpty()) SP2 = "0.001";
416 for (QAD_StudyFrame* aStudyFrame = aFrameList.first(); aStudyFrame; aStudyFrame = aFrameList.next()) {
417 if (aStudyFrame->getTypeView() == VIEW_VTK) {
418 VTKViewer_ViewFrame* aVtkViewFrame = GetVtkViewFrame(aStudyFrame);
419 if (!aVtkViewFrame) continue;
420 // update VTK viewer properties
421 VTKViewer_RenderWindowInteractor* anInteractor = aVtkViewFrame->getRWInteractor();
423 // mesh element selection
424 anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255.,
425 aSelColor.blue()/255., SW.toInt());
428 anInteractor->SetSelectionTolerance(SP1.toDouble(), SP2.toDouble());
431 VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME();
433 aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255.,
434 aPreColor.blue()/255., PW.toInt());
438 vtkRenderer* aRenderer = aVtkViewFrame->getRenderer();
439 vtkActorCollection *aCollection = aRenderer->GetActors();
440 aCollection->InitTraversal();
441 while(vtkActor *anAct = aCollection->GetNextActor()){
442 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
443 anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255.,
444 aHiColor.blue()/255.);
445 anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255.,
446 aPreColor.blue()/255.);
454 //----------------------------------------------------------------------------
455 VTKViewer_InteractorStyleSALOME* GetInteractorStyle(QAD_StudyFrame *theStudyFrame){
456 if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
457 if(VTKViewer_RenderWindowInteractor* anInteractor = aViewFrame->getRWInteractor()){
458 return anInteractor->GetInteractorStyleSALOME();
464 void SetFilter(const Handle(VTKViewer_Filter)& theFilter,
465 VTKViewer_InteractorStyleSALOME* theStyle)
467 theStyle->SetFilter(theFilter);
470 Handle(VTKViewer_Filter) GetFilter(int theId, VTKViewer_InteractorStyleSALOME* theStyle)
472 return theStyle->GetFilter(theId);
475 bool IsFilterPresent(int theId, VTKViewer_InteractorStyleSALOME* theStyle)
477 return theStyle->IsFilterPresent(theId);
480 void RemoveFilter(int theId, VTKViewer_InteractorStyleSALOME* theStyle){
481 theStyle->RemoveFilter(theId);
484 void RemoveFilters(VTKViewer_InteractorStyleSALOME* theStyle){
485 for ( int id = SMESHGUI_NodeFilter; theStyle && id < SMESHGUI_LastFilter; id++ )
486 theStyle->RemoveFilter( id );
489 bool IsValid(SALOME_Actor* theActor, int theCellId,
490 VTKViewer_InteractorStyleSALOME* theStyle)
492 return theStyle->IsValid(theActor,theCellId);
496 //----------------------------------------------------------------------------
497 void SetPointRepresentation(bool theIsVisible){
498 if(VTKViewer_ViewFrame* aViewFrame = GetCurrentVtkView()){
499 vtkRenderer *aRenderer = aViewFrame->getRenderer();
500 vtkActorCollection *aCollection = aRenderer->GetActors();
501 aCollection->InitTraversal();
502 while(vtkActor *anAct = aCollection->GetNextActor()){
503 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
504 if(anActor->GetVisibility()){
505 anActor->SetPointRepresentation(theIsVisible);
509 RepaintCurrentView();
514 void SetPickable(SMESH_Actor* theActor){
515 if(VTKViewer_ViewFrame* aViewFrame = GetCurrentVtkView()){
516 int anIsAllPickable = (theActor == NULL);
517 vtkRenderer *aRenderer = aViewFrame->getRenderer();
518 vtkActorCollection *aCollection = aRenderer->GetActors();
519 aCollection->InitTraversal();
520 while(vtkActor *anAct = aCollection->GetNextActor()){
521 if(SALOME_Actor *anActor = dynamic_cast<SALOME_Actor*>(anAct)){
522 if(anActor->GetVisibility()){
523 anActor->SetPickable(anIsAllPickable);
528 theActor->SetPickable(!anIsAllPickable);
529 RepaintCurrentView();
534 int GetNameOfSelectedNodes(SALOME_Selection *theSel,
535 const Handle(SALOME_InteractiveObject)& theIO,
539 if(theIO->hasEntry()){
540 if(FindActorByEntry(theIO->getEntry())){
541 TColStd_IndexedMapOfInteger aMapIndex;
542 theSel->GetIndex(theIO,aMapIndex);
543 for(int i = 1; i <= aMapIndex.Extent(); i++){
544 theName += QString(" %1").arg(aMapIndex(i));
546 return aMapIndex.Extent();
553 int GetNameOfSelectedNodes(SALOME_Selection *theSel, QString& theName){
555 if(theSel->IObjectCount() == 1){
556 Handle(SALOME_InteractiveObject) anIO = theSel->firstIObject();
557 return GetNameOfSelectedNodes(theSel,anIO,theName);
563 int GetNameOfSelectedElements(SALOME_Selection *theSel,
564 const Handle(SALOME_InteractiveObject)& theIO,
568 if(theIO->hasEntry()){
569 if(FindActorByEntry(theIO->getEntry())){
570 TColStd_IndexedMapOfInteger aMapIndex;
571 theSel->GetIndex(theIO,aMapIndex);
572 typedef std::set<int> TIdContainer;
573 TIdContainer anIdContainer;
574 for( int i = 1; i <= aMapIndex.Extent(); i++)
575 anIdContainer.insert(aMapIndex(i));
576 TIdContainer::const_iterator anIter = anIdContainer.begin();
577 for(; anIter != anIdContainer.end(); anIter++){
578 theName += QString(" %1").arg(*anIter);
580 return aMapIndex.Extent();
587 int GetNameOfSelectedElements(SALOME_Selection *theSel, QString& theName)
590 if(theSel->IObjectCount() == 1){
591 Handle(SALOME_InteractiveObject) anIO = theSel->firstIObject();
592 return GetNameOfSelectedElements(theSel,anIO,theName);
598 int GetSelected(SALOME_Selection* theSel,
599 TColStd_IndexedMapOfInteger& theMap,
600 const bool theIsElement)
604 if ( theSel->IObjectCount() == 1 )
606 Handle(SALOME_InteractiveObject) anIO = theSel->firstIObject();
607 if ( anIO->hasEntry() ) {
608 theSel->GetIndex( anIO, theMap );
611 return theMap.Extent();
615 int GetEdgeNodes( SALOME_Selection* theSel, int& theId1, int& theId2 )
617 if ( theSel->IObjectCount() != 1 )
620 Handle(SALOME_InteractiveObject) anIO = theSel->firstIObject();
621 if ( anIO.IsNull() || !anIO->hasEntry() )
624 SMESH_Actor *anActor = SMESH::FindActorByEntry( anIO->getEntry() );
628 TColStd_IndexedMapOfInteger aMapIndex;
629 theSel->GetIndex( anIO, aMapIndex );
630 if ( aMapIndex.Extent() != 2 )
633 int anObjId = -1, anEdgeNum = -1;
634 for ( int i = 1; i <= aMapIndex.Extent(); i++ ) {
635 int aVal = aMapIndex( i );
639 anEdgeNum = abs( aVal );
642 if ( anObjId == -1 || anEdgeNum == -1 )
645 return anActor->GetObject()->GetEdgeNodes( anObjId, anEdgeNum, theId1, theId2 ) ? 1 : -1;
648 void SetControlsPrecision( const long theVal )
650 if( VTKViewer_ViewFrame* aViewFrame = SMESH::GetCurrentVtkView() )
652 vtkRenderer *aRenderer = aViewFrame->getRenderer();
653 vtkActorCollection *aCollection = aRenderer->GetActors();
654 aCollection->InitTraversal();
656 while ( vtkActor *anAct = aCollection->GetNextActor())
658 if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>( anAct ) )
660 anActor->SetControlsPrecision( theVal );
661 anActor->SetControlMode( anActor->GetControlMode() );