0025477: Boolean Operations with additional tolerance - Fuzzy Boolean operations
[occt.git] / src / BOPDS / BOPDS_DS.cdl
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 class DS from BOPDS 
16
17         ---Purpose: 
18             -- The class BOPDS_DS provides the control 
19         -- the data structure for  
20             -- partition and  boolean operation algorithms 
21         -- 
22             -- The data structure has the  following contents: 
23         --  1. the arguments of an operation [myArguments];
24         --  2  the information about arguments/new shapes  
25         --     and their sub-shapes (type of the shape,  
26         --     bounding box, etc) [myLines]; 
27         --  3. each argument shape(and its subshapes)  
28             --     has/have own range of indices (rank)     
29             --  4. pave blocks on source edges [myPaveBlocksPool];     
30         --  5. the state of source faces  [myFaceInfoPool]   
31         --  6  the collection of same domain shapes [myShapesSD]    
32         --  7  the collection of interferences  [myInterfTB, 
33         --     myInterfVV,..myInterfFF] 
34         
35 uses  
36     ShapeEnum     from TopAbs, 
37     Box from Bnd, 
38     Shape         from TopoDS,
39     -- 
40     ListOfShape from BOPCol,  
41     DataMapOfIntegerInteger from BOPCol, 
42     DataMapOfIntegerReal    from BOPCol,
43     DataMapOfShapeInteger   from BOPCol, 
44     ListOfInteger           from BOPCol, 
45     MapOfInteger            from BOPCol, 
46     BaseAllocator           from BOPCol, 
47     --
48     ShapeInfo  from BOPDS, 
49     IndexRange from BOPDS, 
50     VectorOfIndexRange from BOPDS,
51     VectorOfShapeInfo  from BOPDS, 
52     VectorOfListOfPaveBlock from BOPDS,  
53     ListOfPaveBlock    from BOPDS,  
54     ListOfPave from BOPDS,
55     PaveBlock from BOPDS,  
56     CommonBlock from BOPDS,
57     MapOfPaveBlock from BOPDS, 
58     IndexedMapOfPaveBlock from BOPDS, 
59     VectorOfFaceInfo from BOPDS, 
60     FaceInfo from BOPDS, 
61     --  
62     MapOfPassKey     from BOPDS,  
63     DataMapOfPaveBlockCommonBlock from BOPDS,
64     --
65     VectorOfInterfVV from BOPDS,
66     VectorOfInterfVE from BOPDS,
67     VectorOfInterfVF from BOPDS,
68     VectorOfInterfEE from BOPDS,
69     VectorOfInterfEF from BOPDS, 
70     VectorOfInterfFF from BOPDS,
71     VectorOfInterfVZ from BOPDS,
72     VectorOfInterfEZ from BOPDS,
73     VectorOfInterfFZ from BOPDS,
74     VectorOfInterfZZ from BOPDS
75  
76 --raises
77
78 is
79     Create 
80             returns DS from BOPDS; 
81     ---C++: alias "Standard_EXPORT virtual ~BOPDS_DS();"  
82             ---Purpose:  
83             --- Empty contructor  
84             ---     
85     Create (theAllocator: BaseAllocator from BOPCol) 
86             returns DS from BOPDS;  
87             ---Purpose:  
88             ---  Contructor    
89             ---  theAllocator - the allocator to manage the memory     
90             ---     
91   
92     Clear(me:out); 
93             ---Purpose:  
94         --  Clears the contents 
95          
96     Allocator(me) 
97             returns BaseAllocator from BOPCol; 
98     ---C++: return const &         
99              ---Purpose:  
100             --- Selector  
101             --- 
102         
103     SetArguments(me:out; 
104                 theLS:ListOfShape from BOPCol); 
105             ---Purpose: 
106         --- Modifier 
107         --- Sets the arguments [theLS] of an operation  
108          
109     Arguments(me) 
110             returns ListOfShape from BOPCol;  
111     ---C++: return const &         
112              ---Purpose:  
113             --- Selector  
114             --- Returns the arguments of an operation 
115          
116     Init(me:out); 
117             ---Purpose: 
118               --- Initializes the data structure for 
119         --  the arguments 
120          
121     NbShapes(me) 
122             returns Integer from Standard; 
123             ---Purpose:  
124             --- Selector  
125             --- Returns the total number of shapes stored   
126          
127     NbSourceShapes(me) 
128             returns Integer from Standard; 
129         ---Purpose:  
130             --- Selector  
131             --- Returns the total number of source shapes stored    
132  
133     NbRanges(me) 
134             returns Integer from Standard; 
135         ---Purpose:  
136             --- Selector  
137             --- Returns the number of index ranges     
138     
139     Range(me; 
140                 theIndex:Integer from Standard) 
141             returns IndexRange from BOPDS; 
142     ---C++: return const & 
143              ---Purpose:  
144             --- Selector  
145             --- Returns the index range "i"      
146      
147     Rank (me; 
148                 theIndex:Integer from Standard) 
149         returns Integer from Standard; 
150             ---Purpose: 
151             --- Selector   
152             --- Returns the rank of the shape of index "i"  
153             
154     IsNewShape(me; 
155                 theIndex:Integer from Standard) 
156         returns Boolean from Standard; 
157             ---Purpose:  
158             --- Returns true if the shape of index "i" is not 
159         --- the source shape/sub-shape 
160          
161     --
162     --  shapes and auxiliary info  
163     --
164     Append(me:out; 
165                 theSI:ShapeInfo from BOPDS) 
166             returns Integer from Standard; 
167             ---Purpose: 
168             --- Modifier  
169         --- Appends the information about the shape [theSI] 
170         --- to the data structure  
171         --- Returns the index of theSI in the data structure 
172          
173     Append(me:out;  
174                 theS:Shape from TopoDS) 
175             returns Integer from Standard; 
176             ---Purpose:  
177             --- Modifier  
178         --- Appends the default information about the shape [theS] 
179         --- to the data structure  
180         --- Returns the index of theS in the data structure  
181         
182     ShapeInfo(me; 
183                 theIndex:Integer from Standard) 
184         returns ShapeInfo from BOPDS; 
185     ---C++: return const & 
186             ---Purpose: 
187         --- Selector 
188         --- Returns the information about the shape  
189         --- with index theIndex 
190          
191     ChangeShapeInfo(me:out; 
192                 theIndex:Integer from Standard) 
193         returns ShapeInfo from BOPDS; 
194     ---C++: return &  
195             ---Purpose:      
196             --- Selector/Modifier
197         --- Returns the information about the shape  
198         --- with index theIndex 
199     
200     Shape(me; 
201                 theIndex:Integer from Standard) 
202         returns Shape from TopoDS; 
203     ---C++: return const &   
204              ---Purpose:  
205             --- Selector
206         --- Returns the shape  
207         --  with index theIndex 
208      
209     Index(me; 
210                 theS:Shape from TopoDS) 
211             returns Integer from Standard; 
212             ---Purpose:  
213             --- Selector
214         --- Returns the index  of the shape theS 
215
216     -- 
217     -- pave blocks
218     -- 
219     PaveBlocksPool(me)  
220             returns VectorOfListOfPaveBlock from BOPDS; 
221     ---C++: return const &  
222             ---Purpose:  
223             --- Selector
224         --- Returns the information about pave blocks on source edges 
225
226     ChangePaveBlocksPool(me:out)  
227             returns VectorOfListOfPaveBlock from BOPDS; 
228     ---C++: return &  
229             ---Purpose:  
230             --- Selector/Modifier
231         --- Returns the information about pave blocks on source edges  
232
233     HasPaveBlocks(me; 
234                 theIndex:Integer from Standard)  
235         returns Boolean from Standard; 
236             ---Purpose:  
237             --- Query
238         --- Returns true if the shape with index theIndex has the 
239         --- information about pave blocks 
240      
241     PaveBlocks (me; 
242                 theIndex:Integer from Standard) 
243         returns ListOfPaveBlock from BOPDS; 
244     ---C++: return const &  
245             ---Purpose:  
246             --- Selector
247         --- Returns the pave blocks for the shape with index theIndex  
248
249     ChangePaveBlocks (me:out; 
250                 theIndex:Integer from Standard) 
251         returns ListOfPaveBlock from BOPDS; 
252     ---C++: return & 
253               ---Purpose:  
254             --- Selector/Modifier
255         --- Returns the pave blocks for the shape with index theIndex 
256          
257     InitPaveBlocks(me:out; 
258                 theIndex:Integer from Standard) 
259             is protected;  
260         ---Purpose:  
261         --- Initializes the pave blocks for the shape with index theIndex
262      
263     UpdatePaveBlocks(me:out);  
264             ---Purpose:  
265         --- Update the pave blocks for the all shapes in data structure 
266         
267     UpdatePaveBlock(me:out; 
268                 thePB:PaveBlock from BOPDS);  
269              ---Purpose:  
270         --- Update the pave block thePB 
271          
272     UpdateCommonBlock(me:out; 
273                 theCB:CommonBlock from BOPDS); 
274             ---Purpose:   
275             --- Update the common block theCB  
276              
277     IsCommonBlock(me; 
278                 thePB:PaveBlock from BOPDS)
279         returns Boolean from Standard; 
280     ---Purpose: 
281     --- Query 
282     --- Returns true if the pave block is common block     
283      
284     CommonBlock(me; 
285                 thePB:PaveBlock from BOPDS)
286         returns CommonBlock from BOPDS;     
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     
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 IndexedMapOfPaveBlock 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      InterfVZ(me:out) 
491             returns VectorOfInterfVZ from BOPDS; 
492     ---C++: return &  
493     ---C++: inline  
494             ---Purpose:  
495             --- Selector/Modifier
496         --- Returns the collection of interferences Vertex/Solid   
497      
498     InterfEZ(me:out) 
499             returns VectorOfInterfEZ from BOPDS; 
500     ---C++: return &  
501     ---C++: inline  
502             ---Purpose:  
503             --- Selector/Modifier
504         --- Returns the collection of interferences Edge/Solid          
505   
506     InterfFZ(me:out) 
507             returns VectorOfInterfFZ from BOPDS; 
508     ---C++: return &  
509     ---C++: inline  
510             ---Purpose:  
511             --- Selector/Modifier
512         --- Returns the collection of interferences Face/Solid                  
513  
514     InterfZZ(me:out) 
515             returns VectorOfInterfZZ from BOPDS; 
516     ---C++: return &  
517     ---C++: inline  
518             ---Purpose:  
519             --- Selector/Modifier
520         --- Returns the collection of interferences Solid/Solid                  
521             
522     NbInterfTypes(myclass)  
523             returns Integer from Standard;  
524             ---C++: inline       
525            ---Purpose: 
526            -- Returns the number of types of the interferences 
527            -- 
528  
529     AddInterf(me:out; 
530                 theI1:Integer from Standard;
531                 theI2:Integer from Standard); 
532     ---C++: inline 
533             ---Purpose:  
534             --- Modifier
535         --- Adds the information about an interference between  
536         --- shapes with indices theI1, theI2 to the summary 
537         --- table of interferences 
538          
539     HasInterf(me; 
540                 theI:Integer from Standard)
541         returns Boolean from Standard; 
542             ---Purpose: 
543             --- Query
544         --- Returns true if the shape with index theI    
545         --- is interferred
546           
547     HasInterf(me; 
548                 theI1:Integer from Standard;  
549             theI2:Integer from Standard) 
550         returns Boolean from Standard; 
551     ---C++: inline 
552             ---Purpose: 
553             --- Query
554         --- Returns true if the shapes with indices theI1, theI2    
555         --- are interferred 
556          
557     HasInterfShapeSubShapes(me; 
558             theI1:Integer from Standard;  
559             theI2:Integer from Standard; 
560                 theFlag: Boolean from Standard=Standard_True) 
561         returns Boolean from Standard;  
562             ---Purpose: 
563             --- Query
564         --- Returns true if the shape with index theI1 is interfered 
565         --- with  
566             --    any sub-shape of the shape with index theI2  (theFlag=true)    
567             --    all sub-shapes of the shape with index theI2 (theFlag=false)     
568   
569     HasInterfSubShapes(me; 
570             theI1:Integer from Standard;  
571             theI2:Integer from Standard) 
572         returns Boolean from Standard; 
573             ---Purpose: 
574             --- Query
575         --- Returns true if the shapes with indices theI1, theI2    
576         --- have interferred sub-shapes    
577  
578     Interferences(me) 
579          returns MapOfPassKey from BOPDS; 
580     ---C++: return const &   
581     ---C++: inline 
582             ---Purpose:  
583             --- Selector
584         --- Returns the table of interferences 
585     -- 
586     -- debug
587     -- 
588     Dump(me);     
589     -- 
590     -- protected methods 
591     -- 
592     InitShape(me:out;  
593                 theIndex:Integer from Standard;
594                 theS:Shape from TopoDS; 
595                 theAllocator:out BaseAllocator from BOPCol;   
596             theMSI:out DataMapOfShapeInteger from BOPCol) 
597             is protected;  
598              
599     CheckCoincidence(me:out; 
600                 thePB1:PaveBlock from BOPDS;
601                 thePB2:PaveBlock from BOPDS)
602             returns Boolean from Standard 
603             is protected;
604  
605     SortPaveBlocks(me:out; 
606                 theCB:CommonBlock from BOPDS);
607  
608     IsToSort(me:out; 
609                 theCB:CommonBlock from BOPDS; 
610                 theI:out Integer from Standard) 
611              returns Boolean from Standard;
612      
613     IsSubShape(me:out; 
614                 theI1:Integer from Standard; 
615                 theI2:Integer from Standard) 
616              returns Boolean from Standard; 
617  
618     Paves(me:out; 
619                 theIndex:Integer from Standard; 
620                 theLP:out ListOfPave from BOPDS);
621             ---Purpose: Fills theLP with sorted paves  
622             -- of the shape with index theIndex   
623              
624      UpdateEdgeTolerance(me:out; 
625                  theIndex:Integer from Standard; 
626                  theTolerance:Real from Standard); 
627              ---Purpose: 
628              --- Updates tolerance of the sub-shapes of the shape with index <theIndex>.
629              ---
630  
631     BuildBndBoxSolid (me:out; 
632                 theIndex:Integer from Standard;  
633                 theBox:out Box from Bnd) 
634             is protected;  
635             ---Purpose: 
636             --- Computes bouding box <theBox> for the solid with DS-index <theIndex>
637             ---  
638              
639     SetFuzzyValue(me:out; 
640                 theFuzz : Real from Standard);
641     ---C++: inline 
642     ---Purpose: Sets the extended tolerance
643  
644     FuzzyValue(me)
645              returns Real from Standard;
646     ---C++: inline 
647     ---Purpose: Returns the extended tolerance 
648      
649     SetDefaultTolerances(me:out);
650     ---Purpose: Reverts the tolerance values of unchanged entities to default values.
651
652 fields  
653     myAllocator        : BaseAllocator from BOPCol is protected;
654     myArguments        : ListOfShape from BOPCol is protected;   
655     --contents         
656     myNbShapes         : Integer from Standard is protected;     
657     myNbSourceShapes   : Integer from Standard is protected;       
658     myRanges           : VectorOfIndexRange from BOPDS is protected;    
659     myLines            : VectorOfShapeInfo  from BOPDS is protected;   
660     myMapShapeIndex    : DataMapOfShapeInteger from BOPCol is protected;
661     -- 
662     myPaveBlocksPool   : VectorOfListOfPaveBlock from BOPDS is protected;  
663     myMapPBCB          : DataMapOfPaveBlockCommonBlock from BOPDS is protected;
664     myFaceInfoPool     : VectorOfFaceInfo  from BOPDS is protected; 
665     --                 
666     --same domain shapes 
667     myShapesSD         : DataMapOfIntegerInteger from BOPCol is protected;  
668     -- 
669     --interferences 
670     myInterfTB         : MapOfPassKey     from BOPDS is protected; 
671     myInterfVV         : VectorOfInterfVV from BOPDS is protected;
672     myInterfVE         : VectorOfInterfVE from BOPDS is protected;
673     myInterfVF         : VectorOfInterfVF from BOPDS is protected;
674     myInterfEE         : VectorOfInterfEE from BOPDS is protected;
675     myInterfEF         : VectorOfInterfEF from BOPDS is protected;
676     myInterfFF         : VectorOfInterfFF from BOPDS is protected;
677     myInterfVZ         : VectorOfInterfVZ from BOPDS is protected;
678     myInterfEZ         : VectorOfInterfEZ from BOPDS is protected;
679     myInterfFZ         : VectorOfInterfFZ from BOPDS is protected;
680     myInterfZZ         : VectorOfInterfZZ from BOPDS is protected; 
681     -- 
682     -- extended tolerance for intersection
683     myFuzzyValue       : Real from Standard is protected;
684     myToleranceMap     : DataMapOfIntegerReal from BOPCol is protected; 
685
686 end DS;