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_Vec.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_IGESEntity.hxx> |
25 | #include <IGESData_IGESReaderData.hxx> |
26 | #include <IGESData_IGESWriter.hxx> |
27 | #include <IGESData_ParamCursor.hxx> |
28 | #include <IGESData_ParamReader.hxx> |
29 | #include <IGESData_Status.hxx> |
30 | #include <IGESGeom_OffsetSurface.hxx> |
31 | #include <IGESGeom_ToolOffsetSurface.hxx> |
32 | #include <Interface_Check.hxx> |
33 | #include <Interface_CopyTool.hxx> |
34 | #include <Interface_EntityIterator.hxx> |
7fd59977 |
35 | #include <Interface_Macros.hxx> |
42cf5bc1 |
36 | #include <Interface_ShareTool.hxx> |
37 | #include <Message_Messenger.hxx> |
7fd59977 |
38 | #include <Message_Msg.hxx> |
42cf5bc1 |
39 | #include <Standard_DomainError.hxx> |
7fd59977 |
40 | |
42cf5bc1 |
41 | // MGE 31/07/98 |
7fd59977 |
42 | IGESGeom_ToolOffsetSurface::IGESGeom_ToolOffsetSurface () { } |
43 | |
44 | |
45 | void IGESGeom_ToolOffsetSurface::ReadOwnParams |
46 | (const Handle(IGESGeom_OffsetSurface)& ent, |
47 | const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const |
48 | { |
49 | // MGE 31/07/98 |
50 | // Building of messages |
51 | //======================================== |
52 | Message_Msg Msg162("XSTEP_162"); |
53 | //======================================== |
54 | |
55 | gp_XYZ anIndicator; |
56 | Standard_Real aDistance; |
57 | Handle(IGESData_IGESEntity) aSurface; |
58 | IGESData_Status aStatus; |
59 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
60 | |
61 | // Reading the offset indicator |
62 | PR.ReadXYZ(PR.CurrentList(1, 3), Msg162, anIndicator); //szv#4:S4163:12Mar99 `st=` not needed |
63 | // Reading the offset distance |
64 | if (!PR.ReadReal(PR.Current(), aDistance)){ |
65 | Message_Msg Msg163("XSTEP_163"); |
66 | PR.SendFail(Msg163); |
67 | } //szv#4:S4163:12Mar99 `st=` not needed |
68 | // Reading the surface entity to be offset |
69 | if (!PR.ReadEntity(IR, PR.Current(), aStatus, aSurface)){ |
70 | Message_Msg Msg164("XSTEP_164"); |
71 | switch(aStatus) { |
72 | case IGESData_ReferenceError: { |
73 | Message_Msg Msg216 ("IGES_216"); |
74 | Msg164.Arg(Msg216.Value()); |
75 | PR.SendFail(Msg164); |
76 | break; } |
77 | case IGESData_EntityError: { |
78 | Message_Msg Msg217 ("IGES_217"); |
79 | Msg164.Arg(Msg217.Value()); |
80 | PR.SendFail(Msg164); |
81 | break; } |
82 | default:{ |
83 | } |
84 | } |
85 | }//szv#4:S4163:12Mar99 `st=` not needed |
86 | |
87 | |
88 | /* |
89 | // Reading the offset indicator |
90 | st = PR.ReadXYZ(PR.CurrentList(1, 3), "Offset Indicator", anIndicator); |
91 | // Reading the offset distance |
92 | st = PR.ReadReal(PR.Current(), "The Offset Distance ", aDistance); |
93 | // Reading the surface entity to be offset |
94 | st = PR.ReadEntity(IR, PR.Current(), "Surface entity to be offset", aSurface); |
95 | */ |
96 | |
97 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
98 | ent->Init(anIndicator, aDistance, aSurface); |
99 | } |
100 | |
101 | void IGESGeom_ToolOffsetSurface::WriteOwnParams |
102 | (const Handle(IGESGeom_OffsetSurface)& ent, IGESData_IGESWriter& IW) const |
103 | { |
104 | IW.Send( ent->OffsetIndicator().X() ); |
105 | IW.Send( ent->OffsetIndicator().Y() ); |
106 | IW.Send( ent->OffsetIndicator().Z() ); |
107 | IW.Send( ent->Distance() ); |
108 | IW.Send( ent->Surface() ); |
109 | } |
110 | |
111 | void IGESGeom_ToolOffsetSurface::OwnShared |
112 | (const Handle(IGESGeom_OffsetSurface)& ent, Interface_EntityIterator& iter) const |
113 | { |
114 | iter.GetOneItem( ent->Surface() ); |
115 | } |
116 | |
117 | void IGESGeom_ToolOffsetSurface::OwnCopy |
118 | (const Handle(IGESGeom_OffsetSurface)& another, |
119 | const Handle(IGESGeom_OffsetSurface)& ent, Interface_CopyTool& TC) const |
120 | { |
121 | DeclareAndCast(IGESData_IGESEntity, aSurface, TC.Transferred(another->Surface()) ); |
122 | |
123 | gp_XYZ anIndicator = (another->OffsetIndicator()).XYZ(); |
124 | Standard_Real aDistance = another->Distance(); |
125 | |
126 | ent->Init(anIndicator, aDistance, aSurface); |
127 | } |
128 | |
129 | |
130 | IGESData_DirChecker IGESGeom_ToolOffsetSurface::DirChecker |
131 | (const Handle(IGESGeom_OffsetSurface)& /* ent */ ) const |
132 | { |
133 | IGESData_DirChecker DC(140, 0); |
134 | DC.Structure(IGESData_DefVoid); |
135 | DC.LineFont(IGESData_DefAny); |
136 | // DC.LineWeight(IGESData_DefValue); |
137 | DC.Color(IGESData_DefAny); |
138 | DC.HierarchyStatusIgnored(); |
139 | return DC; |
140 | } |
141 | |
142 | void IGESGeom_ToolOffsetSurface::OwnCheck |
143 | (const Handle(IGESGeom_OffsetSurface)& /* ent */, |
144 | const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const |
145 | { |
146 | } |
147 | |
148 | void IGESGeom_ToolOffsetSurface::OwnDump |
149 | (const Handle(IGESGeom_OffsetSurface)& ent, const IGESData_IGESDumper& dumper, |
0ebe5b0a |
150 | Standard_OStream& S, const Standard_Integer level) const |
7fd59977 |
151 | { |
152 | Standard_Integer sublevel = (level <= 4) ? 0 : 1; |
153 | |
0ebe5b0a |
154 | S << "IGESGeom_OffsetSurface\n" |
155 | << "Offset Indicator : "; |
7fd59977 |
156 | IGESData_DumpXYZL(S,level, ent->OffsetIndicator(), ent->VectorLocation()); |
0ebe5b0a |
157 | S << "\n" |
158 | << "Offset Distance : " << ent->Distance() << " " |
159 | << "Surface to be offset : "; |
7fd59977 |
160 | dumper.Dump(ent->Surface(),S, sublevel); |
0ebe5b0a |
161 | S << std::endl; |
7fd59977 |
162 | } |