4705cc35e9d59d240354216e6ee153adc5de93e2
[occt.git] / src / IGESDimen / IGESDimen_NewDimensionedGeometry.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 <IGESData_IGESEntity.hxx>
22 #include <IGESData_TransfEntity.hxx>
23 #include <IGESDimen_NewDimensionedGeometry.hxx>
24 #include <Standard_DimensionMismatch.hxx>
25 #include <Standard_OutOfRange.hxx>
26 #include <Standard_Type.hxx>
27
28 IMPLEMENT_STANDARD_RTTIEXT(IGESDimen_NewDimensionedGeometry,IGESData_IGESEntity)
29
30 IGESDimen_NewDimensionedGeometry::IGESDimen_NewDimensionedGeometry ()   { }
31
32
33     void  IGESDimen_NewDimensionedGeometry::Init
34   (const Standard_Integer nbDimens,
35    const Handle(IGESData_IGESEntity)& aDimen,
36    const Standard_Integer anOrientation, const Standard_Real anAngle,
37    const Handle(IGESData_HArray1OfIGESEntity)& allEntities,
38    const Handle(TColStd_HArray1OfInteger)& allLocations,
39    const Handle(TColgp_HArray1OfXYZ)& allPoints)
40 {
41   Standard_Integer num = allEntities->Length();
42   if (allEntities->Lower()  != 1 ||
43       allLocations->Lower() != 1 || allLocations->Length() != num ||
44       allPoints->Lower()    != 1 || allPoints->Length()    != num )
45     throw Standard_DimensionMismatch("IGESDimen_NewDimensionedGeometry: Init");
46   theNbDimensions             = nbDimens;
47   theDimensionEntity          = aDimen;
48   theDimensionOrientationFlag = anOrientation;
49   theAngleValue               = anAngle;
50   theGeometryEntities         = allEntities;
51   theDimensionLocationFlags   = allLocations;
52   thePoints                   = allPoints;
53   InitTypeAndForm(402,21);
54 }
55
56
57     Standard_Integer  IGESDimen_NewDimensionedGeometry::NbDimensions () const
58 {
59   return theNbDimensions;
60 }
61
62     Standard_Integer  IGESDimen_NewDimensionedGeometry::NbGeometries () const
63 {
64   return theGeometryEntities->Length();
65 }
66
67     Handle(IGESData_IGESEntity)  IGESDimen_NewDimensionedGeometry::DimensionEntity
68   ()const
69 {
70   return theDimensionEntity;
71 }
72
73     Standard_Integer  IGESDimen_NewDimensionedGeometry::DimensionOrientationFlag
74   () const
75 {
76   return theDimensionOrientationFlag;
77 }
78
79     Standard_Real  IGESDimen_NewDimensionedGeometry::AngleValue () const
80 {
81   return theAngleValue;
82 }
83
84     Handle(IGESData_IGESEntity)  IGESDimen_NewDimensionedGeometry::GeometryEntity
85   (const Standard_Integer Index) const
86 {
87   return theGeometryEntities->Value(Index);
88 }
89
90     Standard_Integer  IGESDimen_NewDimensionedGeometry::DimensionLocationFlag
91   (const Standard_Integer Index) const
92 {
93   return theDimensionLocationFlags->Value(Index);
94 }
95
96     gp_Pnt  IGESDimen_NewDimensionedGeometry::Point
97   (const Standard_Integer Index) const
98 {
99   return gp_Pnt(thePoints->Value(Index));
100 }
101
102     gp_Pnt  IGESDimen_NewDimensionedGeometry::TransformedPoint
103   (const Standard_Integer Index) const
104 {
105   gp_XYZ point = thePoints->Value(Index);
106   if (HasTransf()) Location().Transforms(point);
107   return gp_Pnt(point);
108 }