b311480e |
1 | // Created by: CKY / Contract Toubro-Larsen |
2 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
7fd59977 |
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. |
7fd59977 |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
16 | //-------------------------------------------------------------------- |
7fd59977 |
17 | //-------------------------------------------------------------------- |
18 | |
7fd59977 |
19 | #include <gp_Pnt.hxx> |
42cf5bc1 |
20 | #include <gp_XYZ.hxx> |
21 | #include <IGESData_DirChecker.hxx> |
7fd59977 |
22 | #include <IGESData_Dump.hxx> |
42cf5bc1 |
23 | #include <IGESData_IGESDumper.hxx> |
24 | #include <IGESData_IGESReaderData.hxx> |
25 | #include <IGESData_IGESWriter.hxx> |
26 | #include <IGESData_ParamCursor.hxx> |
27 | #include <IGESData_ParamReader.hxx> |
28 | #include <IGESSolid_ToolVertexList.hxx> |
29 | #include <IGESSolid_VertexList.hxx> |
30 | #include <Interface_Check.hxx> |
31 | #include <Interface_CopyTool.hxx> |
32 | #include <Interface_EntityIterator.hxx> |
7fd59977 |
33 | #include <Interface_Macros.hxx> |
42cf5bc1 |
34 | #include <Interface_ShareTool.hxx> |
35 | #include <Message_Messenger.hxx> |
7fd59977 |
36 | #include <Message_Msg.hxx> |
42cf5bc1 |
37 | #include <Standard_DomainError.hxx> |
38 | #include <TColgp_HArray1OfXYZ.hxx> |
7fd59977 |
39 | |
42cf5bc1 |
40 | // MGE 03/08/98 |
7fd59977 |
41 | //======================================================================= |
42 | //function : IGESSolid_ToolVertexList |
43 | //purpose : |
44 | //======================================================================= |
7fd59977 |
45 | IGESSolid_ToolVertexList::IGESSolid_ToolVertexList () |
46 | { |
47 | } |
48 | |
49 | |
50 | //======================================================================= |
51 | //function : ReadOwnParams |
52 | //purpose : |
53 | //======================================================================= |
54 | |
55 | void IGESSolid_ToolVertexList::ReadOwnParams(const Handle(IGESSolid_VertexList)& ent, |
56 | const Handle(IGESData_IGESReaderData)& /* IR */, |
57 | IGESData_ParamReader& PR) const |
58 | { |
59 | // MGE 03/08/98 |
60 | // Building of messages |
61 | //======================================== |
62 | // Message_Msg Msg182("XSTEP_182"); |
63 | // Message_Msg Msg183("XSTEP_183"); |
64 | //======================================== |
65 | |
66 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
67 | Standard_Integer nbitems = 0; //szv#4:S4163:12Mar99 `i` moved in for |
68 | //gp_XYZ anXYZ; //szv#4:S4163:12Mar99 moved down |
69 | Handle(TColgp_HArray1OfXYZ) tempVertices; |
70 | |
71 | //st = PR.ReadInteger(PR.Current(), Msg182, nbitems); //szv#4:S4163:12Mar99 moved in if |
72 | //st = PR.ReadInteger(PR.Current(), "Number of Vertices", nbitems); |
73 | Standard_Boolean sb = PR.ReadInteger(PR.Current(), nbitems); |
74 | if (sb && (nbitems > 0)) { |
75 | |
76 | Message_Msg Msg183("XSTEP_183"); |
77 | |
78 | tempVertices = new TColgp_HArray1OfXYZ(1, nbitems); |
79 | |
80 | gp_XYZ anXYZ; |
81 | for (Standard_Integer i = 1; i <= nbitems; i++) |
82 | { |
83 | //st = PR.ReadXYZ(PR.CurrentList(1, 3), Msg183, anXYZ); //szv#4:S4163:12Mar99 moved in if |
84 | //st = PR.ReadXYZ(PR.CurrentList(1, 3), "Vertices", anXYZ); |
85 | if (PR.ReadXYZ(PR.CurrentList(1, 3), Msg183, anXYZ)) |
86 | tempVertices->SetValue(i, anXYZ); |
87 | } |
88 | } |
89 | else { |
90 | Message_Msg Msg182("XSTEP_182"); |
91 | PR.SendFail(Msg182); |
92 | } |
93 | |
94 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
95 | if (nbitems > 0) ent->Init (tempVertices); |
96 | } |
97 | |
98 | |
99 | //======================================================================= |
100 | //function : WriteOwnParams |
101 | //purpose : |
102 | //======================================================================= |
103 | |
104 | void IGESSolid_ToolVertexList::WriteOwnParams(const Handle(IGESSolid_VertexList)& ent, |
105 | IGESData_IGESWriter& IW) const |
106 | { |
107 | Standard_Integer nbitems = ent->NbVertices(); |
108 | Standard_Integer i; |
109 | |
110 | IW.Send(nbitems); |
111 | for (i = 1; i <= nbitems; i ++) |
112 | { |
113 | IW.Send(ent->Vertex(i).X()); |
114 | IW.Send(ent->Vertex(i).Y()); |
115 | IW.Send(ent->Vertex(i).Z()); |
116 | } |
117 | } |
118 | |
119 | |
120 | //======================================================================= |
121 | //function : OwnShared |
122 | //purpose : |
123 | //======================================================================= |
124 | |
125 | void IGESSolid_ToolVertexList::OwnShared(const Handle(IGESSolid_VertexList)& /* ent */, |
126 | Interface_EntityIterator& /* iter */) const |
127 | { |
128 | } |
129 | |
130 | |
131 | //======================================================================= |
132 | //function : OwnCopy |
133 | //purpose : |
134 | //======================================================================= |
135 | |
136 | void IGESSolid_ToolVertexList::OwnCopy(const Handle(IGESSolid_VertexList)& another, |
137 | const Handle(IGESSolid_VertexList)& ent, |
138 | Interface_CopyTool& /* TC */) const |
139 | { |
140 | Standard_Integer nbitems, i; |
141 | |
142 | nbitems = another->NbVertices(); |
143 | Handle(TColgp_HArray1OfXYZ) tempVertices = new |
144 | TColgp_HArray1OfXYZ(1, nbitems); |
145 | |
146 | for (i=1; i<=nbitems; i++) |
147 | { |
148 | tempVertices->SetValue(i, another->Vertex(i).XYZ()); |
149 | } |
150 | ent->Init(tempVertices); |
151 | } |
152 | |
153 | |
154 | //======================================================================= |
155 | //function : DirChecker |
156 | //purpose : |
157 | //======================================================================= |
158 | |
159 | IGESData_DirChecker IGESSolid_ToolVertexList::DirChecker |
160 | (const Handle(IGESSolid_VertexList)& /* ent */ ) const |
161 | { |
162 | IGESData_DirChecker DC(502, 1); |
163 | |
164 | DC.Structure (IGESData_DefVoid); |
165 | DC.LineFont (IGESData_DefVoid); |
166 | DC.LineWeight (IGESData_DefVoid); |
167 | DC.Color (IGESData_DefAny); |
168 | |
169 | DC.SubordinateStatusRequired (1); |
170 | DC.HierarchyStatusIgnored (); |
171 | return DC; |
172 | } |
173 | |
174 | |
175 | //======================================================================= |
176 | //function : OwnCheck |
177 | //purpose : |
178 | //======================================================================= |
179 | |
180 | void IGESSolid_ToolVertexList::OwnCheck(const Handle(IGESSolid_VertexList)& ent, |
181 | const Interface_ShareTool&, |
182 | Handle(Interface_Check)& ach) const |
183 | { |
184 | // MGE 03/08/98 |
185 | // Building of messages |
186 | //======================================== |
187 | //Message_Msg Msg182("XSTEP_182"); |
188 | //======================================== |
189 | |
190 | if (ent->NbVertices() <= 0) { |
191 | Message_Msg Msg182("XSTEP_182"); |
192 | ach->SendFail(Msg182); |
193 | } |
194 | } |
195 | |
196 | |
197 | //======================================================================= |
198 | //function : OwnDump |
199 | //purpose : |
200 | //======================================================================= |
201 | |
202 | void IGESSolid_ToolVertexList::OwnDump(const Handle(IGESSolid_VertexList)& ent, |
203 | const IGESData_IGESDumper& /* dumper */, |
204 | const Handle(Message_Messenger)& S, |
205 | const Standard_Integer level) const |
206 | { |
207 | S << "IGESSolid_VertexList" << endl; |
208 | |
209 | S << "Vertices : "; |
210 | IGESData_DumpListXYZL(S ,level,1, ent->NbVertices(),ent->Vertex,ent->Location()); |
211 | S << endl; |
212 | } |