0023258: Missing parenthesis
[occt.git] / src / IGESGeom / IGESGeom_ToolCircularArc.cxx
CommitLineData
b311480e 1// Created by: CKY / Contract Toubro-Larsen
2// Copyright (c) 1993-1999 Matra Datavision
3// Copyright (c) 1999-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
7fd59977 9//
b311480e 10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
7fd59977 12//
b311480e 13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
20//--------------------------------------------------------------------
7fd59977 21//--------------------------------------------------------------------
22
23#include <IGESGeom_ToolCircularArc.ixx>
24#include <IGESData_ParamCursor.hxx>
25#include <gp_XY.hxx>
26#include <gp_Pnt2d.hxx>
27#include <IGESData_Dump.hxx>
28#include <Interface_MSG.hxx>
29#include <Interface_Macros.hxx>
30#include <stdio.h>
31
32// MGE 28/07/98
33#include <Message_Msg.hxx>
34
35IGESGeom_ToolCircularArc::IGESGeom_ToolCircularArc () { }
36
37
38void IGESGeom_ToolCircularArc::ReadOwnParams
39 (const Handle(IGESGeom_CircularArc)& ent,
40 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
41{
42 // MGE 28/07/98
43 // Building of messages
44 //=====================================
45 Message_Msg Msg76("XSTEP_76");
46 Message_Msg Msg77("XSTEP_77");
47 Message_Msg Msg78("XSTEP_78");
48 //=====================================
49
50 Standard_Real aZT;
51 gp_XY aCenter, aStart, anEnd;
52 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
53
54 // MGE 28/07/98
55 if (!PR.ReadReal(PR.Current(), aZT)){ //szv#4:S4163:12Mar99 `st=` not needed
56 Message_Msg Msg75("XSTEP_75");
57 PR.SendFail(Msg75);
58 }
59 PR.ReadXY(PR.CurrentList(1, 2), Msg76, aCenter); //szv#4:S4163:12Mar99 `st=` not needed
60 PR.ReadXY(PR.CurrentList(1, 2), Msg77, aStart); //szv#4:S4163:12Mar99 `st=` not needed
61 PR.ReadXY(PR.CurrentList(1, 2), Msg78, anEnd); //szv#4:S4163:12Mar99 `st=` not needed
62
63/*
64 st = PR.ReadReal(PR.Current(), "Shift above z-plane", aZT);
65 st = PR.ReadXY(PR.CurrentList(1, 2), "Center Of Arc", aCenter);
66 st = PR.ReadXY(PR.CurrentList(1, 2), "Start Point Of Arc", aStart);
67 st = PR.ReadXY(PR.CurrentList(1, 2), "End Point Of Arc", anEnd);
68*/
69
70 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
71 ent->Init(aZT, aCenter, aStart, anEnd);
72
73}
74
75void IGESGeom_ToolCircularArc::WriteOwnParams
76 (const Handle(IGESGeom_CircularArc)& ent, IGESData_IGESWriter& IW) const
77{
78 IW.Send(ent->ZPlane());
79 IW.Send(ent->Center().X());
80 IW.Send(ent->Center().Y());
81 IW.Send(ent->StartPoint().X());
82 IW.Send(ent->StartPoint().Y());
83 IW.Send(ent->EndPoint().X());
84 IW.Send(ent->EndPoint().Y());
85}
86
87void IGESGeom_ToolCircularArc::OwnShared
88 (const Handle(IGESGeom_CircularArc)& /* ent */, Interface_EntityIterator& /* iter */) const
89{
90}
91
92void IGESGeom_ToolCircularArc::OwnCopy
93 (const Handle(IGESGeom_CircularArc)& another,
94 const Handle(IGESGeom_CircularArc)& ent, Interface_CopyTool& /* TC */) const
95{
96 ent->Init(another->ZPlane(), another->Center().XY(),
97 another->StartPoint().XY(), another->EndPoint().XY());
98}
99
100
101IGESData_DirChecker IGESGeom_ToolCircularArc::DirChecker
102 (const Handle(IGESGeom_CircularArc)& /* ent */ ) const
103{
104 IGESData_DirChecker DC(100, 0);
105 DC.Structure(IGESData_DefVoid);
106 DC.LineFont(IGESData_DefAny);
107// DC.LineWeight(IGESData_DefValue);
108 DC.Color(IGESData_DefAny);
109 DC.HierarchyStatusIgnored();
110 return DC;
111}
112
113void IGESGeom_ToolCircularArc::OwnCheck
114 (const Handle(IGESGeom_CircularArc)& /*ent*/,
115 const Interface_ShareTool& , Handle(Interface_Check)& /*ach*/) const
116{
117/*
118 //Standard_Real eps = 1.E-04; // Tolerance des tests ?? //szv#4:S4163:12Mar99 not needed
119
120 Standard_Real Rad1 = Sqrt(Square(ent->StartPoint().X() - ent->Center().X()) +
121 Square(ent->StartPoint().Y() - ent->Center().Y()));
122 Standard_Real Rad2 = Sqrt(Square(ent->EndPoint().X() - ent->Center().X()) +
123 Square(ent->EndPoint().Y() - ent->Center().Y()));
124
125 Standard_Real ratio = Abs(Rad1 - Rad2) / (Rad1+Rad2);
126 if (ratio > eps) {
127 char mess[80];
128 sprintf(mess,"Radius at Start & End Points, relative gap over %f",
129 Interface_MSG::Intervalled (ratio));
130 ach.AddFail(mess,"Radius at Start & End Points, relative gap over %f");
131 }
132*/
133}
134
135void IGESGeom_ToolCircularArc::OwnDump
136 (const Handle(IGESGeom_CircularArc)& ent, const IGESData_IGESDumper& /* dumper */,
137 const Handle(Message_Messenger)& S, const Standard_Integer level) const
138{
139 S << "CircularArc from IGESGeom" << endl;
140 S << "Z-Plane Displacement : " << ent->ZPlane() << endl;
141 S << "Center : ";
142 IGESData_DumpXYLZ(S,level, ent->Center(), ent->Location(), ent->ZPlane());
143 S << endl;
144 S << "Start Point : ";
145 IGESData_DumpXYLZ(S,level, ent->StartPoint(), ent->Location(),ent->ZPlane());
146 S << endl;
147 S << "End Point : ";
148 IGESData_DumpXYLZ(S,level, ent->EndPoint(), ent->Location(), ent->ZPlane());
149 S << endl;
150 if (level <= 5) return;
151 S<< " Normal Axis : "; IGESData_DumpXYZL(S,level,ent->Axis(),ent->VectorLocation());
152 S << endl;
153}