0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / IGESDraw / IGESDraw_ToolCircArraySubfigure.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 <gp_XYZ.hxx>
20 #include <IGESData_DirChecker.hxx>
21 #include <IGESData_Dump.hxx>
22 #include <IGESData_IGESDumper.hxx>
23 #include <IGESData_IGESEntity.hxx>
24 #include <IGESData_IGESReaderData.hxx>
25 #include <IGESData_IGESWriter.hxx>
26 #include <IGESData_ParamCursor.hxx>
27 #include <IGESData_ParamReader.hxx>
28 #include <IGESDraw_CircArraySubfigure.hxx>
29 #include <IGESDraw_ToolCircArraySubfigure.hxx>
30 #include <Interface_Check.hxx>
31 #include <Interface_CopyTool.hxx>
32 #include <Interface_EntityIterator.hxx>
33 #include <Interface_Macros.hxx>
34 #include <Interface_ShareTool.hxx>
35 #include <Message_Messenger.hxx>
36 #include <Standard_DomainError.hxx>
37 #include <TColStd_HArray1OfInteger.hxx>
38
39 IGESDraw_ToolCircArraySubfigure::IGESDraw_ToolCircArraySubfigure ()    {  }
40
41
42 void IGESDraw_ToolCircArraySubfigure::ReadOwnParams
43   (const Handle(IGESDraw_CircArraySubfigure)& ent,
44    const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
45 {
46   //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
47
48   gp_XYZ tempCenter;
49   Handle(IGESData_IGESEntity) tempBase;
50   Standard_Real tempRadius, tempStAngle, tempDelAngle;
51   Standard_Integer tempNumLocs, tempFlag, tempListCount;
52   Handle(TColStd_HArray1OfInteger) tempNumPos;
53
54   //szv#4:S4163:12Mar99 `st=` not needed
55   PR.ReadEntity(IR, PR.Current(), "Base Entity", tempBase);
56   PR.ReadInteger(PR.Current(), "Number Of Instance Locations", tempNumLocs);
57   PR.ReadXYZ(PR.CurrentList(1, 3), "Imaginary Circle Center Coordinate", tempCenter);
58   PR.ReadReal(PR.Current(), "Radius Of Imaginary Circle", tempRadius);
59   PR.ReadReal(PR.Current(), "Start Angle in Radians", tempStAngle);
60   PR.ReadReal(PR.Current(), "Delta Angle in Radians", tempDelAngle);
61
62   //st = PR.ReadInteger(PR.Current(), "DO-DONT List Count", tempListCount); //szv#4:S4163:12Mar99 moved in if
63   if (PR.ReadInteger(PR.Current(), "DO-DONT List Count", tempListCount)) {
64     // Initialise HArray1 only if there is no error reading its Length
65     if (tempListCount > 0)
66       tempNumPos = new TColStd_HArray1OfInteger(1, tempListCount);
67     else if (tempListCount < 0)
68       PR.AddFail("DO-DONT List Count : Less than Zero");
69   }
70
71   PR.ReadInteger(PR.Current(), "DO-DONT Flag", tempFlag); //szv#4:S4163:12Mar99 `st=` not needed
72
73   // Read the HArray1 only if its Length was read without any Error
74   if (! tempNumPos.IsNull()) {
75     Standard_Integer I;
76     for (I = 1; I <= tempListCount; I++) {
77       Standard_Integer tempPosition;
78       //st = PR.ReadInteger(PR.Current(), "Number Of Position To Process",
79                             //tempPosition); //szv#4:S4163:12Mar99 moved in if
80       if (PR.ReadInteger(PR.Current(), "Number Of Position To Process", tempPosition))
81         tempNumPos->SetValue(I, tempPosition);
82     }
83   }
84
85   DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
86   ent->Init
87     (tempBase, tempNumLocs, tempCenter, tempRadius,
88      tempStAngle,tempDelAngle, tempFlag, tempNumPos);
89 }
90
91 void IGESDraw_ToolCircArraySubfigure::WriteOwnParams
92   (const Handle(IGESDraw_CircArraySubfigure)& ent, IGESData_IGESWriter& IW)  const
93 {
94   IW.Send(ent->BaseEntity());
95   IW.Send(ent->NbLocations());
96   IW.Send(ent->CenterPoint().X());
97   IW.Send(ent->CenterPoint().Y());
98   IW.Send(ent->CenterPoint().Z());
99   IW.Send(ent->CircleRadius());
100   IW.Send(ent->StartAngle());
101   IW.Send(ent->DeltaAngle());
102   IW.Send(ent->ListCount());
103   IW.SendBoolean(ent->DoDontFlag());
104   // Send the HArray1 only if it is not empty (i.e. Null)
105   Standard_Integer I;
106   Standard_Integer up  = ent->ListCount();
107   for (I = 1; I <= up; I++)
108     IW.Send(ent->ListPosition(I));
109 }
110
111 void  IGESDraw_ToolCircArraySubfigure::OwnShared
112   (const Handle(IGESDraw_CircArraySubfigure)& /*ent*/, Interface_EntityIterator& /*iter*/) const
113 {
114 }
115
116 void IGESDraw_ToolCircArraySubfigure::OwnCopy
117   (const Handle(IGESDraw_CircArraySubfigure)& another,
118    const Handle(IGESDraw_CircArraySubfigure)& ent, Interface_CopyTool& TC) const
119 {
120   DeclareAndCast(IGESData_IGESEntity, tempBase,
121                  TC.Transferred(another->BaseEntity()));
122   Standard_Integer tempNumLocs = another->NbLocations();
123   gp_XYZ tempCenter = (another->CenterPoint()).XYZ();
124   Standard_Real tempRadius = another->CircleRadius();
125   Standard_Real tempStAngle = another->StartAngle();
126   Standard_Real tempDelAngle = another->DeltaAngle();
127   Standard_Integer tempListCount = another->ListCount();
128   Standard_Integer tempFlag = another->DoDontFlag();
129   Handle(TColStd_HArray1OfInteger) tempNumPos;
130   if (! another->DisplayFlag()) {
131     tempNumPos = new TColStd_HArray1OfInteger(1, tempListCount);
132     Standard_Integer I;
133     for (I = 1; I <= tempListCount; I++) {
134       Standard_Integer tempPosition = another->ListPosition(I);
135       tempNumPos->SetValue(I, tempPosition);
136     }
137   }
138
139   ent->Init(tempBase, tempNumLocs, tempCenter, tempRadius,
140             tempStAngle, tempDelAngle, tempFlag, tempNumPos);
141 }
142
143 IGESData_DirChecker IGESDraw_ToolCircArraySubfigure::DirChecker
144   (const Handle(IGESDraw_CircArraySubfigure)& /*ent*/)  const
145 {
146   IGESData_DirChecker DC(414, 0);
147   DC.Structure(IGESData_DefVoid);
148   DC.LineFont(IGESData_DefAny);
149   DC.LineWeight(IGESData_DefValue);
150   DC.Color(IGESData_DefAny);
151   DC.GraphicsIgnored(1);
152
153   return DC;
154 }
155
156 void IGESDraw_ToolCircArraySubfigure::OwnCheck
157   (const Handle(IGESDraw_CircArraySubfigure)& /*ent*/,
158    const Interface_ShareTool& , Handle(Interface_Check)& /*ach*/)  const
159 {
160 }
161
162 void IGESDraw_ToolCircArraySubfigure::OwnDump
163   (const Handle(IGESDraw_CircArraySubfigure)& ent, const IGESData_IGESDumper& dumper,
164    const Handle(Message_Messenger)& S, const Standard_Integer level)  const
165 {
166   Standard_Integer tempSubLevel = (level <= 4) ? 0 : 1;
167
168   S << "IGESDraw_CircArraySubfigure" << endl;
169
170   S << "Base Entity : ";
171   dumper.Dump(ent->BaseEntity(),S, tempSubLevel);
172   S << endl;
173   S << "Total Number Of Possible Instance Locations : " << ent->NbLocations()
174     << endl;
175   S << "Imaginary Circle. Radius : " << ent->CircleRadius() << "  Center : ";
176   IGESData_DumpXYZL(S, level, ent->CenterPoint(), ent->Location());  S << endl;
177   S << "Start Angle (in radians) : " << ent->StartAngle() << "  ";
178   S << "Delta Angle (in radians) : " << ent->DeltaAngle() << endl;
179   S << "Do-Dont Flag : ";
180   if (ent->DoDontFlag())     S << "Dont" << endl;
181   else                       S << "Do" << endl;
182   S << "The Do-Dont List : ";
183   IGESData_DumpVals(S ,level,1, ent->ListCount(),ent->ListPosition);
184   S << endl;
185 }