Salome HOME
Merge from V6_5_BR 05/06/2012
[modules/smesh.git] / src / SMESH / SMESH_Group.cxx
index 27ef1f3f79e89ccbc2098f505f002bbf44704f55..7ef568593a2f492f535a7fb6a1b0934fa444a11f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -30,6 +30,7 @@
 #include "SMESH_Mesh.hxx"
 #include "SMESHDS_Group.hxx"
 #include "SMESHDS_GroupOnGeom.hxx"
+#include "SMESHDS_GroupOnFilter.hxx"
 
 //=============================================================================
 /*!
@@ -41,18 +42,36 @@ SMESH_Group::SMESH_Group (int                       theID,
                           const SMESH_Mesh*         theMesh,
                           const SMDSAbs_ElementType theType,
                           const char*               theName,
-                          const TopoDS_Shape&       theShape)
+                          const TopoDS_Shape&       theShape,
+                          const SMESH_PredicatePtr& thePredicate)
      : myName(theName)
 {
-  if ( theShape.IsNull() )
-    myGroupDS = new SMESHDS_Group (theID,
-                                   const_cast<SMESH_Mesh*>(theMesh)->GetMeshDS(),
-                                   theType);
-  else
+  if ( !theShape.IsNull() )
     myGroupDS = new SMESHDS_GroupOnGeom (theID,
                                          const_cast<SMESH_Mesh*>(theMesh)->GetMeshDS(),
                                          theType,
                                          theShape);
+  else if ( thePredicate )
+    myGroupDS = new SMESHDS_GroupOnFilter (theID,
+                                           const_cast<SMESH_Mesh*>(theMesh)->GetMeshDS(),
+                                           theType,
+                                           thePredicate);
+  else
+    myGroupDS = new SMESHDS_Group (theID,
+                                   const_cast<SMESH_Mesh*>(theMesh)->GetMeshDS(),
+                                   theType);
+}
+
+//================================================================================
+/*!
+ * \brief Constructor accesible to SMESH_Mesh only
+ */
+//================================================================================
+
+SMESH_Group::SMESH_Group (SMESHDS_GroupBase* groupDS): myGroupDS( groupDS )
+{
+  if ( myGroupDS )
+    myName = myGroupDS->GetStoreName();
 }
 
 //=============================================================================