1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // VISU VISUGUI : GUI of VISU component
24 // File : VisuGUI_Selection.cxx
25 // Author : Sergey Anikin
28 #include "VisuGUI_Selection.h"
30 #include "VisuGUI_ViewTools.h"
31 #include "VisuGUI_Tools.h"
33 #include "VISU_Result_i.hh"
34 #include "VISU_Gen_i.hh"
36 #include "VISU_Actor.h"
37 #include "VISU_ScalarMapAct.h"
38 #include "VISU_GaussPtsAct.h"
40 #include "SalomeApp_Study.h"
41 #include "LightApp_Study.h"
42 #include "LightApp_Displayer.h"
46 //////////////////////////////////////////////////
47 // Class: VisuGUI_Selection
48 //////////////////////////////////////////////////
51 //---------------------------------------------------------------
52 QVariant VisuGUI_Selection::parameter( const int ind, const QString& p ) const
54 QVariant val( LightApp_Selection::parameter( ind, p ) );
55 if ( !val.isValid() ) {
56 if ( p == "type" ) val = QVariant( type( ind ) );
57 else if ( p == "isFieldPrs" ) val = QVariant( isFieldPrs( ind ) );
58 else if ( p == "nbComponents" ) val = QVariant( nbComponents( ind ) );
59 else if ( p == "medEntity" ) val = QVariant( medEntity( ind ) );
60 else if ( p == "medSource" ) val = QVariant( medSource( ind ) );
61 else if ( p == "representation" ) val = QVariant( representation( ind ) );
62 else if ( p == "nbTimeStamps" ) val = QVariant( nbTimeStamps( ind ) );
63 else if ( p == "nbChildren" ) val = QVariant( nbChildren( ind ) );
64 else if ( p == "nbNamedChildren") val = QVariant( nbNamedChildren( ind ) );
65 else if ( p == "isVisible" ) val = QVariant( isVisible( ind ) );
66 else if ( p == "isShrunk" ) val = QVariant( isShrunk( ind ) );
67 else if ( p == "hasActor" ) val = QVariant( hasActor( ind ) );
68 else if ( p == "isShading" ) val = QVariant( isShading( ind ) );
69 else if ( p == "isScalarMapAct" ) val = QVariant( isScalarMapAct( ind ) );
70 else if ( p == "isGaussPtsAct" ) val = QVariant( isGaussPtsAct( ind ) );
71 else if ( p == "isVisuComponent") val = QVariant( isVisuComponent( ind ) );
72 else if ( p == "fullResolution" ) val = QVariant( fullResolution( ind ) );
73 else if ( p == "mediumResolution" ) val = QVariant( mediumResolution( ind ) );
74 else if ( p == "lowResolution" ) val = QVariant( lowResolution( ind ) );
75 else if ( p == "resolutionState" ) val = QVariant( resolutionState( ind ) );
76 else if ( p == "isThereAreVisibleCurves" ) val = QVariant( findDisplayedCurves( ind, false ) );
77 else if ( p == "isThereAreHiddenCurves" ) val = QVariant( findDisplayedCurves( ind, true ) );
78 else if ( p == "hasCurves" ) val = QVariant( hasCurves( ind ) );
79 else if ( p == "isPlot2dViewer" ) val = QVariant( Plot2dViewerType( ind ) );
80 else if ( p == "isValuesLabeled" ) val = QVariant( isValuesLabeled( ind ) );
81 else if ( p == "isScalarBarVisible" ) val = QVariant( isScalarBarVisible( ind ) );
82 else if ( p == "quadratic2DMode" ) val = QVariant( quadratic2DMode(ind) );
83 else if ( p == "hasDeviation" ) val = QVariant( hasDeviation(ind) );
84 else if ( p == "isDeviationDisplayed" ) val = QVariant( isDeviationDisplayed(ind) );
91 //---------------------------------------------------------------
92 // Macro for converting VISU enumeration items into corresponding strings
93 #define ENUM2STRING( x, y ) \
98 QString VisuGUI_Selection::type( const int ind ) const
101 SalomeApp_Study* aStudy = GetStudy();
105 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1());
106 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
108 VISU::Base_i* aBase = anObjectInfo.myBase;
110 VISU::VISUType aType = aBase->GetType();
111 if(aType == VISU::TCOLOREDPRS3DHOLDER){
112 CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
113 VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
114 aType = aHolder->GetPrsType();
117 ENUM2STRING( aResStr, VISU::TVISUGEN );
118 ENUM2STRING( aResStr, VISU::TRESULT );
119 ENUM2STRING( aResStr, VISU::TTABLE );
120 ENUM2STRING( aResStr, VISU::TCURVE );
121 ENUM2STRING( aResStr, VISU::TCONTAINER );
122 ENUM2STRING( aResStr, VISU::TMESH );
123 ENUM2STRING( aResStr, VISU::TSCALARMAP );
124 ENUM2STRING( aResStr, VISU::TISOSURFACES );
125 ENUM2STRING( aResStr, VISU::TDEFORMEDSHAPE );
126 ENUM2STRING( aResStr, VISU::TSCALARMAPONDEFORMEDSHAPE );
127 ENUM2STRING( aResStr, VISU::TCUTPLANES );
128 ENUM2STRING( aResStr, VISU::TCUTLINES );
129 ENUM2STRING( aResStr, VISU::TCUTSEGMENT );
130 ENUM2STRING( aResStr, VISU::TVECTORS );
131 ENUM2STRING( aResStr, VISU::TSTREAMLINES );
132 ENUM2STRING( aResStr, VISU::TPLOT3D );
133 ENUM2STRING( aResStr, VISU::TANIMATION );
134 ENUM2STRING( aResStr, VISU::TPOINTMAP3D );
138 if(aResStr.isNull()){
139 VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aMap);
141 ENUM2STRING( aResStr, VISU::TENTITY );
142 ENUM2STRING( aResStr, VISU::TFAMILY );
143 ENUM2STRING( aResStr, VISU::TGROUP );
144 ENUM2STRING( aResStr, VISU::TVIEW3D );
145 ENUM2STRING( aResStr, VISU::TFIELD );
146 ENUM2STRING( aResStr, VISU::TTIMESTAMP );
150 if(aResStr.isNull()){
152 QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
153 if ( anIsExist && aVal != "MESH" )
154 aResStr = "VISU::T" + aVal;
161 //---------------------------------------------------------------
162 bool VisuGUI_Selection::isFieldPrs( const int ind ) const
164 SalomeApp_Study* aStudy = GetStudy();
168 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1());
169 VISU::Base_i* aBase = anObjectInfo.myBase;
170 return ( aBase && aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER );
174 //---------------------------------------------------------------
175 QString VisuGUI_Selection::nbComponents( const int ind ) const
178 SalomeApp_Study* aStudy = GetStudy();
182 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1());
183 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
186 QString aVal = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist);
193 //---------------------------------------------------------------
194 QString VisuGUI_Selection::resolutions( const int ind ) const
197 SalomeApp_Study* aStudy = GetStudy();
201 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ).toLatin1().data());
202 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
205 QString aVal = VISU::Storable::FindValue(aMap,"myResolutions",&isExist);
213 //---------------------------------------------------------------
214 QString VisuGUI_Selection::resolution( const int ind, char theResoltuion ) const
218 QString aResolutions = resolutions( ind );
219 if(aResolutions.isEmpty())
222 if(aResolutions.indexOf(theResoltuion) != -1)
231 //---------------------------------------------------------------
232 QString VisuGUI_Selection::fullResolution( const int ind ) const
234 return resolution( ind, 'F');
238 //---------------------------------------------------------------
239 QString VisuGUI_Selection::mediumResolution( const int ind ) const
241 return resolution( ind, 'M');
245 //---------------------------------------------------------------
246 QString VisuGUI_Selection::lowResolution( const int ind ) const
248 return resolution( ind, 'L');
252 //---------------------------------------------------------------
253 QString VisuGUI_Selection::resolutionState( const int ind ) const
256 SalomeApp_Study* aStudy = GetStudy();
260 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ).toLatin1().data());
261 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
264 QString aVal = VISU::Storable::FindValue(aMap,"myState",&isExist);
266 if ( aVal.toInt() == VISU::Result::FULL )
268 if ( aVal.toInt() == VISU::Result::MEDIUM )
270 if ( aVal.toInt() == VISU::Result::LOW )
272 if ( aVal.toInt() == VISU::Result::HIDDEN )
280 //---------------------------------------------------------------
281 QString VisuGUI_Selection::medEntity( const int ind ) const
283 SalomeApp_Study* aStudy = GetStudy();
287 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1());
288 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
291 QString aVal = VISU::Storable::FindValue(aMap,"myEntityId",&isExist);
293 using namespace VISU;
294 TEntity anEntityId = TEntity(aVal.toInt());
297 return "NODE_ENTITY";
299 return "EDGE_ENTITY";
301 return "FACE_ENTITY";
303 return "CELL_ENTITY";
311 QString VisuGUI_Selection::medSource( const int ind ) const
313 _PTR(Study) aStudyDS = GetStudy()->studyDS();
314 if(_PTR(SObject) aSObject = aStudyDS->FindObjectID((const char*)entry(ind).toLatin1())){
315 VISU::Result_var aRes;
316 if(VISU::Result_i* aResult = CheckResult(myModule,aSObject,aRes)){
317 using namespace VISU;
318 Result_i::ECreationId aCreationId = aResult->GetCreationId();
320 case Result_i::eImportFile :
321 return "eImportFile";
322 case Result_i::eCopyAndImportFile :
323 return "eCopyAndImportFile";
324 case Result_i::eImportMed :
326 case Result_i::eImportMedField :
327 return "eImportMedField";
336 QString VisuGUI_Selection::nbTimeStamps( const int ind ) const
339 SalomeApp_Study* aStudy = GetStudy();
343 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1());
344 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
347 const QString& aVal = VISU::Storable::FindValue(aMap,"myNbTimeStamps",&isExist);
354 //----------------------------------------------------------------------------
355 template<class TPopupFunctor>
356 struct TPopupDispatcher
359 operator()(const SalomeApp_Module* theModule,
360 const QString& theEntry)
362 if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
363 QString aType = aViewManager->getType();
364 TPopupFunctor aFunctor;
365 if(aType == SVTK_Viewer::Type())
366 return aFunctor.template Get<SVTK_Viewer>(theModule, theEntry);
367 //else if(aType == VVTK_Viewer::Type())
368 //return aFunctor.template Get<VVTK_Viewer>(theModule, theEntry);
375 //----------------------------------------------------------------------------
376 template<class TViewer>
378 GetPrs3dSelectionInfo(const SalomeApp_Module* theModule,
379 const QString& theEntry,
380 VISU::Prs3d_i*& thePrs3d,
381 SVTK_ViewWindow*& theViewWindow,
382 VISU_Actor*& thenActor)
384 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(theModule), (const char*)theEntry.toLatin1());
385 thePrs3d = GetPrs3dFromBase(anObjectInfo.myBase);
389 typedef typename TViewer::TViewWindow TViewWindow;
390 theViewWindow = GetActiveViewWindow<TViewWindow>(theModule);
394 thenActor = FindActor(theViewWindow, thePrs3d);
402 //----------------------------------------------------------------------------
405 template<class TViewer>
407 Get(const SalomeApp_Module* theModule,
408 const QString& theEntry)
410 VISU_Actor* anActor = NULL;
411 VISU::Prs3d_i* aPrs3d = NULL;
412 VISU_ActorBase* anActorBase = NULL;
413 VISU::PointMap3d_i* aPointMap3d = NULL;
414 SVTK_ViewWindow* aViewWindow = NULL;
415 if(GetPrs3dSelectionInfo<TViewer>(theModule, theEntry, aPrs3d, aViewWindow, anActor))
416 return get(aPrs3d, aViewWindow, anActor);
418 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
419 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
420 if ( aSelectionInfo.empty() )
422 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
423 aPointMap3d = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
424 anActorBase = VISU::FindActorBase(aViewWindow, aPointMap3d);
425 return getPointMap(aPointMap3d, aViewWindow, anActorBase);
431 get(VISU::Prs3d_i* thePrs3d,
432 SVTK_ViewWindow* theViewWindow,
433 VISU_Actor* theActor)
440 getPointMap(VISU::PointMap3d_i* thePrs3d,
441 SVTK_ViewWindow* theViewWindow,
442 VISU_ActorBase* theActor)
449 //----------------------------------------------------------------------------
450 struct TGetRepesentationFunctor: TViewFunctor
454 get(VISU::Prs3d_i* thePrs3d,
455 SVTK_ViewWindow* theViewWindow,
456 VISU_Actor* theActor)
459 switch (theActor->GetRepresentation()) {
460 ENUM2STRING( aResStr, VISU::POINT );
461 ENUM2STRING( aResStr, VISU::WIREFRAME );
462 ENUM2STRING( aResStr, VISU::SHADED );
463 ENUM2STRING( aResStr, VISU::INSIDEFRAME );
464 ENUM2STRING( aResStr, VISU::SURFACEFRAME );
465 ENUM2STRING( aResStr, VISU::FEATURE_EDGES );
472 getPointMap(VISU::PointMap3d_i* thePrs3d,
473 SVTK_ViewWindow* theViewWindow,
474 VISU_ActorBase* theActorBase)
476 QString aResStr = "";
478 switch (theActorBase->GetRepresentation()) {
479 ENUM2STRING( aResStr, VISU::WIREFRAME ); // = 1
480 ENUM2STRING( aResStr, VISU::SHADED ); // = 2
487 QString VisuGUI_Selection::representation( const int ind ) const
489 return TPopupDispatcher<TGetRepesentationFunctor>()(myModule, entry(ind));
492 //----------------------------------------------------------------------------
493 SalomeApp_Study* VisuGUI_Selection::GetStudy() const
496 LightApp_Study* aLightStudy = const_cast<LightApp_Study*>( study() );
497 return dynamic_cast<SalomeApp_Study*>( aLightStudy );
500 //----------------------------------------------------------------------------
501 int VisuGUI_Selection::nbChild( const int ind, const bool named ) const
504 SalomeApp_Study* aSStudy = GetStudy();
507 _PTR(Study) aStudy = GetCStudy( aSStudy );
509 _PTR(SObject) SO = aStudy->FindObjectID( (const char*)entry( ind ).toLatin1() );
511 for ( _PTR(ChildIterator) Iter = aStudy->NewChildIterator( SO ); Iter->More(); Iter->Next() ) {
513 if ( !Iter->Value()->ReferencedObject( refSO ) && ( !named || Iter->Value()->GetName().size() ) )
521 //----------------------------------------------------------------------------
522 int VisuGUI_Selection::nbChildren( const int ind ) const
524 return nbChild( ind, false );
527 //----------------------------------------------------------------------------
528 int VisuGUI_Selection::nbNamedChildren( const int ind ) const
530 return nbChild( ind, true );
534 //----------------------------------------------------------------------------
535 struct TIsVisibleFunctor: TViewFunctor
539 get(VISU::Prs3d_i* thePrs3d,
540 SVTK_ViewWindow* theViewWindow,
541 VISU_Actor* theActor)
543 return theActor->GetVisibility() ? "true" : "false";
547 QString VisuGUI_Selection::isVisible( const int ind ) const
549 return TPopupDispatcher<TIsVisibleFunctor>()(myModule, entry(ind));
553 //----------------------------------------------------------------------------
554 struct TIsShrunkFunctor: TViewFunctor
558 get(VISU::Prs3d_i* thePrs3d,
559 SVTK_ViewWindow* theViewWindow,
560 VISU_Actor* theActor)
562 return theActor->IsShrunk() ? "1" : "0";
567 getPointMap(VISU::PointMap3d_i* thePointMap,
568 SVTK_ViewWindow* theViewWindow,
569 VISU_ActorBase* theActorBase)
572 return theActorBase->IsShrunk() ? "1" : "0";
577 QString VisuGUI_Selection::isShrunk( const int ind ) const
579 return TPopupDispatcher<TIsShrunkFunctor>()(myModule, entry(ind));
583 //----------------------------------------------------------------------------
584 bool VisuGUI_Selection::hasActor( const int ind ) const
586 return !representation( ind ).isEmpty();
590 //----------------------------------------------------------------------------
591 struct TIsShadingFunctor: TViewFunctor
595 get(VISU::Prs3d_i* thePrs3d,
596 SVTK_ViewWindow* theViewWindow,
597 VISU_Actor* theActor)
599 if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor))
600 return anActor->IsShading() ? "1" : "0";
605 QString VisuGUI_Selection::isShading( const int ind ) const
607 return TPopupDispatcher<TIsShadingFunctor>()(myModule, entry(ind));
611 //----------------------------------------------------------------------------
612 struct TIsScalarMapActFunctor: TViewFunctor
616 get(VISU::Prs3d_i* thePrs3d,
617 SVTK_ViewWindow* theViewWindow,
618 VISU_Actor* theActor)
620 return dynamic_cast<VISU_ScalarMapAct*>(theActor)? "1" : "0";
625 //---------------------------------------------------------------
626 QString VisuGUI_Selection::isScalarMapAct( const int ind ) const
628 return TPopupDispatcher<TIsScalarMapActFunctor>()(myModule, entry(ind));
631 //----------------------------------------------------------------------------
632 struct TIsGaussPtsActFunctor: TViewFunctor
636 get(VISU::Prs3d_i* thePrs3d,
637 SVTK_ViewWindow* theViewWindow,
638 VISU_Actor* theActor)
640 return dynamic_cast<VISU_GaussPtsAct*>(theActor)? "1" : "0";
645 //---------------------------------------------------------------
646 QString VisuGUI_Selection::isGaussPtsAct( const int ind ) const
648 return TPopupDispatcher<TIsGaussPtsActFunctor>()(myModule, entry(ind));
651 //----------------------------------------------------------------------------
652 bool VisuGUI_Selection::isVisuComponent( const int ind ) const
654 SalomeApp_Study* study = GetStudy();
658 _PTR(SObject) obj = study->studyDS()->FindObjectID( (const char*)entry( ind ).toLatin1() );
661 CORBA::Object_var anObj = VISU::ClientSObjectToObject( obj );
662 if( CORBA::is_nil( anObj ) )
665 return dynamic_cast<VISU::VISU_Gen_i*>( VISU::GetServant( anObj ).in() );
668 //---------------------------------------------------------------------------
669 bool VisuGUI_Selection::findDisplayedCurves( const int ind, bool findHidden ) const
671 // findHidden == false - find at least one Visible curve in the childs of ind
672 // findHidden == true - find at least one Hidden curve in the childs of ind
673 SalomeApp_Study* aSStudy = GetStudy();
678 _PTR(Study) aStudy = GetCStudy( aSStudy );
680 _PTR(SObject) SO = aStudy->FindObjectID( (const char*) entry( ind ).toLatin1() );
682 for ( _PTR(ChildIterator) Iter = aStudy->NewChildIterator( SO ); Iter->More(); Iter->Next() ) {
684 if ( Iter->Value()->ReferencedObject(refSO) )
685 entryId = refSO->GetID().c_str();
687 entryId = Iter->Value()->GetID().c_str();
689 LightApp_Displayer* displayer = LightApp_Displayer::FindDisplayer( myModule->moduleName(), false );
690 if ( displayer->IsDisplayed( entryId ) && findHidden == false )
692 else if ( !displayer->IsDisplayed( entryId ) && findHidden == true )
700 //---------------------------------------------------------------------------
701 bool VisuGUI_Selection::hasCurves( const int ind ) const
703 SalomeApp_Study* aSStudy = GetStudy();
708 _PTR(Study) aStudy = GetCStudy( aSStudy );
710 _PTR(SObject) SO = aStudy->FindObjectID( (const char*) entry( ind ).toLatin1() );
712 for ( _PTR(ChildIterator) Iter = aStudy->NewChildIterator( SO ); Iter->More(); Iter->Next() ) {
714 if ( Iter->Value()->ReferencedObject(refSO) ) {
715 // reference on curve
718 refSO = Iter->Value();
720 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(refSO);
721 if(!CORBA::is_nil(aCORBAObject)){
722 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
723 if(dynamic_cast<VISU::Curve_i*>(aServant.in()))
732 //---------------------------------------------------------------------------
733 bool VisuGUI_Selection::Plot2dViewerType( const int ind ) const
736 SUIT_Session* session = SUIT_Session::session();
737 if( SUIT_Application* app = session->activeApplication() )
738 if( LightApp_Application* sApp = dynamic_cast<LightApp_Application*>( app ) )
739 if( SUIT_ViewManager* vman = sApp->activeViewManager() )
740 if( SUIT_ViewModel* vmod = vman->getViewModel() ) {
741 viewerType = vmod->getType();
742 if (viewerType ==SPlot2d_Viewer::Type())
748 //----------------------------------------------------------------------------
749 struct TIsValuesLabeled : TViewFunctor
753 get(VISU::Prs3d_i* thePrs3d,
754 SVTK_ViewWindow* theViewWindow,
755 VISU_Actor* theActor)
757 return theActor && theActor->GetValuesLabeled() ? "true" : "false";
761 QString VisuGUI_Selection::isValuesLabeled( const int ind ) const
763 return TPopupDispatcher<TIsValuesLabeled>()(myModule, entry(ind));
766 //----------------------------------------------------------------------------
767 struct TIsScalarBarVisibleFunctor: TViewFunctor
771 get(VISU::Prs3d_i* thePrs3d,
772 SVTK_ViewWindow* theViewWindow,
773 VISU_Actor* theActor)
775 if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor))
776 return anActor->GetBarVisibility() ? "true" : "false";
777 else if ( VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor))
778 return anActor->GetBarVisibility() ? "true" : "false";
783 bool VisuGUI_Selection::isScalarBarVisible( const int ind ) const
785 return TPopupDispatcher<TIsScalarBarVisibleFunctor>()(myModule, entry(ind)) == "true";
788 struct TGetQuadratic2DRepresentation: TViewFunctor
790 QString virtual get (VISU::Prs3d_i* thePrs3d,
791 SVTK_ViewWindow* theViewWindow,
792 VISU_Actor* theActor)
794 if(theActor->GetQuadratic2DRepresentation() == VISU_Actor::eLines)
795 return "VISU::LINES";
796 else if (theActor->GetQuadratic2DRepresentation() == VISU_Actor::eArcs)
804 QString VisuGUI_Selection::quadratic2DMode( const int ind) const
806 return TPopupDispatcher<TGetQuadratic2DRepresentation>()(myModule, entry(ind));
810 bool VisuGUI_Selection::hasDeviation(const int ind) const {
811 SalomeApp_Study* aSStudy = GetStudy();
815 _PTR(Study) aStudy = GetCStudy( aSStudy );
817 _PTR(SObject) SO = aStudy->FindObjectID( (const char*) entry( ind ).toLatin1() );
819 CORBA::Object_var anObj = VISU::ClientSObjectToObject( SO );
820 if( !CORBA::is_nil( anObj )) {
821 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( anObj ).in()) ) {
822 return aCurve->hasDeviation();
830 bool VisuGUI_Selection::isDeviationDisplayed(const int ind) const {
831 SalomeApp_Study* aSStudy = GetStudy();
835 _PTR(Study) aStudy = GetCStudy( aSStudy );
837 _PTR(SObject) SO = aStudy->FindObjectID( (const char*) entry( ind ).toLatin1() );
839 CORBA::Object_var anObj = VISU::ClientSObjectToObject( SO );
840 if( !CORBA::is_nil( anObj )) {
841 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( anObj ).in()) ) {
842 return aCurve->isDeviationShown();