b311480e |
1 | // Created on: 2004-11-23 |
2 | // Created by: Pavel TELKOV |
973c2be1 |
3 | // Copyright (c) 2004-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
7fd59977 |
16 | // The original implementation Copyright: (C) RINA S.p.A |
17 | |
18 | #include <TObj_TXYZ.hxx> |
19 | #include <Standard_GUID.hxx> |
20 | #include <TDF_Label.hxx> |
21 | |
7fd59977 |
22 | |
92efcf78 |
23 | IMPLEMENT_STANDARD_RTTIEXT(TObj_TXYZ,TDF_Attribute) |
24 | |
7fd59977 |
25 | //======================================================================= |
26 | //function : TObj_TXYZ |
27 | //purpose : |
28 | //======================================================================= |
29 | |
30 | TObj_TXYZ::TObj_TXYZ() |
31 | { |
32 | } |
33 | |
34 | //======================================================================= |
35 | //function : GetID |
36 | //purpose : |
37 | //======================================================================= |
38 | |
39 | const Standard_GUID& TObj_TXYZ::GetID() |
40 | { |
41 | static Standard_GUID theGUID ("3bbefb50-e618-11d4-ba38-0060b0ee18ea"); |
42 | return theGUID; |
43 | } |
44 | |
45 | //======================================================================= |
46 | //function : ID |
47 | //purpose : |
48 | //======================================================================= |
49 | |
50 | const Standard_GUID& TObj_TXYZ::ID() const |
51 | { |
52 | return GetID(); |
53 | } |
54 | |
55 | //======================================================================= |
56 | //function : Set |
57 | //purpose : |
58 | //======================================================================= |
59 | |
60 | Handle(TObj_TXYZ) TObj_TXYZ::Set (const TDF_Label& theLabel, |
61 | const gp_XYZ& theXYZ) |
62 | { |
63 | Handle(TObj_TXYZ) A; |
64 | if (!theLabel.FindAttribute(TObj_TXYZ::GetID(), A)) |
65 | { |
66 | A = new TObj_TXYZ; |
67 | theLabel.AddAttribute(A); |
68 | } |
69 | A->Set(theXYZ); |
70 | return A; |
71 | } |
72 | |
73 | //======================================================================= |
74 | //function : Set |
75 | //purpose : |
76 | //======================================================================= |
77 | |
78 | void TObj_TXYZ::Set (const gp_XYZ& theXYZ) |
79 | { |
80 | Backup(); |
81 | myXYZ = theXYZ; |
82 | } |
83 | |
84 | //======================================================================= |
85 | //function : Get |
86 | //purpose : |
87 | //======================================================================= |
88 | |
89 | gp_XYZ TObj_TXYZ::Get () const |
90 | { |
91 | return myXYZ; |
92 | } |
93 | |
94 | //======================================================================= |
95 | //function : NewEmpty |
96 | //purpose : |
97 | //======================================================================= |
98 | |
99 | Handle(TDF_Attribute) TObj_TXYZ::NewEmpty () const |
100 | { |
101 | return new TObj_TXYZ(); |
102 | } |
103 | |
104 | //======================================================================= |
105 | //function : Restore |
106 | //purpose : |
107 | //======================================================================= |
108 | |
109 | void TObj_TXYZ::Restore (const Handle(TDF_Attribute)& theWith) |
110 | { |
111 | Handle(TObj_TXYZ) R = Handle(TObj_TXYZ)::DownCast(theWith); |
112 | myXYZ = R->Get(); |
113 | } |
114 | |
115 | //======================================================================= |
116 | //function : Paste |
117 | //purpose : |
118 | //======================================================================= |
119 | |
120 | void TObj_TXYZ::Paste (const Handle(TDF_Attribute)& theInto, |
121 | const Handle(TDF_RelocationTable)& /* RT */) const |
122 | { |
123 | Handle(TObj_TXYZ) R = Handle(TObj_TXYZ)::DownCast (theInto); |
124 | R->Set(myXYZ); |
125 | } |
126 | |
127 | //======================================================================= |
128 | //function : Dump |
129 | //purpose : |
130 | //======================================================================= |
131 | |
132 | Standard_OStream& TObj_TXYZ::Dump(Standard_OStream& theOS) const |
133 | { |
134 | gp_XYZ aXYZ = Get(); |
135 | Standard_OStream& anOS = TDF_Attribute::Dump( theOS ); |
136 | anOS << "X: " << aXYZ.X() << "\tY: " << aXYZ.Y() << "\tZ: " << aXYZ.Z(); |
137 | return anOS; |
138 | } |