0024428: Implementation of LGPL license
[occt.git] / src / BOPDS / BOPDS_Interf.hxx
CommitLineData
4e57c75e 1// Created by: Peter KURNEV
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
4e57c75e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
4e57c75e 5//
973c2be1 6// This library is free software; you can redistribute it and / or modify it
7// under the terms of the GNU Lesser General Public 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.
4e57c75e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
4e57c75e 14
15#ifndef BOPDS_Interf_HeaderFile
16#define BOPDS_Interf_HeaderFile
17
18#ifndef _Standard_HeaderFile
19#include <Standard.hxx>
20#endif
21#ifndef _Standard_Macro_HeaderFile
22#include <Standard_Macro.hxx>
23#endif
24
25#ifndef _Standard_Integer_HeaderFile
26#include <Standard_Integer.hxx>
27#endif
28
29#ifndef _IntTools_CommonPrt_HeaderFile
30#include <IntTools_CommonPrt.hxx>
31#endif
32
33#include <NCollection_BaseAllocator.hxx>
34#include <BOPDS_VectorOfCurve.hxx>
35#include <BOPDS_VectorOfPoint.hxx>
36/**
37 * The class BOPDS_Interf is is to store the information about
38 * the interference between two shapes.
39 * The class BOPDS_Interf is root class
40 *
41*/
42//=======================================================================
43//function : BOPDS_Interf
44//purpose :
45//=======================================================================
46class BOPDS_Interf {
47 public:
48 //
49 /**
50 * Sets the indices of interferred shapes
51 * @param theIndex1
52 * index of the first shape
53 * @param theIndex2
54 * index of the second shape
55 */
56 void SetIndices(const Standard_Integer theIndex1,
57 const Standard_Integer theIndex2) {
58 myIndex1=theIndex1;
59 myIndex2=theIndex2;
60 };
61 //
62 /**
63 * Returns the indices of interferred shapes
64 * @param theIndex1
65 * index of the first shape
66 * @param theIndex2
67 * index of the second shape
68 */
69 void Indices(Standard_Integer& theIndex1,
70 Standard_Integer& theIndex2) const {
71 theIndex1=myIndex1;
72 theIndex2=myIndex2;
73 };
74 //
75 /**
76 * Sets the index of the first interferred shape
77 * @param theIndex
78 * index of the first shape
79 */
80 void SetIndex1(const Standard_Integer theIndex) {
81 myIndex1=theIndex;
82 };
83 //
84 /**
85 * Sets the index of the second interferred shape
86 * @param theIndex
87 * index of the second shape
88 */
89 void SetIndex2(const Standard_Integer theIndex) {
90 myIndex2=theIndex;
91 };
92 //
93 /**
94 * Returns the index of the first interferred shape
95 * @return
96 * index of the first shape
97 */
98 Standard_Integer Index1() const {
99 return myIndex1;
100 };
101 //
102 /**
103 * Returns the index of the second interferred shape
104 * @return
105 * index of the second shape
106 */
107 Standard_Integer Index2() const {
108 return myIndex2;
109 };
110 //
111 /**
112 * Returns the index of that are opposite to the given index
113 * @param theI
114 * the index
115 * @return
116 * index of opposite shape
117 */
118 Standard_Integer OppositeIndex(const Standard_Integer theI) const {
119 if (theI==myIndex1) {
120 return myIndex2;
121 }
122 else if(theI==myIndex2) {
123 return myIndex1;
124 }
125 else {
126 return -1;
127 }
128 };
129 //
130 /**
131 * Returns true if the interference contains given index
132 * @param theIndex
133 * the index
134 * @return
135 * true if the interference contains given index
136 */
137 Standard_Boolean Contains(const Standard_Integer theIndex)const {
138 return (myIndex1==theIndex || myIndex2==theIndex);
139 }
140 //
141 /**
142 * Sets the index of new shape
143 * @param theIndex
144 * the index
145 */
146 void SetIndexNew(const Standard_Integer theIndex) {
147 myIndexNew=theIndex;
148 };
149 //
150 //
151 /**
152 * Returns the index of new shape
153 * @return theIndex
154 * the index of new shape
155 */
156 Standard_Integer IndexNew() const {
157 return myIndexNew;
158 };
159 //
160 /**
161 * Returns true if the interference has index of new shape
162 * that is equal to the given index
163 * @param theIndex
164 * the index
165 * @return true if the interference has index of new shape
166 * that is equal to the given index
167 */
168 Standard_Boolean HasIndexNew(Standard_Integer& theIndex) const {
169 theIndex=myIndexNew;
170 return (myIndexNew>=0);
171 };
172 //
173 /**
174 * Returns true if the interference has index of new shape
175 * the index
176 * @return true if the interference has index of new shape
177 */
178 Standard_Boolean HasIndexNew() const {
179 return (myIndexNew>=0);
180 };
181 //
182 protected:
183 BOPDS_Interf() :
184 myIndex1(-1),
185 myIndex2(-1),
186 myIndexNew(-1),
187 myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()) {
188 };
189 //
190 BOPDS_Interf(const Handle(NCollection_BaseAllocator)& theAllocator) :
191 myIndex1(-1),
192 myIndex2(-1),
193 myIndexNew(-1),
194 myAllocator(theAllocator) {
195 };
196 //
197 virtual ~BOPDS_Interf() {
198 };
199
200 protected:
201 Standard_Integer myIndex1;
202 Standard_Integer myIndex2;
203 Standard_Integer myIndexNew;
204 Handle(NCollection_BaseAllocator) myAllocator;
205};
206/**
207 * The class BOPDS_InterfVV is is to store the information about
208 * the interference of the type vertex/vertex.
209*/
210//=======================================================================
211//function : BOPDS_InterfVV
212//purpose :
213//=======================================================================
214class BOPDS_InterfVV : public BOPDS_Interf {
215 public:
216 //
217 /**
218 * Constructor
219 */
220 BOPDS_InterfVV() : BOPDS_Interf() {
221 };
222 //
223 /**
224 * Constructor
225 * @param theAllocator
226 * allocator to manage the memory
227 */
228 BOPDS_InterfVV(const Handle(NCollection_BaseAllocator)& theAllocator)
229 : BOPDS_Interf(theAllocator) {
230 };
231 //
232 /**
233 * Destructor
234 */
235 virtual ~BOPDS_InterfVV() {
236 };
237 //
238};
239/**
240 * The class BOPDS_InterfVE is is to store the information about
241 * the interference of the type vertex/edge.
242*/
243//=======================================================================
244//function : BOPDS_InterfVE
245//purpose :
246//=======================================================================
247class BOPDS_InterfVE : public BOPDS_Interf {
248 public:
249 //
250 /**
251 * Constructor
252 */
253 BOPDS_InterfVE()
254 :
255 BOPDS_Interf(),
256 myParameter(0.) {
257 };
258 //
259 /**
260 * Constructor
261 * @param theAllocator
262 * allocator to manage the memory
263 */
264 BOPDS_InterfVE(const Handle(NCollection_BaseAllocator)& theAllocator)
265 :
266 BOPDS_Interf(theAllocator),
267 myParameter(0.) {
268 };
269 //
270 /**
271 * Destructor
272 */
273 virtual ~BOPDS_InterfVE() {
274 };
275 //
276 /**
277 * Modifier
278 * Sets the value of parameter
279 * of the point of the vertex
280 * on the curve of the edge
281 * @param theT
282 * value of parameter
283 */
284 void SetParameter(const Standard_Real theT) {
285 myParameter=theT;
286 };
287 //
288 /**
289 * Selector
290 * Returrns the value of parameter
291 * of the point of the vertex
292 * on the curve of the edge
293 * @return
294 * value of parameter
295 */
296 Standard_Real Parameter() const {
297 return myParameter;
298 };
299
300 protected:
301 Standard_Real myParameter;
302
303};
304/**
305 * The class BOPDS_InterfVF is is to store the information about
306 * the interference of the type vertex/face
307*/
308//=======================================================================
309//function : BOPDS_InterfVF
310//purpose :
311//=======================================================================
312class BOPDS_InterfVF : public BOPDS_Interf {
313 public:
314 //
315 /**
316 * Constructor
317 */
318 BOPDS_InterfVF()
319 : BOPDS_Interf(),
320 myU(0.),
321 myV(0.) {
322 };
323 //
324 /**
325 * Constructor
326 * @param theAllocator
327 * allocator to manage the memory
328 */
329 BOPDS_InterfVF(const Handle(NCollection_BaseAllocator)& theAllocator)
330 : BOPDS_Interf(theAllocator),
331 myU(0.),
332 myV(0.) {
333 };
334 //
335 /**
336 * Destructor
337 */
338 virtual ~BOPDS_InterfVF() {
339 };
340 //
341 /**
342 * Modifier
343 * Sets the value of parameters
344 * of the point of the vertex
345 * on the surface of of the face
346 * @param theU
347 * value of U parameter
348 * @param theV
349 * value of U parameter
350 */
351 void SetUV(const Standard_Real theU,
352 const Standard_Real theV) {
353 myU=theU;
354 myV=theV;
355 };
356 //
357 /**
358 * Selector
359 * Returns the value of parameters
360 * of the point of the vertex
361 * on the surface of of the face
362 * @param theU
363 * value of U parameter
364 * @param theV
365 * value of U parameter
366 */
367 void UV(Standard_Real& theU,Standard_Real& theV) const {
368 theU=myU;
369 theV=myV;
370 };
371
372 protected:
373 Standard_Real myU;
374 Standard_Real myV;
375
376};
377/**
378 * The class BOPDS_InterfEE is is to store the information about
379 * the interference of the type edge/edge.
380*/
381//=======================================================================
382//function : BOPDS_InterfEE
383//purpose :
384//=======================================================================
385class BOPDS_InterfEE : public BOPDS_Interf {
386 public:
387 //
388 /**
389 * Constructor
390 */
391 BOPDS_InterfEE() : BOPDS_Interf() {
392 };
393 //
394 /**
395 * Constructor
396 * @param theAllocator
397 * allocator to manage the memory
398 */
399 BOPDS_InterfEE(const Handle(NCollection_BaseAllocator)& theAllocator)
400 : BOPDS_Interf(theAllocator) {
401 };
402 //
403 /**
404 * Destructor
405 */
406 virtual ~BOPDS_InterfEE() {
407 };
408 //
409 /**
410 * Modifier
411 * Sets the info of common part
412 * @param theCP
413 * common part
414 */
415 void SetCommonPart(const IntTools_CommonPrt& theCP) {
416 myCommonPart=theCP;
417 };
418 //
419 /**
420 * Selector
421 * Returns the info of common part
422 * @return
423 * common part
424 */
425 const IntTools_CommonPrt& CommonPart() const {
426 return myCommonPart;
427 };
428
429 protected:
430 IntTools_CommonPrt myCommonPart;
431};
432/**
433 * The class BOPDS_InterfEF is is to store the information about
434 * the interference of the type edge/face.
435*/
436//=======================================================================
437//function : BOPDS_InterfEF
438//purpose :
439//=======================================================================
440class BOPDS_InterfEF : public BOPDS_Interf {
441 public:
442 //
443 /**
444 * Constructor
445 */
446 BOPDS_InterfEF(): BOPDS_Interf() {
447 };
448 //
449 /**
450 * Constructor
451 * @param theAllocator
452 * allocator to manage the memory
453 */
454 /**
455 * Constructor
456 * @param theAllocator
457 * allocator to manage the memory
458 */
459 BOPDS_InterfEF(const Handle(NCollection_BaseAllocator)& theAllocator)
460 : BOPDS_Interf(theAllocator) {
461 };
462 //
463 /**
464 * Destructor
465 */
466 virtual ~BOPDS_InterfEF() {
467 };
468 //
469 /**
470 * Modifier
471 * Sets the info of common part
472 * @param theCP
473 * common part
474 */
475 void SetCommonPart(const IntTools_CommonPrt& theCP){
476 myCommonPart=theCP;
477 };
478 //
479 /**
480 * Selector
481 * Returns the info of common part
482 * @return
483 * common part
484 */
485 const IntTools_CommonPrt& CommonPart() const {
486 return myCommonPart;
487 };
488 //
489 protected:
490 IntTools_CommonPrt myCommonPart;
491}
492/**
493 * The class BOPDS_InterfFF is is to store the information about
494 * the interference of the type face/face.
495*/;
496//=======================================================================
497//function : BOPDS_InterfFF
498//purpose :
499//=======================================================================
500class BOPDS_InterfFF : public BOPDS_Interf {
501 public:
502 //
503 /**
504 * Constructor
505 */
506 BOPDS_InterfFF()
507 :
508 BOPDS_Interf(),
7ff8f019 509 myTangentFaces(Standard_False),
4e57c75e 510 myTolR3D(1.e-7),
511 myTolR2D(1.e-7),
512 myCurves(myAllocator),
513 myPoints(myAllocator) {
514 };
515 //
516 /**
517 * Constructor
518 * @param theAllocator
519 * allocator to manage the memory
520 */
258ff83b 521 /*
4e57c75e 522 BOPDS_InterfFF(const Handle(NCollection_BaseAllocator)& theAllocator)
523 :
524 BOPDS_Interf(theAllocator),
7ff8f019 525 myTangentFaces(Standard_False),
4e57c75e 526 myTolR3D(1.e-7),
527 myTolR2D(1.e-7),
528 myCurves(myAllocator),
529 myPoints(myAllocator) {
530 };
258ff83b 531 */
4e57c75e 532 //
533 /**
534 * Destructor
535 */
536 virtual ~BOPDS_InterfFF() {
537 };
538 //
539 /**
540 * Initializer
541 * @param theNbCurves
542 * number of intersection curves
543 * @param theNbPoints
544 * number of intersection points
545 */
a82b7ef7 546 void Init(const Standard_Integer theNbCurves,
547 const Standard_Integer theNbPoints) {
548 if (theNbCurves>0) {
4e57c75e 549 myCurves.SetStartSize(theNbCurves);
550 myCurves.SetIncrement(theNbCurves);
551 myCurves.Init();
552 }
a82b7ef7 553 if (theNbPoints>0) {
4e57c75e 554 myPoints.SetStartSize(theNbPoints);
555 myPoints.SetIncrement(theNbPoints);
556 myPoints.Init();
557 }
558 }
7ff8f019 559 /**
560 * Modifier
561 * Sets the flag of whether the faces are tangent
562 * @param theFlag
563 * the flag
564 */
565 void SetTangentFaces(const Standard_Boolean theFlag) {
566 myTangentFaces=theFlag;
567 }
568 /**
569 * Selector
570 * Returns the flag whether the faces are tangent
571 * @return
572 * the flag
573 */
574 Standard_Boolean TangentFaces()const {
575 return myTangentFaces;
576 }
4e57c75e 577 /**
578 * Modifier
579 * Sets the value of 3D tolerance
580 * @param theTol
581 * 3D tolerance
582 */
583 void SetTolR3D(const Standard_Real theTol) {
584 myTolR3D=theTol;
585 }
586 //
587 /**
588 * Selector
589 * Returns the value of 3D tolerance
590 * @return
591 * 3D tolerance
592 */
593 Standard_Real TolR3D()const {
594 return myTolR3D;
595 }
596 //
597 /**
598 * Modifier
599 * Sets the value of 2D tolerance
600 * @param theTol
601 * 2D tolerance
602 */
603 void SetTolR2D(const Standard_Real theTol) {
604 myTolR2D=theTol;;
605 }
606 //
607 /**
608 * Selector
609 * Returns the value of 2D tolerance
610 * @return
611 * 2D tolerance
612 */
613 Standard_Real TolR2D()const {
614 return myTolR2D;
615 }
616 //
617 /**
618 * Selector
619 * Returns the intersection curves
620 * @return
621 * intersection curves
622 */
623 const BOPDS_VectorOfCurve& Curves()const{
624 return myCurves;
625 };
626 //
627 /**
628 * Selector/Modifier
629 * Returns the intersection curves
630 * @return
631 * intersection curves
632 */
633 BOPDS_VectorOfCurve& ChangeCurves(){
634 return myCurves;
635 };
636 //
637 /**
638 * Selector
639 * Returns the intersection points
640 * @return
641 * intersection points
642 */
643 const BOPDS_VectorOfPoint& Points()const{
644 return myPoints;
645 };
646 //
647 /**
648 * Selector/Modifier
649 * Returns the intersection points
650 * @return
651 * intersection points
652 */
653 BOPDS_VectorOfPoint& ChangePoints(){
654 return myPoints;
655 };
656 //
657 protected:
7ff8f019 658 Standard_Boolean myTangentFaces;
4e57c75e 659 Standard_Real myTolR3D;
660 Standard_Real myTolR2D;
661 BOPDS_VectorOfCurve myCurves;
662 BOPDS_VectorOfPoint myPoints;
663};
664
665#endif