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

SMESHDS_GroupOnGeom Class Reference

#include <SMESHDS_GroupOnGeom.hxx>

Inheritance diagram for SMESHDS_GroupOnGeom:
Inheritance graph
[legend]

Public Member Functions

 SMESHDS_GroupOnGeom (const int theID, const SMESHDS_Mesh *theMesh, const SMDSAbs_ElementType theType, const TopoDS_Shape &theShape)
void SetShape (const TopoDS_Shape &theShape)
TopoDS_Shape GetShape () const
virtual bool Contains (const int theID)
virtual bool Contains (const SMDS_MeshElement *elem)
virtual SMDS_ElemIteratorPtr GetElements () const
int GetID () const
int GetID (const int theIndex)
const SMESHDS_MeshGetMesh () 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 ()
void SetColor (const Quantity_Color &theColor)
Quantity_Color GetColor () const
void SetColorGroup (int theColorGroup)
int GetColorGroup () const

Protected Member Functions

const SMDS_MeshElementfindInMesh (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 Attributes

TopoDS_Shape myShape
const SMESHDS_SubMeshmySubMesh

Detailed Description

Definition at line 37 of file SMESHDS_GroupOnGeom.hxx.


Constructor & Destructor Documentation

SMESHDS_GroupOnGeom::SMESHDS_GroupOnGeom ( const int  theID,
const SMESHDS_Mesh theMesh,
const SMDSAbs_ElementType  theType,
const TopoDS_Shape &  theShape 
)

Definition at line 39 of file SMESHDS_GroupOnGeom.cxx.

References SetShape().

     : SMESHDS_GroupBase(theID,theMesh,theType)
{
  SetShape( theShape );
}

Member Function Documentation

bool SMESHDS_GroupOnGeom::Contains ( const int  theID) [virtual]

Reimplemented from SMESHDS_GroupBase.

Definition at line 116 of file SMESHDS_GroupOnGeom.cxx.

References SMESHDS_SubMesh.Contains(), SMESHDS_GroupBase.findInMesh(), and mySubMesh.

{
  return mySubMesh->Contains( findInMesh( theID ));
}
bool SMESHDS_GroupOnGeom::Contains ( const SMDS_MeshElement elem) [virtual]

Reimplemented from SMESHDS_GroupBase.

Definition at line 126 of file SMESHDS_GroupOnGeom.cxx.

References SMESHDS_SubMesh.Contains(), and mySubMesh.

{
  return mySubMesh->Contains( elem );
}
int SMESHDS_GroupBase::Extent ( ) [virtual, inherited]

Reimplemented in SMESHDS_Group.

Definition at line 108 of file SMESHDS_GroupBase.cxx.

References SMESHDS_GroupBase.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, inherited]

Definition at line 76 of file SMESHDS_GroupBase.cxx.

References SMDS_Mesh.FindElement(), SMDS_Mesh.FindNode(), SMESHDS_GroupBase.GetMesh(), SMDS_MeshElement.GetType(), SMESHDS_GroupBase.GetType(), SMDSAbs_All, and SMDSAbs_Node.

Referenced by SMESHDS_Group.Add(), 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 [inherited]
int SMESHDS_GroupBase::GetColorGroup ( ) const [inherited]

Definition at line 195 of file SMESHDS_GroupBase.cxx.

References SMESHDS_GroupBase.GetColor().

Referenced by SMESH_GroupBase_i.GetColorNumber().

{
  Quantity_Color aColor = GetColor();
  double aRed = aColor.Red();
  double aGreen = aColor.Green();
  double aBlue = aColor.Blue();
  int aR = int( aRed  *255 );
  int aG = int( aGreen*255 );
  int aB = int( aBlue *255 );
  int aRet = (int)(aR*1000000 + aG*1000 + aB);

  return aRet;
}
SMDS_ElemIteratorPtr SMESHDS_GroupOnGeom::GetElements ( ) const [virtual]

Implements SMESHDS_GroupBase.

Definition at line 106 of file SMESHDS_GroupOnGeom.cxx.

References SMESHDS_GroupBase.GetType(), and mySubMesh.

int SMESHDS_GroupBase.GetID ( ) const [inherited]
int SMESHDS_GroupBase::GetID ( const int  theIndex) [inherited]

Definition at line 56 of file SMESHDS_GroupBase.cxx.

References SMESHDS_GroupBase.GetElements(), SMESHDS_GroupBase.myCurID, SMESHDS_GroupBase.myCurIndex, and SMESHDS_GroupBase.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;
}
const SMESHDS_Mesh* SMESHDS_GroupBase.GetMesh ( ) const [inherited]
TopoDS_Shape SMESHDS_GroupOnGeom.GetShape ( ) const

Definition at line 48 of file SMESHDS_GroupOnGeom.hxx.

Referenced by SMESH_Mesh_i.CheckGeomGroupModif(), and SMESH_GroupOnGeom_i.GetShape().

{ return myShape; }
const char* SMESHDS_GroupBase.GetStoreName ( ) const [inherited]
SMDSAbs_ElementType SMESHDS_GroupBase.GetType ( ) const [inherited]
bool SMESHDS_GroupBase::IsEmpty ( ) [virtual, inherited]

Reimplemented in SMESHDS_Group.

Definition at line 123 of file SMESHDS_GroupBase.cxx.

References SMESHDS_GroupBase.GetElements().

Referenced by SMESH_MeshEditor.generateGroups(), and SMESH_GroupBase_i.IsEmpty().

{
  SMDS_ElemIteratorPtr it = GetElements();
  return ( !it || !it->more() );
}
void SMESHDS_GroupBase::resetIterator ( ) [protected, inherited]

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 SMESHDS_GroupBase.myCurID, and SMESHDS_GroupBase.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) [inherited]
void SMESHDS_GroupBase::SetColorGroup ( int  theColorGroup) [inherited]

Definition at line 171 of file SMESHDS_GroupBase.cxx.

References SMESHDS_GroupBase.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_GroupOnGeom::SetShape ( const TopoDS_Shape &  theShape)
void SMESHDS_GroupBase.SetStoreName ( const char *  theName) [inherited]
void SMESHDS_GroupBase::SetType ( SMDSAbs_ElementType  theType) [virtual, inherited]

Reimplemented in SMESHDS_Group.

Definition at line 161 of file SMESHDS_GroupBase.cxx.

References SMESHDS_GroupBase.myType.

{
  myType = theType;
}

Field Documentation

TopoDS_Shape SMESHDS_GroupOnGeom.myShape [private]

Definition at line 58 of file SMESHDS_GroupOnGeom.hxx.

Referenced by SetShape().

Definition at line 59 of file SMESHDS_GroupOnGeom.hxx.

Referenced by Contains(), GetElements(), and SetShape().

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