return myElements.empty();
}
-bool CompareColors( const Quantity_Color& theColor, const Quantity_Color& theRefColor )
-{
- float aTolerance = 0.01;
- if( fabs( theColor.Red() - theRefColor.Red() ) < aTolerance &&
- fabs( theColor.Green() - theRefColor.Green() ) < aTolerance &&
- fabs( theColor.Blue() - theRefColor.Blue() ) < aTolerance )
- return true;
-
- return false;
-}
-
//=============================================================================
/*!
* Split each group from list <aGroups> on some parts (families)
}
// Process groups
- SMESHDS_GroupBasePtrList::const_iterator aGroupsIter;
-
- int id = 0;
- ColorMap aColorMap;
- for (aGroupsIter = theGroups.begin(); aGroupsIter != theGroups.end(); aGroupsIter++)
- {
- Quantity_Color aColor = (*aGroupsIter)->GetColor();
-
- bool isFound = false;
- for (ColorMap::iterator aColorIter = aColorMap.begin(); aColorIter != aColorMap.end(); aColorIter++)
- {
- Quantity_Color aRefColor = aColorIter->second;
- if( CompareColors( aColor, aRefColor ) )
- {
- isFound = true;
- break;
- }
- }
-
- if( !isFound )
- aColorMap[ id++ ] = aColor;
- }
-
- for (aGroupsIter = theGroups.begin(); aGroupsIter != theGroups.end(); aGroupsIter++)
+ SMESHDS_GroupBasePtrList::const_iterator aGroupsIter = theGroups.begin();
+ for (; aGroupsIter != theGroups.end(); aGroupsIter++)
{
DriverMED_FamilyPtr aFam2 (new DriverMED_Family);
- aFam2->Init(*aGroupsIter, aColorMap);
+ aFam2->Init(*aGroupsIter);
DriverMED_FamilyPtrList::iterator aFamsIter = aFamilies.begin();
while (aFamsIter != aFamilies.end())
* Initialize the tool by SMESHDS_GroupBase
*/
//=============================================================================
-void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup, const ColorMap& theColorMap)
+void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup)
{
// Elements
myElements.clear();
myGroupNames.clear();
myGroupNames.insert(string(theGroup->GetStoreName()));
- myGroupAttributVal = 0;
-
- ColorMap::const_iterator aColorIter = theColorMap.begin();
- for (; aColorIter != theColorMap.end(); aColorIter++)
- {
- if( CompareColors( theGroup->GetColor(), aColorIter->second ) )
- {
- myGroupAttributVal = aColorIter->first;
- break;
- }
- }
+ Quantity_Color aColor = theGroup->GetColor();
+ myGroupAttributVal = aColor.Hue();
}
//=============================================================================
typedef std::map<int,SMESHDS_SubMesh*> SMESHDS_SubMeshPtrMap;
typedef std::list<SMESHDS_GroupBase*> SMESHDS_GroupBasePtrList;
typedef std::set<const SMDS_MeshElement*> ElementsSet;
-typedef std::map<int,Quantity_Color> ColorMap;
class MESHDRIVERMED_EXPORT DriverMED_Family
{
private:
//! Initialize the tool by SMESHDS_GroupBase
- void Init (SMESHDS_GroupBase* theGroup, const ColorMap& theColorMap);
+ void Init (SMESHDS_GroupBase* group);
//! Split <theSubMesh> on some parts (families) on the basis of the elements type.
static