0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / IGESDraw / IGESDraw_RectArraySubfigure.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_RectArraySubfigure.hxx>
23 #include <Standard_DimensionMismatch.hxx>
24 #include <Standard_Type.hxx>
25
26 IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_RectArraySubfigure,IGESData_IGESEntity)
27
28 IGESDraw_RectArraySubfigure::IGESDraw_RectArraySubfigure ()    {  }
29
30
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)
42 {
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;
50   theNbRows           = nbRows;
51   theColumnSeparation = hDisp;
52   theRowSeparation    = vtDisp;
53   theRotationAngle    = rotationAngle;
54   theDoDontFlag       = doDont != 0;
55   thePositions        = allNumPos;
56   InitTypeAndForm(412,0);
57 }
58
59     Handle(IGESData_IGESEntity) IGESDraw_RectArraySubfigure::BaseEntity () const
60 {
61   return theBaseEntity;
62 }
63
64     Standard_Real IGESDraw_RectArraySubfigure::ScaleFactor () const
65 {
66   return theScaleFactor;
67 }
68
69     gp_Pnt IGESDraw_RectArraySubfigure::LowerLeftCorner () const
70 {
71   gp_Pnt tempLowerLeftCorner(theLowerLeftCorner);
72   return tempLowerLeftCorner;
73 }
74
75     gp_Pnt IGESDraw_RectArraySubfigure::TransformedLowerLeftCorner () const
76 {
77   gp_XYZ tempLowerLeftCorner = theLowerLeftCorner;
78   if (HasTransf()) Location().Transforms(tempLowerLeftCorner);
79   gp_Pnt tempRes(tempLowerLeftCorner);
80
81   return (tempRes);
82 }
83
84     Standard_Integer IGESDraw_RectArraySubfigure::NbColumns () const
85 {
86   return theNbColumns;
87 }
88
89     Standard_Integer IGESDraw_RectArraySubfigure::NbRows () const
90 {
91   return theNbRows;
92 }
93
94     Standard_Real IGESDraw_RectArraySubfigure::ColumnSeparation () const
95 {
96   return theColumnSeparation;
97 }
98
99     Standard_Real IGESDraw_RectArraySubfigure::RowSeparation () const
100 {
101   return theRowSeparation;
102 }
103
104     Standard_Real IGESDraw_RectArraySubfigure::RotationAngle () const
105 {
106   return theRotationAngle;
107 }
108
109     Standard_Boolean IGESDraw_RectArraySubfigure::DisplayFlag () const
110 {
111   return (thePositions.IsNull());
112 }
113
114     Standard_Integer IGESDraw_RectArraySubfigure::ListCount () const
115 {
116   return ( thePositions.IsNull() ? 0 : thePositions->Length() );
117   // Return 0 if HArray1 thePositions is NULL Handle
118 }
119
120     Standard_Boolean IGESDraw_RectArraySubfigure::DoDontFlag () const
121 {
122   return (theDoDontFlag);
123 }
124
125     Standard_Boolean IGESDraw_RectArraySubfigure::PositionNum
126   (const Standard_Integer Index) const
127 {
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.
131
132   if (thePositions.IsNull())   return theDoDontFlag;
133
134   Standard_Integer I;
135   Standard_Integer up  = thePositions->Upper();
136   for (I = 1; I <= up; I++) {
137     if (thePositions->Value(I) == Index)   return theDoDontFlag;
138   }
139   return (! theDoDontFlag);
140 }
141
142     Standard_Integer IGESDraw_RectArraySubfigure::ListPosition
143   (const Standard_Integer Index) const
144 {
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
148 }