X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHDS%2FSMESHDS_GroupBase.cxx;h=b14afd408ff1ac732e937a202c6c2df5e49d1daf;hp=c4adcc53b6921a4ce7aeb6c6e789722b7cbfea1c;hb=0635c9fc80f67d1e5dc0e94ec85f487286a92070;hpb=92595f008083c36efe3fb4d5005655ef12582ad0 diff --git a/src/SMESHDS/SMESHDS_GroupBase.cxx b/src/SMESHDS/SMESHDS_GroupBase.cxx index c4adcc53b..b14afd408 100644 --- a/src/SMESHDS/SMESHDS_GroupBase.cxx +++ b/src/SMESHDS/SMESHDS_GroupBase.cxx @@ -1,29 +1,29 @@ -// SMESH SMESHDS : idl implementation based on 'SMESH' unit's classes +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2004 CEA -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// SMESH SMESHDS : idl implementation based on 'SMESH' unit's classes // File : SMESHDS_Group.cxx // Module : SMESH // $Header$ - +// #include "SMESHDS_GroupBase.hxx" #include "SMESHDS_Mesh.hxx" @@ -43,6 +43,7 @@ SMESHDS_GroupBase::SMESHDS_GroupBase (const int theID, myID(theID), myMesh(theMesh), myType(theType), myStoreName(""), myCurIndex(0), myCurID(-1) { + myColor = Quantity_Color( 0.0, 0.0, 0.0, Quantity_TOC_RGB ); } //============================================================================= @@ -131,12 +132,24 @@ bool SMESHDS_GroupBase::IsEmpty() bool SMESHDS_GroupBase::Contains (const int theID) { - SMDS_ElemIteratorPtr it = GetElements(); - bool contains = false; - if ( it ) - while ( !contains && it->more() ) - contains = ( it->next()->GetID() == theID ); - return contains; + if ( SMDS_ElemIteratorPtr it = GetElements() ) { + while ( it->more() ) + if ( it->next()->GetID() == theID ) + return true; + } + return false; +} + +//======================================================================= +//function : Contains +//purpose : +//======================================================================= + +bool SMESHDS_GroupBase::Contains (const SMDS_MeshElement* elem) +{ + if ( elem ) + return Contains( elem->GetID() ); + return false; } //======================================================================= @@ -148,3 +161,47 @@ void SMESHDS_GroupBase::SetType(SMDSAbs_ElementType theType) { myType = theType; } + +//======================================================================= +//function : SetType +//purpose : +//======================================================================= + +void SMESHDS_GroupBase::SetColorGroup(int theColorGroup) +{ + 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("<