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 | |
42cf5bc1 |
19 | #include <IGESData_DirChecker.hxx> |
7fd59977 |
20 | #include <IGESData_Dump.hxx> |
42cf5bc1 |
21 | #include <IGESData_HArray1OfIGESEntity.hxx> |
22 | #include <IGESData_IGESDumper.hxx> |
23 | #include <IGESData_IGESEntity.hxx> |
24 | #include <IGESData_IGESReaderData.hxx> |
25 | #include <IGESData_IGESWriter.hxx> |
26 | #include <IGESData_ParamCursor.hxx> |
27 | #include <IGESData_ParamReader.hxx> |
28 | #include <IGESGeom_CompositeCurve.hxx> |
29 | #include <IGESGeom_ToolCompositeCurve.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> |
7fd59977 |
38 | |
42cf5bc1 |
39 | // MGE 28/07/98 |
7fd59977 |
40 | IGESGeom_ToolCompositeCurve::IGESGeom_ToolCompositeCurve () { } |
41 | |
42 | |
43 | void IGESGeom_ToolCompositeCurve::ReadOwnParams |
44 | (const Handle(IGESGeom_CompositeCurve)& ent, |
45 | const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const |
46 | { |
47 | // MGE 28/07/98 |
48 | // Building of messages |
49 | //Standard_Boolean st; //szv#4:S4163:12Mar99 moved down |
50 | Handle(IGESData_HArray1OfIGESEntity) tempEntities; |
51 | |
52 | Standard_Integer num; //szv#4:S4163:12Mar99 i not needed |
53 | |
54 | Standard_Boolean st = PR.ReadInteger(PR.Current(), num); |
55 | // st = PR.ReadInteger(PR.Current(), "Number of Components", num); |
56 | if (st && (num > 0)){ |
57 | Message_Msg Msg80("XSTEP_80"); |
58 | PR.ReadEnts (IR,PR.CurrentList(num),Msg80,tempEntities); //szv#4:S4163:12Mar99 `st=` not needed |
59 | //else st = PR.ReadEnts (IR,PR.CurrentList(num),"List of Components",tempEntities); |
60 | } |
61 | //if (st && num <= 0) PR.SendFail(Msg79); |
62 | else{ |
63 | Message_Msg Msg79("XSTEP_79"); |
64 | PR.SendFail(Msg79); |
65 | } |
66 | |
67 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
68 | ent->Init(tempEntities); |
69 | } |
70 | |
71 | void IGESGeom_ToolCompositeCurve::WriteOwnParams |
72 | (const Handle(IGESGeom_CompositeCurve)& ent, IGESData_IGESWriter& IW) const |
73 | { |
74 | Standard_Integer num = ent->NbCurves(); Standard_Integer i; |
75 | IW.Send(num); |
76 | for ( num = ent->NbCurves(), i = 1; i <= num; i++ ) |
77 | IW.Send(ent->Curve(i)); |
78 | } |
79 | |
80 | void IGESGeom_ToolCompositeCurve::OwnShared |
81 | (const Handle(IGESGeom_CompositeCurve)& ent, Interface_EntityIterator& iter) const |
82 | { |
83 | Standard_Integer num = ent->NbCurves(); |
84 | for ( Standard_Integer i = 1; i <= num; i++ ) |
85 | iter.GetOneItem(ent->Curve(i)); |
86 | } |
87 | |
88 | void IGESGeom_ToolCompositeCurve::OwnCopy |
89 | (const Handle(IGESGeom_CompositeCurve)& another, |
90 | const Handle(IGESGeom_CompositeCurve)& ent, Interface_CopyTool& TC) const |
91 | { |
92 | Standard_Integer i, num = another->NbCurves(); |
93 | Handle(IGESData_HArray1OfIGESEntity) tempEntities = |
94 | new IGESData_HArray1OfIGESEntity(1, num); |
95 | for ( i = 1; i <= num; i++ ) |
96 | { |
97 | DeclareAndCast(IGESData_IGESEntity, new_ent, |
98 | TC.Transferred(another->Curve(i))); |
99 | tempEntities->SetValue(i, new_ent); |
100 | } |
101 | ent->Init(tempEntities); |
102 | } |
103 | |
104 | IGESData_DirChecker IGESGeom_ToolCompositeCurve::DirChecker |
105 | (const Handle(IGESGeom_CompositeCurve)& /* ent */ ) const |
106 | { |
107 | IGESData_DirChecker DC(102, 0); |
108 | DC.Structure(IGESData_DefVoid); |
109 | DC.GraphicsIgnored(); |
110 | DC.LineFont(IGESData_DefAny); |
111 | // DC.LineWeight(IGESData_DefValue); |
112 | DC.Color(IGESData_DefAny); |
113 | return DC; |
114 | } |
115 | |
116 | void IGESGeom_ToolCompositeCurve::OwnCheck |
117 | (const Handle(IGESGeom_CompositeCurve)& /* ent */, |
118 | const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const |
119 | { |
120 | } |
121 | |
122 | void IGESGeom_ToolCompositeCurve::OwnDump |
123 | (const Handle(IGESGeom_CompositeCurve)& ent, const IGESData_IGESDumper& dumper, |
124 | const Handle(Message_Messenger)& S, const Standard_Integer level) const |
125 | { |
126 | S << "IGESGeom_CompositeCurve" << endl; |
127 | S << "Curve Entities : " << endl; |
128 | IGESData_DumpEntities(S,dumper ,level,1, ent->NbCurves(),ent->Curve); |
129 | S << endl; |
130 | } |