1 // Copyright (C) 2007-2015 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 <Aspect_TypeOfFacingModel.hxx>
69 #include <Prs3d_ShadingAspect.hxx>
70 #include<Graphic3d_MaterialAspect.hxx>
73 #include <vtkActorCollection.h>
75 #define OCC_DISPLAY_MODE_TO_STRING( str, dm ) { \
76 if ( dm == AIS_WireFrame ) \
77 str = QString( "Wireframe" ); \
78 else if ( dm == AIS_Shaded ) \
79 str = QString( "Shading" ); \
80 else if ( dm == GEOM_AISShape::ShadingWithEdges ) \
81 str = QString( "ShadingWithEdges" ); \
82 else if ( dm == GEOM_AISShape::TexturedShape ) \
83 str = QString( "Texture" ); \
87 #define USE_VISUAL_PROP_MAP
89 #ifdef USE_VISUAL_PROP_MAP
90 #define VTK_DISPLAY_MODE_TO_STRING( str, dm ) { \
92 str = QString( "Wireframe" ); \
94 str = QString( "Shading" ); \
96 str = QString( "ShadingWithEdges" ); \
100 #define VTK_DISPLAY_MODE_TO_STRING( str, dm ) { \
102 str = QString( "Wireframe" ); \
103 else if ( dm == 1 ) \
104 str = QString( "Shading" ); \
105 else if ( dm == 3 ) \
106 str = QString( "ShadingWithEdges" ); \
111 GEOMGUI_Selection::GEOMGUI_Selection()
112 : LightApp_Selection()
116 GEOMGUI_Selection::~GEOMGUI_Selection()
120 void GEOMGUI_Selection::init( const QString& context, LightApp_SelectionMgr* selMgr )
122 LightApp_Selection::init( context, selMgr );
124 myObjects.resize( count() );
126 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
128 _PTR(Study) study = appStudy->studyDS();
129 for ( int idx = 0; idx < count(); idx++ ) {
130 QString anEntry = entry( idx );
131 if ( study && !anEntry.isEmpty() ) {
132 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
134 CORBA::Object_var varObj = GeometryGUI::ClientSObjectToObject( aSO );
135 myObjects[idx] = GEOM::GEOM_BaseObject::_narrow( varObj );
142 //QVariant GEOMGUI_Selection::contextParameter( const QString& p ) const
143 QVariant GEOMGUI_Selection::parameter( const QString& p ) const
147 v = activeViewType() == OCCViewer_Viewer::Type();
148 else if ( p == "selectionmode" )
150 else if ( p == "hasImported" )
152 else if ( p == "allImported" )
155 v = LightApp_Selection::parameter( p );
159 //QVariant GEOMGUI_Selection::objectParameter( const int idx, const QString& p ) const
160 QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const
165 else if ( p == "typeid" )
167 else if ( p == "displaymode" )
168 v = displayMode( idx );
169 else if ( p == "isAutoColor" )
170 v = isAutoColor( idx );
171 else if ( p == "isVectorsMode" )
172 v = isVectorsMode( idx );
173 else if ( p == "isVerticesMode" )
174 v = isVerticesMode( idx );
175 else if ( p == "topLevel" )
177 else if ( p == "autoBringToFront" )
178 v = autoBringToFront( idx );
179 else if ( p == "hasChildren" )
180 v = hasChildren( idx );
181 else if ( p == "nbChildren" )
183 else if ( p == "hasConcealedChildren" )
184 v = hasConcealedChildren( idx );
185 else if ( p == "hasDisclosedChildren" )
186 v = hasDisclosedChildren( idx );
187 else if ( p == "compoundOfVertices" )
188 v = compoundOfVertices( idx );
189 else if ( p == "imported" )
190 v = isImported( idx );
191 else if ( p == "isPhysicalMaterial" )
192 v = isPhysicalMaterial(idx);
193 else if ( p == "isFolder" )
195 else if ( p == "hasHiddenDimensions" )
196 v = hasHiddenDimensions(idx);
197 else if ( p == "hasVisibleDimensions" )
198 v = hasVisibleDimensions(idx);
200 v = LightApp_Selection::parameter( idx, p );
205 // the method to skip temporary objects from selection (called from LightApp)
206 bool GEOMGUI_Selection::processOwner( const LightApp_DataOwner* theOwner )
208 return !theOwner->entry().contains("_");
211 QString GEOMGUI_Selection::typeName( const int index ) const
213 if ( isComponent( index ) )
215 if ( isFolder( index ) )
218 static QString aGroup( "Group" );
219 static QString aShape( "Shape" );
220 static QString aField( "Field" );
221 static QString aFieldStep( "FieldStep" );
222 static QString anUnknown( "Unknown" );
224 GEOM::GEOM_BaseObject_var anObj = getBaseObject( index );
225 if ( !CORBA::is_nil( anObj ) ) {
226 const int aGeomType = anObj->GetType();
227 switch ( aGeomType ) {
228 case GEOM_GROUP : return aGroup;
229 case GEOM_FIELD : return aField;
230 case GEOM_FIELD_STEP: return aFieldStep;
231 default : return aShape;
237 int GEOMGUI_Selection::typeId( const int index ) const
240 GEOM::GEOM_Object_var anObj = getObject( index );
241 if ( !CORBA::is_nil( anObj ) )
242 aType = (int)anObj->GetShapeType();
246 bool GEOMGUI_Selection::isVisible( const int index ) const
248 #ifdef USE_VISUAL_PROP_MAP
249 QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::Visibility ) );
250 if ( v.canConvert( QVariant::Bool ) )
256 GEOM::GEOM_Object_var obj = getObject( index );
257 SALOME_View* view = GEOM_Displayer::GetActiveView();
258 if ( !CORBA::is_nil( obj ) && view ) {
259 Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( entry( index ).toLatin1().constData(), "GEOM", "TEMP_IO" );
260 res = view->isVisible( io );
266 bool GEOMGUI_Selection::isAutoColor( const int index ) const
268 GEOM::GEOM_Object_var obj = getObject( index );
269 if ( !CORBA::is_nil( obj ) )
270 return obj->GetAutoColor();
274 bool GEOMGUI_Selection::isImported( const int index ) const
276 GEOM::GEOM_Object_var obj = getObject( index );
277 if ( !CORBA::is_nil( obj ) )
278 return obj->GetType() == GEOM_IMPORT;
282 bool GEOMGUI_Selection::hasImported() const
285 for ( int i = 0; i < count() && !res; i++ )
286 res = isImported( i );
290 bool GEOMGUI_Selection::allImported() const
293 for ( int i = 0; i < count() && res; i++ )
294 res = isImported( i );
298 QVariant GEOMGUI_Selection::visibleProperty( const QString& entry, const QString& propName ) const
301 LightApp_Study* aStudy = study();
303 LightApp_Application* anApp = ::qobject_cast<LightApp_Application*>( aStudy->application() );
304 if ( anApp && anApp->activeViewManager() ) {
305 int id = anApp->activeViewManager()->getGlobalId();
306 v = aStudy->getObjectProperty( id, entry, propName, QVariant() );
312 QString GEOMGUI_Selection::displayMode( const int index ) const
315 QString viewType = activeViewType();
317 #ifdef USE_VISUAL_PROP_MAP
318 QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::DisplayMode ) );
319 if ( v.canConvert( QVariant::Int ) ) {
321 if ( viewType == OCCViewer_Viewer::Type() ) {
322 OCC_DISPLAY_MODE_TO_STRING( res, dm );
323 } else if ( viewType == SVTK_Viewer::Type() ) {
324 VTK_DISPLAY_MODE_TO_STRING( res, dm );
330 SALOME_View* view = GEOM_Displayer::GetActiveView();
331 if ( view /*fix for 9320==>*/&& ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
332 SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
334 if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
335 SOCC_Prs* occPrs = (SOCC_Prs*) prs;
336 AIS_ListOfInteractive lst;
337 occPrs->GetObjects( lst );
338 if ( lst.Extent() ) {
339 Handle(AIS_InteractiveObject) io = lst.First();
340 if ( !io.IsNull() ) {
342 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
344 dm = aSh->isTopLevel() ? aSh->prevDisplayMode() : aSh->DisplayMode();
346 dm = io->DisplayMode();
348 OCC_DISPLAY_MODE_TO_STRING( res, dm );
349 if ( res.isEmpty() ) { // return default display mode of AIS_InteractiveContext
350 OCCViewer_Viewer* occViewer = (OCCViewer_Viewer*)SUIT_Session::session()->activeApplication()->
351 desktop()->activeWindow()->getViewManager()->getViewModel();
352 Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
353 dm = ic->DisplayMode();
354 OCC_DISPLAY_MODE_TO_STRING( res, dm );
359 else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
360 SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
361 vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
363 lst->InitTraversal();
364 vtkActor* actor = lst->GetNextActor();
366 SALOME_Actor* salActor = dynamic_cast<SALOME_Actor*>( actor );
368 int dm = salActor->getDisplayMode();
369 VTK_DISPLAY_MODE_TO_STRING( res, dm );
370 } // if ( salome actor )
372 } // if ( lst == vtkPrs->GetObjects() )
380 bool GEOMGUI_Selection::autoBringToFront( const int /*index*/ ) const
382 return SUIT_Session::session()->resourceMgr()->booleanValue( "Geometry", "auto_bring_to_front", "false" );
385 bool GEOMGUI_Selection::isVectorsMode( const int index ) const
387 #ifdef USE_VISUAL_PROP_MAP
388 QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::EdgesDirection ) );
389 if ( v.canConvert( QVariant::Bool ) )
395 SALOME_View* view = GEOM_Displayer::GetActiveView();
396 QString viewType = activeViewType();
397 if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
398 SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
400 if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
401 SOCC_Prs* occPrs = (SOCC_Prs*) prs;
402 AIS_ListOfInteractive lst;
403 occPrs->GetObjects( lst );
404 if ( lst.Extent() ) {
405 Handle(AIS_InteractiveObject) io = lst.First();
406 if ( !io.IsNull() ) {
407 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
409 res = aSh->isShowVectors();
413 else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
414 SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
415 vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
417 lst->InitTraversal();
418 vtkActor* actor = lst->GetNextActor();
420 GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(actor);
422 res = aGeomActor->GetVectorMode();
432 bool GEOMGUI_Selection::isVerticesMode( const int index ) const
434 #ifdef USE_VISUAL_PROP_MAP
435 QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::Vertices ) );
436 if ( v.canConvert( QVariant::Bool ) )
442 SALOME_View* view = GEOM_Displayer::GetActiveView();
443 QString viewType = activeViewType();
444 if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
445 SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
447 if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
448 SOCC_Prs* occPrs = (SOCC_Prs*) prs;
449 AIS_ListOfInteractive lst;
450 occPrs->GetObjects( lst );
451 if ( lst.Extent() ) {
452 Handle(AIS_InteractiveObject) io = lst.First();
453 if ( !io.IsNull() ) {
454 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
456 res = aSh->isShowVertices();
460 else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
461 SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
462 vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
464 lst->InitTraversal();
465 vtkActor* actor = lst->GetNextActor();
467 GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(actor);
469 res = aGeomActor->GetVerticesMode();
479 bool GEOMGUI_Selection::hasChildren( const _PTR(SObject)& obj )
482 // as soon as Use Case browser data tree was added
483 return obj->GetStudy()->GetUseCaseBuilder()->HasChildren( obj );
487 bool GEOMGUI_Selection::expandable( const _PTR(SObject)& obj )
490 _PTR(GenericAttribute) anAttr;
491 if ( obj && obj->FindAttribute( anAttr, "AttributeExpandable" ) ) {
492 _PTR(AttributeExpandable) aAttrExp = anAttr;
493 exp = aAttrExp->IsExpandable();
498 bool GEOMGUI_Selection::isCompoundOfVertices( GEOM::GEOM_Object_ptr obj )
502 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
503 (SUIT_Session::session()->activeApplication()->activeStudy());*/
504 if ( /*appStudy && */!CORBA::is_nil( obj ) )
505 ret = obj->GetShapeType() == GEOM::COMPOUND && obj->GetMaxShapeType() == GEOM::VERTEX;
509 bool GEOMGUI_Selection::isFolder( const _PTR(SObject)& obj )
512 _PTR(GenericAttribute) anAttr;
513 if ( obj && obj->FindAttribute(anAttr, "AttributeLocalID") ) {
514 _PTR(AttributeLocalID) aLocalID( anAttr );
515 ret = aLocalID->Value() == 999;
520 bool GEOMGUI_Selection::hasChildren( const int index ) const
523 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
526 QString anEntry = entry( index );
527 _PTR(Study) study = appStudy->studyDS();
528 if ( study && !anEntry.isEmpty() ) {
529 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
530 ok = hasChildren( aSO );
536 int GEOMGUI_Selection::nbChildren( const int index ) const
539 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
542 QString anEntry = entry( index );
543 _PTR(Study) study = appStudy->studyDS();
544 if ( study && !anEntry.isEmpty() ) {
545 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
546 if ( aSO && aSO->GetStudy()->GetUseCaseBuilder()->IsUseCaseNode(aSO) ) {
547 _PTR(UseCaseIterator) it = aSO->GetStudy()->GetUseCaseBuilder()->GetUseCaseIterator( aSO );
548 for (it->Init(false); it->More(); it->Next()) nb++;
555 bool GEOMGUI_Selection::hasConcealedChildren( const int index ) const
558 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
561 QString anEntry = entry( index );
562 _PTR(Study) study = appStudy->studyDS();
563 if ( study && !anEntry.isEmpty() ) {
564 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
565 OK = !expandable( aSO ) && hasChildren( aSO );
571 bool GEOMGUI_Selection::hasDisclosedChildren( const int index ) const
574 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
577 QString anEntry = entry( index );
578 _PTR(Study) study = appStudy->studyDS();
579 if ( study && !anEntry.isEmpty() ) {
580 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
581 OK = expandable( aSO ) && hasChildren( aSO );
587 bool GEOMGUI_Selection::compoundOfVertices( const int index ) const
589 GEOM::GEOM_Object_var obj = getObject( index );
590 return isCompoundOfVertices( obj );
593 bool GEOMGUI_Selection::isComponent( const int index ) const
595 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
598 QString anEntry = entry( index );
599 _PTR(Study) study = appStudy->studyDS();
600 if ( study && !anEntry.isNull() ) {
601 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
602 if ( aSO && aSO->GetFatherComponent() )
603 return aSO->GetFatherComponent()->GetIOR() == aSO->GetIOR();
609 GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const
611 GEOM::GEOM_Object_var o;
612 if ( 0 <= index && index < myObjects.size() )
613 o = GEOM::GEOM_Object::_narrow( myObjects[index] );
617 GEOM::GEOM_BaseObject_ptr GEOMGUI_Selection::getBaseObject( const int index ) const
619 GEOM::GEOM_BaseObject_var o;
620 if ( 0 <= index && index < myObjects.size() )
621 o = GEOM::GEOM_BaseObject::_duplicate( myObjects[index] );
625 QString GEOMGUI_Selection::selectionMode() const
627 SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( study()->application() );
629 GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
631 switch ( aGeomGUI->getLocalSelectionMode() )
633 case GEOM_POINT : return "VERTEX";
634 case GEOM_EDGE : return "EDGE";
635 case GEOM_WIRE : return "WIRE";
636 case GEOM_FACE : return "FACE";
637 case GEOM_SHELL : return "SHELL";
638 case GEOM_SOLID : return "SOLID";
639 case GEOM_COMPOUND : return "COMPOUND";
640 case GEOM_ALLOBJECTS : return "ALL";
648 bool GEOMGUI_Selection::topLevel( const int index ) const
650 #ifdef USE_VISUAL_PROP_MAP
651 QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::TopLevel ) );
652 if ( v.canConvert<bool>() )
658 SALOME_View* view = GEOM_Displayer::GetActiveView();
659 QString viewType = activeViewType();
660 if ( view && viewType == OCCViewer_Viewer::Type() ) {
661 SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
663 if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
664 SOCC_Prs* occPrs = (SOCC_Prs*) prs;
665 AIS_ListOfInteractive lst;
666 occPrs->GetObjects( lst );
667 if ( lst.Extent() ) {
668 Handle(AIS_InteractiveObject) io = lst.First();
669 if ( !io.IsNull() ) {
670 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
672 res = (bool)aSh->isTopLevel();
681 bool GEOMGUI_Selection::isPhysicalMaterial( const int idx ) const
683 #ifdef USE_VISUAL_PROP_MAP
684 QVariant v = visibleProperty( entry( idx ), GEOM::propertyName( GEOM::Material ) );
685 if ( v.canConvert<QString>() ) {
686 Material_Model material;
687 material.fromProperties( v.toString() );
688 return material.isPhysical();
694 SALOME_View* view = GEOM_Displayer::GetActiveView();
695 QString viewType = activeViewType();
697 SALOME_Prs* prs = view->CreatePrs( entry( idx ).toLatin1().constData() );
699 if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
700 SOCC_Prs* occPrs = (SOCC_Prs*) prs;
701 AIS_ListOfInteractive lst;
702 occPrs->GetObjects( lst );
703 if ( lst.Extent() ) {
704 Handle(AIS_InteractiveObject) io = lst.First();
705 if ( !io.IsNull() ) {
706 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
708 res = (bool) aSh->Attributes()->ShadingAspect()->
709 Material(Aspect_TOFM_BOTH_SIDE).MaterialType( Graphic3d_MATERIAL_PHYSIC );
713 else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
714 SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
715 vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
717 lst->InitTraversal();
718 vtkActor* actor = lst->GetNextActor();
720 GEOM_Actor* aGeomGActor = GEOM_Actor::SafeDownCast( actor );
722 GEOM_VTKPropertyMaterial* mat = GEOM_VTKPropertyMaterial::SafeDownCast(aGeomGActor->GetProperty());
724 res = mat->GetPhysical();
725 } // if ( salome actor )
727 } // if ( lst == vtkPrs->GetObjects() )
735 bool GEOMGUI_Selection::isFolder( const int index ) const
738 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
741 QString anEntry = entry( index );
742 _PTR(Study) study = appStudy->studyDS();
743 if ( study && !anEntry.isNull() ) {
744 _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
745 if ( aSO ) res = isFolder( aSO );
751 bool GEOMGUI_Selection::hasDimensions( const int theIndex, bool& theHidden, bool& theVisible ) const
753 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
760 QString anEntry = entry( theIndex );
761 _PTR(Study) aStudy = appStudy->studyDS();
762 if ( !aStudy || anEntry.isNull() )
767 GEOMGUI_DimensionProperty aDimensions( appStudy, anEntry.toStdString() );
772 for ( int it = 0; it < aDimensions.GetNumber(); ++it )
774 if ( aDimensions.IsVisible( it ) )
780 return aDimensions.GetNumber() > 0;
783 bool GEOMGUI_Selection::hasHiddenDimensions( const int theIndex ) const
785 bool isAnyVisible = false;
786 bool isAnyHidden = false;
787 if ( !hasDimensions( theIndex, isAnyHidden, isAnyVisible ) )
795 bool GEOMGUI_Selection::hasVisibleDimensions( const int theIndex ) const
797 bool isAnyVisible = false;
798 bool isAnyHidden = false;
799 if ( !hasDimensions( theIndex, isAnyHidden, isAnyVisible ) )