#include <SMESH_ControlsDef.hxx>

Public Member Functions | |
| GroupColor () | |
| virtual void | SetMesh (const SMDS_Mesh *theMesh) |
| virtual bool | IsSatisfy (long theElementId) |
| void | SetType (SMDSAbs_ElementType theType) |
| virtual SMDSAbs_ElementType | GetType () const |
| void | SetColorStr (const TCollection_AsciiString &) |
| void | GetColorStr (TCollection_AsciiString &) const |
Private Types | |
| typedef std::set< long > | TIDs |
Private Attributes | |
| Quantity_Color | myColor |
| SMDSAbs_ElementType | myType |
| TIDs | myIDs |
Definition at line 840 of file SMESH_ControlsDef.hxx.
typedef std::set< long > SMESH.Controls.GroupColor.TIDs [private] |
Definition at line 851 of file SMESH_ControlsDef.hxx.
| GroupColor::GroupColor | ( | ) |
Definition at line 2364 of file SMESH_Controls.cxx.
{
}
| void GroupColor::GetColorStr | ( | TCollection_AsciiString & | theResStr | ) | const |
Definition at line 2451 of file SMESH_Controls.cxx.
| SMDSAbs_ElementType GroupColor::GetType | ( | ) | const [virtual] |
Implements SMESH.Controls.Predicate.
Definition at line 2378 of file SMESH_Controls.cxx.
{
return myType;
}
| bool GroupColor::IsSatisfy | ( | long | theElementId | ) | [virtual] |
Implements SMESH.Controls.Predicate.
Definition at line 2368 of file SMESH_Controls.cxx.
| void GroupColor::SetColorStr | ( | const TCollection_AsciiString & | theStr | ) |
Definition at line 2429 of file SMESH_Controls.cxx.
{
TCollection_AsciiString aStr = theStr;
aStr.RemoveAll( ' ' );
aStr.RemoveAll( '\t' );
for ( int aPos = aStr.Search( ";;" ); aPos != -1; aPos = aStr.Search( ";;" ) )
aStr.Remove( aPos, 2 );
Standard_Real clr[3];
clr[0] = clr[1] = clr[2] = 0.;
for ( int i = 0; i < 3; i++ ) {
TCollection_AsciiString tmpStr = aStr.Token( ";", i+1 );
if ( !tmpStr.IsEmpty() && tmpStr.IsRealValue() )
clr[i] = tmpStr.RealValue();
}
myColor = Quantity_Color( clr[0], clr[1], clr[2], Quantity_TOC_RGB );
}
| void GroupColor::SetMesh | ( | const SMDS_Mesh * | theMesh | ) | [virtual] |
Implements SMESH.Controls.Functor.
Definition at line 2394 of file SMESH_Controls.cxx.
References SMESHDS_GroupBase.Extent(), SMESHDS_GroupBase.GetColor(), SMESHDS_Mesh.GetGroups(), SMESHDS_GroupBase.GetID(), SMESHDS_Mesh.GetNbGroups(), SMESHDS_GroupBase.GetType(), isEqual(), SMDSAbs_All, and SMDSAbs_Node.
{
myIDs.clear();
const SMESHDS_Mesh* aMesh = dynamic_cast<const SMESHDS_Mesh*>(theMesh);
if ( !aMesh )
return;
int nbGrp = aMesh->GetNbGroups();
if ( !nbGrp )
return;
// iterates on groups and find necessary elements ids
const std::set<SMESHDS_GroupBase*>& aGroups = aMesh->GetGroups();
set<SMESHDS_GroupBase*>::const_iterator GrIt = aGroups.begin();
for (; GrIt != aGroups.end(); GrIt++) {
SMESHDS_GroupBase* aGrp = (*GrIt);
if ( !aGrp )
continue;
// check type and color of group
if ( !isEqual( myColor, aGrp->GetColor() ) )
continue;
if ( myType != SMDSAbs_All && myType != (SMDSAbs_ElementType)aGrp->GetType() )
continue;
SMDSAbs_ElementType aGrpElType = (SMDSAbs_ElementType)aGrp->GetType();
if ( myType == aGrpElType || (myType == SMDSAbs_All && aGrpElType != SMDSAbs_Node) ) {
// add elements IDS into control
int aSize = aGrp->Extent();
for (int i = 0; i < aSize; i++)
myIDs.insert( aGrp->GetID(i+1) );
}
}
}
| void GroupColor::SetType | ( | SMDSAbs_ElementType | theType | ) |
Definition at line 2373 of file SMESH_Controls.cxx.
{
myType = theType;
}
Quantity_Color SMESH.Controls.GroupColor.myColor [private] |
Definition at line 853 of file SMESH_ControlsDef.hxx.
TIDs SMESH.Controls.GroupColor.myIDs [private] |
Definition at line 855 of file SMESH_ControlsDef.hxx.
Definition at line 854 of file SMESH_ControlsDef.hxx.