mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 17:30:35 +05:00
Bug PAL11696 - writing a MESH with FAMILY attributes (identifier, value, description
This commit is contained in:
parent
408e1a5c83
commit
1dd2517e39
@ -84,6 +84,16 @@ module SMESH
|
|||||||
* Returns the mesh object this group belongs to
|
* Returns the mesh object this group belongs to
|
||||||
*/
|
*/
|
||||||
SMESH_Mesh GetMesh();
|
SMESH_Mesh GetMesh();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Sets group color number
|
||||||
|
*/
|
||||||
|
void SetColorNumber( in long color );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Returns group color number
|
||||||
|
*/
|
||||||
|
long GetColorNumber();
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -32,6 +32,103 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* Default constructor
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
DriverMED_Family
|
||||||
|
::DriverMED_Family():
|
||||||
|
myGroupAttributVal(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
const ElementsSet&
|
||||||
|
DriverMED_Family
|
||||||
|
::GetElements () const
|
||||||
|
{
|
||||||
|
return myElements;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DriverMED_Family
|
||||||
|
::GetId () const
|
||||||
|
{
|
||||||
|
return myId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DriverMED_Family
|
||||||
|
::SetId (const int theId)
|
||||||
|
{
|
||||||
|
myId = theId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DriverMED_Family
|
||||||
|
::AddElement(const SMDS_MeshElement* theElement)
|
||||||
|
{
|
||||||
|
myElements.insert(theElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DriverMED_Family
|
||||||
|
::AddGroupName(std::string theGroupName)
|
||||||
|
{
|
||||||
|
myGroupNames.insert(theGroupName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DriverMED_Family
|
||||||
|
::SetType(const SMDSAbs_ElementType theType)
|
||||||
|
{
|
||||||
|
myType = theType;
|
||||||
|
}
|
||||||
|
|
||||||
|
SMDSAbs_ElementType
|
||||||
|
DriverMED_Family
|
||||||
|
::GetType()
|
||||||
|
{
|
||||||
|
return myType;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
DriverMED_Family
|
||||||
|
::MemberOf(std::string theGroupName) const
|
||||||
|
{
|
||||||
|
return myGroupNames.find(theGroupName) != myGroupNames.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
const MED::TStringSet&
|
||||||
|
DriverMED_Family
|
||||||
|
::GetGroupNames () const
|
||||||
|
{
|
||||||
|
return myGroupNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DriverMED_Family
|
||||||
|
::GetGroupAttributVal() const
|
||||||
|
{
|
||||||
|
return myGroupAttributVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DriverMED_Family
|
||||||
|
::SetGroupAttributVal( int theValue)
|
||||||
|
{
|
||||||
|
myGroupAttributVal = theValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
DriverMED_Family
|
||||||
|
::IsEmpty () const
|
||||||
|
{
|
||||||
|
return myElements.empty();
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* Split each group from list <aGroups> on some parts (families)
|
* Split each group from list <aGroups> on some parts (families)
|
||||||
@ -39,15 +136,16 @@ using namespace std;
|
|||||||
* Resulting families have no common elements.
|
* Resulting families have no common elements.
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
list<DriverMED_FamilyPtr> DriverMED_Family::MakeFamilies
|
DriverMED_FamilyPtrList
|
||||||
(const map <int, SMESHDS_SubMesh*>& theSubMeshes,
|
DriverMED_Family
|
||||||
const list<SMESHDS_GroupBase*>& theGroups,
|
::MakeFamilies(const SMESHDS_SubMeshPtrMap& theSubMeshes,
|
||||||
const bool doGroupOfNodes,
|
const SMESHDS_GroupBasePtrList& theGroups,
|
||||||
const bool doGroupOfEdges,
|
const bool doGroupOfNodes,
|
||||||
const bool doGroupOfFaces,
|
const bool doGroupOfEdges,
|
||||||
const bool doGroupOfVolumes)
|
const bool doGroupOfFaces,
|
||||||
|
const bool doGroupOfVolumes)
|
||||||
{
|
{
|
||||||
list<DriverMED_FamilyPtr> aFamilies;
|
DriverMED_FamilyPtrList aFamilies;
|
||||||
|
|
||||||
string anAllNodesGroupName = "Group_Of_All_Nodes";
|
string anAllNodesGroupName = "Group_Of_All_Nodes";
|
||||||
string anAllEdgesGroupName = "Group_Of_All_Edges";
|
string anAllEdgesGroupName = "Group_Of_All_Edges";
|
||||||
@ -61,22 +159,23 @@ list<DriverMED_FamilyPtr> DriverMED_Family::MakeFamilies
|
|||||||
int aElemFamId = FIRST_ELEM_FAMILY;
|
int aElemFamId = FIRST_ELEM_FAMILY;
|
||||||
|
|
||||||
// Process sub-meshes
|
// Process sub-meshes
|
||||||
map<int, SMESHDS_SubMesh*>::const_iterator aSMIter = theSubMeshes.begin();
|
SMESHDS_SubMeshPtrMap::const_iterator aSMIter = theSubMeshes.begin();
|
||||||
for (; aSMIter != theSubMeshes.end(); aSMIter++)
|
for (; aSMIter != theSubMeshes.end(); aSMIter++)
|
||||||
{
|
{
|
||||||
if ( aSMIter->second->IsComplexSubmesh() )
|
const int anId = aSMIter->first;
|
||||||
|
SMESHDS_SubMesh* aSubMesh = aSMIter->second;
|
||||||
|
if ( aSubMesh->IsComplexSubmesh() )
|
||||||
continue; // submesh containing other submeshs
|
continue; // submesh containing other submeshs
|
||||||
list<DriverMED_FamilyPtr> aSMFams = SplitByType((*aSMIter).second, (*aSMIter).first);
|
DriverMED_FamilyPtrList aSMFams = SplitByType(aSubMesh,anId);
|
||||||
list<DriverMED_FamilyPtr>::iterator aSMFamsIter = aSMFams.begin();
|
DriverMED_FamilyPtrList::iterator aSMFamsIter = aSMFams.begin();
|
||||||
for (; aSMFamsIter != aSMFams.end(); aSMFamsIter++)
|
for (; aSMFamsIter != aSMFams.end(); aSMFamsIter++)
|
||||||
{
|
{
|
||||||
DriverMED_FamilyPtr aFam2 = (*aSMFamsIter);
|
DriverMED_FamilyPtr aFam2 = (*aSMFamsIter);
|
||||||
|
DriverMED_FamilyPtrList::iterator aFamsIter = aFamilies.begin();
|
||||||
list<DriverMED_FamilyPtr>::iterator aFamsIter = aFamilies.begin();
|
|
||||||
while (aFamsIter != aFamilies.end())
|
while (aFamsIter != aFamilies.end())
|
||||||
{
|
{
|
||||||
DriverMED_FamilyPtr aFam1 = *aFamsIter;
|
DriverMED_FamilyPtr aFam1 = *aFamsIter;
|
||||||
list<DriverMED_FamilyPtr>::iterator aCurrIter = aFamsIter++;
|
DriverMED_FamilyPtrList::iterator aCurrIter = aFamsIter++;
|
||||||
if (aFam1->myType == aFam2->myType)
|
if (aFam1->myType == aFam2->myType)
|
||||||
{
|
{
|
||||||
DriverMED_FamilyPtr aCommon (new DriverMED_Family);
|
DriverMED_FamilyPtr aCommon (new DriverMED_Family);
|
||||||
@ -89,7 +188,8 @@ list<DriverMED_FamilyPtr> DriverMED_Family::MakeFamilies
|
|||||||
{
|
{
|
||||||
aFamilies.erase(aCurrIter);
|
aFamilies.erase(aCurrIter);
|
||||||
}
|
}
|
||||||
if (aFam2->IsEmpty()) break;
|
if (aFam2->IsEmpty())
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The rest elements of family
|
// The rest elements of family
|
||||||
@ -101,30 +201,32 @@ list<DriverMED_FamilyPtr> DriverMED_Family::MakeFamilies
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Process groups
|
// Process groups
|
||||||
list<SMESHDS_GroupBase*>::const_iterator aGroupsIter = theGroups.begin();
|
SMESHDS_GroupBasePtrList::const_iterator aGroupsIter = theGroups.begin();
|
||||||
for (; aGroupsIter != theGroups.end(); aGroupsIter++)
|
for (; aGroupsIter != theGroups.end(); aGroupsIter++)
|
||||||
{
|
{
|
||||||
DriverMED_FamilyPtr aFam2 (new DriverMED_Family);
|
DriverMED_FamilyPtr aFam2 (new DriverMED_Family);
|
||||||
aFam2->Init(*aGroupsIter);
|
aFam2->Init(*aGroupsIter);
|
||||||
|
|
||||||
list<DriverMED_FamilyPtr>::iterator aFamsIter = aFamilies.begin();
|
DriverMED_FamilyPtrList::iterator aFamsIter = aFamilies.begin();
|
||||||
while (aFamsIter != aFamilies.end())
|
while (aFamsIter != aFamilies.end())
|
||||||
{
|
{
|
||||||
DriverMED_FamilyPtr aFam1 = *aFamsIter;
|
DriverMED_FamilyPtr aFam1 = *aFamsIter;
|
||||||
list<DriverMED_FamilyPtr>::iterator aCurrIter = aFamsIter++;
|
DriverMED_FamilyPtrList::iterator aCurrIter = aFamsIter++;
|
||||||
if (aFam1->myType == aFam2->myType)
|
if (aFam1->myType == aFam2->myType)
|
||||||
{
|
{
|
||||||
DriverMED_FamilyPtr aCommon (new DriverMED_Family);
|
DriverMED_FamilyPtr aCommon (new DriverMED_Family);
|
||||||
aFam1->Split(aFam2, aCommon);
|
aFam1->Split(aFam2, aCommon);
|
||||||
if (!aCommon->IsEmpty())
|
if (!aCommon->IsEmpty())
|
||||||
{
|
{
|
||||||
|
aCommon->SetGroupAttributVal(0);
|
||||||
aFamilies.push_back(aCommon);
|
aFamilies.push_back(aCommon);
|
||||||
}
|
}
|
||||||
if (aFam1->IsEmpty())
|
if (aFam1->IsEmpty())
|
||||||
{
|
{
|
||||||
aFamilies.erase(aCurrIter);
|
aFamilies.erase(aCurrIter);
|
||||||
}
|
}
|
||||||
if (aFam2->IsEmpty()) break;
|
if (aFam2->IsEmpty())
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The rest elements of group
|
// The rest elements of group
|
||||||
@ -134,7 +236,7 @@ list<DriverMED_FamilyPtr> DriverMED_Family::MakeFamilies
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list<DriverMED_FamilyPtr>::iterator aFamsIter = aFamilies.begin();
|
DriverMED_FamilyPtrList::iterator aFamsIter = aFamilies.begin();
|
||||||
for (; aFamsIter != aFamilies.end(); aFamsIter++)
|
for (; aFamsIter != aFamilies.end(); aFamsIter++)
|
||||||
{
|
{
|
||||||
DriverMED_FamilyPtr aFam = *aFamsIter;
|
DriverMED_FamilyPtr aFam = *aFamsIter;
|
||||||
@ -210,33 +312,33 @@ MED::PFamilyInfo
|
|||||||
DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper,
|
DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper,
|
||||||
const MED::PMeshInfo& theMeshInfo) const
|
const MED::PMeshInfo& theMeshInfo) const
|
||||||
{
|
{
|
||||||
string aValue;
|
|
||||||
|
|
||||||
ostringstream aStr;
|
ostringstream aStr;
|
||||||
|
|
||||||
aStr << "FAM_" << myId;
|
aStr << "FAM_" << myId;
|
||||||
set<string>::const_iterator aGrIter = myGroupNames.begin();
|
set<string>::const_iterator aGrIter = myGroupNames.begin();
|
||||||
for (; aGrIter != myGroupNames.end(); aGrIter++)
|
for(; aGrIter != myGroupNames.end(); aGrIter++){
|
||||||
{
|
|
||||||
aStr << "_" << *aGrIter;
|
aStr << "_" << *aGrIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
aValue = aStr.str();
|
MED::PFamilyInfo anInfo;
|
||||||
/*
|
string aValue = aStr.str();
|
||||||
MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description,
|
if(myId == 0){
|
||||||
MED::TIntVector anAttrIds (1, myId); // Id=0,
|
anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
|
||||||
MED::TIntVector anAttrVals (1, myId); // Value=0
|
aValue,
|
||||||
*/
|
myId,
|
||||||
|
myGroupNames);
|
||||||
MED::PFamilyInfo anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
|
}else{
|
||||||
aValue,
|
MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description,
|
||||||
myId,
|
MED::TIntVector anAttrIds (1, myId); // Id=0,
|
||||||
myGroupNames);
|
MED::TIntVector anAttrVals (1);
|
||||||
/*
|
anAttrVals[0] = myGroupAttributVal != 0? myGroupAttributVal: myId;
|
||||||
anAttrDescs,
|
anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
|
||||||
anAttrIds,
|
aValue,
|
||||||
anAttrVals);
|
myId,
|
||||||
*/
|
myGroupNames,
|
||||||
|
anAttrDescs,
|
||||||
|
anAttrIds,
|
||||||
|
anAttrVals);
|
||||||
|
}
|
||||||
|
|
||||||
// cout << endl;
|
// cout << endl;
|
||||||
// cout << "Groups: ";
|
// cout << "Groups: ";
|
||||||
@ -279,6 +381,14 @@ void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup)
|
|||||||
// Groups list
|
// Groups list
|
||||||
myGroupNames.clear();
|
myGroupNames.clear();
|
||||||
myGroupNames.insert(string(theGroup->GetStoreName()));
|
myGroupNames.insert(string(theGroup->GetStoreName()));
|
||||||
|
|
||||||
|
myGroupAttributVal = 0;
|
||||||
|
|
||||||
|
if (theGroup->GetColorGroup()!=0)
|
||||||
|
{
|
||||||
|
myGroupAttributVal = theGroup->GetColorGroup();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -287,10 +397,12 @@ void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup)
|
|||||||
* on the basis of the elements type.
|
* on the basis of the elements type.
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
list<DriverMED_FamilyPtr> DriverMED_Family::SplitByType (SMESHDS_SubMesh* theSubMesh,
|
DriverMED_FamilyPtrList
|
||||||
const int theId)
|
DriverMED_Family
|
||||||
|
::SplitByType (SMESHDS_SubMesh* theSubMesh,
|
||||||
|
const int theId)
|
||||||
{
|
{
|
||||||
list<DriverMED_FamilyPtr> aFamilies;
|
DriverMED_FamilyPtrList aFamilies;
|
||||||
DriverMED_FamilyPtr aNodesFamily (new DriverMED_Family);
|
DriverMED_FamilyPtr aNodesFamily (new DriverMED_Family);
|
||||||
DriverMED_FamilyPtr anEdgesFamily (new DriverMED_Family);
|
DriverMED_FamilyPtr anEdgesFamily (new DriverMED_Family);
|
||||||
DriverMED_FamilyPtr aFacesFamily (new DriverMED_Family);
|
DriverMED_FamilyPtr aFacesFamily (new DriverMED_Family);
|
||||||
@ -361,7 +473,7 @@ void DriverMED_Family::Split (DriverMED_FamilyPtr by,
|
|||||||
DriverMED_FamilyPtr common)
|
DriverMED_FamilyPtr common)
|
||||||
{
|
{
|
||||||
// Elements
|
// Elements
|
||||||
set<const SMDS_MeshElement *>::iterator anIter = by->myElements.begin();
|
ElementsSet::iterator anIter = by->myElements.begin();
|
||||||
while ( anIter != by->myElements.end())
|
while ( anIter != by->myElements.end())
|
||||||
{
|
{
|
||||||
if (myElements.find(*anIter) != myElements.end())
|
if (myElements.find(*anIter) != myElements.end())
|
||||||
@ -378,7 +490,7 @@ void DriverMED_Family::Split (DriverMED_FamilyPtr by,
|
|||||||
{
|
{
|
||||||
// Groups list
|
// Groups list
|
||||||
common->myGroupNames = myGroupNames;
|
common->myGroupNames = myGroupNames;
|
||||||
set<string>::iterator aGrNamesIter = by->myGroupNames.begin();
|
MED::TStringSet::iterator aGrNamesIter = by->myGroupNames.begin();
|
||||||
for (; aGrNamesIter != by->myGroupNames.end(); aGrNamesIter++)
|
for (; aGrNamesIter != by->myGroupNames.end(); aGrNamesIter++)
|
||||||
{
|
{
|
||||||
common->myGroupNames.insert(*aGrNamesIter);
|
common->myGroupNames.insert(*aGrNamesIter);
|
||||||
|
@ -45,76 +45,92 @@
|
|||||||
|
|
||||||
class DriverMED_Family;
|
class DriverMED_Family;
|
||||||
typedef boost::shared_ptr<DriverMED_Family> DriverMED_FamilyPtr;
|
typedef boost::shared_ptr<DriverMED_Family> DriverMED_FamilyPtr;
|
||||||
|
typedef std::list<DriverMED_FamilyPtr> DriverMED_FamilyPtrList;
|
||||||
|
typedef std::map<int,SMESHDS_SubMesh*> SMESHDS_SubMeshPtrMap;
|
||||||
|
typedef std::list<SMESHDS_GroupBase*> SMESHDS_GroupBasePtrList;
|
||||||
|
typedef std::set<const SMDS_MeshElement*> ElementsSet;
|
||||||
|
|
||||||
class DriverMED_Family
|
class DriverMED_Family
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Methods for groups storing to MED
|
DriverMED_Family();
|
||||||
|
|
||||||
static std::list<DriverMED_FamilyPtr> MakeFamilies (const std::map <int, SMESHDS_SubMesh*>& theSubMeshes,
|
//! Methods for groups storing to MED
|
||||||
const std::list<SMESHDS_GroupBase*>& theGroups,
|
/*!
|
||||||
const bool doGroupOfNodes,
|
Split each group from list <theGroups> and each sub-mesh from list <theSubMeshes>
|
||||||
const bool doGroupOfEdges,
|
on some parts (families) on the basis of the elements membership in other groups
|
||||||
const bool doGroupOfFaces,
|
from <theGroups> and other sub-meshes from <theSubMeshes>.
|
||||||
const bool doGroupOfVolumes);
|
Resulting families have no common elements.
|
||||||
// Split each group from list <theGroups> and each sub-mesh from list <theSubMeshes>
|
*/
|
||||||
// on some parts (families) on the basis of the elements membership in other groups
|
static
|
||||||
// from <theGroups> and other sub-meshes from <theSubMeshes>.
|
DriverMED_FamilyPtrList
|
||||||
// Resulting families have no common elements.
|
MakeFamilies (const SMESHDS_SubMeshPtrMap& theSubMeshes,
|
||||||
|
const SMESHDS_GroupBasePtrList& theGroups,
|
||||||
|
const bool doGroupOfNodes,
|
||||||
|
const bool doGroupOfEdges,
|
||||||
|
const bool doGroupOfFaces,
|
||||||
|
const bool doGroupOfVolumes);
|
||||||
|
|
||||||
MED::PFamilyInfo GetFamilyInfo (const MED::PWrapper& theWrapper,
|
//! Create TFamilyInfo for this family
|
||||||
const MED::PMeshInfo& theMeshInfo) const;
|
MED::PFamilyInfo
|
||||||
// Create TFamilyInfo for this family
|
GetFamilyInfo (const MED::PWrapper& theWrapper,
|
||||||
|
const MED::PMeshInfo& theMeshInfo) const;
|
||||||
|
|
||||||
const std::set<const SMDS_MeshElement *>& GetElements () const { return myElements; }
|
//! Returns elements of this family
|
||||||
// Returns elements of this family
|
const ElementsSet& GetElements () const;
|
||||||
|
|
||||||
int GetId () const { return myId; }
|
//! Returns a family ID
|
||||||
// Returns a family ID
|
int GetId () const;
|
||||||
|
|
||||||
|
//! Sets a family ID
|
||||||
|
void SetId (const int theId);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Methods for groups reading from MED
|
// Methods for groups reading from MED
|
||||||
|
|
||||||
void AddElement (const SMDS_MeshElement* theElement) { myElements.insert(theElement); }
|
void AddElement(const SMDS_MeshElement* theElement);
|
||||||
|
|
||||||
void AddGroupName (std::string theGroupName) { myGroupNames.insert(theGroupName); }
|
const MED::TStringSet& GetGroupNames() const;
|
||||||
|
void AddGroupName(std::string theGroupName);
|
||||||
|
|
||||||
void SetType (const SMDSAbs_ElementType theType) { myType = theType; }
|
void SetType(const SMDSAbs_ElementType theType);
|
||||||
SMDSAbs_ElementType GetType () { return myType; }
|
SMDSAbs_ElementType GetType();
|
||||||
|
|
||||||
bool MemberOf (std::string theGroupName) const
|
bool MemberOf(std::string theGroupName) const;
|
||||||
{ return (myGroupNames.find(theGroupName) != myGroupNames.end()); }
|
|
||||||
|
|
||||||
const MED::TStringSet& GetGroupNames () const { return myGroupNames; }
|
int GetGroupAttributVal() const;
|
||||||
|
void SetGroupAttributVal( int theValue);
|
||||||
void SetId (const int theId) { myId = theId; }
|
|
||||||
// Sets a family ID
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
//! Initialize the tool by SMESHDS_GroupBase
|
||||||
void Init (SMESHDS_GroupBase* group);
|
void Init (SMESHDS_GroupBase* group);
|
||||||
// Initialize the tool by SMESHDS_GroupBase
|
|
||||||
|
|
||||||
static std::list<DriverMED_FamilyPtr> SplitByType (SMESHDS_SubMesh* theSubMesh,
|
//! Split <theSubMesh> on some parts (families) on the basis of the elements type.
|
||||||
const int theId);
|
static
|
||||||
// Split <theSubMesh> on some parts (families)
|
DriverMED_FamilyPtrList
|
||||||
// on the basis of the elements type.
|
SplitByType(SMESHDS_SubMesh* theSubMesh,
|
||||||
|
const int theId);
|
||||||
|
|
||||||
|
|
||||||
|
/*! Remove from <Elements> elements, common with <by>,
|
||||||
|
Remove from <by> elements, common with <Elements>,
|
||||||
|
Create family <common> from common elements, with combined groups list.
|
||||||
|
*/
|
||||||
void Split (DriverMED_FamilyPtr by,
|
void Split (DriverMED_FamilyPtr by,
|
||||||
DriverMED_FamilyPtr common);
|
DriverMED_FamilyPtr common);
|
||||||
// Remove from <Elements> elements, common with <by>,
|
|
||||||
// Remove from <by> elements, common with <Elements>,
|
|
||||||
// Create family <common> from common elements, with combined groups list.
|
|
||||||
|
|
||||||
bool IsEmpty () const { return myElements.empty(); }
|
//! Check, if this family has empty list of elements
|
||||||
// Check, if this family has empty list of elements
|
bool IsEmpty () const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int myId;
|
int myId;
|
||||||
SMDSAbs_ElementType myType;
|
SMDSAbs_ElementType myType;
|
||||||
std::set<const SMDS_MeshElement *> myElements;
|
ElementsSet myElements;
|
||||||
MED::TStringSet myGroupNames;
|
MED::TStringSet myGroupNames;
|
||||||
|
int myGroupAttributVal;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,6 +53,9 @@ class SMESH_Group
|
|||||||
|
|
||||||
SMESHDS_GroupBase * GetGroupDS () { return myGroupDS; }
|
SMESHDS_GroupBase * GetGroupDS () { return myGroupDS; }
|
||||||
|
|
||||||
|
void SetColorNumber (int theColorNumber) { myColorNumber = theColorNumber; }
|
||||||
|
int GetColorNumber() const { return myColorNumber; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESH_Group (const SMESH_Group& theOther);
|
SMESH_Group (const SMESH_Group& theOther);
|
||||||
// prohibited copy constructor
|
// prohibited copy constructor
|
||||||
@ -61,7 +64,7 @@ class SMESH_Group
|
|||||||
|
|
||||||
SMESHDS_GroupBase * myGroupDS;
|
SMESHDS_GroupBase * myGroupDS;
|
||||||
std::string myName;
|
std::string myName;
|
||||||
|
int myColorNumber;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,6 +66,12 @@ class SMESHDS_GroupBase
|
|||||||
|
|
||||||
virtual ~SMESHDS_GroupBase() {}
|
virtual ~SMESHDS_GroupBase() {}
|
||||||
|
|
||||||
|
void SetColorGroup (int theColorGroup)
|
||||||
|
{ myColorGroup = theColorGroup;}
|
||||||
|
|
||||||
|
int GetColorGroup() const
|
||||||
|
{ return myColorGroup;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const SMDS_MeshElement* findInMesh (const int theID) const;
|
const SMDS_MeshElement* findInMesh (const int theID) const;
|
||||||
void resetIterator();
|
void resetIterator();
|
||||||
@ -84,7 +90,7 @@ class SMESHDS_GroupBase
|
|||||||
int myCurIndex;
|
int myCurIndex;
|
||||||
int myCurID;
|
int myCurID;
|
||||||
SMDS_ElemIteratorPtr myIterator;
|
SMDS_ElemIteratorPtr myIterator;
|
||||||
|
int myColorGroup;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -259,7 +259,7 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
|
|||||||
myGroupLine = new QLineEdit(aSelectBox, "group line");
|
myGroupLine = new QLineEdit(aSelectBox, "group line");
|
||||||
myGroupLine->setReadOnly(true);
|
myGroupLine->setReadOnly(true);
|
||||||
onSelectGroup(false);
|
onSelectGroup(false);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
QGridLayout* wg1Layout = new QGridLayout( wg1, 3, 1, 0, 6 );
|
QGridLayout* wg1Layout = new QGridLayout( wg1, 3, 1, 0, 6 );
|
||||||
wg1Layout->addWidget(aContentBox, 0, 0);
|
wg1Layout->addWidget(aContentBox, 0, 0);
|
||||||
@ -291,6 +291,26 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
|
|||||||
myWGStack->addWidget( wg2, myGrpTypeGroup->id(rb2) );
|
myWGStack->addWidget( wg2, myGrpTypeGroup->id(rb2) );
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
QGroupBox* aColorBox = new QGroupBox(this, "color box");
|
||||||
|
aColorBox->setTitle(tr("SMESH_SET_COLOR"));
|
||||||
|
|
||||||
|
mySelectColorGroup = new QCheckBox(aColorBox, "color checkbox");
|
||||||
|
mySelectColorGroup->setText(tr("SMESH_CHECK_COLOR"));
|
||||||
|
mySelectColorGroup->setMinimumSize(50, 0);
|
||||||
|
|
||||||
|
myColorGroupLine = new QLineEdit(aColorBox, "color line");
|
||||||
|
myColorGroupLine->setReadOnly(false);
|
||||||
|
onSelectColorGroup(false);
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
QHBoxLayout* aColorLayout = new QHBoxLayout(aColorBox, 15, 20);
|
||||||
|
aColorLayout->setAutoAdd(false);
|
||||||
|
|
||||||
|
aColorLayout->addWidget(mySelectColorGroup);
|
||||||
|
aColorLayout->addWidget(myColorGroupLine);
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
|
||||||
QFrame* aButtons = new QFrame(this, "button box");
|
QFrame* aButtons = new QFrame(this, "button box");
|
||||||
aButtons->setFrameStyle(QFrame::Box | QFrame::Sunken);
|
aButtons->setFrameStyle(QFrame::Box | QFrame::Sunken);
|
||||||
QHBoxLayout* aBtnLayout = new QHBoxLayout(aButtons, 11, 6);
|
QHBoxLayout* aBtnLayout = new QHBoxLayout(aButtons, 11, 6);
|
||||||
@ -322,7 +342,8 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
|
|||||||
aMainLayout->addMultiCellWidget(myGrpTypeGroup, 3, 3, 0, 2);
|
aMainLayout->addMultiCellWidget(myGrpTypeGroup, 3, 3, 0, 2);
|
||||||
aMainLayout->addMultiCellWidget(myWGStack, 4, 4, 0, 2);
|
aMainLayout->addMultiCellWidget(myWGStack, 4, 4, 0, 2);
|
||||||
aMainLayout->setRowStretch( 5, 5 );
|
aMainLayout->setRowStretch( 5, 5 );
|
||||||
aMainLayout->addMultiCellWidget(aButtons, 6, 6, 0, 2);
|
aMainLayout->addMultiCellWidget(aColorBox, 6, 6, 0, 2);
|
||||||
|
aMainLayout->addMultiCellWidget(aButtons, 7, 7, 0, 2);
|
||||||
|
|
||||||
/* signals and slots connections */
|
/* signals and slots connections */
|
||||||
connect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
connect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
||||||
@ -344,6 +365,8 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
|
|||||||
connect(mySubMeshBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
connect(mySubMeshBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
||||||
connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
||||||
connect(myGeomGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
connect(myGeomGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
||||||
|
connect(mySelectColorGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectColorGroup(bool)));
|
||||||
|
|
||||||
|
|
||||||
connect(aOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
|
connect(aOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
|
||||||
connect(aApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
|
connect(aApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
|
||||||
@ -439,6 +462,10 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Group_ptr theGroup)
|
|||||||
|
|
||||||
myName->setText(myGroup->GetName());
|
myName->setText(myGroup->GetName());
|
||||||
myName->home(false);
|
myName->home(false);
|
||||||
|
|
||||||
|
myColorGroupLine->setText(QString::number(myGroup->GetColorNumber()));
|
||||||
|
myColorGroupLine->home(false);
|
||||||
|
|
||||||
myMeshGroupLine->setText(myGroup->GetName());
|
myMeshGroupLine->setText(myGroup->GetName());
|
||||||
|
|
||||||
myCurrentLineEdit = 0;
|
myCurrentLineEdit = 0;
|
||||||
@ -595,6 +622,20 @@ bool SMESHGUI_GroupDlg::onApply()
|
|||||||
|
|
||||||
myGroup = SMESH::AddGroup(myMesh, aType, myName->text());
|
myGroup = SMESH::AddGroup(myMesh, aType, myName->text());
|
||||||
myGroup->Add(anIdList.inout());
|
myGroup->Add(anIdList.inout());
|
||||||
|
|
||||||
|
int aColorNumber = myColorGroupLine->text().toInt();
|
||||||
|
myGroup->SetColorNumber(aColorNumber);
|
||||||
|
|
||||||
|
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroup);
|
||||||
|
|
||||||
|
SMESH::setFileName (aMeshGroupSO, myColorGroupLine->text());
|
||||||
|
|
||||||
|
SMESH::setFileType (aMeshGroupSO,"COULEURGROUP");
|
||||||
|
|
||||||
|
/* init for next operation */
|
||||||
|
myName->setText("");
|
||||||
|
|
||||||
|
myColorGroupLine->setText("");
|
||||||
|
|
||||||
/* init for next operation */
|
/* init for next operation */
|
||||||
myName->setText("");
|
myName->setText("");
|
||||||
@ -603,6 +644,9 @@ bool SMESHGUI_GroupDlg::onApply()
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
myGroup->SetName(myName->text());
|
myGroup->SetName(myName->text());
|
||||||
|
|
||||||
|
int aColorNumber = myColorGroupLine->text().toInt();
|
||||||
|
myGroup->SetColorNumber(aColorNumber);
|
||||||
|
|
||||||
QValueList<int> aAddList;
|
QValueList<int> aAddList;
|
||||||
QValueList<int>::iterator anIt;
|
QValueList<int>::iterator anIt;
|
||||||
@ -660,10 +704,20 @@ bool SMESHGUI_GroupDlg::onApply()
|
|||||||
SMESH::SMESH_GroupOnGeom_var aGroupOnGeom =
|
SMESH::SMESH_GroupOnGeom_var aGroupOnGeom =
|
||||||
myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomGroup);
|
myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomGroup);
|
||||||
|
|
||||||
|
int aColorNumber = myColorGroupLine->text().toInt();
|
||||||
|
aGroupOnGeom->SetColorNumber(aColorNumber);
|
||||||
|
|
||||||
|
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(aGroupOnGeom);
|
||||||
|
|
||||||
|
SMESH::setFileName (aMeshGroupSO, myColorGroupLine->text());
|
||||||
|
|
||||||
|
SMESH::setFileType (aMeshGroupSO,"COULEURGROUP");
|
||||||
|
|
||||||
mySMESHGUI->updateObjBrowser(true);
|
mySMESHGUI->updateObjBrowser(true);
|
||||||
mySelectionMgr->clearSelected();
|
mySelectionMgr->clearSelected();
|
||||||
/* init for next operation */
|
/* init for next operation */
|
||||||
myName->setText("");
|
myName->setText("");
|
||||||
|
myColorGroupLine->setText("");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -986,6 +1040,23 @@ void SMESHGUI_GroupDlg::onSelectGeomGroup(bool on)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : (onSelectColorGroup)
|
||||||
|
// purpose : Called when setting a color on group
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_GroupDlg::onSelectColorGroup(bool on)
|
||||||
|
{
|
||||||
|
if (on) {
|
||||||
|
setSelectionMode(7);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
myColorGroupLine->setText("");
|
||||||
|
myCurrentLineEdit = 0;
|
||||||
|
if (myTypeId != -1)
|
||||||
|
setSelectionMode(myTypeId);
|
||||||
|
}
|
||||||
|
myColorGroupLine->setEnabled(on);
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : setCurrentSelection()
|
// function : setCurrentSelection()
|
||||||
|
@ -95,6 +95,7 @@ private slots:
|
|||||||
void onSelectSubMesh(bool on);
|
void onSelectSubMesh(bool on);
|
||||||
void onSelectGroup(bool on);
|
void onSelectGroup(bool on);
|
||||||
void onSelectGeomGroup(bool on);
|
void onSelectGeomGroup(bool on);
|
||||||
|
void onSelectColorGroup(bool on);
|
||||||
void setCurrentSelection();
|
void setCurrentSelection();
|
||||||
|
|
||||||
void setFilters();
|
void setFilters();
|
||||||
@ -141,6 +142,9 @@ private:
|
|||||||
QPushButton* myGroupBtn;
|
QPushButton* myGroupBtn;
|
||||||
QLineEdit* myGroupLine;
|
QLineEdit* myGroupLine;
|
||||||
|
|
||||||
|
QCheckBox* mySelectColorGroup;
|
||||||
|
QLineEdit* myColorGroupLine;
|
||||||
|
|
||||||
QCheckBox* mySelectGeomGroup;
|
QCheckBox* mySelectGeomGroup;
|
||||||
QPushButton* myGeomGroupBtn;
|
QPushButton* myGeomGroupBtn;
|
||||||
QLineEdit* myGeomGroupLine;
|
QLineEdit* myGeomGroupLine;
|
||||||
|
@ -153,6 +153,32 @@ namespace SMESH{
|
|||||||
if (aComment)
|
if (aComment)
|
||||||
aComment->SetValue(theValue);
|
aComment->SetValue(theValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setFileName (_PTR(SObject) theSObject, const char* theValue)
|
||||||
|
{
|
||||||
|
_PTR(Study) aStudy = GetActiveStudyDocument();
|
||||||
|
if (aStudy->GetProperties()->IsLocked())
|
||||||
|
return;
|
||||||
|
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
||||||
|
_PTR(GenericAttribute) anAttr =
|
||||||
|
aBuilder->FindOrCreateAttribute(theSObject, "AttributeExternalFileDef");
|
||||||
|
_PTR(AttributeExternalFileDef) aFileName = anAttr;
|
||||||
|
if (aFileName)
|
||||||
|
aFileName->SetValue(theValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFileType (_PTR(SObject) theSObject, const char* theValue)
|
||||||
|
{
|
||||||
|
_PTR(Study) aStudy = GetActiveStudyDocument();
|
||||||
|
if (aStudy->GetProperties()->IsLocked())
|
||||||
|
return;
|
||||||
|
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
||||||
|
_PTR(GenericAttribute) anAttr =
|
||||||
|
aBuilder->FindOrCreateAttribute(theSObject, "AttributeFileType");
|
||||||
|
_PTR(AttributeFileType) aFileType = anAttr;
|
||||||
|
if (aFileType)
|
||||||
|
aFileType->SetValue(theValue);
|
||||||
|
}
|
||||||
|
|
||||||
CORBA::Object_var SObjectToObject (_PTR(SObject) theSObject,
|
CORBA::Object_var SObjectToObject (_PTR(SObject) theSObject,
|
||||||
_PTR(Study) theStudy)
|
_PTR(Study) theStudy)
|
||||||
|
@ -81,6 +81,8 @@ namespace SMESH {
|
|||||||
|
|
||||||
void SetName (_PTR(SObject) theSObject, const char* theName);
|
void SetName (_PTR(SObject) theSObject, const char* theName);
|
||||||
void SetValue (_PTR(SObject) theSObject, const char* theValue);
|
void SetValue (_PTR(SObject) theSObject, const char* theValue);
|
||||||
|
void setFileType (_PTR(SObject) theSObject, const char* theValue);
|
||||||
|
void setFileName (_PTR(SObject) theSObject, const char* theValue);
|
||||||
|
|
||||||
CORBA::Object_var SObjectToObject (_PTR(SObject) theSObject,
|
CORBA::Object_var SObjectToObject (_PTR(SObject) theSObject,
|
||||||
_PTR(Study) theStudy);
|
_PTR(Study) theStudy);
|
||||||
|
@ -918,6 +918,14 @@ msgstr "Group on geometry"
|
|||||||
msgid "SMESH_GEOM_GROUP"
|
msgid "SMESH_GEOM_GROUP"
|
||||||
msgstr "Geometry group"
|
msgstr "Geometry group"
|
||||||
|
|
||||||
|
#Color group
|
||||||
|
msgid "SMESH_SET_COLOR"
|
||||||
|
msgstr "Color group"
|
||||||
|
|
||||||
|
#Check color group
|
||||||
|
msgid "SMESH_CHECK_COLOR"
|
||||||
|
msgstr "Color number"
|
||||||
|
|
||||||
#%1 SubMeshes
|
#%1 SubMeshes
|
||||||
msgid "SMESH_SUBMESH_SELECTED"
|
msgid "SMESH_SUBMESH_SELECTED"
|
||||||
msgstr "%1 SubMeshes"
|
msgstr "%1 SubMeshes"
|
||||||
|
@ -419,3 +419,33 @@ GEOM::GEOM_Object_ptr SMESH_GroupOnGeom_i::GetShape()
|
|||||||
return aGeomObj._retn();
|
return aGeomObj._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
CORBA::Long SMESH_GroupBase_i::GetColorNumber()
|
||||||
|
{
|
||||||
|
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
||||||
|
if (aGroupDS)
|
||||||
|
return aGroupDS->GetColorGroup();
|
||||||
|
MESSAGE("get color number of a vague group");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
void SMESH_GroupBase_i::SetColorNumber(CORBA::Long color)
|
||||||
|
{
|
||||||
|
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
||||||
|
if (aGroupDS)
|
||||||
|
return aGroupDS->SetColorGroup(color);
|
||||||
|
MESSAGE("set color number of a vague group");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +73,9 @@ class SMESH_GroupBase_i:
|
|||||||
SMESH_Group* GetSmeshGroup() const;
|
SMESH_Group* GetSmeshGroup() const;
|
||||||
SMESHDS_GroupBase* GetGroupDS() const;
|
SMESHDS_GroupBase* GetGroupDS() const;
|
||||||
|
|
||||||
|
void SetColorNumber(CORBA::Long color);
|
||||||
|
CORBA::Long GetColorNumber();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESH_Mesh_i* myMeshServant;
|
SMESH_Mesh_i* myMeshServant;
|
||||||
int myLocalID;
|
int myLocalID;
|
||||||
|
Loading…
Reference in New Issue
Block a user