1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
19 #include <gp_GTrsf.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>
28 IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_CircArraySubfigure,IGESData_IGESEntity)
30 IGESDraw_CircArraySubfigure::IGESDraw_CircArraySubfigure () { }
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)
43 if (!allNumPos.IsNull())
44 if (allNumPos->Lower() != 1)
45 Standard_DimensionMismatch::Raise("IGESDraw_CircArraySubfigure : Init");
46 theBaseEntity = aBase;
47 theNbLocations = aNumLocs;
50 theStartAngle = aStAngle;
51 theDeltaAngle = aDelAngle;
52 theDoDontFlag = aFlag != 0;
53 thePositions = allNumPos;
54 InitTypeAndForm(414,0);
57 Handle(IGESData_IGESEntity) IGESDraw_CircArraySubfigure::BaseEntity () const
62 Standard_Integer IGESDraw_CircArraySubfigure::NbLocations () const
64 return theNbLocations;
67 gp_Pnt IGESDraw_CircArraySubfigure::CenterPoint () const
69 gp_Pnt tempCenterPoint(theCenter);
70 return tempCenterPoint;
73 gp_Pnt IGESDraw_CircArraySubfigure::TransformedCenterPoint () const
75 gp_XYZ tempCenterPoint = theCenter;
76 if (HasTransf()) Location().Transforms(tempCenterPoint);
77 gp_Pnt tempRes(tempCenterPoint);
82 Standard_Real IGESDraw_CircArraySubfigure::CircleRadius () const
87 Standard_Real IGESDraw_CircArraySubfigure::StartAngle () const
92 Standard_Real IGESDraw_CircArraySubfigure::DeltaAngle () const
97 Standard_Boolean IGESDraw_CircArraySubfigure::DisplayFlag () const
99 return (thePositions.IsNull());
100 // if LC == 0 then there is no allocation made for thePositions array
101 // i.e., thePositions == Null Handle
104 Standard_Integer IGESDraw_CircArraySubfigure::ListCount () const
106 return ( thePositions.IsNull() ? 0 : thePositions->Length() );
107 // Return 0 if HArray1 thePositions is NULL Handle
110 Standard_Boolean IGESDraw_CircArraySubfigure::DoDontFlag () const
112 return theDoDontFlag;
115 Standard_Boolean IGESDraw_CircArraySubfigure::PositionNum
116 (const Standard_Integer Index) const
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.
122 if (thePositions.IsNull()) return theDoDontFlag;
126 Standard_Integer up = thePositions->Upper();
127 for (I = 1; I <= up; I ++) {
128 if (thePositions->Value(I) == Index) return theDoDontFlag;
130 return (! theDoDontFlag);
134 Standard_Integer IGESDraw_CircArraySubfigure::ListPosition
135 (const Standard_Integer Index) const
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