0030895: Coding Rules - specify std namespace explicitly for std::cout and streams
[occt.git] / src / IGESDraw / IGESDraw_ToolView.cxx
CommitLineData
b311480e 1// Created by: CKY / Contract Toubro-Larsen
2// Copyright (c) 1993-1999 Matra Datavision
973c2be1 3// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
7fd59977 6//
d5f74e42 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
973c2be1 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.
7fd59977 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
16//--------------------------------------------------------------------
7fd59977 17//--------------------------------------------------------------------
18
42cf5bc1 19#include <IGESData_DirChecker.hxx>
20#include <IGESData_IGESDumper.hxx>
21#include <IGESData_IGESReaderData.hxx>
22#include <IGESData_IGESWriter.hxx>
7fd59977 23#include <IGESData_ParamCursor.hxx>
42cf5bc1 24#include <IGESData_ParamReader.hxx>
7fd59977 25#include <IGESData_TransfEntity.hxx>
42cf5bc1 26#include <IGESDraw_ToolView.hxx>
27#include <IGESDraw_View.hxx>
7fd59977 28#include <IGESGeom_Plane.hxx>
42cf5bc1 29#include <Interface_Check.hxx>
30#include <Interface_CopyTool.hxx>
31#include <Interface_EntityIterator.hxx>
7fd59977 32#include <Interface_Macros.hxx>
42cf5bc1 33#include <Interface_ShareTool.hxx>
34#include <Message_Messenger.hxx>
35#include <Standard_DomainError.hxx>
7fd59977 36
37IGESDraw_ToolView::IGESDraw_ToolView () { }
38
39
40void IGESDraw_ToolView::ReadOwnParams
41 (const Handle(IGESDraw_View)& ent,
42 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
43{
44 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
45
46 Standard_Integer tempViewNumber;
47 Standard_Real tempScaleFactor;
48 Handle(IGESGeom_Plane) tempLeftPlane, tempTopPlane, tempRightPlane;
49 Handle(IGESGeom_Plane) tempBottomPlane, tempBackPlane, tempFrontPlane;
50
51 PR.ReadInteger(PR.Current(), "View Number", tempViewNumber); //szv#4:S4163:12Mar99 `st=` not needed
52
53 if (PR.DefinedElseSkip())
54 PR.ReadReal(PR.Current(), "Scale Factor", tempScaleFactor); //szv#4:S4163:12Mar99 `st=` not needed
55 else
56 tempScaleFactor = 1.0; // Setting to default value of 1.0
57
58 PR.ReadEntity(IR, PR.Current(), "Left Side Of View Volume",
59 STANDARD_TYPE(IGESGeom_Plane), tempLeftPlane, Standard_True); //szv#4:S4163:12Mar99 `st=` not needed
60
61 PR.ReadEntity(IR, PR.Current(), "Top Side Of View Volume",
62 STANDARD_TYPE(IGESGeom_Plane), tempTopPlane, Standard_True); //szv#4:S4163:12Mar99 `st=` not needed
63
64 PR.ReadEntity(IR, PR.Current(), "Right Side Of View Volume",
65 STANDARD_TYPE(IGESGeom_Plane), tempRightPlane, Standard_True); //szv#4:S4163:12Mar99 `st=` not needed
66
67 PR.ReadEntity(IR, PR.Current(), "Bottom Side Of View Volume",
68 STANDARD_TYPE(IGESGeom_Plane), tempBottomPlane, Standard_True); //szv#4:S4163:12Mar99 `st=` not needed
69
70 PR.ReadEntity(IR, PR.Current(), "Back Side Of View Volume",
71 STANDARD_TYPE(IGESGeom_Plane), tempBackPlane, Standard_True); //szv#4:S4163:12Mar99 `st=` not needed
72
73 PR.ReadEntity(IR, PR.Current(), "Front Side Of View Volume",
74 STANDARD_TYPE(IGESGeom_Plane), tempFrontPlane, Standard_True); //szv#4:S4163:12Mar99 `st=` not needed
75
76 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
77 ent->Init
78 (tempViewNumber, tempScaleFactor, tempLeftPlane, tempTopPlane,
79 tempRightPlane, tempBottomPlane, tempBackPlane, tempFrontPlane);
80}
81
82void IGESDraw_ToolView::WriteOwnParams
83 (const Handle(IGESDraw_View)& ent, IGESData_IGESWriter& IW) const
84{
85 IW.Send(ent->ViewNumber());
86 IW.Send(ent->ScaleFactor());
87 IW.Send(ent->LeftPlane());
88 IW.Send(ent->TopPlane());
89 IW.Send(ent->RightPlane());
90 IW.Send(ent->BottomPlane());
91 IW.Send(ent->BackPlane());
92 IW.Send(ent->FrontPlane());
93}
94
95void IGESDraw_ToolView::OwnShared
96 (const Handle(IGESDraw_View)& ent, Interface_EntityIterator& iter) const
97{
98 iter.GetOneItem(ent->LeftPlane());
99 iter.GetOneItem(ent->TopPlane());
100 iter.GetOneItem(ent->RightPlane());
101 iter.GetOneItem(ent->BottomPlane());
102 iter.GetOneItem(ent->BackPlane());
103 iter.GetOneItem(ent->FrontPlane());
104}
105
106void IGESDraw_ToolView::OwnCopy
107 (const Handle(IGESDraw_View)& another,
108 const Handle(IGESDraw_View)& ent, Interface_CopyTool& TC) const
109{
110 Standard_Integer tempViewNumber = another->ViewNumber();
111 Standard_Real tempScaleFactor = another->ScaleFactor();
112 DeclareAndCast(IGESGeom_Plane, tempLeftPlane,
113 TC.Transferred(another->LeftPlane()));
114 DeclareAndCast(IGESGeom_Plane, tempTopPlane,
115 TC.Transferred(another->TopPlane()));
116 DeclareAndCast(IGESGeom_Plane, tempRightPlane,
117 TC.Transferred(another->RightPlane()));
118 DeclareAndCast(IGESGeom_Plane, tempBottomPlane,
119 TC.Transferred(another->BottomPlane()));
120 DeclareAndCast(IGESGeom_Plane, tempBackPlane,
121 TC.Transferred(another->BackPlane()));
122 DeclareAndCast(IGESGeom_Plane, tempFrontPlane,
123 TC.Transferred(another->FrontPlane()));
124
125 ent->Init(tempViewNumber, tempScaleFactor, tempLeftPlane, tempTopPlane,
126 tempRightPlane, tempBottomPlane, tempBackPlane, tempFrontPlane);
127}
128
129IGESData_DirChecker IGESDraw_ToolView::DirChecker
130 (const Handle(IGESDraw_View)& /*ent*/) const
131{
132 IGESData_DirChecker DC(410, 0);
133 DC.Structure(IGESData_DefVoid);
134 DC.LineFont(IGESData_DefVoid);
135 DC.LineWeight(IGESData_DefVoid);
136 DC.Color(IGESData_DefVoid);
137 DC.BlankStatusIgnored();
138 DC.UseFlagRequired(1);
139 DC.HierarchyStatusIgnored();
140
141 return DC;
142}
143
144void IGESDraw_ToolView::OwnCheck
145 (const Handle(IGESDraw_View)& ent,
146 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
147{
148 if (ent->HasTransf()) {
149 if (ent->Transf()->FormNumber() != 0)
150 ach->AddFail("Associated Matrix has not Form Number 0");
151 }
152}
153
154void IGESDraw_ToolView::OwnDump
155 (const Handle(IGESDraw_View)& ent, const IGESData_IGESDumper& dumper,
156 const Handle(Message_Messenger)& S, const Standard_Integer level) const
157{
158 Standard_Integer tempSubLevel = (level <= 4) ? 0 : 1;
159
04232180 160 S << "IGESDraw_View" << Message_EndLine;
7fd59977 161
04232180 162 S << "View Number : " << ent->ViewNumber() << Message_EndLine;
163 S << "Scale Factor : " << ent->ScaleFactor() << Message_EndLine;
7fd59977 164 S << "Left Plane Of View Volume : ";
04232180 165 dumper.Dump(ent->LeftPlane(),S, tempSubLevel); S << Message_EndLine;
7fd59977 166 S << "Top Plane Of View Volume : ";
04232180 167 dumper.Dump(ent->TopPlane(),S, tempSubLevel); S << Message_EndLine;
7fd59977 168 S << "Right Plane Of View Volume : ";
04232180 169 dumper.Dump(ent->RightPlane(),S, tempSubLevel); S << Message_EndLine;
7fd59977 170 S << "Bottom Plane Of View Volume : ";
04232180 171 dumper.Dump(ent->BottomPlane(),S, tempSubLevel); S << Message_EndLine;
7fd59977 172 S << "Back Plane Of View Volume : ";
04232180 173 dumper.Dump(ent->BackPlane(),S, tempSubLevel); S << Message_EndLine;
7fd59977 174 S << "Front Plane Of View Volume : ";
04232180 175 dumper.Dump(ent->FrontPlane(),S, tempSubLevel); S << Message_EndLine;
7fd59977 176}