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_RectArraySubfigure.hxx>
24 #include <Standard_DimensionMismatch.hxx>
25 #include <Standard_OutOfRange.hxx>
26 #include <Standard_Type.hxx>
28 IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_RectArraySubfigure,IGESData_IGESEntity)
30 IGESDraw_RectArraySubfigure::IGESDraw_RectArraySubfigure () { }
33 void IGESDraw_RectArraySubfigure::Init
34 (const Handle(IGESData_IGESEntity)& aBase,
35 const Standard_Real aScale,
36 const gp_XYZ& aCorner,
37 const Standard_Integer nbCols,
38 const Standard_Integer nbRows,
39 const Standard_Real hDisp,
40 const Standard_Real vtDisp,
41 const Standard_Real rotationAngle,
42 const Standard_Integer doDont,
43 const Handle(TColStd_HArray1OfInteger)& allNumPos)
45 if (!allNumPos.IsNull())
46 if (allNumPos->Lower() != 1)
47 throw Standard_DimensionMismatch("IGESDraw_RectArraySubfigure : Init");
48 theBaseEntity = aBase;
49 theScaleFactor = aScale;
50 theLowerLeftCorner = aCorner;
51 theNbColumns = nbCols;
53 theColumnSeparation = hDisp;
54 theRowSeparation = vtDisp;
55 theRotationAngle = rotationAngle;
56 theDoDontFlag = doDont != 0;
57 thePositions = allNumPos;
58 InitTypeAndForm(412,0);
61 Handle(IGESData_IGESEntity) IGESDraw_RectArraySubfigure::BaseEntity () const
66 Standard_Real IGESDraw_RectArraySubfigure::ScaleFactor () const
68 return theScaleFactor;
71 gp_Pnt IGESDraw_RectArraySubfigure::LowerLeftCorner () const
73 gp_Pnt tempLowerLeftCorner(theLowerLeftCorner);
74 return tempLowerLeftCorner;
77 gp_Pnt IGESDraw_RectArraySubfigure::TransformedLowerLeftCorner () const
79 gp_XYZ tempLowerLeftCorner = theLowerLeftCorner;
80 if (HasTransf()) Location().Transforms(tempLowerLeftCorner);
81 gp_Pnt tempRes(tempLowerLeftCorner);
86 Standard_Integer IGESDraw_RectArraySubfigure::NbColumns () const
91 Standard_Integer IGESDraw_RectArraySubfigure::NbRows () const
96 Standard_Real IGESDraw_RectArraySubfigure::ColumnSeparation () const
98 return theColumnSeparation;
101 Standard_Real IGESDraw_RectArraySubfigure::RowSeparation () const
103 return theRowSeparation;
106 Standard_Real IGESDraw_RectArraySubfigure::RotationAngle () const
108 return theRotationAngle;
111 Standard_Boolean IGESDraw_RectArraySubfigure::DisplayFlag () const
113 return (thePositions.IsNull());
116 Standard_Integer IGESDraw_RectArraySubfigure::ListCount () const
118 return ( thePositions.IsNull() ? 0 : thePositions->Length() );
119 // Return 0 if HArray1 thePositions is NULL Handle
122 Standard_Boolean IGESDraw_RectArraySubfigure::DoDontFlag () const
124 return (theDoDontFlag);
127 Standard_Boolean IGESDraw_RectArraySubfigure::PositionNum
128 (const Standard_Integer Index) const
130 // Method : If thePositions array length is Zero return theDoDontFlag;
131 // else Search Index in to the Array. If 'Index' found in the
132 // array return theDoDontFlag else return !theDoDontFlag.
134 if (thePositions.IsNull()) return theDoDontFlag;
137 Standard_Integer up = thePositions->Upper();
138 for (I = 1; I <= up; I++) {
139 if (thePositions->Value(I) == Index) return theDoDontFlag;
141 return (! theDoDontFlag);
144 Standard_Integer IGESDraw_RectArraySubfigure::ListPosition
145 (const Standard_Integer Index) const
147 return thePositions->Value(Index);
148 // raise OutOfRange from Standard if Index is out-of-bound
149 // Exception NoSuchObject will be raised if thePositions == Null Handle