0032961: Coding - get rid of unused headers [IGESAppli to IGESToBRep]
[occt.git] / src / IGESDraw / IGESDraw_CircArraySubfigure.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_GTrsf.hxx>
20 #include <gp_Pnt.hxx>
21 #include <gp_XYZ.hxx>
22 #include <IGESDraw_CircArraySubfigure.hxx>
23 #include <Standard_DimensionMismatch.hxx>
24 #include <Standard_Type.hxx>
25
26 IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_CircArraySubfigure,IGESData_IGESEntity)
27
28 IGESDraw_CircArraySubfigure::IGESDraw_CircArraySubfigure ()    {  }
29
30
31     void IGESDraw_CircArraySubfigure::Init
32   (const Handle(IGESData_IGESEntity)&      aBase,
33    const Standard_Integer                  aNumLocs,
34    const gp_XYZ&                           aCenter,
35    const Standard_Real                     aRadius,
36    const Standard_Real                     aStAngle,
37    const Standard_Real                     aDelAngle,
38    const Standard_Integer                  aFlag,
39    const Handle(TColStd_HArray1OfInteger)& allNumPos)
40 {
41   if (!allNumPos.IsNull())
42     if (allNumPos->Lower() != 1)
43       throw Standard_DimensionMismatch("IGESDraw_CircArraySubfigure : Init");
44   theBaseEntity  = aBase;
45   theNbLocations = aNumLocs;
46   theCenter      = aCenter;
47   theRadius      = aRadius;
48   theStartAngle  = aStAngle;
49   theDeltaAngle  = aDelAngle;
50   theDoDontFlag  = aFlag != 0;
51   thePositions   = allNumPos;
52   InitTypeAndForm(414,0);
53 }
54
55     Handle(IGESData_IGESEntity) IGESDraw_CircArraySubfigure::BaseEntity () const
56 {
57   return theBaseEntity;
58 }
59
60     Standard_Integer IGESDraw_CircArraySubfigure::NbLocations () const
61 {
62   return theNbLocations;
63 }
64
65     gp_Pnt IGESDraw_CircArraySubfigure::CenterPoint () const
66 {
67   gp_Pnt tempCenterPoint(theCenter);
68   return tempCenterPoint;
69 }
70
71     gp_Pnt IGESDraw_CircArraySubfigure::TransformedCenterPoint () const
72 {
73   gp_XYZ tempCenterPoint = theCenter;
74   if (HasTransf()) Location().Transforms(tempCenterPoint);
75   gp_Pnt tempRes(tempCenterPoint);
76
77   return tempRes;
78 }
79
80     Standard_Real IGESDraw_CircArraySubfigure::CircleRadius () const
81 {
82   return theRadius;
83 }
84
85     Standard_Real IGESDraw_CircArraySubfigure::StartAngle () const
86 {
87   return theStartAngle;
88 }
89
90     Standard_Real IGESDraw_CircArraySubfigure::DeltaAngle () const
91 {
92   return theDeltaAngle;
93 }
94
95     Standard_Boolean IGESDraw_CircArraySubfigure::DisplayFlag () const
96 {
97   return (thePositions.IsNull());
98   // if LC == 0 then there is no allocation made for thePositions array
99   // i.e., thePositions == Null Handle
100 }
101
102     Standard_Integer IGESDraw_CircArraySubfigure::ListCount () const
103 {
104   return ( thePositions.IsNull() ? 0 : thePositions->Length() );
105   // Return 0 if HArray1 thePositions is NULL Handle
106 }
107
108     Standard_Boolean IGESDraw_CircArraySubfigure::DoDontFlag () const
109 {
110   return theDoDontFlag;
111 }
112
113     Standard_Boolean IGESDraw_CircArraySubfigure::PositionNum
114   (const Standard_Integer Index) const
115 {
116   // Method : If thePositions array length is Zero return theDoDontFlag;
117   //          else Search Index in to the Array. If 'Index' found in the
118   //          array return theDoDontFlag else return !theDoDontFlag.
119
120   if (thePositions.IsNull())        return theDoDontFlag;
121
122   else {
123     Standard_Integer I;
124     Standard_Integer up  = thePositions->Upper();
125     for (I = 1; I <= up; I ++) {
126       if (thePositions->Value(I) == Index)     return theDoDontFlag;
127     }
128     return (! theDoDontFlag);
129   }
130 }
131
132     Standard_Integer IGESDraw_CircArraySubfigure::ListPosition
133   (const Standard_Integer Index) const
134 {
135   return thePositions->Value(Index);
136   // raise OutOfRange from Standard if Index is out-of-bound
137   // Exception NoSuchObject will be raised if thePositions == Null Handle
138 }