7fd59977 |
1 | //-------------------------------------------------------------------- |
2 | // |
3 | // File Name : IGESSolid_SolidOfLinearExtrusion.cxx |
4 | // Date : |
5 | // Author : CKY / Contract Toubro-Larsen |
6 | // Copyright : MATRA-DATAVISION 1993 |
7 | // |
8 | //-------------------------------------------------------------------- |
9 | |
10 | #include <IGESSolid_ToolSolidOfLinearExtrusion.ixx> |
11 | #include <IGESData_ParamCursor.hxx> |
12 | #include <IGESData_IGESEntity.hxx> |
13 | #include <gp_XYZ.hxx> |
14 | #include <IGESData_Dump.hxx> |
15 | #include <Interface_Macros.hxx> |
16 | |
17 | |
18 | IGESSolid_ToolSolidOfLinearExtrusion::IGESSolid_ToolSolidOfLinearExtrusion () |
19 | { } |
20 | |
21 | |
22 | void IGESSolid_ToolSolidOfLinearExtrusion::ReadOwnParams |
23 | (const Handle(IGESSolid_SolidOfLinearExtrusion)& ent, |
24 | const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const |
25 | { |
26 | Handle(IGESData_IGESEntity) tempEntity; |
27 | gp_XYZ tempDirection; |
28 | Standard_Real tempLength; |
29 | Standard_Real tempreal; |
30 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
31 | |
32 | PR.ReadEntity(IR, PR.Current(), "Curve Entity", tempEntity); //szv#4:S4163:12Mar99 `st=` not needed |
33 | |
34 | PR.ReadReal(PR.Current(), "Length of extrusion", tempLength); //szv#4:S4163:12Mar99 `st=` not needed |
35 | |
36 | if (PR.DefinedElseSkip()) |
37 | { |
38 | //st = PR.ReadReal(PR.Current(), "Extrusion direction (I)", tempreal); //szv#4:S4163:12Mar99 moved in if |
39 | if (PR.ReadReal(PR.Current(), "Extrusion direction (I)", tempreal)) |
40 | tempDirection.SetX(tempreal); |
41 | } |
42 | else tempDirection.SetX(0.0); |
43 | |
44 | if (PR.DefinedElseSkip()) |
45 | { |
46 | //st = PR.ReadReal(PR.Current(), "Extrusion direction (J)", tempreal); //szv#4:S4163:12Mar99 moved in if |
47 | if (PR.ReadReal(PR.Current(), "Extrusion direction (J)", tempreal)) |
48 | tempDirection.SetY(tempreal); |
49 | } |
50 | else tempDirection.SetY(0.0); |
51 | |
52 | if (PR.DefinedElseSkip()) |
53 | { |
54 | //st = PR.ReadReal(PR.Current(), "Extrusion direction (K)", tempreal); //szv#4:S4163:12Mar99 moved in if |
55 | if (PR.ReadReal(PR.Current(), "Extrusion direction (K)", tempreal)) |
56 | tempDirection.SetZ(tempreal); |
57 | } |
58 | else tempDirection.SetZ(1.0); |
59 | |
60 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
61 | ent->Init(tempEntity, tempLength, tempDirection); |
62 | Standard_Real eps = 1.E-05; |
63 | if (!tempDirection.IsEqual(ent->ExtrusionDirection().XYZ(),eps)) |
64 | PR.AddWarning("Extrusion Direction poorly unitary, normalized"); |
65 | } |
66 | |
67 | void IGESSolid_ToolSolidOfLinearExtrusion::WriteOwnParams |
68 | (const Handle(IGESSolid_SolidOfLinearExtrusion)& ent, IGESData_IGESWriter& IW) const |
69 | { |
70 | IW.Send(ent->Curve()); |
71 | IW.Send(ent->ExtrusionLength()); |
72 | IW.Send(ent->ExtrusionDirection().X()); |
73 | IW.Send(ent->ExtrusionDirection().Y()); |
74 | IW.Send(ent->ExtrusionDirection().Z()); |
75 | } |
76 | |
77 | void IGESSolid_ToolSolidOfLinearExtrusion::OwnShared |
78 | (const Handle(IGESSolid_SolidOfLinearExtrusion)& ent, Interface_EntityIterator& iter) const |
79 | { |
80 | iter.GetOneItem(ent->Curve()); |
81 | } |
82 | |
83 | void IGESSolid_ToolSolidOfLinearExtrusion::OwnCopy |
84 | (const Handle(IGESSolid_SolidOfLinearExtrusion)& another, |
85 | const Handle(IGESSolid_SolidOfLinearExtrusion)& ent, Interface_CopyTool& TC) const |
86 | { |
87 | DeclareAndCast(IGESData_IGESEntity, tempEntity, |
88 | TC.Transferred(another->Curve())); |
89 | Standard_Real tempLength = another->ExtrusionLength(); |
90 | gp_XYZ tempDirection = another->ExtrusionDirection().XYZ(); |
91 | ent->Init(tempEntity, tempLength, tempDirection); |
92 | } |
93 | |
94 | IGESData_DirChecker IGESSolid_ToolSolidOfLinearExtrusion::DirChecker |
95 | (const Handle(IGESSolid_SolidOfLinearExtrusion)& /* ent */ ) const |
96 | { |
97 | IGESData_DirChecker DC(164, 0); |
98 | |
99 | DC.Structure (IGESData_DefVoid); |
100 | DC.LineFont (IGESData_DefAny); |
101 | DC.Color (IGESData_DefAny); |
102 | |
103 | DC.UseFlagRequired (0); |
104 | DC.HierarchyStatusIgnored (); |
105 | return DC; |
106 | } |
107 | |
108 | void IGESSolid_ToolSolidOfLinearExtrusion::OwnCheck |
109 | (const Handle(IGESSolid_SolidOfLinearExtrusion)& ent, |
110 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
111 | { |
112 | if (ent->ExtrusionLength() <= 0.0) |
113 | ach->AddFail("Length of extrusion : Not Positive"); |
114 | } |
115 | |
116 | void IGESSolid_ToolSolidOfLinearExtrusion::OwnDump |
117 | (const Handle(IGESSolid_SolidOfLinearExtrusion)& ent, const IGESData_IGESDumper& dumper, |
118 | const Handle(Message_Messenger)& S, const Standard_Integer level) const |
119 | { |
120 | S << "IGESSolid_SolidOfLinearExtrusion" << endl; |
121 | |
122 | S << "Curve entity : "; |
123 | dumper.Dump(ent->Curve(),S, (level <= 4) ? 0 : 1); |
124 | S << endl; |
125 | S << "Extrusion length : " << ent->ExtrusionLength() << endl; |
126 | S << "Extrusion direction : "; |
127 | IGESData_DumpXYZL(S,level, ent->ExtrusionDirection(), ent->VectorLocation()); |
128 | S << endl; |
129 | } |