1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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 // File : GEOMGUI_Selection.cxx
24 // Author : Alexander SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com)
26 #include "GEOMGUI_Selection.h"
27 #include <GEOMGUI_DimensionProperty.h>
29 #include "GeometryGUI.h"
30 #include "GEOM_Displayer.h"
32 #include "Material_Model.h"
34 #include <GEOM_Constants.h>
36 #include <SalomeApp_Application.h>
37 #include <SalomeApp_Study.h>
39 #include "LightApp_DataOwner.h"
41 #include <SUIT_Session.h>
42 #include <SUIT_Desktop.h>
43 #include <SUIT_ViewWindow.h>
44 #include <SUIT_ViewManager.h>
45 #include <SUIT_ResourceMgr.h>
47 #include <SALOME_Prs.h>
48 #include <SALOME_InteractiveObject.hxx>
52 #include <SALOME_Actor.h>
53 #include <GEOM_Actor.h>
55 #include <OCCViewer_ViewModel.h>
56 #include <SVTK_ViewModel.h>
58 #include <GEOMImpl_Types.hxx>
60 #include <GEOM_AISShape.hxx>
61 #include <GEOM_VTKPropertyMaterial.hxx>
65 #include <AIS_InteractiveObject.hxx>
66 #include <AIS_ListOfInteractive.hxx>
67 #include <AIS_GraphicTool.hxx>
68 #include <AIS_Drawer.hxx>
69 #include <Aspect_TypeOfFacingModel.hxx>
70 #include <Prs3d_ShadingAspect.hxx>
71 #include<Graphic3d_MaterialAspect.hxx>
74 #include <vtkActorCollection.h>
76 #define OCC_DISPLAY_MODE_TO_STRING( str, dm ) { \
77 if ( dm == AIS_WireFrame ) \
78 str = QString( "Wireframe" ); \
79 else if ( dm == AIS_Shaded ) \
80 str = QString( "Shading" ); \
81 else if ( dm == GEOM_AISShape::ShadingWithEdges ) \
82 str = QString( "ShadingWithEdges" ); \
83 else if ( dm == GEOM_AISShape::TexturedShape ) \
84 str = QString( "Texture" ); \
88 #define USE_VISUAL_PROP_MAP
90 #ifdef USE_VISUAL_PROP_MAP
91 #define VTK_DISPLAY_MODE_TO_STRING( str, dm ) { \
93 str = QString( "Wireframe" ); \
95 str = QString( "Shading" ); \
97 str = QString( "ShadingWithEdges" ); \
101 #define VTK_DISPLAY_MODE_TO_STRING( str, dm ) { \
103 str = QString( "Wireframe" ); \
104 else if ( dm == 1 ) \
105 str = QString( "Shading" ); \
106 else if ( dm == 3 ) \
107 str = QString( "ShadingWithEdges" ); \
112 GEOMGUI_Selection::GEOMGUI_Selection()
113 : LightApp_Selection()
117 GEOMGUI_Selection::~GEOMGUI_Selection()
121 void GEOMGUI_Selection::init( const QString& context, LightApp_SelectionMgr* selMgr )
123 LightApp_Selection::init( context, selMgr );
125 myObjects.resize( count() );
127 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
129 _PTR(Study) study = appStudy->studyDS();
130 for ( int idx = 0; idx < count(); idx++ ) {
131 QString anEntry = entry( idx );
132 if ( study && !anEntry.isEmpty() ) {
133 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
135 CORBA::Object_var varObj = GeometryGUI::ClientSObjectToObject( aSO );
136 myObjects[idx] = GEOM::GEOM_BaseObject::_narrow( varObj );
143 //QVariant GEOMGUI_Selection::contextParameter( const QString& p ) const
144 QVariant GEOMGUI_Selection::parameter( const QString& p ) const
148 v = activeViewType() == OCCViewer_Viewer::Type();
149 else if ( p == "selectionmode" )
151 else if ( p == "hasImported" )
153 else if ( p == "allImported" )
156 v = LightApp_Selection::parameter( p );
160 //QVariant GEOMGUI_Selection::objectParameter( const int idx, const QString& p ) const
161 QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const
166 else if ( p == "typeid" )
168 else if ( p == "displaymode" )
169 v = displayMode( idx );
170 else if ( p == "isAutoColor" )
171 v = isAutoColor( idx );
172 else if ( p == "isVectorsMode" )
173 v = isVectorsMode( idx );
174 else if ( p == "isVerticesMode" )
175 v = isVerticesMode( idx );
176 else if ( p == "topLevel" )
178 else if ( p == "autoBringToFront" )
179 v = autoBringToFront( idx );
180 else if ( p == "hasChildren" )
181 v = hasChildren( idx );
182 else if ( p == "nbChildren" )
184 else if ( p == "hasConcealedChildren" )
185 v = hasConcealedChildren( idx );
186 else if ( p == "hasDisclosedChildren" )
187 v = hasDisclosedChildren( idx );
188 else if ( p == "compoundOfVertices" )
189 v = compoundOfVertices( idx );
190 else if ( p == "imported" )
191 v = isImported( idx );
192 else if ( p == "isPhysicalMaterial" )
193 v = isPhysicalMaterial(idx);
194 else if ( p == "isFolder" )
196 else if ( p == "hasHiddenDimensions" )
197 v = hasHiddenDimensions(idx);
198 else if ( p == "hasVisibleDimensions" )
199 v = hasVisibleDimensions(idx);
201 v = LightApp_Selection::parameter( idx, p );
206 // the method to skip temporary objects from selection (called from LightApp)
207 bool GEOMGUI_Selection::processOwner( const LightApp_DataOwner* theOwner )
209 return !theOwner->entry().contains("_");
212 QString GEOMGUI_Selection::typeName( const int index ) const
214 if ( isComponent( index ) )
216 if ( isFolder( index ) )
219 static QString aGroup( "Group" );
220 static QString aShape( "Shape" );
221 static QString aField( "Field" );
222 static QString aFieldStep( "FieldStep" );
223 static QString anUnknown( "Unknown" );
225 GEOM::GEOM_BaseObject_var anObj = getBaseObject( index );
226 if ( !CORBA::is_nil( anObj ) ) {
227 const int aGeomType = anObj->GetType();
228 switch ( aGeomType ) {
229 case GEOM_GROUP : return aGroup;
230 case GEOM_FIELD : return aField;
231 case GEOM_FIELD_STEP: return aFieldStep;
232 default : return aShape;
238 int GEOMGUI_Selection::typeId( const int index ) const
241 GEOM::GEOM_Object_var anObj = getObject( index );
242 if ( !CORBA::is_nil( anObj ) )
243 aType = (int)anObj->GetShapeType();
247 bool GEOMGUI_Selection::isVisible( const int index ) const
249 #ifdef USE_VISUAL_PROP_MAP
250 QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::Visibility ) );
251 if ( v.canConvert( QVariant::Bool ) )
257 GEOM::GEOM_Object_var obj = getObject( index );
258 SALOME_View* view = GEOM_Displayer::GetActiveView();
259 if ( !CORBA::is_nil( obj ) && view ) {
260 Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( entry( index ).toLatin1().constData(), "GEOM", "TEMP_IO" );
261 res = view->isVisible( io );
267 bool GEOMGUI_Selection::isAutoColor( const int index ) const
269 GEOM::GEOM_Object_var obj = getObject( index );
270 if ( !CORBA::is_nil( obj ) )
271 return obj->GetAutoColor();
275 bool GEOMGUI_Selection::isImported( const int index ) const
277 GEOM::GEOM_Object_var obj = getObject( index );
278 if ( !CORBA::is_nil( obj ) )
279 return obj->GetType() == GEOM_IMPORT;
283 bool GEOMGUI_Selection::hasImported() const
286 for ( int i = 0; i < count() && !res; i++ )
287 res = isImported( i );
291 bool GEOMGUI_Selection::allImported() const
294 for ( int i = 0; i < count() && res; i++ )
295 res = isImported( i );
299 QVariant GEOMGUI_Selection::visibleProperty( const QString& entry, const QString& propName ) const
302 LightApp_Study* aStudy = study();
304 LightApp_Application* anApp = ::qobject_cast<LightApp_Application*>( aStudy->application() );
305 if ( anApp && anApp->activeViewManager() ) {
306 int id = anApp->activeViewManager()->getGlobalId();
307 v = aStudy->getObjectProperty( id, entry, propName, QVariant() );
313 QString GEOMGUI_Selection::displayMode( const int index ) const
316 QString viewType = activeViewType();
318 #ifdef USE_VISUAL_PROP_MAP
319 QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::DisplayMode ) );
320 if ( v.canConvert( QVariant::Int ) ) {
322 if ( viewType == OCCViewer_Viewer::Type() ) {
323 OCC_DISPLAY_MODE_TO_STRING( res, dm );
324 } else if ( viewType == SVTK_Viewer::Type() ) {
325 VTK_DISPLAY_MODE_TO_STRING( res, dm );
331 SALOME_View* view = GEOM_Displayer::GetActiveView();
332 if ( view /*fix for 9320==>*/&& ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
333 SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
335 if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
336 SOCC_Prs* occPrs = (SOCC_Prs*) prs;
337 AIS_ListOfInteractive lst;
338 occPrs->GetObjects( lst );
339 if ( lst.Extent() ) {
340 Handle(AIS_InteractiveObject) io = lst.First();
341 if ( !io.IsNull() ) {
343 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
345 dm = aSh->isTopLevel() ? aSh->prevDisplayMode() : aSh->DisplayMode();
347 dm = io->DisplayMode();
349 OCC_DISPLAY_MODE_TO_STRING( res, dm );
350 if ( res.isEmpty() ) { // return default display mode of AIS_InteractiveContext
351 OCCViewer_Viewer* occViewer = (OCCViewer_Viewer*)SUIT_Session::session()->activeApplication()->
352 desktop()->activeWindow()->getViewManager()->getViewModel();
353 Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
354 dm = ic->DisplayMode();
355 OCC_DISPLAY_MODE_TO_STRING( res, dm );
360 else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
361 SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
362 vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
364 lst->InitTraversal();
365 vtkActor* actor = lst->GetNextActor();
367 SALOME_Actor* salActor = dynamic_cast<SALOME_Actor*>( actor );
369 int dm = salActor->getDisplayMode();
370 VTK_DISPLAY_MODE_TO_STRING( res, dm );
371 } // if ( salome actor )
373 } // if ( lst == vtkPrs->GetObjects() )
381 bool GEOMGUI_Selection::autoBringToFront( const int /*index*/ ) const
383 return SUIT_Session::session()->resourceMgr()->booleanValue( "Geometry", "auto_bring_to_front", "false" );
386 bool GEOMGUI_Selection::isVectorsMode( const int index ) const
388 #ifdef USE_VISUAL_PROP_MAP
389 QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::EdgesDirection ) );
390 if ( v.canConvert( QVariant::Bool ) )
396 SALOME_View* view = GEOM_Displayer::GetActiveView();
397 QString viewType = activeViewType();
398 if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
399 SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
401 if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
402 SOCC_Prs* occPrs = (SOCC_Prs*) prs;
403 AIS_ListOfInteractive lst;
404 occPrs->GetObjects( lst );
405 if ( lst.Extent() ) {
406 Handle(AIS_InteractiveObject) io = lst.First();
407 if ( !io.IsNull() ) {
408 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
410 res = aSh->isShowVectors();
414 else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
415 SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
416 vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
418 lst->InitTraversal();
419 vtkActor* actor = lst->GetNextActor();
421 GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(actor);
423 res = aGeomActor->GetVectorMode();
433 bool GEOMGUI_Selection::isVerticesMode( const int index ) const
435 #ifdef USE_VISUAL_PROP_MAP
436 QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::Vertices ) );
437 if ( v.canConvert( QVariant::Bool ) )
443 SALOME_View* view = GEOM_Displayer::GetActiveView();
444 QString viewType = activeViewType();
445 if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
446 SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
448 if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
449 SOCC_Prs* occPrs = (SOCC_Prs*) prs;
450 AIS_ListOfInteractive lst;
451 occPrs->GetObjects( lst );
452 if ( lst.Extent() ) {
453 Handle(AIS_InteractiveObject) io = lst.First();
454 if ( !io.IsNull() ) {
455 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
457 res = aSh->isShowVertices();
461 else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
462 SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
463 vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
465 lst->InitTraversal();
466 vtkActor* actor = lst->GetNextActor();
468 GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(actor);
470 res = aGeomActor->GetVerticesMode();
480 bool GEOMGUI_Selection::hasChildren( const _PTR(SObject)& obj )
483 // as soon as Use Case browser data tree was added
484 return obj->GetStudy()->GetUseCaseBuilder()->HasChildren( obj );
488 bool GEOMGUI_Selection::expandable( const _PTR(SObject)& obj )
491 _PTR(GenericAttribute) anAttr;
492 if ( obj && obj->FindAttribute( anAttr, "AttributeExpandable" ) ) {
493 _PTR(AttributeExpandable) aAttrExp = anAttr;
494 exp = aAttrExp->IsExpandable();
499 bool GEOMGUI_Selection::isCompoundOfVertices( GEOM::GEOM_Object_ptr obj )
503 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
504 (SUIT_Session::session()->activeApplication()->activeStudy());*/
505 if ( /*appStudy && */!CORBA::is_nil( obj ) )
506 ret = obj->GetShapeType() == GEOM::COMPOUND && obj->GetMaxShapeType() == GEOM::VERTEX;
510 bool GEOMGUI_Selection::isFolder( const _PTR(SObject)& obj )
513 _PTR(GenericAttribute) anAttr;
514 if ( obj && obj->FindAttribute(anAttr, "AttributeLocalID") ) {
515 _PTR(AttributeLocalID) aLocalID( anAttr );
516 ret = aLocalID->Value() == 999;
521 bool GEOMGUI_Selection::hasChildren( const int index ) const
524 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
527 QString anEntry = entry( index );
528 _PTR(Study) study = appStudy->studyDS();
529 if ( study && !anEntry.isEmpty() ) {
530 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
531 ok = hasChildren( aSO );
537 int GEOMGUI_Selection::nbChildren( const int index ) const
540 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
543 QString anEntry = entry( index );
544 _PTR(Study) study = appStudy->studyDS();
545 if ( study && !anEntry.isEmpty() ) {
546 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
547 if ( aSO && aSO->GetStudy()->GetUseCaseBuilder()->IsUseCaseNode(aSO) ) {
548 _PTR(UseCaseIterator) it = aSO->GetStudy()->GetUseCaseBuilder()->GetUseCaseIterator( aSO );
549 for (it->Init(false); it->More(); it->Next()) nb++;
556 bool GEOMGUI_Selection::hasConcealedChildren( const int index ) const
559 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
562 QString anEntry = entry( index );
563 _PTR(Study) study = appStudy->studyDS();
564 if ( study && !anEntry.isEmpty() ) {
565 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
566 OK = !expandable( aSO ) && hasChildren( aSO );
572 bool GEOMGUI_Selection::hasDisclosedChildren( const int index ) const
575 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
578 QString anEntry = entry( index );
579 _PTR(Study) study = appStudy->studyDS();
580 if ( study && !anEntry.isEmpty() ) {
581 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
582 OK = expandable( aSO ) && hasChildren( aSO );
588 bool GEOMGUI_Selection::compoundOfVertices( const int index ) const
590 GEOM::GEOM_Object_var obj = getObject( index );
591 return isCompoundOfVertices( obj );
594 bool GEOMGUI_Selection::isComponent( const int index ) const
596 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
599 QString anEntry = entry( index );
600 _PTR(Study) study = appStudy->studyDS();
601 if ( study && !anEntry.isNull() ) {
602 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
603 if ( aSO && aSO->GetFatherComponent() )
604 return aSO->GetFatherComponent()->GetIOR() == aSO->GetIOR();
610 GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const
612 GEOM::GEOM_Object_var o;
613 if ( 0 <= index && index < myObjects.size() )
614 o = GEOM::GEOM_Object::_narrow( myObjects[index] );
618 GEOM::GEOM_BaseObject_ptr GEOMGUI_Selection::getBaseObject( const int index ) const
620 GEOM::GEOM_BaseObject_var o;
621 if ( 0 <= index && index < myObjects.size() )
622 o = GEOM::GEOM_BaseObject::_duplicate( myObjects[index] );
626 QString GEOMGUI_Selection::selectionMode() const
628 SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( study()->application() );
630 GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
632 switch ( aGeomGUI->getLocalSelectionMode() )
634 case GEOM_POINT : return "VERTEX";
635 case GEOM_EDGE : return "EDGE";
636 case GEOM_WIRE : return "WIRE";
637 case GEOM_FACE : return "FACE";
638 case GEOM_SHELL : return "SHELL";
639 case GEOM_SOLID : return "SOLID";
640 case GEOM_COMPOUND : return "COMPOUND";
641 case GEOM_ALLOBJECTS : return "ALL";
649 bool GEOMGUI_Selection::topLevel( const int index ) const
651 #ifdef USE_VISUAL_PROP_MAP
652 QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::TopLevel ) );
653 if ( v.canConvert<bool>() )
659 SALOME_View* view = GEOM_Displayer::GetActiveView();
660 QString viewType = activeViewType();
661 if ( view && viewType == OCCViewer_Viewer::Type() ) {
662 SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
664 if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
665 SOCC_Prs* occPrs = (SOCC_Prs*) prs;
666 AIS_ListOfInteractive lst;
667 occPrs->GetObjects( lst );
668 if ( lst.Extent() ) {
669 Handle(AIS_InteractiveObject) io = lst.First();
670 if ( !io.IsNull() ) {
671 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
673 res = (bool)aSh->isTopLevel();
682 bool GEOMGUI_Selection::isPhysicalMaterial( const int idx ) const
684 #ifdef USE_VISUAL_PROP_MAP
685 QVariant v = visibleProperty( entry( idx ), GEOM::propertyName( GEOM::Material ) );
686 if ( v.canConvert<QString>() ) {
687 Material_Model material;
688 material.fromProperties( v.toString() );
689 return material.isPhysical();
695 SALOME_View* view = GEOM_Displayer::GetActiveView();
696 QString viewType = activeViewType();
698 SALOME_Prs* prs = view->CreatePrs( entry( idx ).toLatin1().constData() );
700 if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
701 SOCC_Prs* occPrs = (SOCC_Prs*) prs;
702 AIS_ListOfInteractive lst;
703 occPrs->GetObjects( lst );
704 if ( lst.Extent() ) {
705 Handle(AIS_InteractiveObject) io = lst.First();
706 if ( !io.IsNull() ) {
707 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
709 res = (bool) aSh->Attributes()->ShadingAspect()->
710 Material(Aspect_TOFM_BOTH_SIDE).MaterialType( Graphic3d_MATERIAL_PHYSIC );
714 else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
715 SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
716 vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
718 lst->InitTraversal();
719 vtkActor* actor = lst->GetNextActor();
721 GEOM_Actor* aGeomGActor = GEOM_Actor::SafeDownCast( actor );
723 GEOM_VTKPropertyMaterial* mat = GEOM_VTKPropertyMaterial::SafeDownCast(aGeomGActor->GetProperty());
725 res = mat->GetPhysical();
726 } // if ( salome actor )
728 } // if ( lst == vtkPrs->GetObjects() )
736 bool GEOMGUI_Selection::isFolder( const int index ) const
739 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
742 QString anEntry = entry( index );
743 _PTR(Study) study = appStudy->studyDS();
744 if ( study && !anEntry.isNull() ) {
745 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
746 if ( aSO ) res = isFolder( aSO );
752 bool GEOMGUI_Selection::hasDimensions( const int theIndex, bool& theHidden, bool& theVisible ) const
754 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
761 QString anEntry = entry( theIndex );
762 _PTR(Study) aStudy = appStudy->studyDS();
763 if ( !aStudy || anEntry.isNull() )
768 GEOMGUI_DimensionProperty aDimensions( appStudy, anEntry.toStdString() );
773 for ( int it = 0; it < aDimensions.GetNumber(); ++it )
775 if ( aDimensions.IsVisible( it ) )
781 return aDimensions.GetNumber() > 0;
784 bool GEOMGUI_Selection::hasHiddenDimensions( const int theIndex ) const
786 bool isAnyVisible = false;
787 bool isAnyHidden = false;
788 if ( !hasDimensions( theIndex, isAnyHidden, isAnyVisible ) )
796 bool GEOMGUI_Selection::hasVisibleDimensions( const int theIndex ) const
798 bool isAnyVisible = false;
799 bool isAnyHidden = false;
800 if ( !hasDimensions( theIndex, isAnyHidden, isAnyVisible ) )