b311480e |
1 | // Created on: 1998-02-16 |
2 | // Created by: Jing Cheng MEI |
3 | // Copyright (c) 1998-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
973c2be1 |
8 | // This library is free software; you can redistribute it and / or modify it |
9 | // under the terms of the GNU Lesser General Public version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | #include <MDataXtd_PatternStdStorageDriver.ixx> |
18 | #include <PDataXtd_PatternStd.hxx> |
19 | #include <TDataXtd_PatternStd.hxx> |
20 | #include <CDM_MessageDriver.hxx> |
21 | |
22 | |
23 | //======================================================================= |
24 | //function : MDataXtd_PatternStdStorageDriver |
25 | //purpose : |
26 | //======================================================================= |
27 | |
28 | MDataXtd_PatternStdStorageDriver::MDataXtd_PatternStdStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver) |
29 | { |
30 | } |
31 | |
32 | //======================================================================= |
33 | //function : VersionNumber |
34 | //purpose : |
35 | //======================================================================= |
36 | |
37 | Standard_Integer MDataXtd_PatternStdStorageDriver::VersionNumber() const |
38 | { |
39 | return 0; |
40 | } |
41 | |
42 | //======================================================================= |
43 | //function : SourceType |
44 | //purpose : |
45 | //======================================================================= |
46 | |
47 | Handle(Standard_Type) MDataXtd_PatternStdStorageDriver::SourceType() const |
48 | { |
49 | return STANDARD_TYPE(TDataXtd_PatternStd); |
50 | } |
51 | |
52 | |
53 | //======================================================================= |
54 | //function : NewEmpty |
55 | //purpose : |
56 | //======================================================================= |
57 | |
58 | Handle(PDF_Attribute) MDataXtd_PatternStdStorageDriver::NewEmpty() const |
59 | { |
60 | return new PDataXtd_PatternStd (); |
61 | } |
62 | |
63 | //======================================================================= |
64 | //function : Paste |
65 | //purpose : |
66 | //======================================================================= |
67 | |
68 | void MDataXtd_PatternStdStorageDriver::Paste (const Handle(TDF_Attribute)& Source, |
69 | const Handle(PDF_Attribute)& Target, |
70 | const Handle(MDF_SRelocationTable)& SRelocTable) const |
71 | { |
72 | Handle(TDataXtd_PatternStd) S = Handle(TDataXtd_PatternStd)::DownCast (Source); |
73 | Handle(PDataXtd_PatternStd) T = Handle(PDataXtd_PatternStd)::DownCast (Target); |
74 | |
75 | T->Signature(S->Signature()); |
76 | T->Axis1Reversed(S->Axis1Reversed()); |
77 | T->Axis2Reversed(S->Axis2Reversed()); |
78 | |
79 | Standard_Integer signature = S->Signature(); |
80 | |
81 | Handle(TNaming_NamedShape) TNS; |
82 | Handle(PNaming_NamedShape) PNS; |
83 | Handle(TDataStd_Real) TReal; |
84 | Handle(PDataStd_Real) PReal; |
85 | Handle(TDataStd_Integer) TInt; |
86 | Handle(PDataStd_Integer) PInt; |
87 | |
88 | if (signature < 5) { |
89 | TNS = S->Axis1(); |
90 | SRelocTable->HasRelocation(TNS, PNS); |
91 | T->Axis1(PNS); |
92 | TReal = S->Value1(); |
93 | SRelocTable->HasRelocation(TReal, PReal); |
94 | T->Value1(PReal); |
95 | TInt = S->NbInstances1(); |
96 | SRelocTable->HasRelocation(TInt, PInt); |
97 | T->NbInstances1(PInt); |
98 | |
99 | if (signature > 2) { |
100 | TNS = S->Axis2(); |
101 | SRelocTable->HasRelocation(TNS, PNS); |
102 | T->Axis2(PNS); |
103 | TReal = S->Value2(); |
104 | SRelocTable->HasRelocation(TReal, PReal); |
105 | T->Value2(PReal); |
106 | TInt = S->NbInstances2(); |
107 | SRelocTable->HasRelocation(TInt, PInt); |
108 | T->NbInstances2(PInt); |
109 | } |
110 | } |
111 | else { |
112 | TNS = S->Mirror(); |
113 | SRelocTable->HasRelocation(TNS, PNS); |
114 | T->Mirror(PNS); |
115 | } |
116 | } |
117 | |
118 | |
119 | |