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 | |
19 | #include <IGESSolid_ToolCylindricalSurface.ixx> |
20 | #include <IGESData_ParamCursor.hxx> |
21 | #include <IGESGeom_Point.hxx> |
22 | #include <IGESGeom_Direction.hxx> |
23 | #include <Interface_Macros.hxx> |
24 | |
25 | |
26 | IGESSolid_ToolCylindricalSurface::IGESSolid_ToolCylindricalSurface () { } |
27 | |
28 | |
29 | void IGESSolid_ToolCylindricalSurface::ReadOwnParams |
30 | (const Handle(IGESSolid_CylindricalSurface)& ent, |
31 | const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const |
32 | { |
33 | Handle(IGESGeom_Point) tempLocation; |
34 | Handle(IGESGeom_Direction) tempAxis; |
35 | Handle(IGESGeom_Direction) tempRefdir; // default Unparametrised |
36 | Standard_Real tempRadius; |
37 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
38 | |
39 | PR.ReadEntity(IR, PR.Current(), "Point on axis", |
40 | STANDARD_TYPE(IGESGeom_Point), tempLocation); //szv#4:S4163:12Mar99 `st=` not needed |
41 | |
42 | PR.ReadEntity(IR, PR.Current(), "Axis direction", |
43 | STANDARD_TYPE(IGESGeom_Direction), tempAxis); //szv#4:S4163:12Mar99 `st=` not needed |
44 | |
45 | PR.ReadReal(PR.Current(), "Radius", tempRadius); //szv#4:S4163:12Mar99 `st=` not needed |
46 | |
47 | if (ent->FormNumber() == 1) // Parametrised surface |
48 | PR.ReadEntity(IR, PR.Current(), "Reference direction", |
49 | STANDARD_TYPE(IGESGeom_Direction), tempRefdir); //szv#4:S4163:12Mar99 `st=` not needed |
50 | |
51 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
52 | ent->Init (tempLocation, tempAxis, tempRadius, tempRefdir); |
53 | } |
54 | |
55 | void IGESSolid_ToolCylindricalSurface::WriteOwnParams |
56 | (const Handle(IGESSolid_CylindricalSurface)& ent, IGESData_IGESWriter& IW) const |
57 | { |
58 | IW.Send(ent->LocationPoint()); |
59 | IW.Send(ent->Axis()); |
60 | IW.Send(ent->Radius()); |
61 | if (ent->IsParametrised()) IW.Send(ent->ReferenceDir()); |
62 | } |
63 | |
64 | void IGESSolid_ToolCylindricalSurface::OwnShared |
65 | (const Handle(IGESSolid_CylindricalSurface)& ent, Interface_EntityIterator& iter) const |
66 | { |
67 | iter.GetOneItem(ent->LocationPoint()); |
68 | iter.GetOneItem(ent->Axis()); |
69 | iter.GetOneItem(ent->ReferenceDir()); |
70 | } |
71 | |
72 | void IGESSolid_ToolCylindricalSurface::OwnCopy |
73 | (const Handle(IGESSolid_CylindricalSurface)& another, |
74 | const Handle(IGESSolid_CylindricalSurface)& ent, Interface_CopyTool& TC) const |
75 | { |
76 | Standard_Real tempRadius; |
77 | |
78 | DeclareAndCast(IGESGeom_Point, tempLocation, |
79 | TC.Transferred(another->LocationPoint())); |
80 | DeclareAndCast(IGESGeom_Direction, tempAxis, |
81 | TC.Transferred(another->Axis())); |
82 | tempRadius = another->Radius(); |
83 | if (another->IsParametrised()) |
84 | { |
85 | DeclareAndCast(IGESGeom_Direction, tempRefdir, |
86 | TC.Transferred(another->ReferenceDir())); |
87 | ent->Init (tempLocation, tempAxis, tempRadius, tempRefdir); |
88 | } |
89 | else |
90 | { |
91 | Handle(IGESGeom_Direction) tempRefdir; |
92 | ent->Init (tempLocation, tempAxis, tempRadius, tempRefdir); |
93 | } |
94 | |
95 | } |
96 | |
97 | IGESData_DirChecker IGESSolid_ToolCylindricalSurface::DirChecker |
98 | (const Handle(IGESSolid_CylindricalSurface)& /*ent*/) const |
99 | { |
100 | IGESData_DirChecker DC(192, 0, 1); |
101 | |
102 | DC.Structure (IGESData_DefVoid); |
103 | DC.LineFont (IGESData_DefAny); |
104 | DC.Color (IGESData_DefAny); |
105 | |
106 | DC.BlankStatusIgnored (); |
107 | DC.SubordinateStatusRequired (1); |
108 | DC.HierarchyStatusIgnored (); |
109 | return DC; |
110 | } |
111 | |
112 | void IGESSolid_ToolCylindricalSurface::OwnCheck |
113 | (const Handle(IGESSolid_CylindricalSurface)& ent, |
114 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
115 | { |
116 | if (ent->Radius() <= 0.0) |
117 | ach->AddFail("Radius : Value <= 0.0"); |
118 | Standard_Integer fn = 0; |
119 | if (ent->IsParametrised()) fn = 1; |
120 | if (fn != ent->FormNumber()) ach->AddFail |
121 | ("Parametrised Status Mismatches with Form Number"); |
122 | } |
123 | |
124 | void IGESSolid_ToolCylindricalSurface::OwnDump |
125 | (const Handle(IGESSolid_CylindricalSurface)& ent, const IGESData_IGESDumper& dumper, |
126 | const Handle(Message_Messenger)& S, const Standard_Integer level) const |
127 | { |
128 | S << "IGESSolid_CylindricalSurface" << endl; |
129 | |
130 | Standard_Integer sublevel = (level <= 4) ? 0 : 1; |
131 | S << "Point on axis : "; |
132 | dumper.Dump(ent->LocationPoint(),S, sublevel); |
133 | S << endl; |
134 | S << "Axis direction : "; |
135 | dumper.Dump(ent->Axis(),S, sublevel); |
136 | S << endl; |
137 | S << "Radius : " << ent->Radius() << endl; |
138 | if (ent->IsParametrised()) |
139 | { |
140 | S << "Surface is Parametrised - Reference direction : "; |
141 | dumper.Dump(ent->ReferenceDir(),S, sublevel); |
142 | S << endl; |
143 | } |
144 | else S << "Surface is UnParametrised" << endl; |
145 | } |