mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0028782: Shape sewing behavior not consistent for the same CAD file
Get rid of iterations on maps with shape key by replacing simple maps with indexed maps. So iteration is done on integer key. The map containers have been updated to insert into them type definitions of key and value. The new methods RemoveKey() and RemoveFromIndex() have been added to indexed [data] map to be able to remove an arbitrary key from the map. All the code in OCCT has been updated where RemoveLast() and Substitute() methods were used to remove a key from indexed [data] map.
This commit is contained in:
@@ -49,8 +49,14 @@ template < class TheKeyType,
|
||||
class Hasher = NCollection_DefaultHasher<TheKeyType> >
|
||||
class NCollection_IndexedDataMap : public NCollection_BaseMap
|
||||
{
|
||||
public:
|
||||
//! STL-compliant typedef for key type
|
||||
typedef TheKeyType key_type;
|
||||
//! STL-compliant typedef for value type
|
||||
typedef TheItemType value_type;
|
||||
|
||||
private:
|
||||
//! Adaptation of the TListNode to the INDEXEDDatamap
|
||||
private:
|
||||
class IndexedDataMapNode : public NCollection_TListNode<TheItemType>
|
||||
{
|
||||
public:
|
||||
@@ -435,6 +441,27 @@ class NCollection_IndexedDataMap : public NCollection_BaseMap
|
||||
Decrement();
|
||||
}
|
||||
|
||||
//! Remove the key of the given index.
|
||||
//! Caution! The index of the last key can be changed.
|
||||
void RemoveFromIndex(const Standard_Integer theKey2)
|
||||
{
|
||||
Standard_OutOfRange_Raise_if(theKey2 < 1 || theKey2 > Extent(), "NCollection_IndexedDataMap::Remove");
|
||||
Standard_Integer aLastInd = Extent();
|
||||
if (theKey2 != aLastInd)
|
||||
Swap(theKey2, aLastInd);
|
||||
RemoveLast();
|
||||
}
|
||||
|
||||
//! Remove the given key.
|
||||
//! Caution! The index of the last key can be changed.
|
||||
void RemoveKey(const TheKeyType& theKey1)
|
||||
{
|
||||
Standard_Integer anIndToRemove = FindIndex(theKey1);
|
||||
if (anIndToRemove > 0) {
|
||||
RemoveFromIndex(anIndToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
//! FindKey
|
||||
const TheKeyType& FindKey (const Standard_Integer theKey2) const
|
||||
{
|
||||
|
Reference in New Issue
Block a user