Color Number (Color Group) parameter is returned for compatibility

This commit is contained in:
ouv 2007-11-16 13:02:19 +00:00
parent dbacb15bb5
commit 64c772da5a
10 changed files with 103 additions and 31 deletions

View File

@ -217,7 +217,11 @@ DriverMED_Family
ColorMap aColorMap;
for (aGroupsIter = theGroups.begin(); aGroupsIter != theGroups.end(); aGroupsIter++)
{
SALOMEDS::Color aColor = (*aGroupsIter)->GetColor();
Quantity_Color aQColor = (*aGroupsIter)->GetColor();
SALOMEDS::Color aColor;
aColor.R = aQColor.Red();
aColor.G = aQColor.Green();
aColor.B = aQColor.Blue();
bool isFound = false;
for (ColorMap::iterator aColorIter = aColorMap.begin(); aColorIter != aColorMap.end(); aColorIter++)
@ -418,8 +422,14 @@ void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup, const ColorMap& theCol
ColorMap::const_iterator aColorIter = theColorMap.begin();
for (; aColorIter != theColorMap.end(); aColorIter++)
{
Quantity_Color aGroupQColor = theGroup->GetColor();
SALOMEDS::Color aGroupColor;
aGroupColor.R = aGroupQColor.Red();
aGroupColor.G = aGroupQColor.Green();
aGroupColor.B = aGroupQColor.Blue();
SALOMEDS::Color aColor = aColorIter->second;
if( CompareColors( theGroup->GetColor(), aColor ) )
if( CompareColors( aGroupColor, aColor ) )
{
myGroupAttributVal = aColorIter->first;
break;

View File

@ -38,6 +38,10 @@
#include <boost/shared_ptr.hpp>
#include <set>
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SALOMEDS)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
#define REST_NODES_FAMILY 1
#define REST_EDGES_FAMILY -1
#define REST_FACES_FAMILY -2

View File

@ -87,8 +87,6 @@ libSMESHimpl_la_CPPFLAGS = \
$(GEOM_CXX_FLAGS) \
$(BOOST_CPPFLAGS) \
$(CAS_CPPFLAGS) \
$(CORBA_CXXFLAGS) \
$(CORBA_INCLUDES) \
@HDF5_INCLUDES@ \
-I$(srcdir)/../Controls \
-I$(srcdir)/../Driver \

View File

@ -35,10 +35,6 @@
#include <string>
#include <TopoDS_Shape.hxx>
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SALOMEDS)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
class SMESHDS_GroupBase;
class SMESH_Mesh;
@ -59,9 +55,6 @@ class SMESH_EXPORT SMESH_Group
SMESHDS_GroupBase * GetGroupDS () { return myGroupDS; }
void SetColor (const SALOMEDS::Color& theColor) { myColor = theColor; }
SALOMEDS::Color GetColor() const { return myColor; }
private:
SMESH_Group (const SMESH_Group& theOther);
// prohibited copy constructor
@ -70,8 +63,6 @@ class SMESH_EXPORT SMESH_Group
SMESHDS_GroupBase * myGroupDS;
std::string myName;
int myColorNumber;
SALOMEDS::Color myColor;
};
#endif

View File

@ -61,8 +61,6 @@ dist_libSMESHDS_la_SOURCES = \
libSMESHDS_la_CPPFLAGS = \
$(KERNEL_CXXFLAGS) \
$(CAS_CPPFLAGS) \
$(CORBA_CXXFLAGS) \
$(CORBA_INCLUDES) \
$(BOOST_CPPFLAGS) \
-I$(srcdir)/../SMDS

View File

