42cf5bc1 |
1 | // Created on: 1994-11-16 |
2 | // Created by: Christian CAILLET |
3 | // Copyright (c) 1994-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _IGESConvGeom_GeomBuilder_HeaderFile |
18 | #define _IGESConvGeom_GeomBuilder_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <TColgp_HSequenceOfXYZ.hxx> |
25 | #include <gp_Trsf.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | #include <Standard_Boolean.hxx> |
28 | #include <Standard_Real.hxx> |
29 | class Standard_DomainError; |
30 | class gp_XY; |
31 | class gp_XYZ; |
32 | class IGESGeom_CopiousData; |
33 | class gp_Trsf; |
34 | class gp_Ax3; |
35 | class gp_Ax2; |
36 | class gp_Ax1; |
37 | class IGESGeom_TransformationMatrix; |
38 | |
39 | |
40 | //! This class provides some useful basic tools to build IGESGeom |
41 | //! curves, especially : |
42 | //! define a curve in a plane in 3D space (ex. Circular or Conic |
43 | //! arc, or Copious Data defined in 2D) |
44 | //! make a CopiousData from a list of points/vectors |
45 | class IGESConvGeom_GeomBuilder |
46 | { |
47 | public: |
48 | |
49 | DEFINE_STANDARD_ALLOC |
50 | |
51 | |
52 | //! Creates a GeomBuilder at initial state. |
53 | Standard_EXPORT IGESConvGeom_GeomBuilder(); |
54 | |
55 | //! Clears list of Points/Vectors and data about Transformation |
56 | Standard_EXPORT void Clear(); |
57 | |
58 | //! Adds a XY (Z=0) to the list of points |
59 | Standard_EXPORT void AddXY (const gp_XY& val); |
60 | |
61 | //! Adds a XYZ to the list of points |
62 | Standard_EXPORT void AddXYZ (const gp_XYZ& val); |
63 | |
64 | //! Adds a Vector part to the list of points. It will be used |
65 | //! for CopiousData, datatype=3, only. |
66 | //! AddXY and AddXYZ consider a null vector part (0,0,0) |
67 | //! AddVec adds to the last added XY or XYZ |
68 | Standard_EXPORT void AddVec (const gp_XYZ& val); |
69 | |
70 | //! Returns the count of already recorded points |
71 | Standard_EXPORT Standard_Integer NbPoints() const; |
72 | |
73 | //! Returns a point given its rank (if added as XY, Z will be 0) |
74 | Standard_EXPORT gp_XYZ Point (const Standard_Integer num) const; |
75 | |
76 | //! Makes a CopiousData with the list of recorded Points/Vectors |
77 | //! according to <datatype>, which must be 1,2 or 3 |
78 | //! If <polyline> is given True, the CopiousData is coded as a |
79 | //! Polyline, but <datatype> must not be 3 |
80 | //! <datatype> = 1 : Common Z is computed as average of all Z |
81 | //! <datatype> = 1 or 2 : Vectors are ignored |
82 | Standard_EXPORT Handle(IGESGeom_CopiousData) MakeCopiousData (const Standard_Integer datatype, const Standard_Boolean polyline = Standard_False) const; |
83 | |
84 | //! Returns the Position in which the method EvalXYZ will |
85 | //! evaluate a XYZ. It can be regarded as defining a local system. |
86 | //! It is initially set to Identity |
87 | Standard_EXPORT gp_Trsf Position() const; |
88 | |
89 | //! Sets final position from an already defined Trsf |
90 | Standard_EXPORT void SetPosition (const gp_Trsf& pos); |
91 | |
92 | //! Sets final position from an Ax3 |
93 | Standard_EXPORT void SetPosition (const gp_Ax3& pos); |
94 | |
95 | //! Sets final position from an Ax2 |
96 | Standard_EXPORT void SetPosition (const gp_Ax2& pos); |
97 | |
98 | //! Sets final position from an Ax1 |
99 | //! (this means that origin point and Z-axis are defined, the |
100 | //! other axes are defined arbitrarily) |
101 | Standard_EXPORT void SetPosition (const gp_Ax1& pos); |
102 | |
103 | //! Returns True if the Position is Identity |
104 | Standard_EXPORT Standard_Boolean IsIdentity() const; |
105 | |
106 | //! Returns True if the Position is a Translation only |
107 | //! Remark : Identity and ZOnly will answer True |
108 | Standard_EXPORT Standard_Boolean IsTranslation() const; |
109 | |
110 | //! Returns True if the Position corresponds to a Z-Displacement, |
111 | //! i.e. is a Translation only, and only on Z |
112 | //! Remark : Identity will answer True |
113 | Standard_EXPORT Standard_Boolean IsZOnly() const; |
114 | |
115 | //! Evaluates a XYZ value in the Position already defined. |
116 | //! Returns the transformed coordinates. |
117 | //! For a 2D definition, X,Y will then be used to define a XY and |
118 | //! Z will be regarded as a Z Displacement (can be ignored) |
119 | Standard_EXPORT void EvalXYZ (const gp_XYZ& val, Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const; |
120 | |
121 | //! Returns the IGES Transformation which corresponds to the |
122 | //! Position. Even if it is an Identity : IsIdentity should be |
123 | //! tested first. |
124 | //! <unit> is the unit value in which the model is created : |
125 | //! it is used to convert translation part |
126 | Standard_EXPORT Handle(IGESGeom_TransformationMatrix) MakeTransformation (const Standard_Real unit = 1) const; |
127 | |
128 | |
129 | |
130 | |
131 | protected: |
132 | |
133 | |
134 | |
135 | |
136 | |
137 | private: |
138 | |
139 | |
140 | |
141 | Handle(TColgp_HSequenceOfXYZ) theXYZ; |
142 | Handle(TColgp_HSequenceOfXYZ) theVec; |
143 | gp_Trsf thepos; |
144 | |
145 | |
146 | }; |
147 | |
148 | |
149 | |
150 | |
151 | |
152 | |
153 | |
154 | #endif // _IGESConvGeom_GeomBuilder_HeaderFile |