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 <Standard_DomainError.hxx>
38 IGESGeom_ToolDirection::IGESGeom_ToolDirection () { }
41 void IGESGeom_ToolDirection::ReadOwnParams
42 (const Handle(IGESGeom_Direction)& ent,
43 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
47 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
48 Standard_Real tmpReal;
50 //st = PR.ReadXY(PR.CurrentList(1, 2), "Direction", tmpXY); //szv#4:S4163:12Mar99 moved in if
51 if (PR.ReadXY(PR.CurrentList(1, 2), "Direction", tmpXY)) {
52 aDirection.SetX(tmpXY.X());
53 aDirection.SetY(tmpXY.Y());
56 if (PR.DefinedElseSkip())
58 //st = PR.ReadReal(PR.Current(), "Direction", tmpReal); //szv#4:S4163:12Mar99 moved in if
59 if (PR.ReadReal(PR.Current(), "Direction", tmpReal))
60 aDirection.SetZ(tmpReal);
64 aDirection.SetZ(0.0); // Default value.
67 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
68 ent->Init(aDirection);
71 void IGESGeom_ToolDirection::WriteOwnParams
72 (const Handle(IGESGeom_Direction)& ent, IGESData_IGESWriter& IW) const
74 IW.Send(ent->Value().X());
75 IW.Send(ent->Value().Y());
76 IW.Send(ent->Value().Z());
79 void IGESGeom_ToolDirection::OwnShared
80 (const Handle(IGESGeom_Direction)& /* ent */, Interface_EntityIterator& /* iter */) const
84 void IGESGeom_ToolDirection::OwnCopy
85 (const Handle(IGESGeom_Direction)& another,
86 const Handle(IGESGeom_Direction)& ent, Interface_CopyTool& /* TC */) const
88 ent->Init(another->Value().XYZ());
91 IGESData_DirChecker IGESGeom_ToolDirection::DirChecker
92 (const Handle(IGESGeom_Direction)& /* ent */ ) const
94 IGESData_DirChecker DC(123, 0);
95 DC.Structure(IGESData_DefVoid);
96 DC.LineFont(IGESData_DefAny);
97 // DC.LineWeight(IGESData_DefValue);
98 DC.Color(IGESData_DefAny);
100 DC.BlankStatusIgnored ();
101 DC.SubordinateStatusRequired (1);
102 DC.UseFlagRequired (2);
103 DC.HierarchyStatusIgnored ();
107 void IGESGeom_ToolDirection::OwnCheck
108 (const Handle(IGESGeom_Direction)& ent,
109 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
111 if (ent->Value().XYZ().SquareModulus() <= 0.0)
112 ach->AddFail("Direction : The values indicate no direction");
115 void IGESGeom_ToolDirection::OwnDump
116 (const Handle(IGESGeom_Direction)& ent, const IGESData_IGESDumper& /* dumper */,
117 Standard_OStream& S, const Standard_Integer level) const
119 S << "IGESGeom_Direction\n\n"
121 IGESData_DumpXYZL(S,level, ent->Value(), ent->VectorLocation());