From e913c3429b8f45e35a5cfc97adb8b68e86ccd56a Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 5 Dec 2007 14:19:29 +0000 Subject: [PATCH] Fix for Bug IPAL17943 4.x: log file, generated by "mdump_V2_1" for the mesh with set color number differs from the initial one (3x) --- src/DriverMED/DriverMED_Family.cxx | 54 ++++-------------------------- src/DriverMED/DriverMED_Family.h | 3 +- 2 files changed, 7 insertions(+), 50 deletions(-) diff --git a/src/DriverMED/DriverMED_Family.cxx b/src/DriverMED/DriverMED_Family.cxx index c588008fc..16363f8e6 100644 --- a/src/DriverMED/DriverMED_Family.cxx +++ b/src/DriverMED/DriverMED_Family.cxx @@ -129,17 +129,6 @@ DriverMED_Family 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 on some parts (families) @@ -212,33 +201,11 @@ DriverMED_Family } // 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()) @@ -397,7 +364,7 @@ DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper, * 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(); @@ -414,17 +381,8 @@ void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup, const ColorMap& theCol 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(); } //============================================================================= diff --git a/src/DriverMED/DriverMED_Family.h b/src/DriverMED/DriverMED_Family.h index 0e6ede4cd..64ad65a56 100644 --- a/src/DriverMED/DriverMED_Family.h +++ b/src/DriverMED/DriverMED_Family.h @@ -51,7 +51,6 @@ typedef std::list DriverMED_FamilyPtrList; typedef std::map SMESHDS_SubMeshPtrMap; typedef std::list SMESHDS_GroupBasePtrList; typedef std::set ElementsSet; -typedef std::map ColorMap; class MESHDRIVERMED_EXPORT DriverMED_Family { @@ -108,7 +107,7 @@ 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 on some parts (families) on the basis of the elements type. static -- 2.39.2