blob: 220e843f568f076ee83d380290fdc778082f50e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
#include <MDataXtd_ConstraintRetrievalDriver.ixx>
#include <MDataXtd.hxx>
#include <PDataXtd_Constraint.hxx>
#include <TDataXtd_Constraint.hxx>
#include <TDataXtd_ConstraintEnum.hxx>
#include <TNaming_NamedShape.hxx>
#include <PNaming_NamedShape.hxx>
#include <PDF_HAttributeArray1.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_DomainError.hxx>
#include <CDM_MessageDriver.hxx>
//=======================================================================
//function : MDataXtd_ConstraintRetrievalDriver
//purpose :
//=======================================================================
MDataXtd_ConstraintRetrievalDriver::MDataXtd_ConstraintRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver)
{
}
//=======================================================================
//function : VersionNumber
//purpose :
//=======================================================================
Standard_Integer MDataXtd_ConstraintRetrievalDriver::VersionNumber() const
{ return 0; }
//=======================================================================
//function : SourceType
//purpose :
//=======================================================================
Handle(Standard_Type) MDataXtd_ConstraintRetrievalDriver::SourceType() const
{ return STANDARD_TYPE(PDataXtd_Constraint); }
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) MDataXtd_ConstraintRetrievalDriver::NewEmpty() const
{ return new TDataXtd_Constraint (); }
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
void MDataXtd_ConstraintRetrievalDriver::Paste (
const Handle(PDF_Attribute)& Source,
const Handle(TDF_Attribute)& Target,
const Handle(MDF_RRelocationTable)& RelocTable) const
{
Handle(PDataXtd_Constraint) S =
Handle(PDataXtd_Constraint)::DownCast (Source);
Handle(TDataXtd_Constraint) T =
Handle(TDataXtd_Constraint)::DownCast (Target);
Handle(TDataStd_Real) TValue;
Handle(PDataStd_Real) Value = S->GetValue ();
if (!Value.IsNull ()) {
if (!RelocTable->HasRelocation(Value, TValue )) {
Standard_NoSuchObject::Raise("MDataXtd_ConstraintRetrievalDriver::Paste");
}
T->SetValue(TValue);
}
Handle(PDF_HAttributeArray1) PGeometries = S->GetGeometries ();
if (!PGeometries.IsNull()) {
for (Standard_Integer i = 1; i <= PGeometries->Length (); i++) {
Handle(PDF_Attribute) PG = PGeometries->Value (i);
if (!PG.IsNull ()) {
Handle(TNaming_NamedShape) G;
if (!RelocTable->HasRelocation (PG, G)) {
Standard_NoSuchObject::Raise("MDataXtd_ConstraintRetrievalDriver::Paste");
}
T->SetGeometry (i, G);
}
}
}
Handle(PNaming_NamedShape) PPlane = S->GetPlane();
Handle(TNaming_NamedShape) TPlane;
if (!PPlane.IsNull()) {
if (!RelocTable->HasRelocation (PPlane, TPlane )) {
Standard_NoSuchObject::Raise("MDataXtd_ConstraintStorageDriver::Paste");
}
T->SetPlane(TPlane);
}
T->SetType (MDataXtd::IntegerToConstraintType (S->GetType ()));
T->Verified(S->Verified());
T->Inverted(S->Inverted());
T->Reversed(S->Reversed());
}
|