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 // SMESH SMESHGUI_Selection
24 // File : SMESHGUI_Selection.cxx
25 // Author : Alexander SOLOVYOV, Open CASCADE S.A.S.
29 #include "SMESHGUI_Selection.h"
31 #include "SMESHGUI_Utils.h"
32 #include "SMESHGUI_VTKUtils.h"
33 #include "SMESHGUI_GEOMGenUtils.h"
34 #include "SMESHGUI_ComputeDlg.h"
36 #include <SMESH_Type.h>
37 #include <SMESH_Actor.h>
38 #include <SMESH_ScalarBarActor.h>
40 // SALOME GUI includes
41 #include <SalomeApp_Study.h>
42 #include <LightApp_VTKSelector.h>
43 #include <SVTK_ViewWindow.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)
51 //=======================================================================
52 //function : SMESHGUI_Selection
54 //=======================================================================
55 SMESHGUI_Selection::SMESHGUI_Selection()
56 : LightApp_Selection()
60 //=======================================================================
61 //function : ~SMESHGUI_Selection
63 //=======================================================================
64 SMESHGUI_Selection::~SMESHGUI_Selection()
68 //=======================================================================
71 //=======================================================================
72 void SMESHGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr )
74 LightApp_Selection::init( client, mgr );
78 SalomeApp_Study* aSStudy = dynamic_cast<SalomeApp_Study*>(study());
81 _PTR(Study) aStudy = aSStudy->studyDS();
83 for( int i=0, n=count(); i<n; i++ ) {
84 myTypes.append( typeName( type( entry( i ), aStudy ) ) );
85 myControls.append( controlMode( i ) );
90 //=======================================================================
91 //function : processOwner
93 //=======================================================================
94 bool SMESHGUI_Selection::processOwner( const LightApp_DataOwner* ow )
96 const LightApp_SVTKDataOwner* owner =
97 dynamic_cast<const LightApp_SVTKDataOwner*> ( ow );
99 myActors.append( dynamic_cast<SMESH_Actor*>( owner->GetActor() ) );
101 else if ( ow ) { // SVTK selection disabled
102 QString entry = ow->entry();
103 myActors.append( SMESH::FindActorByEntry( entry.toStdString().c_str() ));
106 myActors.append( 0 );
111 //=======================================================================
112 //function : parameter
114 //=======================================================================
115 QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
118 if ( p=="client" ) val = QVariant( LightApp_Selection::parameter( p ) );
119 else if ( p=="type" ) val = QVariant( myTypes[ind] );
120 else if ( p=="elemTypes" ) val = QVariant( elemTypes( ind ) );
121 else if ( p=="isAutoColor" ) val = QVariant( isAutoColor( ind ) );
122 else if ( p=="numberOfNodes" ) val = QVariant( numberOfNodes( ind ) );
123 else if ( p=="dim" ) val = QVariant( dim( ind ) );
124 else if ( p=="labeledTypes" ) val = QVariant( labeledTypes( ind ) );
125 else if ( p=="shrinkMode" ) val = QVariant( shrinkMode( ind ) );
126 else if ( p=="entityMode" ) val = QVariant( entityMode( ind ) );
127 else if ( p=="isNumFunctor" ) val = QVariant( isNumFunctor( ind ) );
128 else if ( p=="displayMode" ) val = QVariant( displayMode( ind ) );
129 else if ( p=="isComputable" ) val = QVariant( isComputable( ind ) );
130 else if ( p=="isPreComputable" ) val = QVariant( isPreComputable( ind ) );
131 else if ( p=="hasReference" ) val = QVariant( hasReference( ind ) );
132 else if ( p=="isImported" ) val = QVariant( isImported( ind ) );
133 else if ( p=="facesOrientationMode" ) val = QVariant( facesOrientationMode( ind ) );
134 else if ( p=="groupType" ) val = QVariant( groupType( ind ) );
135 else if ( p=="quadratic2DMode") val = QVariant( quadratic2DMode( ind ) );
136 else if ( p=="isDistributionVisible") val = QVariant( isDistributionVisible( ind ) );
137 else if ( p=="isScalarBarVisible") val = QVariant( isScalarBarVisible( ind ) );
138 else if ( p=="hasChildren") val = QVariant( hasChildren( ind ) );
139 else if ( p=="nbChildren") val = QVariant( nbChildren( ind ) );
140 else if ( p=="isContainer") val = QVariant( isContainer( ind ) );
145 return LightApp_Selection::parameter( ind, p );
148 //=======================================================================
149 //function : parameter
151 //=======================================================================
152 QVariant SMESHGUI_Selection::parameter( const QString& p ) const
155 if ( p=="controlMode" ) val = QVariant( controlMode() );
160 return LightApp_Selection::parameter( p );
163 //=======================================================================
164 //function : getVtkOwner
166 //=======================================================================
168 SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const
170 if( ind >= 0 && ind < count() )
171 return myActors.isEmpty() ? 0 : myActors.at( ind );
176 //=======================================================================
177 //function : elemTypes
178 //purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume' 'BallElem'} at most
179 //=======================================================================
181 QList<QVariant> SMESHGUI_Selection::elemTypes( int ind ) const
183 QList<QVariant> types;
184 SMESH_Actor* actor = getActor( ind );
186 TVisualObjPtr object = actor->GetObject();
188 if ( object->GetNbEntities( SMDSAbs_0DElement )) types.append( "Elem0d" );
189 if ( object->GetNbEntities( SMDSAbs_Ball )) types.append( "BallElem" );
190 if ( object->GetNbEntities( SMDSAbs_Edge )) types.append( "Edge" );
191 if ( object->GetNbEntities( SMDSAbs_Face )) types.append( "Face" );
192 if ( object->GetNbEntities( SMDSAbs_Volume )) types.append( "Volume" );
198 //=======================================================================
199 //function : labeledTypes
200 //purpose : may return {'Point' 'Cell'} at most
201 //=======================================================================
203 QList<QVariant> SMESHGUI_Selection::labeledTypes( int ind ) const
205 QList<QVariant> types;
206 SMESH_Actor* actor = getActor( ind );
208 if ( actor->GetPointsLabeled()) types.append( "Point" );
209 if ( actor->GetCellsLabeled()) types.append( "Cell" );
214 //=======================================================================
215 //function : displayMode
216 //purpose : return SMESH_Actor::EReperesent
217 //=======================================================================
219 QString SMESHGUI_Selection::displayMode( int ind ) const
221 SMESH_Actor* actor = getActor( ind );
223 switch( actor->GetRepresentation() ) {
224 case SMESH_Actor::eEdge: return "eEdge";
225 case SMESH_Actor::eSurface: return "eSurface";
226 case SMESH_Actor::ePoint: return "ePoint";
234 //=======================================================================
235 //function : quadratic2DMode
236 //purpose : return SMESH_Actor::EQuadratic2DRepresentation
237 //=======================================================================
238 QString SMESHGUI_Selection::quadratic2DMode( int ind ) const
240 SMESH_Actor* actor = getActor( ind );
242 switch( actor->GetQuadratic2DRepresentation() ) {
243 case SMESH_Actor::eLines: return "eLines";
244 case SMESH_Actor::eArcs: return "eArcs";
251 //=======================================================================
252 //function : isDistributionVisible
253 //purpose : Visible/Invisible distribution of the ScalarBar Actor
254 //=======================================================================
256 bool SMESHGUI_Selection::isDistributionVisible(int ind) const {
257 SMESH_Actor* actor = getActor( ind );
258 return (actor && actor->GetScalarBarActor() && actor->GetScalarBarActor()->GetDistributionVisibility());
261 //=======================================================================
262 //function : isScalarBarVisible
263 //purpose : Visible/Invisible Scalar Bar
264 //=======================================================================
266 bool SMESHGUI_Selection::isScalarBarVisible(int ind) const {
267 SMESH_Actor* actor = getActor( ind );
268 return (actor && actor->GetScalarBarActor() && actor->GetScalarBarActor()->GetVisibility());
271 //=======================================================================
272 //function : shrinkMode
273 //purpose : return either 'IsSrunk', 'IsNotShrunk' or 'IsNotShrinkable'
274 //=======================================================================
276 QString SMESHGUI_Selection::shrinkMode( int ind ) const
278 SMESH_Actor* actor = getActor( ind );
279 if ( actor && actor->IsShrunkable() ) {
280 return actor->IsShrunk() ? "IsShrunk" : "IsNotShrunk";
282 return "IsNotShrinkable";
285 //=======================================================================
286 //function : entityMode
287 //purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume' 'BallElem' } at most
288 //=======================================================================
290 QList<QVariant> SMESHGUI_Selection::entityMode( int ind ) const
292 QList<QVariant> types;
293 SMESH_Actor* actor = getActor( ind );
295 unsigned int aMode = actor->GetEntityMode();
296 if ( aMode & SMESH_Actor::eVolumes ) types.append( "Volume" );
297 if ( aMode & SMESH_Actor::eFaces ) types.append( "Face" );
298 if ( aMode & SMESH_Actor::eEdges ) types.append( "Edge" );
299 if ( aMode & SMESH_Actor::e0DElements ) types.append( "Elem0d" );
300 if ( aMode & SMESH_Actor::eBallElem ) types.append( "BallElem" );
305 //=======================================================================
306 //function : controlMode
307 //purpose : return SMESH_Actor::eControl
308 //=======================================================================
310 QString SMESHGUI_Selection::controlMode( int ind ) const
312 SMESH_Actor* actor = getActor( ind );
313 QString mode = "eNone";
315 switch( actor->GetControlMode() ) {
316 case SMESH_Actor::eLength: mode = "eLength"; break;
317 case SMESH_Actor::eLength2D: mode = "eLength2D"; break;
318 case SMESH_Actor::eFreeEdges: mode = "eFreeEdges"; break;
319 case SMESH_Actor::eFreeNodes: mode = "eFreeNodes"; break;
320 case SMESH_Actor::eFreeBorders: mode = "eFreeBorders"; break;
321 case SMESH_Actor::eFreeFaces: mode = "eFreeFaces"; break;
322 case SMESH_Actor::eMultiConnection: mode = "eMultiConnection"; break;
323 case SMESH_Actor::eMultiConnection2D: mode = "eMultiConnection2D"; break;
324 case SMESH_Actor::eArea: mode = "eArea"; break;
325 case SMESH_Actor::eVolume3D: mode = "eVolume3D"; break;
326 case SMESH_Actor::eMaxElementLength2D: mode = "eMaxElementLength2D"; break;
327 case SMESH_Actor::eMaxElementLength3D: mode = "eMaxElementLength3D"; break;
328 case SMESH_Actor::eTaper: mode = "eTaper"; break;
329 case SMESH_Actor::eAspectRatio: mode = "eAspectRatio"; break;
330 case SMESH_Actor::eAspectRatio3D: mode = "eAspectRatio3D"; break;
331 case SMESH_Actor::eMinimumAngle: mode = "eMinimumAngle"; break;
332 case SMESH_Actor::eWarping: mode = "eWarping"; break;
333 case SMESH_Actor::eSkew: mode = "eSkew"; break;
334 case SMESH_Actor::eBareBorderFace: mode = "eBareBorderFace"; break;
335 case SMESH_Actor::eBareBorderVolume: mode = "eBareBorderVolume"; break;
336 case SMESH_Actor::eOverConstrainedFace: mode = "eOverConstrainedFace"; break;
337 case SMESH_Actor::eOverConstrainedVolume: mode = "eOverConstrainedVolume"; break;
338 case SMESH_Actor::eCoincidentNodes: mode = "eCoincidentNodes"; break;
339 case SMESH_Actor::eCoincidentElems1D: mode = "eCoincidentElems1D"; break;
340 case SMESH_Actor::eCoincidentElems2D: mode = "eCoincidentElems2D"; break;
341 case SMESH_Actor::eCoincidentElems3D: mode = "eCoincidentElems3D"; break;
348 //=======================================================================
349 //function : controlMode
350 //purpose : gets global control mode; return SMESH_Actor::eControl
351 //=======================================================================
352 QString SMESHGUI_Selection::controlMode() const
354 if( myControls.count() > 0 ) {
355 QString mode = myControls[0];
356 for( int ind = 1; ind < myControls.count(); ind++ ) {
357 if( mode != myControls[ind] )
358 return "eMixed"; // different controls used for different actors
365 bool SMESHGUI_Selection::isNumFunctor( int ind ) const
368 SMESH_Actor* actor = getActor( ind );
370 switch( actor->GetControlMode() ) {
371 case SMESH_Actor::eLength:
372 case SMESH_Actor::eLength2D:
373 case SMESH_Actor::eMultiConnection:
374 case SMESH_Actor::eMultiConnection2D:
375 case SMESH_Actor::eArea:
376 case SMESH_Actor::eVolume3D:
377 case SMESH_Actor::eMaxElementLength2D:
378 case SMESH_Actor::eMaxElementLength3D:
379 case SMESH_Actor::eTaper:
380 case SMESH_Actor::eAspectRatio:
381 case SMESH_Actor::eAspectRatio3D:
382 case SMESH_Actor::eMinimumAngle:
383 case SMESH_Actor::eWarping:
384 case SMESH_Actor::eSkew:
394 //=======================================================================
395 //function : facesOrientationMode
397 //=======================================================================
399 QString SMESHGUI_Selection::facesOrientationMode( int ind ) const
401 SMESH_Actor* actor = getActor( ind );
403 return actor->GetFacesOriented() ? "IsOriented" : "IsNotOriented";
408 //=======================================================================
409 //function : isAutoColor
411 //=======================================================================
413 bool SMESHGUI_Selection::isAutoColor( int ind ) const
415 if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
417 _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
418 CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
420 if ( !CORBA::is_nil( obj ) ) {
421 SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
422 if ( !CORBA::is_nil( mesh ) )
423 return mesh->GetAutoColor();
429 //=======================================================================
430 //function : numberOfNodes
431 //purpose : this method is actually used to check if an object is empty or not
432 //=======================================================================
434 int SMESHGUI_Selection::numberOfNodes( int ind ) const
436 if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
438 _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
439 CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
441 if ( !CORBA::is_nil( obj ) ) {
442 SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
443 if ( !CORBA::is_nil( mesh ) )
444 return mesh->NbNodes();
445 SMESH::SMESH_subMesh_var aSubMeshObj = SMESH::SMESH_subMesh::_narrow( obj );
446 if ( !CORBA::is_nil( aSubMeshObj ) )
447 return aSubMeshObj->GetNumberOfNodes(true);
448 SMESH::SMESH_GroupBase_var aGroupObj = SMESH::SMESH_GroupBase::_narrow( obj );
449 if ( !CORBA::is_nil( aGroupObj ) )
450 return aGroupObj->IsEmpty() ? 0 : 1; // aGroupObj->Size();
456 //================================================================================
458 * \brief return dimension of elements of the selected object
460 * \retval int - 0 for 0D elements, -1 for an empty object (the rest as usual)
462 //================================================================================
464 int SMESHGUI_Selection::dim( int ind ) const
467 if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
469 _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
470 CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
472 if ( !CORBA::is_nil( obj ) ) {
473 SMESH::SMESH_IDSource_var idSrc = SMESH::SMESH_IDSource::_narrow( obj );
474 if ( !CORBA::is_nil( idSrc ) )
476 SMESH::array_of_ElementType_var types = idSrc->GetTypes();
477 for ( int i = 0; i < types->length(); ++ i) {
478 switch ( types[i] ) {
479 case SMESH::EDGE : dim = std::max( dim, 1 ); break;
480 case SMESH::FACE : dim = std::max( dim, 2 ); break;
481 case SMESH::VOLUME: dim = std::max( dim, 3 ); break;
482 case SMESH::ELEM0D: dim = std::max( dim, 0 ); break;
483 case SMESH::BALL : dim = std::max( dim, 0 ); break;
493 //=======================================================================
494 //function : isComputable
496 //=======================================================================
498 QVariant SMESHGUI_Selection::isComputable( int ind ) const
500 if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
502 _PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
503 CORBA::Object_var obj = SMESH::SObjectToObject( so, SMESH::GetActiveStudyDocument() );
504 if( !CORBA::is_nil( obj ) ) {
505 SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
506 if ( !CORBA::is_nil( mesh ) ) {
507 if ( mesh->HasShapeToMesh() ) {
508 GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so );
509 return QVariant( !shape->_is_nil() );
513 return QVariant( mesh->NbFaces() !=0 );
518 GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so );
519 return QVariant( !shape->_is_nil() );
523 return QVariant( false );
526 //=======================================================================
527 //function : isPreComputable
529 //=======================================================================
531 QVariant SMESHGUI_Selection::isPreComputable( int ind ) const
533 if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
535 QMap<int,int> modeMap;
536 _PTR(SObject) pMesh = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
537 SMESHGUI_PrecomputeOp::getAssignedAlgos( pMesh, modeMap );
538 return QVariant( modeMap.size() > 1 );
540 return QVariant( false );
543 //=======================================================================
544 //function : hasReference
546 //=======================================================================
548 QVariant SMESHGUI_Selection::hasReference( int ind ) const
550 return QVariant( isReference( ind ) );
553 //=======================================================================
554 //function : isVisible
556 //=======================================================================
558 QVariant SMESHGUI_Selection::isVisible( int ind ) const
560 if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
562 SMESH_Actor* actor = SMESH::FindActorByEntry( entry( ind ).toLatin1().data() );
563 if ( actor && actor->hasIO() ) {
564 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView() )
565 return QVariant( aViewWindow->isVisible( actor->getIO() ) );
568 return QVariant( false );
571 //=======================================================================
572 //function : hasChildren
574 //=======================================================================
576 bool SMESHGUI_Selection::hasChildren( int ind ) const
580 _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
582 return SMESH::GetActiveStudyDocument()->GetUseCaseBuilder()->HasChildren( sobj );
587 //=======================================================================
588 //function : hasChildren
590 //=======================================================================
592 int SMESHGUI_Selection::nbChildren( int ind ) const
597 _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
598 if ( sobj && sobj->GetStudy()->GetUseCaseBuilder()->IsUseCaseNode( sobj ) ) {
599 _PTR(UseCaseIterator) it = sobj->GetStudy()->GetUseCaseBuilder()->GetUseCaseIterator( sobj );
600 for ( it->Init( false ); it->More(); it->Next() ) nb++;
606 //=======================================================================
607 //function : isContainer
609 //=======================================================================
611 bool SMESHGUI_Selection::isContainer( int ind ) const
613 return ind >= 0 && ind < myTypes.count() && myTypes[ind] == "Unknown";
616 //=======================================================================
619 //=======================================================================
621 int SMESHGUI_Selection::type( const QString& entry, _PTR(Study) study )
624 _PTR(SObject) obj = study->FindObjectID( entry.toLatin1().data() );
627 if ( obj->ReferencedObject( ref ) )
630 _PTR(SObject) objFather = obj->GetFather();
631 _PTR(SComponent) objComponent = obj->GetFatherComponent();
633 if ( objComponent->ComponentDataType() == "SMESH" ) {
634 if ( objComponent->GetIOR() == obj->GetIOR() ) {
635 res = SMESH::COMPONENT;
638 int aLevel = obj->Depth() - objComponent->Depth(),
639 aFTag = objFather->Tag(),
645 if ( anOTag >= SMESH::Tag_FirstMeshRoot )
651 case SMESH::Tag_HypothesisRoot: res = SMESH::HYPOTHESIS; break;
652 case SMESH::Tag_AlgorithmsRoot: res = SMESH::ALGORITHM; break;
659 case SMESH::Tag_SubMeshOnVertex: res = SMESH::SUBMESH_VERTEX; break;
660 case SMESH::Tag_SubMeshOnEdge: res = SMESH::SUBMESH_EDGE; break;
661 case SMESH::Tag_SubMeshOnFace: res = SMESH::SUBMESH_FACE; break;
662 case SMESH::Tag_SubMeshOnSolid: res = SMESH::SUBMESH_SOLID; break;
663 case SMESH::Tag_SubMeshOnCompound: res = SMESH::SUBMESH_COMPOUND; break;
665 if ( aFTag >= SMESH::Tag_FirstGroup) res = SMESH::GROUP;
666 else res = SMESH::SUBMESH;
677 //=======================================================================
678 //function : typeName
680 //=======================================================================
682 QString SMESHGUI_Selection::typeName( const int t )
684 QString res = "Unknown";
687 case SMESH::HYPOTHESIS:
688 res = "Hypothesis"; break;
689 case SMESH::ALGORITHM:
690 res = "Algorithm"; break;
694 res = "SubMesh"; break;
695 case SMESH::MESHorSUBMESH:
696 res = "Mesh or submesh"; break;
697 case SMESH::SUBMESH_VERTEX:
698 res = "Mesh vertex"; break;
699 case SMESH::SUBMESH_EDGE:
700 res = "Mesh edge"; break;
701 case SMESH::SUBMESH_FACE:
702 res = "Mesh face"; break;
703 case SMESH::SUBMESH_SOLID:
704 res = "Mesh solid"; break;
705 case SMESH::SUBMESH_COMPOUND:
706 res = "Mesh compound"; break;
708 res = "Group"; break;
709 case SMESH::COMPONENT:
710 res = "Component"; break;
717 bool SMESHGUI_Selection::isImported( const int ind ) const
720 _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().constData() );
723 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( sobj ) );
724 if( !aMesh->_is_nil() )
726 SMESH::MedFileInfo_var inf = aMesh->GetMEDFileInfo();
727 res = strlen( (char*)inf->fileName ) > 0;
733 //=======================================================================
734 //function : groupType
736 //=======================================================================
738 QString SMESHGUI_Selection::groupType( int ind ) const
740 _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().constData() );
743 SMESH::SMESH_Group_var g = SMESH::SObjectToInterface<SMESH::SMESH_Group>( sobj );
744 if ( !CORBA::is_nil( g ) )
746 SMESH::SMESH_GroupOnGeom_var gog = SMESH::SObjectToInterface<SMESH::SMESH_GroupOnGeom>( sobj );
747 if( !CORBA::is_nil( gog ) )
748 return "GroupOnGeom";
749 SMESH::SMESH_GroupOnFilter_var gof = SMESH::SObjectToInterface<SMESH::SMESH_GroupOnFilter>( sobj );
750 if ( !CORBA::is_nil( gof ) )
751 return "GroupOnFilter";