Version: 6.3.1
Public Member Functions | Private Types | Private Attributes

SMESH.Controls.GroupColor Class Reference

#include <SMESH_ControlsDef.hxx>

Inheritance diagram for SMESH.Controls.GroupColor:
Inheritance graph
[legend]

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

Detailed Description

Definition at line 840 of file SMESH_ControlsDef.hxx.


Member Typedef Documentation

typedef std::set< long > SMESH.Controls.GroupColor.TIDs [private]

Definition at line 851 of file SMESH_ControlsDef.hxx.


Constructor & Destructor Documentation

GroupColor::GroupColor ( )

Definition at line 2364 of file SMESH_Controls.cxx.

{
}

Member Function Documentation

void GroupColor::GetColorStr ( TCollection_AsciiString &  theResStr) const

Definition at line 2451 of file SMESH_Controls.cxx.

{
  theResStr.Clear();
  theResStr += TCollection_AsciiString( myColor.Red() );
  theResStr += TCollection_AsciiString( ";" ) + TCollection_AsciiString( myColor.Green() );
  theResStr += TCollection_AsciiString( ";" ) + TCollection_AsciiString( myColor.Blue() );
}
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.

{
  return (myIDs.find( theId ) != myIDs.end());
}
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;
}

Field Documentation

Quantity_Color SMESH.Controls.GroupColor.myColor [private]

Definition at line 853 of file SMESH_ControlsDef.hxx.

Definition at line 855 of file SMESH_ControlsDef.hxx.

Definition at line 854 of file SMESH_ControlsDef.hxx.

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS