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; ColorMap aColorMap;
for (aGroupsIter = theGroups.begin(); aGroupsIter != theGroups.end(); aGroupsIter++) 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; bool isFound = false;
for (ColorMap::iterator aColorIter = aColorMap.begin(); aColorIter != aColorMap.end(); aColorIter++) 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(); ColorMap::const_iterator aColorIter = theColorMap.begin();
for (; aColorIter != theColorMap.end(); aColorIter++) 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; SALOMEDS::Color aColor = aColorIter->second;
if( CompareColors( theGroup->GetColor(), aColor ) ) if( CompareColors( aGroupColor, aColor ) )
{ {
myGroupAttributVal = aColorIter->first; myGroupAttributVal = aColorIter->first;
break; break;

View File

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

View File

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

View File

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

View File

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

View File

@ -43,9 +43,7 @@ SMESHDS_GroupBase::SMESHDS_GroupBase (const int theID,
myID(theID), myMesh(theMesh), myType(theType), myStoreName(""), myID(theID), myMesh(theMesh), myType(theType), myStoreName(""),
myCurIndex(0), myCurID(-1) myCurIndex(0), myCurID(-1)
{ {
myColor.R = 0.f; myColor = Quantity_Color( 0.0, 0.0, 0.0, Quantity_TOC_RGB );
myColor.G = 0.f;
myColor.B = 0.f;
} }
//============================================================================= //=============================================================================
@ -151,3 +149,35 @@ void SMESHDS_GroupBase::SetType(SMDSAbs_ElementType theType)
{ {
myType = 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 <string>
#include "SMDSAbs_ElementType.hxx" #include "SMDSAbs_ElementType.hxx"
#include "SMDS_MeshElement.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_Mesh;
class SMESHDS_EXPORT SMESHDS_GroupBase class SMESHDS_EXPORT SMESHDS_GroupBase
@ -72,11 +70,15 @@ class SMESHDS_EXPORT SMESHDS_GroupBase
virtual ~SMESHDS_GroupBase() {} virtual ~SMESHDS_GroupBase() {}
void SetColor (const SALOMEDS::Color& theColor) void SetColor (const Quantity_Color& theColor)
{ myColor = theColor;} { myColor = theColor;}
SALOMEDS::Color GetColor() const Quantity_Color GetColor() const
{ return myColor;} { return myColor;}
void SetColorGroup (int theColorGroup);
int GetColorGroup() const;
protected: protected:
const SMDS_MeshElement* findInMesh (const int theID) const; const SMDS_MeshElement* findInMesh (const int theID) const;
@ -96,7 +98,7 @@ class SMESHDS_EXPORT SMESHDS_GroupBase
int myCurIndex; int myCurIndex;
int myCurID; int myCurID;
SMDS_ElemIteratorPtr myIterator; SMDS_ElemIteratorPtr myIterator;
SALOMEDS::Color myColor; Quantity_Color myColor;
}; };
#endif #endif

View File

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

View File

@ -428,7 +428,15 @@ SALOMEDS::Color SMESH_GroupBase_i::GetColor()
{ {
SMESHDS_GroupBase* aGroupDS = GetGroupDS(); SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS) 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"); MESSAGE("get color of a group");
return SALOMEDS::Color(); return SALOMEDS::Color();
} }
@ -442,7 +450,38 @@ void SMESH_GroupBase_i::SetColor(const SALOMEDS::Color& color)
{ {
SMESHDS_GroupBase* aGroupDS = GetGroupDS(); SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS) 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"); MESSAGE("set color of a group");
return ; 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); void SetColor(const SALOMEDS::Color& color);
SALOMEDS::Color GetColor(); SALOMEDS::Color GetColor();
void SetColorNumber(CORBA::Long color);
CORBA::Long GetColorNumber();
private: private:
SMESH_Mesh_i* myMeshServant; SMESH_Mesh_i* myMeshServant;
int myLocalID; int myLocalID;