0023024: Update headers of OCCT files
[occt.git] / src / BOPTools / BOPTools_PaveFiller_4.cxx
CommitLineData
b311480e 1// Created on: 2002-02-22
2// Created by: Peter KURNEV
3// Copyright (c) 2002-2012 OPEN CASCADE SAS
4//
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.
9//
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.
12//
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.
19
7fd59977 20
21#include <BOPTools_PaveFiller.ixx>
22#include <TColStd_IndexedMapOfInteger.hxx>
23
24#include <TopoDS_Shape.hxx>
25
26#include <BooleanOperations_ShapesDataStructure.hxx>
27
28#include <BooleanOperations_OnceExplorer.hxx>
29#include <BooleanOperations_KindOfInterference.hxx>
30#include <TopAbs_ShapeEnum.hxx>
31#include <BOPTools_ListIteratorOfListOfInterference.hxx>
32#include <BOPTools_CArray1OfInterferenceLine.hxx>
33#include <BOPTools_InterferenceLine.hxx>
34#include <BOPTools_ListOfInterference.hxx>
35#include <BOPTools_Interference.hxx>
36#include <BOPTools_PShapeShapeInterference.hxx>
37
38
39
40static
41 void GetFullFaceMap(const Standard_Integer nF2,
42 const BOPTools_InterferencePool& myIntrPool,
43 TColStd_IndexedMapOfInteger& aMF2);
44
45static
46 void GetInterferedVertices(const Standard_Integer nF1,
47 const TColStd_IndexedMapOfInteger& aMF2,
48 const BOPTools_InterferencePool& myIntrPool,
49 TColStd_IndexedMapOfInteger& aMV);
50
51//=======================================================================
52// function: StickVertices
53// purpose:
54//=======================================================================
55 void BOPTools_PaveFiller::StickVertices(const Standard_Integer nF1,
56 const Standard_Integer nF2,
57 TColStd_IndexedMapOfInteger& aMV)
58{
59 Standard_Integer i, aNb, iEntity;
60 TColStd_IndexedMapOfInteger aMF1, aMF2;
61 //
62 GetFullFaceMap(nF1, *myIntrPool, aMF1);
63 GetFullFaceMap(nF2, *myIntrPool, aMF2);
64 //
65 aNb=aMF1.Extent();
66 for (i=1; i<=aNb; ++i) {
67 iEntity=aMF1(i);
68 GetInterferedVertices(iEntity, aMF2, *myIntrPool, aMV);
69 }
70 //
71 aNb=aMF2.Extent();
72 for (i=1; i<=aNb; ++i) {
73 iEntity=aMF2(i);
74 GetInterferedVertices(iEntity, aMF1, *myIntrPool, aMV);
75 }
76}
77
78//=======================================================================
79// function: GetFullFaceMap
80// purpose:
81//=======================================================================
82void GetFullFaceMap(const Standard_Integer nF2,
83 const BOPTools_InterferencePool& anIntrPool,
84 TColStd_IndexedMapOfInteger& aMF2)
85{
86 Standard_Integer nEF2, nVF2;
87 //
88 aMF2.Add(nF2);
89 BooleanOperations_PShapesDataStructure myDS=anIntrPool.DS();
90 BooleanOperations_OnceExplorer aExp(*myDS);
91 aExp.Init(nF2, TopAbs_EDGE);
92 for (; aExp.More(); aExp.Next()) {
93 nEF2=aExp.Current();
94 aMF2.Add(nEF2);
95 }
96 //
97 aExp.Init(nF2, TopAbs_VERTEX);
98 for (; aExp.More(); aExp.Next()) {
99 nVF2=aExp.Current();
100 aMF2.Add(nVF2);
101 }
102}
103//=======================================================================
104// function: GetInterferedVertices
105// purpose:
106//=======================================================================
107void GetInterferedVertices(const Standard_Integer nF1,
108 const TColStd_IndexedMapOfInteger& aMF2,
109 const BOPTools_InterferencePool& anIntrPool,
110 TColStd_IndexedMapOfInteger& aMV)
111{
112 Standard_Integer aIndex, aNewShape, aWith;
113 BooleanOperations_KindOfInterference aType;
114 TopAbs_ShapeEnum aShapeType;
115 BOPTools_ListIteratorOfListOfInterference anIt;
116 BOPTools_PShapeShapeInterference pI;
117 //
118 BooleanOperations_PShapesDataStructure myDS=anIntrPool.DS();
119 const BOPTools_CArray1OfInterferenceLine& aITable= anIntrPool.InterferenceTable();
120 const BOPTools_InterferenceLine& aILineF1=aITable(nF1);
121 const BOPTools_ListOfInterference& aLIF1=aILineF1.RealList();
122
123 //
124 anIt.Initialize(aLIF1);
125 for (; anIt.More(); anIt.Next()) {
126 const BOPTools_Interference& anInterference=anIt.Value();
127 aWith=anInterference.With();
128 if (aMF2.Contains(aWith)) {
129 aIndex=anInterference.Index();
130 aType= anInterference.Type();
131 pI=anIntrPool.GetInterference(aIndex, aType);
132 if (pI!=NULL) {
133 //aNewShape=anIntrPool.NewShape(aIndex, aType);
134 aNewShape=pI->NewShape();
135 if (aNewShape) {
136 const TopoDS_Shape& aS=myDS->Shape(aNewShape);
137 aShapeType=aS.ShapeType();
138 if (aShapeType==TopAbs_VERTEX) {
139 aMV.Add(aNewShape);
140 }
141 }
142 }
143 }
144 }
145}
146
147
148
149
150