1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0029402: In OCCT7.2.1-dev the names written into a FSD_File are associated with the wrong shapes.

The issue of incorrect Roots indexing is fixed by changing DataMap to IndexedDataMap.
Draw command fsdread was improved to allow restoring of shapes with kept names.
This commit is contained in:
szy
2017-12-27 17:28:54 +03:00
committed by apn
parent 44f2982356
commit 409095ba18
4 changed files with 118 additions and 29 deletions

View File

@@ -19,8 +19,9 @@
#include <StdStorage_Root.hxx>
#include <TCollection_AsciiString.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_IndexedDataMap.hxx>
typedef NCollection_DataMap<TCollection_AsciiString, Handle(StdStorage_Root), TCollection_AsciiString> StdStorage_MapOfRoots;
typedef NCollection_DataMap<TCollection_AsciiString, Handle(StdStorage_Root), TCollection_AsciiString>::Iterator StdStorage_DataMapIteratorOfMapOfRoots;
typedef NCollection_IndexedDataMap<TCollection_AsciiString, Handle(StdStorage_Root), TCollection_AsciiString> StdStorage_MapOfRoots;
typedef NCollection_IndexedDataMap<TCollection_AsciiString, Handle(StdStorage_Root), TCollection_AsciiString>::Iterator StdStorage_DataMapIteratorOfMapOfRoots;
#endif // StdStorage_MapOfRoots_HeaderFile

View File

@@ -66,7 +66,7 @@ Standard_Boolean StdStorage_RootData::Read(Storage_BaseDriver& theDriver)
}
Handle(StdStorage_Root) aRoot = new StdStorage_Root(aRootName, aRef, aTypeName);
myObjects.Bind(aRootName, aRoot);
myObjects.Add(aRootName, aRoot);
}
myErrorStatus = theDriver.EndReadRootSection();
@@ -132,7 +132,7 @@ Standard_Integer StdStorage_RootData::NumberOfRoots() const
void StdStorage_RootData::AddRoot(const Handle(StdStorage_Root)& aRoot)
{
myObjects.Bind(aRoot->Name(), aRoot);
myObjects.Add(aRoot->Name(), aRoot);
aRoot->myRef = myObjects.Size();
}
@@ -151,9 +151,8 @@ Handle(StdStorage_HSequenceOfRoots) StdStorage_RootData::Roots() const
Handle(StdStorage_Root) StdStorage_RootData::Find(const TCollection_AsciiString& aName) const
{
Handle(StdStorage_Root) p;
if (myObjects.IsBound(aName)) {
p = myObjects.Find(aName);
if (myObjects.Contains(aName)) {
p = myObjects.FindFromKey(aName);
}
return p;
@@ -161,14 +160,14 @@ Handle(StdStorage_Root) StdStorage_RootData::Find(const TCollection_AsciiString&
Standard_Boolean StdStorage_RootData::IsRoot(const TCollection_AsciiString& aName) const
{
return myObjects.IsBound(aName);
return myObjects.Contains(aName);
}
void StdStorage_RootData::RemoveRoot(const TCollection_AsciiString& aName)
{
if (myObjects.IsBound(aName)) {
myObjects.ChangeFind(aName)->myRef = 0;
myObjects.UnBind(aName);
if (myObjects.Contains(aName)) {
myObjects.ChangeFromKey(aName)->myRef = 0;
myObjects.RemoveKey(aName);
Standard_Integer aRef = 1;
for (StdStorage_MapOfRoots::Iterator anIt(myObjects); anIt.More(); anIt.Next(), ++aRef)
anIt.ChangeValue()->myRef = aRef;