0030895: Coding Rules - specify std namespace explicitly for std::cout and streams
[occt.git] / src / IGESGraph / IGESGraph_ToolDrawingSize.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 #include <IGESData_DirChecker.hxx>
20 #include <IGESData_IGESDumper.hxx>
21 #include <IGESData_IGESReaderData.hxx>
22 #include <IGESData_IGESWriter.hxx>
23 #include <IGESData_ParamCursor.hxx>
24 #include <IGESData_ParamReader.hxx>
25 #include <IGESGraph_DrawingSize.hxx>
26 #include <IGESGraph_ToolDrawingSize.hxx>
27 #include <Interface_Check.hxx>
28 #include <Interface_CopyTool.hxx>
29 #include <Interface_EntityIterator.hxx>
30 #include <Interface_ShareTool.hxx>
31 #include <Message_Messenger.hxx>
32 #include <Standard_DomainError.hxx>
33
34 IGESGraph_ToolDrawingSize::IGESGraph_ToolDrawingSize ()    {  }
35
36
37 void IGESGraph_ToolDrawingSize::ReadOwnParams
38   (const Handle(IGESGraph_DrawingSize)& ent,
39    const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const
40
41   //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
42
43   Standard_Integer nbPropertyValues;
44   Standard_Real    xSize;
45   Standard_Real    ySize; 
46
47   // Reading nbPropertyValues(Integer)
48   PR.ReadInteger(PR.Current(), "No. of property values", nbPropertyValues); //szv#4:S4163:12Mar99 `st=` not needed
49   if (nbPropertyValues != 2)
50     PR.AddFail("No. of Property values : Value is not 2");
51
52   // Reading xSize(Real)
53   PR.ReadReal (PR.Current(), "Drawing extent along +ve XD axis", xSize); //szv#4:S4163:12Mar99 `st=` not needed
54
55   // Reading ySize(Real)
56   PR.ReadReal (PR.Current(), "Drawing extent along +ve YD axis", ySize); //szv#4:S4163:12Mar99 `st=` not needed
57
58   DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
59   ent->Init(nbPropertyValues, xSize, ySize);
60 }
61
62 void IGESGraph_ToolDrawingSize::WriteOwnParams
63   (const Handle(IGESGraph_DrawingSize)& ent, IGESData_IGESWriter& IW)  const
64
65   IW.Send( ent->NbPropertyValues() );
66   IW.Send( ent->XSize() );
67   IW.Send( ent->YSize() );
68 }
69
70 void  IGESGraph_ToolDrawingSize::OwnShared
71   (const Handle(IGESGraph_DrawingSize)& /*ent*/, Interface_EntityIterator& /*iter*/) const
72 {
73 }
74
75 void IGESGraph_ToolDrawingSize::OwnCopy
76   (const Handle(IGESGraph_DrawingSize)& another,
77    const Handle(IGESGraph_DrawingSize)& ent, Interface_CopyTool& /*TC*/) const
78 {
79   ent->Init(2,another->XSize(),another->YSize());
80 }
81
82 Standard_Boolean  IGESGraph_ToolDrawingSize::OwnCorrect
83   (const Handle(IGESGraph_DrawingSize)& ent) const
84 {
85   Standard_Boolean res = (ent->NbPropertyValues() != 2);
86   if (res) ent->Init(2,ent->XSize(),ent->YSize());    // nbpropertyvalues=2
87   return res;
88 }
89
90 IGESData_DirChecker IGESGraph_ToolDrawingSize::DirChecker
91   (const Handle(IGESGraph_DrawingSize)& /*ent*/)  const
92
93   IGESData_DirChecker DC (406, 16);
94   DC.Structure(IGESData_DefVoid);
95   DC.LineFont(IGESData_DefVoid);
96   DC.LineWeight(IGESData_DefVoid);
97   DC.Color(IGESData_DefVoid);
98   DC.BlankStatusIgnored();
99   DC.UseFlagIgnored();
100   DC.HierarchyStatusIgnored();
101   return DC;
102 }
103
104 void IGESGraph_ToolDrawingSize::OwnCheck
105   (const Handle(IGESGraph_DrawingSize)& ent,
106    const Interface_ShareTool& , Handle(Interface_Check)& ach)  const
107 {
108   if (ent->NbPropertyValues() != 2)
109     ach->AddFail("No. of Property values : Value != 2");
110 }
111
112 void IGESGraph_ToolDrawingSize::OwnDump
113   (const Handle(IGESGraph_DrawingSize)& ent, const IGESData_IGESDumper& /*dumper*/,
114    const Handle(Message_Messenger)& S, const Standard_Integer /*level*/)  const
115 {
116   S << "IGESGraph_DrawingSize" << Message_EndLine;
117
118   S << "No. of property values : " << ent->NbPropertyValues() << Message_EndLine;
119   S << "Drawing extent along positive X-axis : " << ent->XSize() << Message_EndLine;
120   S << "Drawing extent along positive Y-axis : " << ent->YSize() << Message_EndLine;
121   S << Message_EndLine;
122 }