42cf5bc1 |
1 | // Created by: Peter KURNEV |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
3 | // |
4 | // This file is part of Open CASCADE Technology software library. |
5 | // |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
11 | // |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
14 | |
15 | #ifndef _BOPDS_PaveBlock_HeaderFile |
16 | #define _BOPDS_PaveBlock_HeaderFile |
17 | |
18 | #include <Standard.hxx> |
19 | #include <Standard_Type.hxx> |
20 | |
1155d05a |
21 | #include <Bnd_Box.hxx> |
42cf5bc1 |
22 | #include <BOPDS_ListOfPave.hxx> |
1155d05a |
23 | #include <BOPDS_ListOfPaveBlock.hxx> |
24 | #include <BOPDS_Pave.hxx> |
25 | #include <NCollection_BaseAllocator.hxx> |
26 | #include <Standard_Boolean.hxx> |
27 | #include <Standard_Integer.hxx> |
42cf5bc1 |
28 | #include <Standard_Real.hxx> |
25e59720 |
29 | #include <Standard_Transient.hxx> |
1155d05a |
30 | #include <TColStd_MapOfInteger.hxx> |
42cf5bc1 |
31 | class BOPDS_Pave; |
32 | class Bnd_Box; |
33 | |
34 | |
35 | class BOPDS_PaveBlock; |
25e59720 |
36 | DEFINE_STANDARD_HANDLE(BOPDS_PaveBlock, Standard_Transient) |
42cf5bc1 |
37 | |
38 | |
39 | //! The class BOPDS_PaveBlock is to store |
40 | //! the information about pave block on an edge. |
41 | //! Two adjacent paves on edge make up pave block. |
25e59720 |
42 | class BOPDS_PaveBlock : public Standard_Transient |
42cf5bc1 |
43 | { |
44 | |
45 | public: |
46 | |
47 | |
48 | |
49 | //! Empty contructor |
50 | Standard_EXPORT BOPDS_PaveBlock(); |
51 | |
52 | |
53 | //! Contructor |
54 | //! <theAllocator> - the allocator to manage the memory |
1155d05a |
55 | Standard_EXPORT BOPDS_PaveBlock(const Handle(NCollection_BaseAllocator)& theAllocator); |
42cf5bc1 |
56 | |
57 | |
58 | //! Modifier |
59 | //! Sets the first pave <thePave> |
60 | Standard_EXPORT void SetPave1 (const BOPDS_Pave& thePave); |
61 | |
62 | |
63 | //! Selector |
64 | //! Returns the first pave |
65 | Standard_EXPORT const BOPDS_Pave& Pave1() const; |
66 | |
67 | |
68 | //! Modifier |
69 | //! Sets the second pave <thePave> |
70 | Standard_EXPORT void SetPave2 (const BOPDS_Pave& thePave); |
71 | |
72 | |
73 | //! Selector |
74 | //! Returns the second pave |
75 | Standard_EXPORT const BOPDS_Pave& Pave2() const; |
76 | |
77 | |
78 | //! Modifier |
79 | //! Sets the index of edge of pave block <theEdge> |
80 | Standard_EXPORT void SetEdge (const Standard_Integer theEdge); |
81 | |
82 | |
83 | //! Selector |
84 | //! Returns the index of edge of pave block |
85 | Standard_EXPORT Standard_Integer Edge() const; |
86 | |
87 | |
88 | //! Query |
89 | //! Returns true if the pave block has edge |
90 | Standard_EXPORT Standard_Boolean HasEdge() const; |
91 | |
92 | |
93 | //! Query |
94 | //! Returns true if the pave block has edge |
95 | //! Returns the index of edge <theEdge> |
96 | Standard_EXPORT Standard_Boolean HasEdge (Standard_Integer& theEdge) const; |
97 | |
98 | |
99 | //! Modifier |
100 | //! Sets the index of original edge |
101 | //! of the pave block <theEdge> |
102 | Standard_EXPORT void SetOriginalEdge (const Standard_Integer theEdge); |
103 | |
104 | |
105 | //! Selector |
106 | //! Returns the index of original edge of pave block |
107 | Standard_EXPORT Standard_Integer OriginalEdge() const; |
108 | |
109 | |
110 | //! Query |
111 | //! Returns true if the edge is equal to the original edge |
112 | //! of the pave block |
113 | Standard_EXPORT Standard_Boolean IsSplitEdge() const; |
114 | |
115 | |
116 | //! Selector |
117 | //! Returns the parametric range <theT1,theT2> |
118 | //! of the pave block |
119 | Standard_EXPORT void Range (Standard_Real& theT1, Standard_Real& theT2) const; |
120 | |
121 | |
122 | //! Query |
123 | //! Returns true if the pave block has pave indices |
124 | //! that equal to the pave indices of the pave block |
125 | //! <theOther> |
126 | Standard_EXPORT Standard_Boolean HasSameBounds (const Handle(BOPDS_PaveBlock)& theOther) const; |
127 | |
128 | |
129 | //! Selector |
130 | //! Returns the pave indices <theIndex1,theIndex2> |
131 | //! of the pave block |
787c4320 |
132 | Standard_EXPORT void Indices (Standard_Integer& theIndex1, |
133 | Standard_Integer& theIndex2) const; |
42cf5bc1 |
134 | |
135 | |
136 | //! Query |
137 | //! Returns true if the pave block contains extra paves |
138 | Standard_EXPORT Standard_Boolean IsToUpdate() const; |
139 | |
140 | |
141 | //! Modifier |
0d0481c7 |
142 | //! Appends extra paves <thePave> |
143 | Standard_EXPORT void AppendExtPave(const BOPDS_Pave& thePave); |
42cf5bc1 |
144 | |
145 | |
146 | //! Modifier |
147 | //! Appends extra pave <thePave> |
148 | Standard_EXPORT void AppendExtPave1 (const BOPDS_Pave& thePave); |
149 | |
0d0481c7 |
150 | //! Modifier |
151 | //! Removes a pave with the given vertex number from extra paves |
152 | Standard_EXPORT void RemoveExtPave(const Standard_Integer theVertNum); |
42cf5bc1 |
153 | |
154 | //! Selector |
155 | //! Returns the extra paves |
156 | Standard_EXPORT const BOPDS_ListOfPave& ExtPaves() const; |
157 | |
158 | |
159 | //! Selector / Modifier |
160 | //! Returns the extra paves |
161 | Standard_EXPORT BOPDS_ListOfPave& ChangeExtPaves(); |
162 | |
163 | |
164 | //! Modifier |
165 | //! Updates the pave block. The extra paves are used |
166 | //! to create new pave blocks <theLPB>. |
167 | //! <theFlag> - if true, the first pave and the second |
168 | //! pave are used to produce new pave blocks. |
787c4320 |
169 | Standard_EXPORT void Update (BOPDS_ListOfPaveBlock& theLPB, |
170 | const Standard_Boolean theFlag = Standard_True); |
42cf5bc1 |
171 | |
172 | |
173 | //! Query |
174 | //! Returns true if the extra paves contain the pave |
175 | //! with given value of the parameter <thePrm> |
176 | //! <theTol> - the value of the tolerance to compare |
787c4320 |
177 | //! <theInd> - index of the found pave |
178 | Standard_EXPORT Standard_Boolean ContainsParameter (const Standard_Real thePrm, |
179 | const Standard_Real theTol, |
180 | Standard_Integer& theInd) const; |
42cf5bc1 |
181 | |
182 | |
183 | //! Modifier |
184 | //! Sets the shrunk data for the pave block |
185 | //! <theTS1>, <theTS2> - shrunk range |
186 | //! <theBox> - the bounding box |
01b5b3df |
187 | //! <theIsSplittable> - defines whether the edge can be split |
787c4320 |
188 | Standard_EXPORT void SetShrunkData (const Standard_Real theTS1, |
189 | const Standard_Real theTS2, |
01b5b3df |
190 | const Bnd_Box& theBox, |
191 | const Standard_Boolean theIsSplittable); |
42cf5bc1 |
192 | |
193 | |
194 | //! Selector |
195 | //! Returns the shrunk data for the pave block |
196 | //! <theTS1>, <theTS2> - shrunk range |
197 | //! <theBox> - the bounding box |
01b5b3df |
198 | //! <theIsSplittable> - defines whether the edge can be split |
787c4320 |
199 | Standard_EXPORT void ShrunkData (Standard_Real& theTS1, |
200 | Standard_Real& theTS2, |
01b5b3df |
201 | Bnd_Box& theBox, |
202 | Standard_Boolean& theIsSplittable) const; |
42cf5bc1 |
203 | |
204 | |
205 | //! Query |
206 | //! Returns true if the pave block contains |
207 | //! the shrunk data |
208 | Standard_EXPORT Standard_Boolean HasShrunkData() const; |
209 | |
210 | Standard_EXPORT void Dump() const; |
211 | |
01b5b3df |
212 | //! Query |
213 | //! Returns FALSE if the pave block has a too short |
214 | //! shrunk range and cannot be split, otherwise returns TRUE |
215 | Standard_Boolean IsSplittable() const |
216 | { |
217 | return myIsSplittable; |
218 | } |
42cf5bc1 |
219 | |
220 | |
221 | |
25e59720 |
222 | DEFINE_STANDARD_RTTIEXT(BOPDS_PaveBlock,Standard_Transient) |
42cf5bc1 |
223 | |
224 | protected: |
225 | |
226 | |
1155d05a |
227 | Handle(NCollection_BaseAllocator) myAllocator; |
42cf5bc1 |
228 | Standard_Integer myEdge; |
229 | Standard_Integer myOriginalEdge; |
230 | BOPDS_Pave myPave1; |
231 | BOPDS_Pave myPave2; |
232 | BOPDS_ListOfPave myExtPaves; |
233 | Standard_Real myTS1; |
234 | Standard_Real myTS2; |
235 | Bnd_Box myShrunkBox; |
1155d05a |
236 | TColStd_MapOfInteger myMFence; |
01b5b3df |
237 | Standard_Boolean myIsSplittable; |
42cf5bc1 |
238 | |
239 | private: |
240 | |
241 | |
242 | |
243 | |
244 | }; |
245 | |
246 | |
247 | |
248 | |
249 | |
250 | |
251 | |
252 | #endif // _BOPDS_PaveBlock_HeaderFile |