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 <IGESDraw_RectArraySubfigure.hxx>
23 #include <Standard_DimensionMismatch.hxx>
24 #include <Standard_Type.hxx>
26 IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_RectArraySubfigure,IGESData_IGESEntity)
28 IGESDraw_RectArraySubfigure::IGESDraw_RectArraySubfigure () { }
31 void IGESDraw_RectArraySubfigure::Init
32 (const Handle(IGESData_IGESEntity)& aBase,
33 const Standard_Real aScale,
34 const gp_XYZ& aCorner,
35 const Standard_Integer nbCols,
36 const Standard_Integer nbRows,
37 const Standard_Real hDisp,
38 const Standard_Real vtDisp,
39 const Standard_Real rotationAngle,
40 const Standard_Integer doDont,
41 const Handle(TColStd_HArray1OfInteger)& allNumPos)
43 if (!allNumPos.IsNull())
44 if (allNumPos->Lower() != 1)
45 throw Standard_DimensionMismatch("IGESDraw_RectArraySubfigure : Init");
46 theBaseEntity = aBase;
47 theScaleFactor = aScale;
48 theLowerLeftCorner = aCorner;
49 theNbColumns = nbCols;
51 theColumnSeparation = hDisp;
52 theRowSeparation = vtDisp;
53 theRotationAngle = rotationAngle;
54 theDoDontFlag = doDont != 0;
55 thePositions = allNumPos;
56 InitTypeAndForm(412,0);
59 Handle(IGESData_IGESEntity) IGESDraw_RectArraySubfigure::BaseEntity () const
64 Standard_Real IGESDraw_RectArraySubfigure::ScaleFactor () const
66 return theScaleFactor;
69 gp_Pnt IGESDraw_RectArraySubfigure::LowerLeftCorner () const
71 gp_Pnt tempLowerLeftCorner(theLowerLeftCorner);
72 return tempLowerLeftCorner;
75 gp_Pnt IGESDraw_RectArraySubfigure::TransformedLowerLeftCorner () const
77 gp_XYZ tempLowerLeftCorner = theLowerLeftCorner;
78 if (HasTransf()) Location().Transforms(tempLowerLeftCorner);
79 gp_Pnt tempRes(tempLowerLeftCorner);
84 Standard_Integer IGESDraw_RectArraySubfigure::NbColumns () const
89 Standard_Integer IGESDraw_RectArraySubfigure::NbRows () const
94 Standard_Real IGESDraw_RectArraySubfigure::ColumnSeparation () const
96 return theColumnSeparation;
99 Standard_Real IGESDraw_RectArraySubfigure::RowSeparation () const
101 return theRowSeparation;
104 Standard_Real IGESDraw_RectArraySubfigure::RotationAngle () const
106 return theRotationAngle;
109 Standard_Boolean IGESDraw_RectArraySubfigure::DisplayFlag () const
111 return (thePositions.IsNull());
114 Standard_Integer IGESDraw_RectArraySubfigure::ListCount () const
116 return ( thePositions.IsNull() ? 0 : thePositions->Length() );
117 // Return 0 if HArray1 thePositions is NULL Handle
120 Standard_Boolean IGESDraw_RectArraySubfigure::DoDontFlag () const
122 return (theDoDontFlag);
125 Standard_Boolean IGESDraw_RectArraySubfigure::PositionNum
126 (const Standard_Integer Index) const
128 // Method : If thePositions array length is Zero return theDoDontFlag;
129 // else Search Index in to the Array. If 'Index' found in the
130 // array return theDoDontFlag else return !theDoDontFlag.
132 if (thePositions.IsNull()) return theDoDontFlag;
135 Standard_Integer up = thePositions->Upper();
136 for (I = 1; I <= up; I++) {
137 if (thePositions->Value(I) == Index) return theDoDontFlag;
139 return (! theDoDontFlag);
142 Standard_Integer IGESDraw_RectArraySubfigure::ListPosition
143 (const Standard_Integer Index) const
145 return thePositions->Value(Index);
146 // raise OutOfRange from Standard if Index is out-of-bound
147 // Exception NoSuchObject will be raised if thePositions == Null Handle