1 // Created on: 2000-08-10
2 // Created by: Vincent DELOS
3 // Copyright (c) 2000-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
22 #include <BooleanOperations_ShapesDataStructure.ixx>
28 #include <Bnd_Box.hxx>
30 #include <TopoDS_Shape.hxx>
31 #include <TopoDS_TShape.hxx>
32 #include <TopoDS_TVertex.hxx>
33 #include <TopoDS_TEdge.hxx>
34 #include <TopoDS_TWire.hxx>
35 #include <TopoDS_TFace.hxx>
36 #include <TopoDS_TShell.hxx>
37 #include <TopoDS_TSolid.hxx>
38 #include <TopoDS_Iterator.hxx>
39 #include <TopoDS_TCompound.hxx>
40 #include <TopoDS_TCompSolid.hxx>
41 #include <BRep_Tool.hxx>
42 #include <BRepBndLib.hxx>
43 #include <BRepTools_ShapeSet.hxx>
45 #include <TopExp_Explorer.hxx>
46 #include <TopTools_ShapeSet.hxx>
47 #include <TopTools_IndexedMapOfShape.hxx>
48 #include <TopTools_IndexedMapOfOrientedShape.hxx>
50 #include <BooleanOperations_OnceExplorer.hxx>
51 #include <BooleanOperations_AncestorsAndSuccessors.hxx>
52 #include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
53 #include <BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors.hxx>
55 #include <TColStd_SequenceOfInteger.hxx>
57 #include <Bnd_Box.hxx>
58 #include <TColStd_MapOfInteger.hxx>
59 #include <BOPTColStd_Dump.hxx>
63 #pragma warning ( disable : 4291 )
67 void Message(const Standard_Integer i);
69 const static Standard_Integer AddedValue=20;
71 //===========================================================================
72 //function : BooleanOperations_ShapesDataStructure
74 //===========================================================================
75 BooleanOperations_ShapesDataStructure::BooleanOperations_ShapesDataStructure():
76 myListOfShapeAndInterferences(NULL),
77 myNumberOfShapesOfTheObject(0),
78 myNumberOfShapesOfTheTool(0),
79 myNumberOfInsertedShapes(0),
83 //printf("-BOPDS_ShapesDataStructure CREATE:%x\n", (int)this);
85 //===========================================================================
86 //function : BooleanOperations_ShapesDataStructure
88 //===========================================================================
89 BooleanOperations_ShapesDataStructure::BooleanOperations_ShapesDataStructure(const TopoDS_Shape& Object,
90 const TopoDS_Shape& Tool)
92 myListOfShapeAndInterferences(NULL),
93 myNumberOfShapesOfTheObject(0),
94 myNumberOfShapesOfTheTool(0),
95 myNumberOfInsertedShapes(0),
101 //printf(" BOPDS_ShapesDataStructure CREATE:%x\n", (int)this);
102 Standard_Integer i, Average;//, aNbShapes;
103 BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors IndDatMapTool;
104 BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors IndDatMapObject;
106 FillIndexedMapOfShapesAncestorsAndSuccessors(Object,IndDatMapObject);
107 FillIndexedMapOfShapesAncestorsAndSuccessors(Tool,IndDatMapTool);
108 myNumberOfShapesOfTheObject = IndDatMapObject.Extent();
109 myNumberOfShapesOfTheTool = IndDatMapTool.Extent();
110 Average = (myNumberOfShapesOfTheTool+myNumberOfShapesOfTheObject)/2;
111 myLength = myNumberOfShapesOfTheTool+myNumberOfShapesOfTheObject+Average;
113 myListOfShapeAndInterferences = (BooleanOperations_PShapeAndInterferences)
114 Standard::Allocate(myLength*sizeof(BooleanOperations_ShapeAndInterferences));
116 // Inserting the shapes into the DS
118 for (i=1; i<=myNumberOfShapesOfTheObject; i++){
119 const BooleanOperations_AncestorsSeqAndSuccessorsSeq& theAncestorsSeqAndSuccessorsSeq =
120 IndDatMapObject.FindFromIndex(i);
121 const TopoDS_Shape& theShape = IndDatMapObject.FindKey(i);
122 InsertShapeAndAncestorsSuccessors(theShape, theAncestorsSeqAndSuccessorsSeq, 0);
125 for (i=1;i<=myNumberOfShapesOfTheTool;i++){
126 const BooleanOperations_AncestorsSeqAndSuccessorsSeq& theAncestorsSeqAndSuccessorsSeq =
127 IndDatMapTool.FindFromIndex(i);
128 const TopoDS_Shape& theShape = IndDatMapTool.FindKey(i);
129 InsertShapeAndAncestorsSuccessors(theShape,theAncestorsSeqAndSuccessorsSeq,myNumberOfShapesOfTheObject);
132 // Fill the myShapeIndexMapObj
133 for (i=1; i<=myNumberOfShapesOfTheObject; ++i){
134 const TopoDS_Shape& aS=GetShape(i);
135 myShapeIndexMapObj.Add(aS, i);
139 // Fill the myShapeIndexMapObj
140 Standard_Integer iFirst, iLast;
142 ToolRange (iFirst, iLast);
143 for (i=iFirst; i<=iLast; ++i){
144 const TopoDS_Shape& aS=GetShape(i);
145 myShapeIndexMapTool.Add(aS, i);
148 iLast=myNumberOfShapesOfTheObject+myNumberOfShapesOfTheTool;
151 myRefEdges.Resize(iLast);
153 for (i=1; i<=iLast; ++i) {
154 const TopoDS_Shape& aS=Shape(i);
156 if (aS.ShapeType()==TopAbs_EDGE) {
158 myRefEdges(i)=myNbEdges;
162 //modified by NIZNHY-PKV Wed Feb 2 11:34:07 2005f
163 //===========================================================================
166 //===========================================================================
167 BooleanOperations_ShapesDataStructure::~BooleanOperations_ShapesDataStructure()
169 //printf(" BOPDS_ShapesDataStructure DELETE:%x\n", (int)this);
172 //modified by NIZNHY-PKV Wed Feb 2 11:34:12 2005t
173 //===========================================================================
174 //function : BooleanOperations_ShapesDataStructure
175 //purpose : destructor
176 //===========================================================================
177 void BooleanOperations_ShapesDataStructure::Destroy()
181 for (i=0;i<myNumberOfInsertedShapes;i++) {
182 myListOfShapeAndInterferences[i].~BooleanOperations_ShapeAndInterferences();
185 //modified by NIZNHY-PKV Wed Feb 2 12:31:28 2005f
186 //printf(" ~ :%x, now:%x\n",
188 // (int)myListOfShapeAndInterferences);
189 //modified by NIZNHY-PKV Wed Feb 2 12:31:31 2005t
191 Standard::Free((Standard_Address&)myListOfShapeAndInterferences);
193 //===========================================================================
194 //function : ShapeIndexMap
196 //===========================================================================
197 const BooleanOperations_IndexedDataMapOfShapeInteger&
198 BooleanOperations_ShapesDataStructure::ShapeIndexMap(const Standard_Integer iRank)const
201 return myShapeIndexMapObj;
203 return myShapeIndexMapTool;
205 //===========================================================================
206 //function : ShapeIndex
208 //===========================================================================
209 Standard_Integer BooleanOperations_ShapesDataStructure::ShapeIndex(const TopoDS_Shape& aS,
210 const Standard_Integer iRank) const
212 Standard_Integer anIndex=0;
213 const BooleanOperations_IndexedDataMapOfShapeInteger& aMap=ShapeIndexMap(iRank);
214 if (aMap.Contains(aS)) {
215 anIndex=aMap.FindFromKey(aS);
221 //===========================================================================
222 //function : FillIndexedMapOfShapesAncestorsAndSuccessors
224 //===========================================================================
225 void BooleanOperations_ShapesDataStructure::FillIndexedMapOfShapesAncestorsAndSuccessors
226 (const TopoDS_Shape& Sha,
227 BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& IndDatMap) const
229 Standard_Integer TotalNumberOfShapes = 1;
230 BooleanOperations_AncestorsSeqAndSuccessorsSeq theAncestorAndSuccessor;
231 IndDatMap.Add(Sha,theAncestorAndSuccessor);
232 this->FindSubshapes(Sha,TotalNumberOfShapes,IndDatMap);
234 Standard_Integer aNumberOfShapes = IndDatMap.Extent();
235 for(Standard_Integer i=1; i <= aNumberOfShapes; i++) {
236 const BooleanOperations_AncestorsSeqAndSuccessorsSeq& anAncestorAndSuccessorSeq1=IndDatMap(i);
237 TColStd_MapOfInteger aMapOfIndices;
238 for(Standard_Integer j = 1; j <= anAncestorAndSuccessorSeq1.NumberOfSuccessors(); j++) {
239 Standard_Integer aShapeIndex = anAncestorAndSuccessorSeq1.GetSuccessor(j);
240 if(aMapOfIndices.Add(aShapeIndex)) {
241 BooleanOperations_AncestorsSeqAndSuccessorsSeq& anAncestorAndSuccessorSeq2 =
242 IndDatMap.ChangeFromIndex(aShapeIndex);
243 anAncestorAndSuccessorSeq2.SetNewAncestor(i);
248 //===========================================================================
249 //function : FindSubshapes
251 //===========================================================================
252 void BooleanOperations_ShapesDataStructure::FindSubshapes
253 (const TopoDS_Shape& Sha,
254 Standard_Integer& TotalNumberOfShapes,
255 BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& IndDatMap) const
258 TopoDS_Iterator anIt(Sha, Standard_True);//Standard_False);
259 Standard_Integer anIndexOfShape = IndDatMap.FindIndex(Sha);
260 BooleanOperations_AncestorsSeqAndSuccessorsSeq& AncSucOfShape=IndDatMap.ChangeFromIndex(anIndexOfShape);
261 for(; anIt.More(); anIt.Next()) {
262 const TopoDS_Shape& aSubShape = anIt.Value();
263 Standard_Integer aSubShapeIndex = 0;
264 Standard_Boolean isNewSubShape = Standard_False;
265 if(!IndDatMap.Contains(aSubShape)) {
266 isNewSubShape = Standard_True;
267 BooleanOperations_AncestorsSeqAndSuccessorsSeq anAncestorAndSuccessorSeq;
268 aSubShapeIndex = IndDatMap.Add(aSubShape, anAncestorAndSuccessorSeq);
271 aSubShapeIndex = IndDatMap.FindIndex(aSubShape);
273 AncSucOfShape.SetNewSuccessor(aSubShapeIndex);
274 AncSucOfShape.SetNewOrientation(aSubShape.Orientation());
276 if(isNewSubShape && (aSubShape.ShapeType() != TopAbs_VERTEX)) {
277 FindSubshapes(aSubShape, TotalNumberOfShapes, IndDatMap);
280 TotalNumberOfShapes = IndDatMap.Extent();
282 //===========================================================================
285 //===========================================================================
286 void BooleanOperations_ShapesDataStructure::ReInit()
288 Standard_Integer i,NewLength;
289 BooleanOperations_PShapeAndInterferences NewListOfShapeAndInterferences;
291 NewLength = AddedValue + myLength;
292 NewListOfShapeAndInterferences = (BooleanOperations_PShapeAndInterferences)
293 Standard::Allocate(NewLength*sizeof(BooleanOperations_ShapeAndInterferences));
295 //modified by NIZNHY-PKV Wed Feb 2 12:16:51 2005f
296 //printf(" ReInit:%x, was:%x, now:%x\n",
298 // (int)myListOfShapeAndInterferences,
299 // (int)NewListOfShapeAndInterferences);
300 //modified by NIZNHY-PKV Wed Feb 2 12:16:55 2005t
302 for (i=0;i<myNumberOfInsertedShapes;i++) {
303 new (&NewListOfShapeAndInterferences[i])
304 BooleanOperations_ShapeAndInterferences(myListOfShapeAndInterferences[i]);
305 myListOfShapeAndInterferences[i].myShape.Nullify();
309 Standard::Free((Standard_Address&) myListOfShapeAndInterferences);
312 myLength = NewLength;
313 myListOfShapeAndInterferences = NewListOfShapeAndInterferences;
315 //===========================================================================
316 //function : InsertShapeAndAncestorsSuccessors
318 //===========================================================================
319 void BooleanOperations_ShapesDataStructure::InsertShapeAndAncestorsSuccessors
320 (const TopoDS_Shape& S,
321 const BooleanOperations_AncestorsSeqAndSuccessorsSeq& AncSuc,
322 const Standard_Integer shift)
324 if ((myNumberOfInsertedShapes<0)||(myNumberOfInsertedShapes>myLength)) {
330 if (myNumberOfInsertedShapes==myLength) {
334 new (&(myListOfShapeAndInterferences[myNumberOfInsertedShapes].myShape)) TopoDS_Shape(S);
335 // Compute and insert the bounding box of <myShape>.
337 BRepBndLib::Add(S,B);
339 new (&(myListOfShapeAndInterferences[myNumberOfInsertedShapes].myBoundingBox))
341 new (&(myListOfShapeAndInterferences[myNumberOfInsertedShapes].myAncestorsAndSuccessors))
342 BooleanOperations_AncestorsAndSuccessors(AncSuc,shift);
344 myListOfShapeAndInterferences[myNumberOfInsertedShapes].myState = BooleanOperations_UNKNOWN;
345 myNumberOfInsertedShapes++;
348 //===========================================================================
349 //function : GetShape
351 //===========================================================================
352 const TopoDS_Shape& BooleanOperations_ShapesDataStructure::GetShape(const Standard_Integer index) const
354 if ((index<1)||(index>myNumberOfInsertedShapes)) {
357 return myListOfShapeAndInterferences[index-1].GetShape();
359 //===========================================================================
362 //===========================================================================
363 const TopoDS_Shape& BooleanOperations_ShapesDataStructure::Shape(const Standard_Integer index) const
365 return GetShape(index);
367 //===========================================================================
368 //function : GetShapeType
370 //===========================================================================
371 TopAbs_ShapeEnum BooleanOperations_ShapesDataStructure::GetShapeType(const Standard_Integer index) const
373 if ((index<1)||(index>myNumberOfInsertedShapes)) {
376 return myListOfShapeAndInterferences[index-1].GetShapeType();
378 //===========================================================================
379 //function : GetBoundingBox
381 //===========================================================================
382 const Bnd_Box& BooleanOperations_ShapesDataStructure::GetBoundingBox(const Standard_Integer index) const
384 if ((index<1)||(index>myNumberOfInsertedShapes)) {
387 return myListOfShapeAndInterferences[index-1].GetBoundingBox();
389 //===========================================================================
390 //function : GetState
392 //===========================================================================
393 BooleanOperations_StateOfShape BooleanOperations_ShapesDataStructure::GetState(const Standard_Integer index) const
395 if ((index<1)||(index>myNumberOfInsertedShapes)) {
398 return myListOfShapeAndInterferences[index-1].GetState();
400 //===========================================================================
401 //function : SetState
403 //===========================================================================
404 void BooleanOperations_ShapesDataStructure::SetState(const Standard_Integer index,
405 const BooleanOperations_StateOfShape theState)
407 if ((index<1)||(index>myNumberOfInsertedShapes)) {
410 myListOfShapeAndInterferences[index-1].SetState(theState);
413 //===========================================================================
414 //function : NumberOfAncestors
416 //===========================================================================
418 BooleanOperations_ShapesDataStructure::NumberOfAncestors(const Standard_Integer index) const
420 if ((index<1)||(index>myNumberOfInsertedShapes)) {
423 return myListOfShapeAndInterferences[index-1].NumberOfAncestors();
425 //===========================================================================
426 //function : NumberOfSuccessors
428 //===========================================================================
430 BooleanOperations_ShapesDataStructure::NumberOfSuccessors(const Standard_Integer index) const
432 if ((index<1)||(index>myNumberOfInsertedShapes)) {
435 return myListOfShapeAndInterferences[index-1].NumberOfSuccessors();
437 //===========================================================================
438 //function : GetAncestor
440 //===========================================================================
442 BooleanOperations_ShapesDataStructure::GetAncestor(const Standard_Integer index,
443 const Standard_Integer ancestorNumber) const
446 (index>myNumberOfInsertedShapes)||
448 (ancestorNumber>NumberOfAncestors(index))) {
451 return myListOfShapeAndInterferences[index-1].GetAncestor(ancestorNumber);
453 //===========================================================================
454 //function : GetSuccessor
456 //===========================================================================
458 BooleanOperations_ShapesDataStructure::GetSuccessor(const Standard_Integer index,
459 const Standard_Integer successorNumber) const
461 if ((index<1)||(index>myNumberOfInsertedShapes)||(successorNumber<1)||(successorNumber>NumberOfSuccessors(index))) {
464 if (GetShapeType(index) == TopAbs_VERTEX) {
467 return myListOfShapeAndInterferences[index-1].GetSuccessor(successorNumber);
469 //===========================================================================
470 //function : GetAncestors
471 //purpose : returns the array of ancestors
472 //===========================================================================
474 BooleanOperations_ShapesDataStructure::GetAncestors(const Standard_Integer index,
475 Standard_Address& theArrayOfAncestors,
476 Standard_Integer& ancestorsNumber) const
478 if ((index<1)||(index>myNumberOfInsertedShapes)) {
481 myListOfShapeAndInterferences[index-1].GetAncestors(theArrayOfAncestors,ancestorsNumber);
485 //===========================================================================
486 //function : GetSuccessors
487 //purpose : returns the array of successors
488 //===========================================================================
490 BooleanOperations_ShapesDataStructure::GetSuccessors(const Standard_Integer index,
491 Standard_Address& theArrayOfSuccessors,
492 Standard_Integer& successorsNumber) const
494 if ((index<1)||(index>myNumberOfInsertedShapes)) {
497 if (GetShapeType(index) == TopAbs_VERTEX) {
500 myListOfShapeAndInterferences[index-1].GetSuccessors(theArrayOfSuccessors,successorsNumber);
504 //===========================================================================
505 //function : NumberOfShapesOfTheObject
507 //===========================================================================
508 Standard_Integer BooleanOperations_ShapesDataStructure::NumberOfShapesOfTheObject()const
510 return myNumberOfShapesOfTheObject;
512 //===========================================================================
513 //function : NumberOfShapesOfTheTool
515 //===========================================================================
516 Standard_Integer BooleanOperations_ShapesDataStructure::NumberOfShapesOfTheTool()const
518 return myNumberOfShapesOfTheTool;
523 //===========================================================================
524 //function : NumberOfInsertedShapes
526 //===========================================================================
527 Standard_Integer BooleanOperations_ShapesDataStructure::NumberOfInsertedShapes()const
529 return myNumberOfInsertedShapes;
531 //===========================================================================
532 //function : NumberOfNewShapes
534 //===========================================================================
535 Standard_Integer BooleanOperations_ShapesDataStructure::NumberOfNewShapes()const
537 Standard_Integer aNb;
539 aNb=NumberOfSourceShapes();
540 aNb=myNumberOfInsertedShapes-aNb;
544 //===========================================================================
545 //function : NumberOfSourceShapes
547 //===========================================================================
548 Standard_Integer BooleanOperations_ShapesDataStructure::NumberOfSourceShapes()const
550 Standard_Integer aNb;
551 aNb=myNumberOfShapesOfTheTool+myNumberOfShapesOfTheObject;
555 //===========================================================================
556 //function : IsNewShape
558 //===========================================================================
560 BooleanOperations_ShapesDataStructure::IsNewShape(const Standard_Integer anIndex)const
562 Standard_Boolean aFlag;
563 aFlag=anIndex>NumberOfSourceShapes();
568 //===========================================================================
571 //===========================================================================
572 const BooleanOperations_ShapeAndInterferences&
573 BooleanOperations_ShapesDataStructure::Line(const Standard_Integer index) const
575 if ((index<1)||(index>myNumberOfInsertedShapes)) {
578 return myListOfShapeAndInterferences[index-1];
580 //===========================================================================
583 //===========================================================================
584 const TopoDS_Shape& BooleanOperations_ShapesDataStructure::Object()const
588 //===========================================================================
591 //===========================================================================
592 const TopoDS_Shape& BooleanOperations_ShapesDataStructure::Tool()const
596 //===========================================================================
597 //function : ObjectRange
599 //===========================================================================
600 void BooleanOperations_ShapesDataStructure::ObjectRange(Standard_Integer& iFirst,
601 Standard_Integer& iLast)const
604 iLast=NumberOfShapesOfTheObject();
607 //===========================================================================
608 //function : ToolRange
610 //===========================================================================
611 void BooleanOperations_ShapesDataStructure::ToolRange(Standard_Integer& iFirst,
612 Standard_Integer& iLast)const
614 iFirst=NumberOfShapesOfTheObject()+1;
615 iLast=NumberOfShapesOfTheObject()+NumberOfShapesOfTheTool();
617 //===========================================================================
620 //===========================================================================
621 Standard_Integer BooleanOperations_ShapesDataStructure::Rank(const Standard_Integer nS)const
624 if (IsNewShape(nS)) {
628 Standard_Integer iFirst, iLast;
630 ObjectRange(iFirst, iLast);
631 if (nS >= iFirst && nS <= iLast){
635 ToolRange(iFirst, iLast);
636 if (nS >= iFirst && nS <= iLast){
642 //===========================================================================
645 //===========================================================================
647 BooleanOperations_ShapesDataStructure::RefEdge(const Standard_Integer anIndex)const
649 Standard_Integer iRefEdge;
650 iRefEdge=myRefEdges(anIndex);
654 //===========================================================================
657 //===========================================================================
658 Standard_Integer BooleanOperations_ShapesDataStructure::NbEdges()const
664 //===========================================================================
667 //===========================================================================
668 void Message(const Standard_Integer i)
671 sprintf(buf, " BooleanOperations_ShapesDataStructure:: ");
672 BOPTColStd_Dump::PrintMessage(buf);
676 sprintf (buf, "index is out of range\n");
679 sprintf (buf, "incorrect Type\n");
682 sprintf(buf, "undefined message\n");
685 BOPTColStd_Dump::PrintMessage(buf);
686 Standard_DomainError::Raise("Message");
689 //===========================================================================
692 //===========================================================================
693 void BooleanOperations_ShapesDataStructure::Dump(Standard_OStream& S) const
696 Standard_Integer i,j;
698 //ZZ gp_Pnt thePoint;
699 BooleanOperations_StateOfShape St;
701 S<<endl<<"BooleanOperations_ShapesDataStructure::Dump()"<<endl;
702 S<<endl<<"myLength = "<<myLength;
703 S<<endl<<"myNumberOfInsertedShapes = "<<myNumberOfInsertedShapes;
704 S<<endl<<"myNumberOfShapesOfTheTool = "<<myNumberOfShapesOfTheTool;
705 S<<endl<<"myNumberOfShapesOfTheObject = "<<myNumberOfShapesOfTheObject<<endl;
707 for (i=1;i<=myNumberOfInsertedShapes;i++)
710 if (i < 10) cout<< " ";
711 if (i < 100) cout<< " ";
712 if (i < 1000) cout<< " ";
713 cout << i << " --- ";
714 T = GetShape(i).ShapeType();
741 case TopAbs_COMPSOLID :
745 case TopAbs_COMPOUND :
756 case BooleanOperations_IN :
760 case BooleanOperations_OUT :
764 case BooleanOperations_UNKNOWN :
768 case BooleanOperations_ON :
772 case BooleanOperations_INOROUT :
776 case BooleanOperations_INTERSECTED :
782 Standard_Real a,b,c,d,e,f;
783 GetBoundingBox(i).Get(a,b,c,d,e,f);
784 S << " @ " << a << " " << b << " " << c << " " << d << " " << e << " " << f << " @ " ;
786 S << " Ancestors :" ;
787 for (j=1;j<=NumberOfAncestors(i);j++)
788 S << " " << GetAncestor(i,j);
789 S << " Successors :" ;
790 for (j=1;j<=NumberOfSuccessors(i);j++)
791 S << " " << GetSuccessor(i,j);
794 for (j=1;j<=NumberOfInterferences(i);j++)
795 S << " " << GetIntersectedShape(i,j) << " " << GetIntersectionResult(i,j) << " #";
803 //===========================================================================
804 //function : LightDump
806 //===========================================================================
807 void BooleanOperations_ShapesDataStructure::LightDump(Standard_OStream& S) const
809 Standard_Real a,b,c,d,e,f;
813 S<<endl<<"BooleanOperations_ShapesDataStructure::Dump()"<<endl;
814 S<<endl<<"myLength = "<<myLength;
815 S<<endl<<"myNumberOfInsertedShapes = "<<myNumberOfInsertedShapes;
816 S<<endl<<"myNumberOfShapesOfTheTool = "<<myNumberOfShapesOfTheTool;
817 S<<endl<<"myNumberOfShapesOfTheObject = "<<myNumberOfShapesOfTheObject<<endl;
819 for (i=1;i<=myNumberOfInsertedShapes;i++)
822 if (i < 10) cout<< " ";
823 if (i < 100) cout<< " ";
824 if (i < 1000) cout<< " ";
825 cout << i << " --- ";
826 T = GetShape(i).ShapeType();
853 case TopAbs_COMPSOLID :
857 case TopAbs_COMPOUND :
865 GetBoundingBox(i).Get(a,b,c,d,e,f);
866 S << " @ " << a << " " << b << " " << c << " " << d << " " << e << " " << f << endl;
870 //===========================================================================
871 //function : GetOrientation
873 //===========================================================================
875 BooleanOperations_ShapesDataStructure::GetOrientation(const Standard_Integer index,
876 const Standard_Integer successorNumber) const
878 if ((index<1)||(index>myNumberOfInsertedShapes)||(successorNumber<1)||(successorNumber>NumberOfSuccessors(index))) {
881 if (GetShapeType(index) == TopAbs_VERTEX) {
884 return myListOfShapeAndInterferences[index-1].GetOrientation(successorNumber);
886 //===========================================================================
887 //function : GetOrientations
888 //purpose : returns the array of orientations
889 //===========================================================================
891 BooleanOperations_ShapesDataStructure::GetOrientations(const Standard_Integer index,
892 Standard_Address& theArrayOfOrientations,
893 Standard_Integer& orientationsNumber) const
895 if ((index<1)||(index>myNumberOfInsertedShapes)) {
898 if (GetShapeType(index) == TopAbs_VERTEX) {
901 myListOfShapeAndInterferences[index-1].GetOrientations(theArrayOfOrientations,orientationsNumber);
903 //modified by NIZNHY-PKV Wed Feb 2 14:44:08 2005f
906 #pragma warning ( default : 4291 )
910 //===========================================================================
911 //function : InsertInterference
913 //===========================================================================
914 void BooleanOperations_ShapesDataStructure::InsertInterference(const Standard_Integer index,
915 const BooleanOperations_InterferenceResult&)// IR)
917 if ((index<1)||(index>myNumberOfInsertedShapes)) {
920 //modified by NIZNHY-PKV Wed Feb 2 13:02:32 2005ft
921 // myListOfShapeAndInterferences[index-1].SetInterference(IR);
923 //===========================================================================
924 //function : GetInterference
926 //===========================================================================
927 const BooleanOperations_InterferenceResult&
928 BooleanOperations_ShapesDataStructure::GetInterference(const Standard_Integer index,
929 const Standard_Integer interfNumber) const
932 if ((index<1)||(index>myNumberOfInsertedShapes)) {
935 //modified by NIZNHY-PKV Wed Feb 2 13:04:12 2005f
936 //return myListOfShapeAndInterferences[index-1].GetInterference(interfNumber);
938 static BooleanOperations_InterferenceResult aIR;
940 //modified by NIZNHY-PKV Wed Feb 2 13:04:22 2005t
943 //===========================================================================
944 //function : GetIntersectedShape
946 //===========================================================================
948 BooleanOperations_ShapesDataStructure::GetIntersectedShape(const Standard_Integer index,
949 const Standard_Integer interfNumber) const
951 if ((index<1)||(index>myNumberOfInsertedShapes)) {
954 //modified by NIZNHY-PKV Wed Feb 2 13:04:39 2005f
955 //return myListOfShapeAndInterferences[index-1].GetIntersectedShape(interfNumber);
957 //modified by NIZNHY-PKV Wed Feb 2 13:04:45 2005t
959 //===========================================================================
960 //function : GetIntersectionResult
962 //===========================================================================
964 BooleanOperations_ShapesDataStructure::GetIntersectionResult (const Standard_Integer index,
965 const Standard_Integer interfNumber) const
967 if ((index<1)||(index>myNumberOfInsertedShapes)) {
970 //modified by NIZNHY-PKV Wed Feb 2 13:05:36 2005f
971 //return myListOfShapeAndInterferences[index-1].GetIntersectionResult(interfNumber);
973 //modified by NIZNHY-PKV Wed Feb 2 13:04:45 2005t
975 //===========================================================================
976 //function : NumberOfInterferences
978 //===========================================================================
980 BooleanOperations_ShapesDataStructure::NumberOfInterferences(const Standard_Integer index) const
982 if ((index<1)||(index>myNumberOfInsertedShapes)) {
985 //modified by NIZNHY-PKV Wed Feb 2 13:06:43 2005f
986 //return myListOfShapeAndInterferences[index-1].NumberOfInterferences();
988 //modified by NIZNHY-PKV Wed Feb 2 13:04:45 2005t
992 //modified by NIZNHY-PKV Wed Feb 2 14:44:11 2005t