42cf5bc1 |
1 | // Created on: 1991-12-02 |
2 | // Created by: Laurent PAINNOT |
3 | // Copyright (c) 1991-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 _AppParCurves_MultiPoint_HeaderFile |
18 | #define _AppParCurves_MultiPoint_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Integer.hxx> |
25 | #include <TColgp_Array1OfPnt.hxx> |
26 | #include <TColgp_Array1OfPnt2d.hxx> |
27 | #include <Standard_Real.hxx> |
28 | #include <Standard_OStream.hxx> |
29 | class MMgt_TShared; |
30 | class Standard_OutOfRange; |
31 | class Standard_DimensionError; |
32 | class gp_Pnt; |
33 | class gp_Pnt2d; |
34 | |
35 | |
36 | //! This class describes Points composing a MultiPoint. |
37 | //! These points can be 2D or 3D. The user must first give the |
38 | //! 3D Points and then the 2D Points. |
39 | //! They are Poles of a Bezier Curve. |
40 | //! This class is used either to define data input or |
41 | //! results when performing the approximation of several lines in parallel. |
42 | class AppParCurves_MultiPoint |
43 | { |
44 | public: |
45 | |
46 | DEFINE_STANDARD_ALLOC |
47 | |
48 | |
49 | //! creates an indefinite MultiPoint. |
50 | Standard_EXPORT AppParCurves_MultiPoint(); |
51 | |
52 | //! constructs a set of Points used to approximate a |
53 | //! Multiline. |
54 | //! These Points can be of 2 or 3 dimensions. |
55 | //! Points will be initialized with SetPoint and SetPoint2d. |
56 | //! NbPoints is the number of 3D Points. |
57 | //! NbPoints2d is the number of 2D Points. |
58 | Standard_EXPORT AppParCurves_MultiPoint(const Standard_Integer NbPoints, const Standard_Integer NbPoints2d); |
59 | |
60 | //! creates a MultiPoint only composed of 3D points. |
61 | Standard_EXPORT AppParCurves_MultiPoint(const TColgp_Array1OfPnt& tabP); |
62 | |
63 | //! creates a MultiPoint only composed of 2D points. |
64 | Standard_EXPORT AppParCurves_MultiPoint(const TColgp_Array1OfPnt2d& tabP2d); |
65 | |
66 | //! constructs a set of Points used to approximate a |
67 | //! Multiline. |
68 | //! These Points can be of 2 or 3 dimensions. |
69 | //! Points will be initialized with SetPoint and SetPoint2d. |
70 | //! NbPoints is the total number of Points. |
71 | Standard_EXPORT AppParCurves_MultiPoint(const TColgp_Array1OfPnt& tabP, const TColgp_Array1OfPnt2d& tabP2d); |
72 | Standard_EXPORT virtual ~AppParCurves_MultiPoint(); |
73 | |
74 | //! the 3d Point of range Index of this MultiPoint is |
75 | //! set to <Point>. |
76 | //! An exception is raised if Index < 0 or |
77 | //! Index > number of 3d Points. |
78 | Standard_EXPORT void SetPoint (const Standard_Integer Index, const gp_Pnt& Point); |
79 | |
80 | //! returns the 3d Point of range Index. |
81 | //! An exception is raised if Index < 0 or |
82 | //! Index < number of 3d Points. |
83 | Standard_EXPORT const gp_Pnt& Point (const Standard_Integer Index) const; |
84 | |
85 | //! The 2d Point of range Index is set to <Point>. |
86 | //! An exception is raised if Index > 3d Points or |
87 | //! Index > total number of Points. |
88 | Standard_EXPORT void SetPoint2d (const Standard_Integer Index, const gp_Pnt2d& Point); |
89 | |
90 | //! returns the 2d Point of range Index. |
91 | //! An exception is raised if index <= number of |
92 | //! 3d Points or Index > total number of Points. |
93 | Standard_EXPORT const gp_Pnt2d& Point2d (const Standard_Integer Index) const; |
94 | |
95 | //! returns the dimension of the point of range Index. |
96 | //! An exception is raised if Index <0 or Index > NbCurves. |
97 | Standard_Integer Dimension (const Standard_Integer Index) const; |
98 | |
99 | //! returns the number of points of dimension 3D. |
100 | Standard_Integer NbPoints() const; |
101 | |
102 | //! returns the number of points of dimension 2D. |
103 | Standard_Integer NbPoints2d() const; |
104 | |
105 | //! Applies a transformation to the curve of range |
106 | //! <CuIndex>. |
107 | //! newx = x + dx*oldx |
108 | //! newy = y + dy*oldy for all points of the curve. |
109 | //! newz = z + dz*oldz |
110 | Standard_EXPORT void Transform (const Standard_Integer CuIndex, const Standard_Real x, const Standard_Real dx, const Standard_Real y, const Standard_Real dy, const Standard_Real z, const Standard_Real dz); |
111 | |
112 | //! Applies a transformation to the Curve of range |
113 | //! <CuIndex>. |
114 | //! newx = x + dx*oldx |
115 | //! newy = y + dy*oldy for all points of the curve. |
116 | Standard_EXPORT void Transform2d (const Standard_Integer CuIndex, const Standard_Real x, const Standard_Real dx, const Standard_Real y, const Standard_Real dy); |
117 | |
118 | //! Prints on the stream o information on the current |
119 | //! state of the object. |
120 | //! Is used to redefine the operator <<. |
121 | Standard_EXPORT virtual void Dump (Standard_OStream& o) const; |
122 | |
123 | |
124 | |
125 | |
126 | protected: |
127 | |
128 | |
129 | |
130 | Handle(MMgt_TShared) ttabPoint; |
131 | Handle(MMgt_TShared) ttabPoint2d; |
132 | Standard_Integer nbP; |
133 | Standard_Integer nbP2d; |
134 | |
135 | |
136 | private: |
137 | |
138 | |
139 | |
140 | |
141 | |
142 | }; |
143 | |
144 | |
145 | #include <AppParCurves_MultiPoint.lxx> |
146 | |
147 | |
148 | |
149 | |
150 | |
151 | #endif // _AppParCurves_MultiPoint_HeaderFile |