1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
21 #include <IGESData_DirChecker.hxx>
22 #include <IGESData_Dump.hxx>
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>
33 #include <Interface_Macros.hxx>
34 #include <Interface_ShareTool.hxx>
35 #include <Message_Messenger.hxx>
36 #include <Message_Msg.hxx>
37 #include <Standard_DomainError.hxx>
38 #include <TColgp_HArray1OfXYZ.hxx>
41 //=======================================================================
42 //function : IGESSolid_ToolVertexList
44 //=======================================================================
45 IGESSolid_ToolVertexList::IGESSolid_ToolVertexList ()
50 //=======================================================================
51 //function : ReadOwnParams
53 //=======================================================================
55 void IGESSolid_ToolVertexList::ReadOwnParams(const Handle(IGESSolid_VertexList)& ent,
56 const Handle(IGESData_IGESReaderData)& /* IR */,
57 IGESData_ParamReader& PR) const
60 // Building of messages
61 //========================================
62 // Message_Msg Msg182("XSTEP_182");
63 // Message_Msg Msg183("XSTEP_183");
64 //========================================
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;
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)) {
76 Message_Msg Msg183("XSTEP_183");
78 tempVertices = new TColgp_HArray1OfXYZ(1, nbitems);
81 for (Standard_Integer i = 1; i <= nbitems; i++)
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);
90 Message_Msg Msg182("XSTEP_182");
94 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
95 if (nbitems > 0) ent->Init (tempVertices);
99 //=======================================================================
100 //function : WriteOwnParams
102 //=======================================================================
104 void IGESSolid_ToolVertexList::WriteOwnParams(const Handle(IGESSolid_VertexList)& ent,
105 IGESData_IGESWriter& IW) const
107 Standard_Integer nbitems = ent->NbVertices();
111 for (i = 1; i <= nbitems; i ++)
113 IW.Send(ent->Vertex(i).X());
114 IW.Send(ent->Vertex(i).Y());
115 IW.Send(ent->Vertex(i).Z());
120 //=======================================================================
121 //function : OwnShared
123 //=======================================================================
125 void IGESSolid_ToolVertexList::OwnShared(const Handle(IGESSolid_VertexList)& /* ent */,
126 Interface_EntityIterator& /* iter */) const
131 //=======================================================================
134 //=======================================================================
136 void IGESSolid_ToolVertexList::OwnCopy(const Handle(IGESSolid_VertexList)& another,
137 const Handle(IGESSolid_VertexList)& ent,
138 Interface_CopyTool& /* TC */) const
140 Standard_Integer nbitems, i;
142 nbitems = another->NbVertices();
143 Handle(TColgp_HArray1OfXYZ) tempVertices = new
144 TColgp_HArray1OfXYZ(1, nbitems);
146 for (i=1; i<=nbitems; i++)
148 tempVertices->SetValue(i, another->Vertex(i).XYZ());
150 ent->Init(tempVertices);
154 //=======================================================================
155 //function : DirChecker
157 //=======================================================================
159 IGESData_DirChecker IGESSolid_ToolVertexList::DirChecker
160 (const Handle(IGESSolid_VertexList)& /* ent */ ) const
162 IGESData_DirChecker DC(502, 1);
164 DC.Structure (IGESData_DefVoid);
165 DC.LineFont (IGESData_DefVoid);
166 DC.LineWeight (IGESData_DefVoid);
167 DC.Color (IGESData_DefAny);
169 DC.SubordinateStatusRequired (1);
170 DC.HierarchyStatusIgnored ();
175 //=======================================================================
176 //function : OwnCheck
178 //=======================================================================
180 void IGESSolid_ToolVertexList::OwnCheck(const Handle(IGESSolid_VertexList)& ent,
181 const Interface_ShareTool&,
182 Handle(Interface_Check)& ach) const
185 // Building of messages
186 //========================================
187 //Message_Msg Msg182("XSTEP_182");
188 //========================================
190 if (ent->NbVertices() <= 0) {
191 Message_Msg Msg182("XSTEP_182");
192 ach->SendFail(Msg182);
197 //=======================================================================
200 //=======================================================================
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
207 S << "IGESSolid_VertexList" << endl;
210 IGESData_DumpListXYZL(S ,level,1, ent->NbVertices(),ent->Vertex,ent->Location());