7fd59977 |
1 | //-------------------------------------------------------------------- |
2 | // |
3 | // File Name : IGESGeom_CircularArc.cxx |
4 | // Date : |
5 | // Author : CKY / Contract Toubro-Larsen |
6 | // Copyright : MATRA-DATAVISION 1993 |
7 | // |
8 | //-------------------------------------------------------------------- |
9 | |
10 | #include <IGESGeom_ToolCircularArc.ixx> |
11 | #include <IGESData_ParamCursor.hxx> |
12 | #include <gp_XY.hxx> |
13 | #include <gp_Pnt2d.hxx> |
14 | #include <IGESData_Dump.hxx> |
15 | #include <Interface_MSG.hxx> |
16 | #include <Interface_Macros.hxx> |
17 | #include <stdio.h> |
18 | |
19 | // MGE 28/07/98 |
20 | #include <Message_Msg.hxx> |
21 | |
22 | IGESGeom_ToolCircularArc::IGESGeom_ToolCircularArc () { } |
23 | |
24 | |
25 | void IGESGeom_ToolCircularArc::ReadOwnParams |
26 | (const Handle(IGESGeom_CircularArc)& ent, |
27 | const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const |
28 | { |
29 | // MGE 28/07/98 |
30 | // Building of messages |
31 | //===================================== |
32 | Message_Msg Msg76("XSTEP_76"); |
33 | Message_Msg Msg77("XSTEP_77"); |
34 | Message_Msg Msg78("XSTEP_78"); |
35 | //===================================== |
36 | |
37 | Standard_Real aZT; |
38 | gp_XY aCenter, aStart, anEnd; |
39 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
40 | |
41 | // MGE 28/07/98 |
42 | if (!PR.ReadReal(PR.Current(), aZT)){ //szv#4:S4163:12Mar99 `st=` not needed |
43 | Message_Msg Msg75("XSTEP_75"); |
44 | PR.SendFail(Msg75); |
45 | } |
46 | PR.ReadXY(PR.CurrentList(1, 2), Msg76, aCenter); //szv#4:S4163:12Mar99 `st=` not needed |
47 | PR.ReadXY(PR.CurrentList(1, 2), Msg77, aStart); //szv#4:S4163:12Mar99 `st=` not needed |
48 | PR.ReadXY(PR.CurrentList(1, 2), Msg78, anEnd); //szv#4:S4163:12Mar99 `st=` not needed |
49 | |
50 | /* |
51 | st = PR.ReadReal(PR.Current(), "Shift above z-plane", aZT); |
52 | st = PR.ReadXY(PR.CurrentList(1, 2), "Center Of Arc", aCenter); |
53 | st = PR.ReadXY(PR.CurrentList(1, 2), "Start Point Of Arc", aStart); |
54 | st = PR.ReadXY(PR.CurrentList(1, 2), "End Point Of Arc", anEnd); |
55 | */ |
56 | |
57 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
58 | ent->Init(aZT, aCenter, aStart, anEnd); |
59 | |
60 | } |
61 | |
62 | void IGESGeom_ToolCircularArc::WriteOwnParams |
63 | (const Handle(IGESGeom_CircularArc)& ent, IGESData_IGESWriter& IW) const |
64 | { |
65 | IW.Send(ent->ZPlane()); |
66 | IW.Send(ent->Center().X()); |
67 | IW.Send(ent->Center().Y()); |
68 | IW.Send(ent->StartPoint().X()); |
69 | IW.Send(ent->StartPoint().Y()); |
70 | IW.Send(ent->EndPoint().X()); |
71 | IW.Send(ent->EndPoint().Y()); |
72 | } |
73 | |
74 | void IGESGeom_ToolCircularArc::OwnShared |
75 | (const Handle(IGESGeom_CircularArc)& /* ent */, Interface_EntityIterator& /* iter */) const |
76 | { |
77 | } |
78 | |
79 | void IGESGeom_ToolCircularArc::OwnCopy |
80 | (const Handle(IGESGeom_CircularArc)& another, |
81 | const Handle(IGESGeom_CircularArc)& ent, Interface_CopyTool& /* TC */) const |
82 | { |
83 | ent->Init(another->ZPlane(), another->Center().XY(), |
84 | another->StartPoint().XY(), another->EndPoint().XY()); |
85 | } |
86 | |
87 | |
88 | IGESData_DirChecker IGESGeom_ToolCircularArc::DirChecker |
89 | (const Handle(IGESGeom_CircularArc)& /* ent */ ) const |
90 | { |
91 | IGESData_DirChecker DC(100, 0); |
92 | DC.Structure(IGESData_DefVoid); |
93 | DC.LineFont(IGESData_DefAny); |
94 | // DC.LineWeight(IGESData_DefValue); |
95 | DC.Color(IGESData_DefAny); |
96 | DC.HierarchyStatusIgnored(); |
97 | return DC; |
98 | } |
99 | |
100 | void IGESGeom_ToolCircularArc::OwnCheck |
101 | (const Handle(IGESGeom_CircularArc)& /*ent*/, |
102 | const Interface_ShareTool& , Handle(Interface_Check)& /*ach*/) const |
103 | { |
104 | /* |
105 | //Standard_Real eps = 1.E-04; // Tolerance des tests ?? //szv#4:S4163:12Mar99 not needed |
106 | |
107 | Standard_Real Rad1 = Sqrt(Square(ent->StartPoint().X() - ent->Center().X()) + |
108 | Square(ent->StartPoint().Y() - ent->Center().Y())); |
109 | Standard_Real Rad2 = Sqrt(Square(ent->EndPoint().X() - ent->Center().X()) + |
110 | Square(ent->EndPoint().Y() - ent->Center().Y())); |
111 | |
112 | Standard_Real ratio = Abs(Rad1 - Rad2) / (Rad1+Rad2); |
113 | if (ratio > eps) { |
114 | char mess[80]; |
115 | sprintf(mess,"Radius at Start & End Points, relative gap over %f", |
116 | Interface_MSG::Intervalled (ratio)); |
117 | ach.AddFail(mess,"Radius at Start & End Points, relative gap over %f"); |
118 | } |
119 | */ |
120 | } |
121 | |
122 | void IGESGeom_ToolCircularArc::OwnDump |
123 | (const Handle(IGESGeom_CircularArc)& ent, const IGESData_IGESDumper& /* dumper */, |
124 | const Handle(Message_Messenger)& S, const Standard_Integer level) const |
125 | { |
126 | S << "CircularArc from IGESGeom" << endl; |
127 | S << "Z-Plane Displacement : " << ent->ZPlane() << endl; |
128 | S << "Center : "; |
129 | IGESData_DumpXYLZ(S,level, ent->Center(), ent->Location(), ent->ZPlane()); |
130 | S << endl; |
131 | S << "Start Point : "; |
132 | IGESData_DumpXYLZ(S,level, ent->StartPoint(), ent->Location(),ent->ZPlane()); |
133 | S << endl; |
134 | S << "End Point : "; |
135 | IGESData_DumpXYLZ(S,level, ent->EndPoint(), ent->Location(), ent->ZPlane()); |
136 | S << endl; |
137 | if (level <= 5) return; |
138 | S<< " Normal Axis : "; IGESData_DumpXYZL(S,level,ent->Axis(),ent->VectorLocation()); |
139 | S << endl; |
140 | } |