@ -43,9 +43,7 @@ SMESHDS_GroupBase::SMESHDS_GroupBase (const int theID,
myID(theID), myMesh(theMesh), myType(theType), myStoreName(""),
myCurIndex(0), myCurID(-1)
{
myColor.R = 0.f;
myColor.G = 0.f;
myColor.B = 0.f;
myColor = Quantity_Color( 0.0, 0.0, 0.0, Quantity_TOC_RGB );
}
//=============================================================================
@ -151,3 +149,35 @@ void SMESHDS_GroupBase::SetType(SMDSAbs_ElementType theType)
{
myType = theType;
}
//=======================================================================
//function : SetType
//purpose :
//=======================================================================
void SMESHDS_GroupBase::SetColorGroup(int theColorGroup)
{
if( theColorGroup < 0 || theColorGroup > 360 )
{
MESSAGE("SMESHDS_GroupBase::SetColorGroup : Value must be in range [0,360]");
return;
}
Quantity_Color aColor( (double)theColorGroup, 1.0, 1.0, Quantity_TOC_HLS );
SetColor( aColor );
}
//=======================================================================
//function : SetType
//purpose :
//=======================================================================
int SMESHDS_GroupBase::GetColorGroup() const
{
Quantity_Color aColor = GetColor();
double aHue = aColor.Hue();
if( aHue < 0 )
return 0;
return (int)( aHue );
}

View File

@ -32,11 +32,9 @@
#include <string>
#include "SMDSAbs_ElementType.hxx"
#include "SMDS_MeshElement.hxx"
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SALOMEDS)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
#include <Quantity_Color.hxx>
class SMESHDS_Mesh;
class SMESHDS_EXPORT SMESHDS_GroupBase
@ -72,11 +70,15 @@ class SMESHDS_EXPORT SMESHDS_GroupBase
virtual ~SMESHDS_GroupBase() {}
void SetColor (const SALOMEDS::Color& theColor)
void SetColor (const Quantity_Color& theColor)
{ myColor = theColor;}
SALOMEDS::Color GetColor() const
Quantity_Color GetColor() const
{ return myColor;}
void SetColorGroup (int theColorGroup);
int GetColorGroup() const;
protected:
const SMDS_MeshElement* findInMesh (const int theID) const;
@ -96,7 +98,7 @@ class SMESHDS_EXPORT SMESHDS_GroupBase
int myCurIndex;
int myCurID;
SMDS_ElemIteratorPtr myIterator;
SALOMEDS::Color myColor;
Quantity_Color myColor;
};
#endif

View File

@ -3502,10 +3502,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
double* anRGB = new double[ size ];
aDataset->ReadFromDisk( anRGB );
aDataset->CloseOnDisk();
SALOMEDS::Color aColor;
aColor.R = anRGB[0];
aColor.G = anRGB[1];
aColor.B = anRGB[2];
Quantity_Color aColor( anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB );
aGroupBaseDS->SetColor( aColor );
}

View File

@ -428,7 +428,15 @@ SALOMEDS::Color SMESH_GroupBase_i::GetColor()
{
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS)
return aGroupDS->GetColor();
{
Quantity_Color aQColor = aGroupDS->GetColor();
SALOMEDS::Color aColor;
aColor.R = aQColor.Red();
aColor.G = aQColor.Green();
aColor.B = aQColor.Blue();
return aColor;
}
MESSAGE("get color of a group");
return SALOMEDS::Color();
}
@ -442,7 +450,38 @@ void SMESH_GroupBase_i::SetColor(const SALOMEDS::Color& color)
{
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS)
return aGroupDS->SetColor(color);
{
Quantity_Color aQColor( color.R, color.G, color.B, Quantity_TOC_RGB );
return aGroupDS->SetColor(aQColor);
}
MESSAGE("set color of a group");
return ;
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_GroupBase_i::GetColorNumber()
{
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS)
return aGroupDS->GetColorGroup();
MESSAGE("get color number of a group");
return 0;
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_GroupBase_i::SetColorNumber(CORBA::Long color)
{
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS)
return aGroupDS->SetColorGroup(color);
MESSAGE("set color number of a group");
return ;
}

View File

@ -78,6 +78,9 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
void SetColor(const SALOMEDS::Color& color);
SALOMEDS::Color GetColor();
void SetColorNumber(CORBA::Long color);
CORBA::Long GetColorNumber();
private:
SMESH_Mesh_i* myMeshServant;
int myLocalID;