mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0028564: Support of applications using old persistence (ShapeSchema)
1. Bug fix in reading old persistent data using FSD_File storage driver 2. Persistence compatible with legacy format was restored for shapes a. Implemented a storage read / write wrapper for legacy persistence b. Added DRAW commands to read / write files in legacy format c. Added test cases for reading / writing operations with checking number of sub-shapes and physical properties d. Updated related sections of the development guide
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <StdPersistent_TopLoc.hxx>
|
||||
#include <StdObjMgt_ReadData.hxx>
|
||||
#include <StdObjMgt_WriteData.hxx>
|
||||
#include <StdObject_gp_Trsfs.hxx>
|
||||
|
||||
|
||||
@@ -27,6 +28,11 @@ void StdPersistent_TopLoc::Datum3D::Read (StdObjMgt_ReadData& theReadData)
|
||||
myTransient = new TopLoc_Datum3D (aTrsf);
|
||||
}
|
||||
|
||||
void StdPersistent_TopLoc::Datum3D::Write(StdObjMgt_WriteData& theWriteData) const
|
||||
{
|
||||
theWriteData << myTransient->Transformation();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Read
|
||||
//purpose : Read persistent data from a file
|
||||
@@ -36,6 +42,26 @@ void StdPersistent_TopLoc::ItemLocation::Read (StdObjMgt_ReadData& theReadData)
|
||||
theReadData >> myDatum >> myPower >> myNext;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Write
|
||||
//purpose : Write persistent data to a file
|
||||
//=======================================================================
|
||||
void StdPersistent_TopLoc::ItemLocation::Write (StdObjMgt_WriteData& theWriteData) const
|
||||
{
|
||||
theWriteData << myDatum << myPower << myNext;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PChildren
|
||||
//purpose : Gets persistent child objects
|
||||
//=======================================================================
|
||||
void StdPersistent_TopLoc::ItemLocation::PChildren
|
||||
(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
|
||||
{
|
||||
theChildren.Append(myDatum);
|
||||
myNext.PChildren(theChildren);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Import
|
||||
//purpose : Import transient object from the persistent data
|
||||
@@ -48,3 +74,40 @@ TopLoc_Location StdPersistent_TopLoc::ItemLocation::Import() const
|
||||
else
|
||||
return aNext;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Translate
|
||||
//purpose : Create a persistent object from a location
|
||||
//=======================================================================
|
||||
Handle(StdPersistent_TopLoc::ItemLocation)
|
||||
StdPersistent_TopLoc::Translate (const TopLoc_Location& theLoc,
|
||||
StdObjMgt_TransientPersistentMap& theMap)
|
||||
{
|
||||
Handle(ItemLocation) aPLoc = new ItemLocation;
|
||||
aPLoc->myDatum = Translate(theLoc.FirstDatum(), theMap);
|
||||
aPLoc->myPower = theLoc.FirstPower();
|
||||
aPLoc->myNext = StdObject_Location::Translate(theLoc.NextLocation(), theMap);
|
||||
return aPLoc;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Translate
|
||||
//purpose : Create a persistent object from a location datum
|
||||
//=======================================================================
|
||||
Handle(StdPersistent_TopLoc::Datum3D)
|
||||
StdPersistent_TopLoc::Translate (const Handle(TopLoc_Datum3D)& theDatum,
|
||||
StdObjMgt_TransientPersistentMap& theMap)
|
||||
{
|
||||
Handle(Datum3D) aPDatum;
|
||||
if (theMap.IsBound(theDatum))
|
||||
{
|
||||
aPDatum = Handle(Datum3D)::DownCast(theMap.Find(theDatum));
|
||||
}
|
||||
else
|
||||
{
|
||||
aPDatum = new Datum3D;
|
||||
aPDatum->Transient(theDatum);
|
||||
theMap.Bind(theDatum, aPDatum);
|
||||
}
|
||||
return aPDatum;
|
||||
}
|
||||
|
Reference in New Issue
Block a user