1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
22 #include <IGESData_DirChecker.hxx>
23 #include <IGESData_Dump.hxx>
24 #include <IGESData_IGESDumper.hxx>
25 #include <IGESData_IGESReaderData.hxx>
26 #include <IGESData_IGESWriter.hxx>
27 #include <IGESData_ParamCursor.hxx>
28 #include <IGESData_ParamReader.hxx>
29 #include <IGESGeom_Direction.hxx>
30 #include <IGESGeom_ToolDirection.hxx>
31 #include <Interface_Check.hxx>
32 #include <Interface_CopyTool.hxx>
33 #include <Interface_EntityIterator.hxx>
34 #include <Interface_Macros.hxx>
35 #include <Interface_ShareTool.hxx>
36 #include <Message_Messenger.hxx>
37 #include <Standard_DomainError.hxx>
39 IGESGeom_ToolDirection::IGESGeom_ToolDirection () { }
42 void IGESGeom_ToolDirection::ReadOwnParams
43 (const Handle(IGESGeom_Direction)& ent,
44 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
48 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
49 Standard_Real tmpReal;
51 //st = PR.ReadXY(PR.CurrentList(1, 2), "Direction", tmpXY); //szv#4:S4163:12Mar99 moved in if
52 if (PR.ReadXY(PR.CurrentList(1, 2), "Direction", tmpXY)) {
53 aDirection.SetX(tmpXY.X());
54 aDirection.SetY(tmpXY.Y());
57 if (PR.DefinedElseSkip())
59 //st = PR.ReadReal(PR.Current(), "Direction", tmpReal); //szv#4:S4163:12Mar99 moved in if
60 if (PR.ReadReal(PR.Current(), "Direction", tmpReal))
61 aDirection.SetZ(tmpReal);
65 aDirection.SetZ(0.0); // Default value.
68 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
69 ent->Init(aDirection);
72 void IGESGeom_ToolDirection::WriteOwnParams
73 (const Handle(IGESGeom_Direction)& ent, IGESData_IGESWriter& IW) const
75 IW.Send(ent->Value().X());
76 IW.Send(ent->Value().Y());
77 IW.Send(ent->Value().Z());
80 void IGESGeom_ToolDirection::OwnShared
81 (const Handle(IGESGeom_Direction)& /* ent */, Interface_EntityIterator& /* iter */) const
85 void IGESGeom_ToolDirection::OwnCopy
86 (const Handle(IGESGeom_Direction)& another,
87 const Handle(IGESGeom_Direction)& ent, Interface_CopyTool& /* TC */) const
89 ent->Init(another->Value().XYZ());
92 IGESData_DirChecker IGESGeom_ToolDirection::DirChecker
93 (const Handle(IGESGeom_Direction)& /* ent */ ) const
95 IGESData_DirChecker DC(123, 0);
96 DC.Structure(IGESData_DefVoid);
97 DC.LineFont(IGESData_DefAny);
98 // DC.LineWeight(IGESData_DefValue);
99 DC.Color(IGESData_DefAny);
101 DC.BlankStatusIgnored ();
102 DC.SubordinateStatusRequired (1);
103 DC.UseFlagRequired (2);
104 DC.HierarchyStatusIgnored ();
108 void IGESGeom_ToolDirection::OwnCheck
109 (const Handle(IGESGeom_Direction)& ent,
110 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
112 if (ent->Value().XYZ().SquareModulus() <= 0.0)
113 ach->AddFail("Direction : The values indicate no direction");
116 void IGESGeom_ToolDirection::OwnDump
117 (const Handle(IGESGeom_Direction)& ent, const IGESData_IGESDumper& /* dumper */,
118 const Handle(Message_Messenger)& S, const Standard_Integer level) const
120 S << "IGESGeom_Direction" << endl << endl;
123 IGESData_DumpXYZL(S,level, ent->Value(), ent->VectorLocation());