0026961: Recover possibility to read files in old persistence format

Possibility to read shapes and OCAF documents from old persistence format (Std and StdL schema) is restored.

Test cases used old persistent files on input are restored with suffix "_std"

Removing toolkit from OS package
This commit is contained in:
myn
2016-03-02 23:04:30 +03:00
committed by abv
parent 1d8656890c
commit ff205346c9
115 changed files with 6856 additions and 442 deletions
+16 -1
View File
@@ -1,3 +1,18 @@
FILES
StdPersistent.cxx
StdPersistent.hxx
StdPersistent_DataXtd.cxx
StdPersistent_DataXtd.hxx
StdPersistent_DataXtd_Constraint.cxx
StdPersistent_DataXtd_Constraint.hxx
StdPersistent_DataXtd_PatternStd.cxx
StdPersistent_DataXtd_PatternStd.hxx
StdPersistent_HArray1OfShape1.hxx
StdPersistent_HArray1.cxx
StdPersistent_HArray1.hxx
StdPersistent_Naming.cxx
StdPersistent_Naming.hxx
StdPersistent_PPrsStd.cxx
StdPersistent_PPrsStd.hxx
StdPersistent_TopLoc.cxx
StdPersistent_TopLoc.hxx
StdPersistent_TopoDS.hxx
+45 -1
View File
@@ -14,10 +14,54 @@
#include <StdPersistent.hxx>
#include <StdObjMgt_MapOfInstantiators.hxx>
#include <StdPersistent_TopLoc.hxx>
#include <StdPersistent_TopoDS.hxx>
#include <StdPersistent_Naming.hxx>
#include <StdPersistent_HArray1.hxx>
#include <StdLPersistent_HArray1.hxx>
#include <StdPersistent_DataXtd.hxx>
#include <StdPersistent_DataXtd_Constraint.hxx>
#include <StdPersistent_DataXtd_PatternStd.hxx>
#include <StdPersistent_PPrsStd.hxx>
//=======================================================================
//function : BindTypes
//purpose : Register types
//=======================================================================
void StdPersistent::BindTypes (StdObjMgt_MapOfInstantiators& /*theMap*/)
void StdPersistent::BindTypes (StdObjMgt_MapOfInstantiators& theMap)
{
// Non-attribute data
theMap.Bind <StdPersistent_TopLoc::Datum3D> ("PTopLoc_Datum3D");
theMap.Bind <StdPersistent_TopLoc::ItemLocation> ("PTopLoc_ItemLocation");
theMap.Bind <StdPersistent_TopoDS::TShape> ("PTopoDS_TShape1");
theMap.Bind <StdPersistent_HArray1::Shape1> ("PTopoDS_HArray1OfShape1");
theMap.Bind <StdPersistent_Naming::Name> ("PNaming_Name");
theMap.Bind <StdPersistent_Naming::Name_1> ("PNaming_Name_1");
theMap.Bind <StdPersistent_Naming::Name_2> ("PNaming_Name_2");
theMap.Bind <StdLPersistent_HArray1::Persistent>
("PNaming_HArray1OfNamedShape");
// Attributes
theMap.Bind <StdPersistent_Naming::NamedShape> ("PNaming_NamedShape");
theMap.Bind <StdPersistent_Naming::Naming> ("PNaming_Naming");
theMap.Bind <StdPersistent_Naming::Naming_1> ("PNaming_Naming_1");
theMap.Bind <StdPersistent_Naming::Naming_2> ("PNaming_Naming_2");
theMap.Bind <StdPersistent_DataXtd::Shape> ("PDataXtd_Shape");
theMap.Bind <StdPersistent_DataXtd::Point> ("PDataXtd_Point");
theMap.Bind <StdPersistent_DataXtd::Axis> ("PDataXtd_Axis");
theMap.Bind <StdPersistent_DataXtd::Plane> ("PDataXtd_Plane");
theMap.Bind <StdPersistent_DataXtd::Placement> ("PDataXtd_Placement");
theMap.Bind <StdPersistent_DataXtd::Geometry> ("PDataXtd_Geometry");
theMap.Bind <StdPersistent_DataXtd::Position> ("PDataXtd_Position");
theMap.Bind <StdPersistent_DataXtd_Constraint> ("PDataXtd_Constraint");
theMap.Bind <StdPersistent_DataXtd_PatternStd> ("PDataXtd_PatternStd");
theMap.Bind <StdPersistent_PPrsStd::AISPresentation>
("PPrsStd_AISPresentation");
theMap.Bind <StdPersistent_PPrsStd::AISPresentation_1>
("PPrsStd_AISPresentation_1");
}
@@ -0,0 +1,29 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StdPersistent_DataXtd.hxx>
//=======================================================================
//function : ImportAttribute
//purpose : Import transient attribuite from the persistent data
//=======================================================================
void StdPersistent_DataXtd::Geometry::ImportAttribute()
{ myTransient->SetType (myData); }
//=======================================================================
//function : ImportAttribute
//purpose : Import transient attribuite from the persistent data
//=======================================================================
void StdPersistent_DataXtd::Position::ImportAttribute()
{ myTransient->SetPosition (myData); }
@@ -0,0 +1,65 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StdPersistent_DataXtd_HeaderFile
#define _StdPersistent_DataXtd_HeaderFile
#include <StdObjMgt_ContentTypes.hxx>
#include <StdObjMgt_Attribute.hxx>
#include <StdLPersistent_Void.hxx>
#include <StdObject_gp.hxx>
#include <TDataXtd_Shape.hxx>
#include <TDataXtd_Point.hxx>
#include <TDataXtd_Axis.hxx>
#include <TDataXtd_Plane.hxx>
#include <TDataXtd_Placement.hxx>
#include <TDataXtd_Geometry.hxx>
#include <TDataXtd_Position.hxx>
class StdPersistent_DataXtd : private StdObjMgt_ContentTypes
{
class _void : private StdLPersistent_Void
{
public:
template <class AttribClass>
struct Instance : instance<AttribClass> {};
};
public:
typedef _void::Instance<TDataXtd_Shape> Shape;
typedef _void::Instance<TDataXtd_Point> Point;
typedef _void::Instance<TDataXtd_Axis> Axis;
typedef _void::Instance<TDataXtd_Plane> Plane;
typedef _void::Instance<TDataXtd_Placement> Placement;
class Geometry : public StdObjMgt_Attribute<TDataXtd_Geometry>::
Simple <Enum<TDataXtd_GeometryEnum> >
{
public:
//! Import transient attribuite from the persistent data.
Standard_EXPORT virtual void ImportAttribute();
};
class Position : public StdObjMgt_Attribute<TDataXtd_Position>::
Simple <StdObject_gp::Object<gp_Pnt> >
{
public:
//! Import transient attribuite from the persistent data.
Standard_EXPORT virtual void ImportAttribute();
};
};
#endif
@@ -0,0 +1,58 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StdPersistent_DataXtd_Constraint.hxx>
#include <TNaming_NamedShape.hxx>
#include <TDataStd_Real.hxx>
//=======================================================================
//function : Import
//purpose : Import transient attribuite from the persistent data
//=======================================================================
void StdPersistent_DataXtd_Constraint::Import
(const Handle(TDataXtd_Constraint)& theAttribute) const
{
theAttribute->SetType (myType);
theAttribute->Reversed (myIsReversed);
theAttribute->Inverted (myIsInverted);
theAttribute->Verified (myIsVerified);
if (myGeometries)
{
Handle(StdLPersistent_HArray1OfPersistent) aGeometries = myGeometries->Array();
for (Standard_Integer i = 1; i <= aGeometries->Length(); i++)
{
Handle(StdObjMgt_Persistent) aPGeometry = aGeometries->Value(i);
if (aPGeometry)
{
Handle(TDF_Attribute) aTGeometry = aPGeometry->GetAttribute();
theAttribute->SetGeometry
(i, Handle(TNaming_NamedShape)::DownCast (aTGeometry));
}
}
}
if (myValue)
{
Handle(TDF_Attribute) aValue = myValue->GetAttribute();
theAttribute->SetValue (Handle(TDataStd_Real)::DownCast (aValue));
}
if (myPlane)
{
Handle(TDF_Attribute) aPlane = myPlane->GetAttribute();
theAttribute->SetPlane (Handle(TNaming_NamedShape)::DownCast (aPlane));
}
}
@@ -0,0 +1,49 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StdPersistent_DataXtd_Constraint_HeaderFile
#define _StdPersistent_DataXtd_Constraint_HeaderFile
#include <StdObjMgt_Attribute.hxx>
#include <StdLPersistent_HArray1.hxx>
#include <TDataXtd_Constraint.hxx>
#include <TDataXtd_ConstraintEnum.hxx>
class StdPersistent_DataXtd_Constraint
: public StdObjMgt_Attribute<TDataXtd_Constraint>
{
public:
//! Read persistent data from a file.
inline void Read (StdObjMgt_ReadData& theReadData)
{
theReadData >> myType >> myGeometries >> myValue
>> myIsReversed >> myIsInverted >> myIsVerified >> myPlane;
}
//! Import transient attribuite from the persistent data.
void Import (const Handle(TDataXtd_Constraint)& theAttribute) const;
private:
Enum<TDataXtd_ConstraintEnum> myType;
Reference<StdLPersistent_HArray1::Persistent> myGeometries;
Reference<> myValue;
Value<Standard_Boolean> myIsReversed;
Value<Standard_Boolean> myIsInverted;
Value<Standard_Boolean> myIsVerified;
Reference<> myPlane;
};
#endif
@@ -0,0 +1,56 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StdPersistent_DataXtd_PatternStd.hxx>
#include <TNaming_NamedShape.hxx>
#include <TDataStd_Real.hxx>
#include <TDataStd_Integer.hxx>
//=======================================================================
//function : Import
//purpose : Import transient attribuite from the persistent data
//=======================================================================
void StdPersistent_DataXtd_PatternStd::Import
(const Handle(TDataXtd_PatternStd)& theAttribute) const
{
if (mySignature < 5)
{
theAttribute->Axis1 (
Handle(TNaming_NamedShape)::DownCast (myAxis1->GetAttribute()));
theAttribute->Value1 (
Handle(TDataStd_Real)::DownCast (myValue1->GetAttribute()));
theAttribute->NbInstances1 (
Handle(TDataStd_Integer)::DownCast (myNb1->GetAttribute()));
if (mySignature > 2)
{
theAttribute->Axis2 (
Handle(TNaming_NamedShape)::DownCast (myAxis2->GetAttribute()));
theAttribute->Value2 (
Handle(TDataStd_Real)::DownCast (myValue2->GetAttribute()));
theAttribute->NbInstances2 (
Handle(TDataStd_Integer)::DownCast (myNb2->GetAttribute()));
}
}
else
{
theAttribute->Mirror (
Handle(TNaming_NamedShape)::DownCast (myMirror->GetAttribute()));
}
}
@@ -0,0 +1,50 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StdPersistent_DataXtd_PatternStd_HeaderFile
#define _StdPersistent_DataXtd_PatternStd_HeaderFile
#include <StdObjMgt_Attribute.hxx>
#include <TDataXtd_PatternStd.hxx>
class StdPersistent_DataXtd_PatternStd
: public StdObjMgt_Attribute<TDataXtd_PatternStd>
{
public:
//! Read persistent data from a file.
inline void Read (StdObjMgt_ReadData& theReadData)
{
theReadData >> mySignature >> myAxis1Reversed >> myAxis2Reversed >>
myAxis1 >> myAxis2 >> myValue1 >> myValue2 >> myNb1 >> myNb2 >> myMirror;
}
//! Import transient attribuite from the persistent data.
void Import (const Handle(TDataXtd_PatternStd)& theAttribute) const;
private:
Value<Standard_Integer> mySignature;
Value<Standard_Boolean> myAxis1Reversed;
Value<Standard_Boolean> myAxis2Reversed;
Reference<> myAxis1;
Reference<> myAxis2;
Reference<> myValue1;
Reference<> myValue2;
Reference<> myNb1;
Reference<> myNb2;
Reference<> myMirror;
};
#endif
@@ -0,0 +1,22 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StdPersistent_HArray1.hxx>
#include <StdObjMgt_ReadData.hxx>
void StdPersistent_HArray1::Shape1::readValue (StdObjMgt_ReadData& theReadData,
const Standard_Integer theIndex)
{
theReadData.ReadObject (myArray->ChangeValue (theIndex));
}
@@ -0,0 +1,32 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StdPersistent_HArray1_HeaderFile
#define _StdPersistent_HArray1_HeaderFile
#include <StdLPersistent_HArray1.hxx>
#include <StdPersistent_HArray1OfShape1.hxx>
class StdPersistent_HArray1 : private StdLPersistent_HArray1
{
public:
class Shape1 : public StdLPersistent_HArray1::base<StdPersistent_HArray1OfShape1>
{
virtual void readValue (StdObjMgt_ReadData& theReadData,
const Standard_Integer theIndex);
};
};
#endif
@@ -0,0 +1,23 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StdPersistent_HArray1OfShape1_HeaderFile
#define _StdPersistent_HArray1OfShape1_HeaderFile
#include <NCollection_DefineHArray1.hxx>
#include <StdObject_Shape.hxx>
DEFINE_HARRAY1 (StdPersistent_HArray1OfShape1, NCollection_Array1<StdObject_Shape>)
#endif // _StdPersistent_HArray1OfShape1_HeaderFile
+178
View File
@@ -0,0 +1,178 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StdPersistent_Naming.hxx>
#include <StdObjMgt_ReadData.hxx>
#include <TNaming_Name.hxx>
#include <TNaming_Builder.hxx>
#include <TNaming_Iterator.hxx>
//=======================================================================
//function : Import
//purpose : Import transient attribuite from the persistent data
//=======================================================================
void StdPersistent_Naming::NamedShape::Import
(const Handle(TNaming_NamedShape)& theAttribute) const
{
theAttribute->SetVersion (myVersion);
if (myOldShapes.IsNull() || myNewShapes.IsNull())
return;
TNaming_Builder aBuilder (theAttribute->Label());
StdPersistent_HArray1OfShape1::Iterator aOldShapesIter (*myOldShapes->Array());
StdPersistent_HArray1OfShape1::Iterator aNewShapesIter (*myNewShapes->Array());
for (; aNewShapesIter.More(); aOldShapesIter.Next(), aNewShapesIter.Next())
{
TopoDS_Shape aOldShape = aOldShapesIter.Value().Import();
TopoDS_Shape aNewShape = aNewShapesIter.Value().Import();
switch (myShapeStatus)
{
case 0: aBuilder.Generated (aNewShape); break; // PRIMITIVE
case 1: aBuilder.Generated (aOldShape, aNewShape); break; // GENERATED
case 2: aBuilder.Modify (aOldShape, aNewShape); break; // MODIFY
case 3: aBuilder.Delete (aOldShape); break; // DELETE
case 4: aBuilder.Select (aNewShape, aOldShape); break; // SELECTED
case 5: aBuilder.Modify (aOldShape, aNewShape); break; // REPLACE
}
}
}
//=======================================================================
//function : Read
//purpose : Read persistent data from a file
//=======================================================================
void StdPersistent_Naming::Name::Read (StdObjMgt_ReadData& theReadData)
{
theReadData >> myType >> myShapeType >> myArgs >> myStop >> myIndex;
}
//=======================================================================
//function : Import
//purpose : Import transient object from the persistent data
//=======================================================================
void StdPersistent_Naming::Name::Import
(TNaming_Name& theName, const Handle(TDF_Data)&) const
{
theName.Type (myType);
theName.ShapeType (myShapeType);
if (myArgs)
{
StdLPersistent_HArray1OfPersistent::Iterator anIter (*myArgs->Array());
for (; anIter.More(); anIter.Next())
{
Handle(StdObjMgt_Persistent) aPersistent = anIter.Value();
if (aPersistent)
{
Handle(TDF_Attribute) anArg = aPersistent->GetAttribute();
theName.Append (Handle(TNaming_NamedShape)::DownCast (anArg));
}
}
}
if (myStop)
{
Handle(TDF_Attribute) aStop = myStop->GetAttribute();
theName.StopNamedShape (Handle(TNaming_NamedShape)::DownCast (aStop));
}
theName.Index (myIndex);
}
//=======================================================================
//function : Read
//purpose : Read persistent data from a file
//=======================================================================
void StdPersistent_Naming::Name_1::Read (StdObjMgt_ReadData& theReadData)
{
Name::Read (theReadData);
theReadData >> myContextLabel;
}
//=======================================================================
//function : Import
//purpose : Import transient object from the persistent data
//=======================================================================
void StdPersistent_Naming::Name_1::Import
(TNaming_Name& theName, const Handle(TDF_Data)& theDF) const
{
Name::Import (theName, theDF);
if (myContextLabel)
theName.ContextLabel (myContextLabel->Label (theDF));
}
//=======================================================================
//function : Read
//purpose : Read persistent data from a file
//=======================================================================
void StdPersistent_Naming::Name_2::Read (StdObjMgt_ReadData& theReadData)
{
Name_1::Read (theReadData);
theReadData >> myOrientation;
}
//=======================================================================
//function : Import
//purpose : Import transient object from the persistent data
//=======================================================================
void StdPersistent_Naming::Name_2::Import
(TNaming_Name& theName, const Handle(TDF_Data)& theDF) const
{
Name_1::Import (theName, theDF);
theName.Orientation (myOrientation);
}
//=======================================================================
//function : ImportAttribute
//purpose : Import transient attribuite from the persistent data
//=======================================================================
void StdPersistent_Naming::Naming::ImportAttribute()
{
Handle(Name) aName;
if (myData.Cast (aName))
{
aName->Import (myTransient->ChangeName(), myTransient->Label().Data());
myData.Nullify();
}
}
//=======================================================================
//function : ImportAttribute
//purpose : Import transient attribuite from the persistent data
//=======================================================================
void StdPersistent_Naming::Naming_1::ImportAttribute()
{
Naming::ImportAttribute();
Handle(TNaming_NamedShape) aNamedShape;
if (myTransient->Label().FindAttribute (TNaming_NamedShape::GetID(), aNamedShape)
&& aNamedShape->Evolution() == TNaming_SELECTED)
{
for (TNaming_Iterator anIter (aNamedShape); anIter.More(); anIter.Next())
{
const TopoDS_Shape& aOldShape = anIter.OldShape();
const TopoDS_Shape& aNewShape = anIter.NewShape();
if (!aOldShape.IsNull() && aOldShape.ShapeType() == TopAbs_VERTEX
&& !aNewShape.IsNull() && aNewShape.ShapeType() != TopAbs_VERTEX)
{
myTransient->ChangeName().Orientation (aOldShape.Orientation());
}
}
}
}
+118
View File
@@ -0,0 +1,118 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StdPersistent_Naming_HeaderFile
#define _StdPersistent_Naming_HeaderFile
#include <StdObjMgt_Attribute.hxx>
#include <StdObjMgt_Persistent.hxx>
#include <StdPersistent_HArray1.hxx>
#include <StdLPersistent_HArray1.hxx>
#include <StdLPersistent_HString.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopAbs_Orientation.hxx>
#include <TNaming_NameType.hxx>
#include <TNaming_NamedShape.hxx>
#include <TNaming_Naming.hxx>
class TNaming_Name;
class StdPersistent_Naming
{
public:
class NamedShape : public StdObjMgt_Attribute<TNaming_NamedShape>
{
public:
//! Read persistent data from a file.
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myOldShapes >> myNewShapes >> myShapeStatus >> myVersion; }
//! Import transient attribuite from the persistent data.
void Import (const Handle(TNaming_NamedShape)& theAttribute) const;
private:
Reference <StdPersistent_HArray1::Shape1> myOldShapes;
Reference <StdPersistent_HArray1::Shape1> myNewShapes;
Value <Standard_Integer> myShapeStatus;
Value <Standard_Integer> myVersion;
};
class Name : public StdObjMgt_Persistent
{
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
//! Import transient object from the persistent data.
Standard_EXPORT virtual void Import
(TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
private:
Enum <TNaming_NameType> myType;
Enum <TopAbs_ShapeEnum> myShapeType;
Reference <StdLPersistent_HArray1::Persistent> myArgs;
Reference<> myStop;
Value <Standard_Integer> myIndex;
};
class Name_1 : public Name
{
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
//! Import transient object from the persistent data.
Standard_EXPORT virtual void Import
(TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
private:
Reference<StdLPersistent_HString::Ascii> myContextLabel;
};
class Name_2 : public Name_1
{
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
//! Import transient object from the persistent data.
Standard_EXPORT virtual void Import
(TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
private:
Enum<TopAbs_Orientation> myOrientation;
};
class Naming : public StdObjMgt_Attribute<TNaming_Naming>::SingleRef
{
public:
//! Import transient attribuite from the persistent data.
Standard_EXPORT virtual void ImportAttribute();
};
class Naming_1 : public Naming
{
public:
//! Import transient attribuite from the persistent data.
Standard_EXPORT virtual void ImportAttribute();
};
typedef Naming Naming_2;
};
#endif
@@ -0,0 +1,62 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StdPersistent_PPrsStd.hxx>
//=======================================================================
//function : Import
//purpose : Import transient attribuite from the persistent data
//=======================================================================
void StdPersistent_PPrsStd::AISPresentation::Import
(const Handle(TDataXtd_Presentation)& theAttribute) const
{
theAttribute->SetDisplayed (myIsDisplayed);
Handle(TCollection_HExtendedString) aDriverGUID = myDriverGUID->ExtString();
if (aDriverGUID)
theAttribute->SetDriverGUID (
Standard_GUID (aDriverGUID->String().ToExtString()));
if (myColor != -1)
theAttribute->SetColor
(static_cast<Quantity_NameOfColor> ((Standard_Integer)myColor));
else
theAttribute->UnsetColor();
if (myMaterial != -1)
theAttribute->SetMaterialIndex (myMaterial);
else
theAttribute->UnsetMaterial();
if (myTransparency != -1.)
theAttribute->SetTransparency (myTransparency);
else
theAttribute->UnsetTransparency();
if (myWidth != -1.)
theAttribute->SetWidth (myWidth);
else
theAttribute->UnsetWidth();
}
//=======================================================================
//function : Import
//purpose : Import transient attribuite from the persistent data
//=======================================================================
void StdPersistent_PPrsStd::AISPresentation_1::Import
(const Handle(TDataXtd_Presentation)& theAttribute) const
{
AISPresentation::Import (theAttribute);
theAttribute->SetMode (myMode);
}
@@ -0,0 +1,66 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StdPersistent_PPrsStd_PatternStd_HeaderFile
#define _StdPersistent_PPrsStd_PatternStd_HeaderFile
#include <StdObjMgt_Attribute.hxx>
#include <StdLPersistent_HString.hxx>
#include <TDataXtd_Presentation.hxx>
class StdPersistent_PPrsStd
{
public:
class AISPresentation : public StdObjMgt_Attribute<TDataXtd_Presentation>
{
public:
//! Read persistent data from a file.
inline void Read (StdObjMgt_ReadData& theReadData)
{
theReadData >> myIsDisplayed >> myDriverGUID
>> myTransparency >> myColor >> myMaterial >> myWidth;
}
//! Import transient attribuite from the persistent data.
void Import (const Handle(TDataXtd_Presentation)& theAttribute) const;
private:
Value<Standard_Boolean> myIsDisplayed;
Reference<> myDriverGUID;
Value<Standard_Real> myTransparency;
Value<Standard_Integer> myColor;
Value<Standard_Integer> myMaterial;
Value<Standard_Real> myWidth;
};
class AISPresentation_1 : public AISPresentation
{
public:
//! Read persistent data from a file.
inline void Read (StdObjMgt_ReadData& theReadData)
{
AISPresentation::Read (theReadData);
theReadData >> myMode;
}
//! Import transient attribuite from the persistent data.
void Import (const Handle(TDataXtd_Presentation)& theAttribute) const;
private:
Value<Standard_Integer> myMode;
};
};
#endif
@@ -0,0 +1,52 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StdPersistent_TopLoc.hxx>
#include <StdObjMgt_ReadData.hxx>
#include <StdObject_gp.hxx>
#include <gp_Trsf.hxx>
//=======================================================================
//function : Read
//purpose : Read persistent data from a file
//=======================================================================
void StdPersistent_TopLoc::Datum3D::Read (StdObjMgt_ReadData& theReadData)
{
StdObject_gp::Object<gp_Trsf> aTrsf;
theReadData >> aTrsf;
myTransient = new TopLoc_Datum3D (aTrsf);
}
//=======================================================================
//function : Read
//purpose : Read persistent data from a file
//=======================================================================
void StdPersistent_TopLoc::ItemLocation::Read (StdObjMgt_ReadData& theReadData)
{
theReadData >> myDatum >> myPower >> myNext;
}
//=======================================================================
//function : Import
//purpose : Import transient object from the persistent data
//=======================================================================
TopLoc_Location StdPersistent_TopLoc::ItemLocation::Import() const
{
TopLoc_Location aNext = myNext.Import();
if (myDatum)
return aNext * TopLoc_Location (myDatum->Import()).Powered (myPower);
else
return aNext;
}
@@ -0,0 +1,52 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StdPersistent_TopLoc_HeaderFile
#define _StdPersistent_TopLoc_HeaderFile
#include <StdObjMgt_SharedObject.hxx>
#include <StdObjMgt_Persistent.hxx>
#include <StdObject_Location.hxx>
#include <TopLoc_Datum3D.hxx>
#include <TopLoc_Location.hxx>
class StdPersistent_TopLoc
{
public:
class Datum3D : public StdObjMgt_SharedObject::SharedBase<TopLoc_Datum3D>
{
public:
//! Read persistent data from a file.
void Read (StdObjMgt_ReadData& theReadData);
};
class ItemLocation : public StdObjMgt_Persistent
{
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
//! Import transient object from the persistent data.
Standard_EXPORT TopLoc_Location Import() const;
private:
Reference<Datum3D> myDatum;
Value<Standard_Integer> myPower;
Object<StdObject_Location> myNext;
};
};
#endif
@@ -0,0 +1,42 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StdPersistent_TopoDS_HeaderFile
#define _StdPersistent_TopoDS_HeaderFile
#include <StdObjMgt_SharedObject.hxx>
#include <StdObjMgt_ReadData.hxx>
#include <TopoDS_TShape.hxx>
class StdPersistent_TopoDS : protected StdObjMgt_SharedObject
{
protected:
class pTShape : public PersistentBase
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myShapes >> myFlags; }
protected:
Reference<> myShapes;
Value<Standard_Integer> myFlags;
};
public:
typedef IgnoreData<StdObjMgt_Persistent, pTShape, TopoDS_TShape> TShape;
};
#endif