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 //--------------------------------------------------------------------
19 #include <IGESData_DirChecker.hxx>
20 #include <IGESData_IGESDumper.hxx>
21 #include <IGESData_IGESReaderData.hxx>
22 #include <IGESData_IGESWriter.hxx>
23 #include <IGESData_ParamReader.hxx>
24 #include <IGESGraph_DrawingSize.hxx>
25 #include <IGESGraph_ToolDrawingSize.hxx>
26 #include <Interface_Check.hxx>
27 #include <Interface_CopyTool.hxx>
28 #include <Interface_EntityIterator.hxx>
29 #include <Interface_ShareTool.hxx>
31 IGESGraph_ToolDrawingSize::IGESGraph_ToolDrawingSize () { }
34 void IGESGraph_ToolDrawingSize::ReadOwnParams
35 (const Handle(IGESGraph_DrawingSize)& ent,
36 const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const
38 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
40 Standard_Integer nbPropertyValues;
44 // Reading nbPropertyValues(Integer)
45 PR.ReadInteger(PR.Current(), "No. of property values", nbPropertyValues); //szv#4:S4163:12Mar99 `st=` not needed
46 if (nbPropertyValues != 2)
47 PR.AddFail("No. of Property values : Value is not 2");
49 // Reading xSize(Real)
50 PR.ReadReal (PR.Current(), "Drawing extent along +ve XD axis", xSize); //szv#4:S4163:12Mar99 `st=` not needed
52 // Reading ySize(Real)
53 PR.ReadReal (PR.Current(), "Drawing extent along +ve YD axis", ySize); //szv#4:S4163:12Mar99 `st=` not needed
55 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
56 ent->Init(nbPropertyValues, xSize, ySize);
59 void IGESGraph_ToolDrawingSize::WriteOwnParams
60 (const Handle(IGESGraph_DrawingSize)& ent, IGESData_IGESWriter& IW) const
62 IW.Send( ent->NbPropertyValues() );
63 IW.Send( ent->XSize() );
64 IW.Send( ent->YSize() );
67 void IGESGraph_ToolDrawingSize::OwnShared
68 (const Handle(IGESGraph_DrawingSize)& /*ent*/, Interface_EntityIterator& /*iter*/) const
72 void IGESGraph_ToolDrawingSize::OwnCopy
73 (const Handle(IGESGraph_DrawingSize)& another,
74 const Handle(IGESGraph_DrawingSize)& ent, Interface_CopyTool& /*TC*/) const
76 ent->Init(2,another->XSize(),another->YSize());
79 Standard_Boolean IGESGraph_ToolDrawingSize::OwnCorrect
80 (const Handle(IGESGraph_DrawingSize)& ent) const
82 Standard_Boolean res = (ent->NbPropertyValues() != 2);
83 if (res) ent->Init(2,ent->XSize(),ent->YSize()); // nbpropertyvalues=2
87 IGESData_DirChecker IGESGraph_ToolDrawingSize::DirChecker
88 (const Handle(IGESGraph_DrawingSize)& /*ent*/) const
90 IGESData_DirChecker DC (406, 16);
91 DC.Structure(IGESData_DefVoid);
92 DC.LineFont(IGESData_DefVoid);
93 DC.LineWeight(IGESData_DefVoid);
94 DC.Color(IGESData_DefVoid);
95 DC.BlankStatusIgnored();
97 DC.HierarchyStatusIgnored();
101 void IGESGraph_ToolDrawingSize::OwnCheck
102 (const Handle(IGESGraph_DrawingSize)& ent,
103 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
105 if (ent->NbPropertyValues() != 2)
106 ach->AddFail("No. of Property values : Value != 2");
109 void IGESGraph_ToolDrawingSize::OwnDump
110 (const Handle(IGESGraph_DrawingSize)& ent, const IGESData_IGESDumper& /*dumper*/,
111 Standard_OStream& S, const Standard_Integer /*level*/) const
113 S << "IGESGraph_DrawingSize\n"
114 << "No. of property values : " << ent->NbPropertyValues() << "\n"
115 << "Drawing extent along positive X-axis : " << ent->XSize() << "\n"
116 << "Drawing extent along positive Y-axis : " << ent->YSize() << "\n"