4e57c75e |
1 | -- Created by: Peter KURNEV |
2 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
3 | -- |
4 | -- The content of this file is subject to the Open CASCADE Technology Public |
5 | -- License Version 6.5 (the "License"). You may not use the content of this file |
6 | -- except in compliance with the License. Please obtain a copy of the License |
7 | -- at http://www.opencascade.org and read it completely before using this file. |
8 | -- |
9 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
10 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
11 | -- |
12 | -- The Original Code and all software distributed under the License is |
13 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
14 | -- Initial Developer hereby disclaims all such warranties, including without |
15 | -- limitation, any warranties of merchantability, fitness for a particular |
16 | -- purpose or non-infringement. Please see the License for the specific terms |
17 | -- and conditions governing the rights and limitations under the License. |
18 | |
19 | |
20 | class DS from BOPDS |
21 | |
22 | ---Purpose: |
23 | -- The class BOPDS_DS provides the control |
24 | -- the data structure for |
25 | -- partition and boolean operation algorithms |
26 | -- |
27 | -- The data structure has the following contents: |
28 | -- 1. the arguments of an operation [myArguments]; |
29 | -- 2 the information about arguments/new shapes |
30 | -- and their sub-shapes (type of the shape, |
31 | -- bounding box, etc) [myLines]; |
32 | -- 3. each argument shape(and its subshapes) |
33 | -- has/have own range of indices (rank) |
34 | -- 4. pave blocks on source edges [myPaveBlocksPool]; |
35 | -- 5. the state of source faces [myFaceInfoPool] |
36 | -- 6 the collection of same domain shapes [myShapesSD] |
37 | -- 7 the collection of interferences [myInterfTB, |
38 | -- myInterfVV,..myInterfFF] |
39 | |
40 | uses |
41 | ShapeEnum from TopAbs, |
42 | Shape from TopoDS, |
43 | -- |
44 | ListOfShape from BOPCol, |
45 | DataMapOfIntegerInteger from BOPCol, |
46 | DataMapOfShapeInteger from BOPCol, |
47 | ListOfInteger from BOPCol, |
48 | MapOfInteger from BOPCol, |
49 | BaseAllocator from BOPCol, |
50 | -- |
51 | ShapeInfo from BOPDS, |
52 | IndexRange from BOPDS, |
53 | VectorOfIndexRange from BOPDS, |
54 | VectorOfShapeInfo from BOPDS, |
55 | VectorOfListOfPaveBlock from BOPDS, |
56 | ListOfPaveBlock from BOPDS, |
57 | ListOfPave from BOPDS, |
58 | PaveBlock from BOPDS, |
59 | CommonBlock from BOPDS, |
60 | MapOfPaveBlock from BOPDS, |
61 | IndexedMapOfPaveBlock from BOPDS, |
62 | VectorOfFaceInfo from BOPDS, |
63 | FaceInfo from BOPDS, |
64 | -- |
5a77460e |
65 | MapOfPassKey from BOPDS, |
66 | DataMapOfPaveBlockCommonBlock from BOPDS, |
4e57c75e |
67 | -- |
68 | VectorOfInterfVV from BOPDS, |
69 | VectorOfInterfVE from BOPDS, |
70 | VectorOfInterfVF from BOPDS, |
71 | VectorOfInterfEE from BOPDS, |
72 | VectorOfInterfEF from BOPDS, |
73 | VectorOfInterfFF from BOPDS |
74 | |
75 | --raises |
76 | |
77 | is |
78 | Create |
79 | returns DS from BOPDS; |
80 | ---C++: alias "Standard_EXPORT virtual ~BOPDS_DS();" |
81 | ---Purpose: |
82 | --- Empty contructor |
83 | --- |
84 | Create (theAllocator: BaseAllocator from BOPCol) |
85 | returns DS from BOPDS; |
86 | ---Purpose: |
87 | --- Contructor |
88 | --- theAllocator - the allocator to manage the memory |
89 | --- |
90 | |
91 | Clear(me:out); |
92 | ---Purpose: |
93 | -- Clears the contents |
94 | |
95 | Allocator(me) |
96 | returns BaseAllocator from BOPCol; |
97 | ---C++: return const & |
98 | ---Purpose: |
99 | --- Selector |
100 | --- |
101 | |
102 | SetArguments(me:out; |
103 | theLS:ListOfShape from BOPCol); |
104 | ---Purpose: |
105 | --- Modifier |
106 | --- Sets the arguments [theLS] of an operation |
107 | |
108 | Arguments(me) |
109 | returns ListOfShape from BOPCol; |
110 | ---C++: return const & |
111 | ---Purpose: |
112 | --- Selector |
113 | --- Returns the arguments of an operation |
114 | |
115 | Init(me:out); |
116 | ---Purpose: |
117 | --- Initializes the data structure for |
118 | -- the arguments |
119 | |
120 | NbShapes(me) |
121 | returns Integer from Standard; |
122 | ---Purpose: |
123 | --- Selector |
124 | --- Returns the total number of shapes stored |
125 | |
126 | NbSourceShapes(me) |
127 | returns Integer from Standard; |
128 | ---Purpose: |
129 | --- Selector |
130 | --- Returns the total number of source shapes stored |
131 | |
132 | NbRanges(me) |
133 | returns Integer from Standard; |
134 | ---Purpose: |
135 | --- Selector |
136 | --- Returns the number of index ranges |
137 | |
138 | Range(me; |
139 | theIndex:Integer from Standard) |
140 | returns IndexRange from BOPDS; |
141 | ---C++: return const & |
142 | ---Purpose: |
143 | --- Selector |
144 | --- Returns the index range "i" |
145 | |
146 | Rank (me; |
147 | theIndex:Integer from Standard) |
148 | returns Integer from Standard; |
149 | ---Purpose: |
150 | --- Selector |
151 | --- Returns the rank of the shape of index "i" |
152 | |
153 | IsNewShape(me; |
154 | theIndex:Integer from Standard) |
155 | returns Boolean from Standard; |
156 | ---Purpose: |
157 | --- Returns true if the shape of index "i" is not |
158 | --- the source shape/sub-shape |
159 | |
160 | -- |
161 | -- shapes and auxiliary info |
162 | -- |
163 | Append(me:out; |
164 | theSI:ShapeInfo from BOPDS) |
165 | returns Integer from Standard; |
166 | ---Purpose: |
167 | --- Modifier |
168 | --- Appends the information about the shape [theSI] |
169 | --- to the data structure |
170 | --- Returns the index of theSI in the data structure |
171 | |
172 | Append(me:out; |
173 | theS:Shape from TopoDS) |
174 | returns Integer from Standard; |
175 | ---Purpose: |
176 | --- Modifier |
177 | --- Appends the default information about the shape [theS] |
178 | --- to the data structure |
179 | --- Returns the index of theS in the data structure |
180 | |
181 | ShapeInfo(me; |
182 | theIndex:Integer from Standard) |
183 | returns ShapeInfo from BOPDS; |
184 | ---C++: return const & |
185 | ---Purpose: |
186 | --- Selector |
187 | --- Returns the information about the shape |
188 | --- with index theIndex |
189 | |
190 | ChangeShapeInfo(me:out; |
191 | theIndex:Integer from Standard) |
192 | returns ShapeInfo from BOPDS; |
193 | ---C++: return & |
194 | ---Purpose: |
195 | --- Selector/Modifier |
196 | --- Returns the information about the shape |
197 | --- with index theIndex |
198 | |
199 | Shape(me; |
200 | theIndex:Integer from Standard) |
201 | returns Shape from TopoDS; |
202 | ---C++: return const & |
203 | ---Purpose: |
204 | --- Selector |
205 | --- Returns the shape |
206 | -- with index theIndex |
207 | |
208 | Index(me; |
209 | theS:Shape from TopoDS) |
210 | returns Integer from Standard; |
211 | ---Purpose: |
212 | --- Selector |
213 | --- Returns the index of the shape theS |
214 | |
215 | -- |
216 | -- pave blocks |
217 | -- |
218 | PaveBlocksPool(me) |
219 | returns VectorOfListOfPaveBlock from BOPDS; |
220 | ---C++: return const & |
221 | ---Purpose: |
222 | --- Selector |
223 | --- Returns the information about pave blocks on source edges |
224 | |
225 | ChangePaveBlocksPool(me:out) |
226 | returns VectorOfListOfPaveBlock from BOPDS; |
227 | ---C++: return & |
228 | ---Purpose: |
229 | --- Selector/Modifier |
230 | --- Returns the information about pave blocks on source edges |
231 | |
232 | HasPaveBlocks(me; |
233 | theIndex:Integer from Standard) |
234 | returns Boolean from Standard; |
235 | ---Purpose: |
236 | --- Query |
237 | --- Returns true if the shape with index theIndex has the |
238 | --- information about pave blocks |
239 | |
240 | PaveBlocks (me; |
241 | theIndex:Integer from Standard) |
242 | returns ListOfPaveBlock from BOPDS; |
243 | ---C++: return const & |
244 | ---Purpose: |
245 | --- Selector |
246 | --- Returns the pave blocks for the shape with index theIndex |
247 | |
248 | ChangePaveBlocks (me:out; |
249 | theIndex:Integer from Standard) |
250 | returns ListOfPaveBlock from BOPDS; |
251 | ---C++: return & |
252 | ---Purpose: |
253 | --- Selector/Modifier |
254 | --- Returns the pave blocks for the shape with index theIndex |
255 | |
256 | InitPaveBlocks(me:out; |
257 | theIndex:Integer from Standard) |
258 | is protected; |
259 | ---Purpose: |
260 | --- Initializes the pave blocks for the shape with index theIndex |
261 | |
262 | UpdatePaveBlocks(me:out); |
263 | ---Purpose: |
264 | --- Update the pave blocks for the all shapes in data structure |
265 | |
266 | UpdatePaveBlock(me:out; |
267 | thePB:PaveBlock from BOPDS); |
268 | ---Purpose: |
269 | --- Update the pave block thePB |
270 | |
271 | UpdateCommonBlock(me:out; |
272 | theCB:CommonBlock from BOPDS); |
273 | ---Purpose: |
5a77460e |
274 | --- Update the common block theCB |
275 | |
276 | IsCommonBlock(me; |
277 | thePB:PaveBlock from BOPDS) |
278 | returns Boolean from Standard; |
279 | ---Purpose: |
280 | --- Query |
281 | --- Returns true if the pave block is common block |
282 | |
283 | CommonBlock(me; |
284 | thePB:PaveBlock from BOPDS) |
285 | returns CommonBlock from BOPDS; |
286 | ---C++: return const & |
287 | ---Purpose: |
288 | --- Selector |
289 | --- Returns the common block |
290 | |
291 | SetCommonBlock(me:out; |
292 | thePB:PaveBlock from BOPDS; |
293 | theCB:CommonBlock from BOPDS); |
294 | ---Purpose: |
295 | --- Modifier |
296 | --- Sets the common block <theCB> |
297 | |
298 | RealPaveBlock(me; |
299 | thePB:PaveBlock from BOPDS) |
300 | returns PaveBlock from BOPDS; |
301 | ---Purpose: |
302 | --- Selector |
303 | --- Returns the real first pave block |
304 | |
305 | IsCommonBlockOnEdge(me; |
306 | thePB:PaveBlock from BOPDS) |
307 | returns Boolean from Standard; |
308 | ---Purpose: |
309 | --- Query |
310 | --- Returns true if common block contains more then one pave block |
311 | |
4e57c75e |
312 | -- |
313 | -- face info |
314 | -- |
315 | FaceInfoPool(me) |
316 | returns VectorOfFaceInfo from BOPDS; |
317 | ---C++: return const & |
318 | ---Purpose: |
319 | --- Selector |
320 | --- Returns the information about state of faces |
321 | |
322 | HasFaceInfo(me; |
323 | theIndex:Integer from Standard) |
324 | returns Boolean from Standard; |
325 | ---Purpose: |
326 | --- Query |
327 | --- Returns true if the shape with index theIndex has the |
328 | --- information about state of face |
329 | |
330 | FaceInfo(me; |
331 | theIndex:Integer from Standard) |
332 | returns FaceInfo from BOPDS; |
333 | ---C++: return const & |
334 | ---Purpose: |
335 | --- Selector |
336 | --- Returns the state of face with index theIndex |
337 | |
338 | ChangeFaceInfo(me:out; |
339 | theIndex:Integer from Standard) |
340 | returns FaceInfo from BOPDS; |
341 | ---C++: return & |
342 | ---Purpose: |
343 | --- Selector/Modifier |
344 | --- Returns the state of face with index theIndex |
345 | |
346 | InitFaceInfo(me:out; |
347 | theIndex:Integer from Standard) |
348 | is protected; |
349 | ---Purpose: |
350 | --- Initializes the state of face with index theIndex |
351 | |
352 | UpdateFaceInfoIn(me:out; |
353 | theIndex:Integer from Standard); |
354 | ---Purpose: |
355 | --- Update the state In of face with index theIndex |
356 | |
357 | UpdateFaceInfoOn(me:out; |
358 | theIndex:Integer from Standard); |
359 | ---Purpose: |
360 | --- Update the state On of face with index theIndex |
361 | |
362 | FaceInfoOn(me:out; |
363 | theIndex:Integer from Standard; |
364 | theMPB:out IndexedMapOfPaveBlock from BOPDS; |
365 | theMVP:out MapOfInteger from BOPCol); |
366 | ---Purpose: |
367 | --- Selector |
368 | --- Returns the state On |
369 | --- [theMPB,theMVP] of face with index theIndex |
370 | |
371 | FaceInfoIn(me:out; |
372 | theIndex:Integer from Standard; |
373 | theMPB:out IndexedMapOfPaveBlock from BOPDS; |
374 | theMVP:out MapOfInteger from BOPCol); |
375 | ---Purpose: |
376 | --- Selector |
377 | --- Returns the state In |
378 | --- [theMPB,theMVP] of face with index theIndex |
379 | |
380 | AloneVertices(me; |
381 | theF:Integer from Standard; |
382 | theLI:out ListOfInteger from BOPCol); |
383 | ---Purpose: |
384 | --- Selector |
385 | --- Returns the indices of alone vertices |
386 | --- for the face with index theIndex |
387 | |
388 | RefineFaceInfoOn(me:out); |
389 | ---Purpose: |
390 | --- Refine the state On for the all faces having |
391 | --- state information |
392 | -- |
393 | -- ++ |
394 | -- |
395 | VerticesOnIn(me; |
396 | theF1:Integer from Standard; |
397 | theF2:Integer from Standard; |
398 | theMI:out MapOfInteger from BOPCol; |
399 | aMPB: out MapOfPaveBlock from BOPDS); |
400 | ---Purpose: |
401 | --- Returns the indices of vertices and pave blocks |
402 | --- that are On/In for the faces with indices theF1, theF2 |
403 | |
404 | SharedEdges(me:out; |
405 | theF1:Integer from Standard; |
406 | theF2:Integer from Standard; |
407 | theLI:out ListOfInteger from BOPCol; |
408 | theAllocator:BaseAllocator from BOPCol); |
409 | ---Purpose: |
410 | --- Returns the indices of edges that are shared |
411 | --- for the faces with indices theF1, theF2 |
412 | -- |
413 | -- same domain shapes |
414 | -- |
415 | ShapesSD (me:out) |
416 | returns DataMapOfIntegerInteger from BOPCol; |
417 | ---C++: return & |
418 | ---Purpose: |
419 | --- Selector |
420 | --- Returns the collection same domain shapes |
421 | |
422 | AddShapeSD(me:out; |
423 | theIndex:Integer from Standard; |
424 | theIndexSD:Integer from Standard); |
425 | ---Purpose: |
426 | --- Modifier |
427 | --- Adds the information about same domain shapes |
428 | --- with indices theIndex, theIndexSD |
429 | |
430 | HasShapeSD(me; |
431 | theIndex:Integer from Standard; |
432 | theIndexSD:out Integer from Standard) |
433 | returns Boolean from Standard; |
434 | ---Purpose: |
435 | --- Query |
436 | --- Returns true if the shape with index theIndex has the |
437 | --- same domain shape. In this case theIndexSD will contain |
438 | -- the index of same domain shape found |
439 | -- |
440 | -- interferences |
441 | -- |
442 | InterfVV(me:out) |
443 | returns VectorOfInterfVV from BOPDS; |
444 | ---C++: return & |
445 | ---C++: inline |
446 | ---Purpose: |
447 | --- Selector/Modifier |
448 | --- Returns the collection of interferences Vertex/Vertex |
449 | |
450 | InterfVE(me:out) |
451 | returns VectorOfInterfVE from BOPDS; |
452 | ---C++: return & |
453 | ---C++: inline |
454 | ---Purpose: |
455 | --- Selector/Modifier |
456 | --- Returns the collection of interferences Vertex/Edge |
457 | |
458 | InterfVF(me:out) |
459 | returns VectorOfInterfVF from BOPDS; |
460 | ---C++: return & |
461 | ---C++: inline |
462 | ---Purpose: |
463 | --- Selector/Modifier |
464 | --- Returns the collection of interferences Vertex/Face |
465 | |
466 | InterfEE(me:out) |
467 | returns VectorOfInterfEE from BOPDS; |
468 | ---C++: return & |
469 | ---C++: inline |
470 | ---Purpose: |
471 | --- Selector/Modifier |
472 | --- Returns the collection of interferences Edge/Edge |
473 | |
474 | InterfEF(me:out) |
475 | returns VectorOfInterfEF from BOPDS; |
476 | ---C++: return & |
477 | ---C++: inline |
478 | ---Purpose: |
479 | --- Selector/Modifier |
480 | --- Returns the collection of interferences Edge/Face |
481 | |
482 | InterfFF(me:out) |
483 | returns VectorOfInterfFF from BOPDS; |
484 | ---C++: return & |
485 | ---C++: inline |
486 | ---Purpose: |
487 | --- Selector/Modifier |
488 | --- Returns the collection of interferences Face/Face |
489 | |
490 | AddInterf(me:out; |
491 | theI1:Integer from Standard; |
492 | theI2:Integer from Standard); |
493 | ---C++: inline |
494 | ---Purpose: |
495 | --- Modifier |
496 | --- Adds the information about an interference between |
497 | --- shapes with indices theI1, theI2 to the summary |
498 | --- table of interferences |
499 | |
500 | HasInterf(me; |
501 | theI:Integer from Standard) |
502 | returns Boolean from Standard; |
503 | ---Purpose: |
504 | --- Query |
505 | --- Returns true if the shape with index theI |
506 | --- is interferred |
507 | |
508 | HasInterf(me; |
509 | theI1:Integer from Standard; |
510 | theI2:Integer from Standard) |
511 | returns Boolean from Standard; |
512 | ---C++: inline |
513 | ---Purpose: |
514 | --- Query |
515 | --- Returns true if the shapes with indices theI1, theI2 |
516 | --- are interferred |
517 | |
518 | HasInterfShapeSubShapes(me; |
519 | theI1:Integer from Standard; |
520 | theI2:Integer from Standard) |
521 | returns Boolean from Standard; |
522 | ---Purpose: |
523 | --- Query |
524 | --- Returns true if the shape with index theI1 is interfered |
525 | --- with any of sub-shapes of the shapes with index theI2 |
526 | |
527 | HasInterfSubShapes(me; |
528 | theI1:Integer from Standard; |
529 | theI2:Integer from Standard) |
530 | returns Boolean from Standard; |
531 | ---Purpose: |
532 | --- Query |
533 | --- Returns true if the shapes with indices theI1, theI2 |
534 | --- have interferred sub-shapes |
535 | |
536 | Interferences(me) |
537 | returns MapOfPassKey from BOPDS; |
538 | ---C++: return const & |
539 | ---C++: inline |
540 | ---Purpose: |
541 | --- Selector |
542 | --- Returns the table of interferences |
543 | -- |
544 | -- debug |
545 | -- |
546 | Dump(me); |
547 | -- |
548 | -- protected methods |
549 | -- |
550 | InitShape(me:out; |
551 | theIndex:Integer from Standard; |
552 | theS:Shape from TopoDS; |
553 | theAllocator:out BaseAllocator from BOPCol; |
554 | theMSI:out DataMapOfShapeInteger from BOPCol) |
555 | is protected; |
556 | |
557 | CheckCoincidence(me:out; |
558 | thePB1:PaveBlock from BOPDS; |
559 | thePB2:PaveBlock from BOPDS) |
560 | returns Boolean from Standard |
561 | is protected; |
562 | |
563 | SortPaveBlocks(me:out; |
564 | theCB:CommonBlock from BOPDS); |
565 | |
566 | IsToSort(me:out; |
567 | theCB:CommonBlock from BOPDS; |
568 | theI:out Integer from Standard) |
569 | returns Boolean from Standard; |
570 | |
571 | IsSubShape(me:out; |
572 | theI1:Integer from Standard; |
573 | theI2:Integer from Standard) |
574 | returns Boolean from Standard; |
575 | |
576 | Paves(me:out; |
577 | theIndex:Integer from Standard; |
578 | theLP:out ListOfPave from BOPDS); |
579 | ---Purpose: Fills theLP with sorted paves |
580 | -- of the shape with index theIndex |
581 | |
582 | UpdateEdgeTolerance(me:out; |
583 | theIndex:Integer from Standard; |
584 | theTolerance:Real from Standard); |
585 | ---Purpose: |
586 | --- Updates tolerance of the sub-shapes of the shape with index <theIndex>. |
587 | --- |
588 | |
589 | fields |
590 | myAllocator : BaseAllocator from BOPCol is protected; |
591 | myArguments : ListOfShape from BOPCol is protected; |
592 | --contents |
593 | myNbShapes : Integer from Standard is protected; |
594 | myNbSourceShapes : Integer from Standard is protected; |
595 | myRanges : VectorOfIndexRange from BOPDS is protected; |
596 | myLines : VectorOfShapeInfo from BOPDS is protected; |
597 | myMapShapeIndex : DataMapOfShapeInteger from BOPCol is protected; |
598 | -- |
5a77460e |
599 | myPaveBlocksPool : VectorOfListOfPaveBlock from BOPDS is protected; |
600 | myMapPBCB : DataMapOfPaveBlockCommonBlock from BOPDS is protected; |
4e57c75e |
601 | myFaceInfoPool : VectorOfFaceInfo from BOPDS is protected; |
602 | -- |
603 | --same domain shapes |
604 | myShapesSD : DataMapOfIntegerInteger from BOPCol is protected; |
605 | -- |
606 | --interferences |
607 | myInterfTB : MapOfPassKey from BOPDS is protected; |
608 | myInterfVV : VectorOfInterfVV from BOPDS is protected; |
609 | myInterfVE : VectorOfInterfVE from BOPDS is protected; |
610 | myInterfVF : VectorOfInterfVF from BOPDS is protected; |
611 | myInterfEE : VectorOfInterfEE from BOPDS is protected; |
612 | myInterfEF : VectorOfInterfEF from BOPDS is protected; |
613 | myInterfFF : VectorOfInterfFF from BOPDS is protected; |
614 | |
615 | end DS; |