#include <SMESHDS_GroupBase.hxx>

Public Member Functions | |
| SMESHDS_GroupBase (const int theID, const SMESHDS_Mesh *theMesh, const SMDSAbs_ElementType theType) | |
| int | GetID () const |
| const SMESHDS_Mesh * | GetMesh () const |
| virtual void | SetType (SMDSAbs_ElementType theType) |
| SMDSAbs_ElementType | GetType () const |
| void | SetStoreName (const char *theName) |
| const char * | GetStoreName () const |
| virtual int | Extent () |
| virtual bool | IsEmpty () |
| virtual bool | Contains (const int theID) |
| virtual bool | Contains (const SMDS_MeshElement *elem) |
| virtual SMDS_ElemIteratorPtr | GetElements () const =0 |
| int | GetID (const int theIndex) |
| virtual | ~SMESHDS_GroupBase () |
| void | SetColor (const Quantity_Color &theColor) |
| Quantity_Color | GetColor () const |
| void | SetColorGroup (int theColorGroup) |
| int | GetColorGroup () const |
Protected Member Functions | |
| const SMDS_MeshElement * | findInMesh (const int theID) const |
| void | resetIterator () |
| Internal method: resets cached iterator, should be called by ancestors when they are modified (ex: Add() or Remove() ) | |
Private Member Functions | |
| SMESHDS_GroupBase (const SMESHDS_GroupBase &theOther) | |
| SMESHDS_GroupBase & | operator= (const SMESHDS_GroupBase &theOther) |
Private Attributes | |
| int | myID |
| const SMESHDS_Mesh * | myMesh |
| SMDSAbs_ElementType | myType |
| std::string | myStoreName |
| int | myCurIndex |
| int | myCurID |
| SMDS_ElemIteratorPtr | myIterator |
| Quantity_Color | myColor |
Definition at line 41 of file SMESHDS_GroupBase.hxx.
| SMESHDS_GroupBase::SMESHDS_GroupBase | ( | const int | theID, |
| const SMESHDS_Mesh * | theMesh, | ||
| const SMDSAbs_ElementType | theType | ||
| ) |
Definition at line 41 of file SMESHDS_GroupBase.cxx.
References myColor.
:
myID(theID), myMesh(theMesh), myType(theType), myStoreName(""),
myCurIndex(0), myCurID(-1)
{
myColor = Quantity_Color( 0.0, 0.0, 0.0, Quantity_TOC_RGB );
}
| virtual SMESHDS_GroupBase.~SMESHDS_GroupBase | ( | ) | [virtual] |
Definition at line 74 of file SMESHDS_GroupBase.hxx.
{}
| SMESHDS_GroupBase.SMESHDS_GroupBase | ( | const SMESHDS_GroupBase & | theOther | ) | [private] |
Reimplemented in SMESHDS_Group, and SMESHDS_GroupOnGeom.
Definition at line 134 of file SMESHDS_GroupBase.cxx.
References GetElements().
Referenced by Contains(), SMESH_GroupBase_i.Contains(), and SMESH_MeshEditor.generateGroups().
{
if ( SMDS_ElemIteratorPtr it = GetElements() ) {
while ( it->more() )
if ( it->next()->GetID() == theID )
return true;
}
return false;
}
| bool SMESHDS_GroupBase::Contains | ( | const SMDS_MeshElement * | elem | ) | [virtual] |
Reimplemented in SMESHDS_Group, and SMESHDS_GroupOnGeom.
Definition at line 149 of file SMESHDS_GroupBase.cxx.
References Contains(), and SMDS_MeshElement.GetID().
| int SMESHDS_GroupBase::Extent | ( | ) | [virtual] |
Reimplemented in SMESHDS_Group.
Definition at line 108 of file SMESHDS_GroupBase.cxx.
References GetElements().
Referenced by SMESH_GroupBase_i.GetListOfID(), SMESH_GroupBase_i.GetMeshInfo(), DriverUNV_W_SMDS_Mesh.Perform(), SMESH.Controls.GroupColor.SetMesh(), and SMESH_GroupBase_i.Size().
{
SMDS_ElemIteratorPtr it = GetElements();
int nb = 0;
if ( it )
for ( ; it->more(); it->next() )
nb++;
return nb;
}
| const SMDS_MeshElement * SMESHDS_GroupBase::findInMesh | ( | const int | theID | ) | const [protected] |
Definition at line 76 of file SMESHDS_GroupBase.cxx.
References SMDS_Mesh.FindElement(), SMDS_Mesh.FindNode(), GetMesh(), SMDS_MeshElement.GetType(), GetType(), SMDSAbs_All, and SMDSAbs_Node.
Referenced by SMESHDS_Group.Add(), SMESHDS_GroupOnGeom.Contains(), SMESHDS_Group.Contains(), and SMESHDS_Group.Remove().
{
SMDSAbs_ElementType aType = GetType();
const SMDS_MeshElement* aElem = NULL;
if (aType == SMDSAbs_Node) {
aElem = GetMesh()->FindNode(theID);
}
else if (aType != SMDSAbs_All) {
aElem = GetMesh()->FindElement(theID);
if (aElem && aType != aElem->GetType())
aElem = NULL;
}
return aElem;
}
| Quantity_Color SMESHDS_GroupBase.GetColor | ( | ) | const |
Definition at line 79 of file SMESHDS_GroupBase.hxx.
Referenced by SMESH_GroupBase_i.GetColor(), GetColorGroup(), DriverMED_Family.Init(), and SMESH.Controls.GroupColor.SetMesh().
{ return myColor;}
| int SMESHDS_GroupBase::GetColorGroup | ( | ) | const |
Definition at line 195 of file SMESHDS_GroupBase.cxx.
References GetColor().
Referenced by SMESH_GroupBase_i.GetColorNumber().
| virtual SMDS_ElemIteratorPtr SMESHDS_GroupBase.GetElements | ( | ) | const [pure virtual] |
Implemented in SMESHDS_Group, and SMESHDS_GroupOnGeom.
Referenced by Contains(), SMESH_Mesh.ConvertToStandalone(), SMESH_Gen_i.CopyMesh(), Extent(), GetID(), SMESH_GroupBase_i.GetMeshInfo(), StdMeshers_Import_1D.importMesh(), DriverMED_Family.Init(), IsEmpty(), and DriverUNV_W_SMDS_Mesh.Perform().
Definition at line 56 of file SMESHDS_GroupBase.cxx.
References GetElements(), myCurID, myCurIndex, and myIterator.
{
if (myCurIndex < 1 || myCurIndex > theIndex) {
myIterator = GetElements();
myCurIndex = 0;
myCurID = -1;
}
while (myCurIndex < theIndex && myIterator->more()) {
myCurIndex++;
myCurID = myIterator->next()->GetID();
}
return myCurIndex == theIndex ? myCurID : -1;
}
| int SMESHDS_GroupBase.GetID | ( | ) | const |
Definition at line 49 of file SMESHDS_GroupBase.hxx.
Referenced by SMESH_GroupBase_i.GetID(), SMESH_GroupBase_i.GetListOfID(), DriverUNV_W_SMDS_Mesh.Perform(), SMESH_Gen_i.Save(), and SMESH.Controls.GroupColor.SetMesh().
{ return myID; }
| const SMESHDS_Mesh* SMESHDS_GroupBase.GetMesh | ( | ) | const |
Definition at line 51 of file SMESHDS_GroupBase.hxx.
Referenced by ChangeByPredicate(), findInMesh(), StdMeshers_ImportSource1D.GetSourceMeshes(), and SMESHDS_GroupOnGeom.SetShape().
{ return myMesh; }
| const char* SMESHDS_GroupBase.GetStoreName | ( | ) | const |
Definition at line 59 of file SMESHDS_GroupBase.hxx.
Referenced by SMESH_MeshEditor.generateGroups(), DriverMED_R_SMESHDS_Mesh.GetGroup(), DriverMED_Family.Init(), DriverUNV_W_SMDS_Mesh.Perform(), and SMESH_Gen_i.Save().
{ return myStoreName.c_str(); }
| SMDSAbs_ElementType SMESHDS_GroupBase.GetType | ( | ) | const |
Definition at line 55 of file SMESHDS_GroupBase.hxx.
Referenced by SMESH_Mesh.ConvertToStandalone(), SMESH_Gen_i.CopyMesh(), findInMesh(), SMESH_MeshEditor.generateGroups(), SMESHDS_GroupOnGeom.GetElements(), DriverMED_R_SMESHDS_Mesh.GetGroup(), SMESH_GroupBase_i.GetType(), StdMeshers_Import_1D.importMesh(), DriverMED_Family.Init(), DriverUNV_W_SMDS_Mesh.Perform(), SMESH.Controls.GroupColor.SetMesh(), and SMESHDS_Group.SetType().
{ return myType; }
| bool SMESHDS_GroupBase::IsEmpty | ( | ) | [virtual] |
Reimplemented in SMESHDS_Group.
Definition at line 123 of file SMESHDS_GroupBase.cxx.
References GetElements().
Referenced by SMESH_MeshEditor.generateGroups(), and SMESH_GroupBase_i.IsEmpty().
{
SMDS_ElemIteratorPtr it = GetElements();
return ( !it || !it->more() );
}
| SMESHDS_GroupBase& SMESHDS_GroupBase.operator= | ( | const SMESHDS_GroupBase & | theOther | ) | [private] |
| void SMESHDS_GroupBase::resetIterator | ( | ) | [protected] |
Internal method: resets cached iterator, should be called by ancestors when they are modified (ex: Add() or Remove() )
Definition at line 97 of file SMESHDS_GroupBase.cxx.
References myCurID, and myCurIndex.
Referenced by SMESHDS_Group.Add(), SMESHDS_Group.Clear(), and SMESHDS_Group.Remove().
{
myCurIndex = 0;
myCurID = -1;
}
| void SMESHDS_GroupBase.SetColor | ( | const Quantity_Color & | theColor | ) |
Definition at line 76 of file SMESHDS_GroupBase.hxx.
Referenced by SMESH_Gen_i.Load(), SMESH_GroupBase_i.SetColor(), and SetColorGroup().
{ myColor = theColor;}
| void SMESHDS_GroupBase::SetColorGroup | ( | int | theColorGroup | ) |
Definition at line 171 of file SMESHDS_GroupBase.cxx.
References SetColor().
Referenced by DriverMED_R_SMESHDS_Mesh.GetGroup(), and SMESH_GroupBase_i.SetColorNumber().
{
int aRed = ( theColorGroup/1000000 );
int aGreen = ( theColorGroup -aRed*1000000)/1000;
int aBlue = ( theColorGroup - aRed*1000000 - aGreen*1000 );
double aR = aRed/255.0;
double aG = aGreen/255.0;
double aB = aBlue/255.0;
if ( aR < 0. || aR > 1. || // PAL19395
aG < 0. || aG > 1. ||
aB < 0. || aB > 1. )
// #ifdef _DEBUG_
// cout << "SMESHDS_GroupBase::SetColorGroup("<<theColorGroup<<"), invalid color ignored"<<endl;
// #endif
return;
Quantity_Color aColor( aR, aG, aB, Quantity_TOC_RGB );
SetColor( aColor );
}
| void SMESHDS_GroupBase.SetStoreName | ( | const char * | theName | ) |
Definition at line 57 of file SMESHDS_GroupBase.hxx.
Referenced by SMESH_Mesh.ExportUNV(), SMESH_MeshEditor.generateGroups(), SMESH_Gen_i.Load(), SMESH_Mesh.MEDToMesh(), SMESH_Gen_i.Save(), and SMESH_Mesh.UNVToMesh().
{ myStoreName = theName; }
| void SMESHDS_GroupBase::SetType | ( | SMDSAbs_ElementType | theType | ) | [virtual] |
Reimplemented in SMESHDS_Group.
Definition at line 161 of file SMESHDS_GroupBase.cxx.
References myType.
{
myType = theType;
}
Quantity_Color SMESHDS_GroupBase.myColor [private] |
Definition at line 104 of file SMESHDS_GroupBase.hxx.
Referenced by SMESHDS_GroupBase().
int SMESHDS_GroupBase.myCurID [private] |
Definition at line 102 of file SMESHDS_GroupBase.hxx.
Referenced by GetID(), and resetIterator().
int SMESHDS_GroupBase.myCurIndex [private] |
Definition at line 101 of file SMESHDS_GroupBase.hxx.
Referenced by GetID(), and resetIterator().
int SMESHDS_GroupBase.myID [private] |
Definition at line 96 of file SMESHDS_GroupBase.hxx.
Definition at line 103 of file SMESHDS_GroupBase.hxx.
Referenced by GetID().
const SMESHDS_Mesh* SMESHDS_GroupBase.myMesh [private] |
Definition at line 97 of file SMESHDS_GroupBase.hxx.
std::string SMESHDS_GroupBase.myStoreName [private] |
Definition at line 99 of file SMESHDS_GroupBase.hxx.
SMDSAbs_ElementType SMESHDS_GroupBase.myType [private] |
Definition at line 98 of file SMESHDS_GroupBase.hxx.
Referenced by SetType().