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