e0eb4134d8781257a2b64397a04a054db9041961
[occt.git] / src / TopOpeBRepDS / TopOpeBRepDS_Filter.cxx
1 // Created on: 1997-04-21
2 // Created by: Prestataire Mary FABIEN
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22 #include <TopOpeBRepDS_Filter.ixx>
23 #include <TopOpeBRepDS_DataStructure.hxx>
24 #include <TopoDS_Shape.hxx>
25 #include <TopOpeBRepDS_Interference.hxx>
26 #include <TopOpeBRepDS_ListOfInterference.hxx>
27 #include <TopOpeBRepDS_ListIteratorOfListOfInterference.hxx>
28
29 #ifdef DEB
30 Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettracePEI();
31 Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettracePI();
32 Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer);
33 //unreferenced function, commented
34 /*static Standard_Boolean TRCE(const Standard_Integer EIX) {
35   Standard_Boolean b1 = TopOpeBRepDS_GettracePEI();
36   Standard_Boolean b2 = TopOpeBRepDS_GettracePI();
37   Standard_Boolean b3 = TopOpeBRepDS_GettraceSPSX(EIX);
38   return (b1 || b2 || b3);
39 }*/
40 #endif
41
42 //=======================================================================
43 //function : TopOpeBRepDS_Filter
44 //purpose  : 
45 //=======================================================================
46
47 TopOpeBRepDS_Filter::TopOpeBRepDS_Filter
48 (const Handle(TopOpeBRepDS_HDataStructure)& HDS,
49  const TopOpeBRepTool_PShapeClassifier& pClassif)
50 : myHDS(HDS),
51   myPShapeClassif(pClassif)
52 {}
53
54
55 //=======================================================================
56 //function : ProcessInterferences
57 //purpose  : 
58 //=======================================================================
59
60 void TopOpeBRepDS_Filter::ProcessInterferences()
61 {
62   ProcessEdgeInterferences();
63   ProcessCurveInterferences();
64 }
65
66 //=======================================================================
67 //function : ProcessEdgeInterferences
68 //purpose  : 
69 //=======================================================================
70
71 void TopOpeBRepDS_Filter::ProcessEdgeInterferences()
72 {
73   TopOpeBRepDS_DataStructure& BDS = myHDS->ChangeDS();
74   Standard_Integer i,nshape = BDS.NbShapes();
75
76   for (i = 1; i <= nshape; i++) {
77     const TopoDS_Shape& S = BDS.Shape(i);
78     if(S.IsNull()) continue;
79     if ( S.ShapeType() == TopAbs_EDGE ) {
80       ProcessEdgeInterferences(i);
81     }
82   }
83 }
84
85 //=======================================================================
86 //function : ProcessFaceInterferences
87 //purpose  : 
88 //=======================================================================
89
90 void TopOpeBRepDS_Filter::ProcessFaceInterferences
91 (const TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State& MEsp)
92 {
93   TopOpeBRepDS_DataStructure& BDS = myHDS->ChangeDS();
94   Standard_Integer i,nshape = BDS.NbShapes();
95
96   for (i = 1; i <= nshape; i++) {
97     const TopoDS_Shape& S = BDS.Shape(i);
98     if(S.IsNull()) continue;
99     if ( S.ShapeType() == TopAbs_FACE ) {
100       ProcessFaceInterferences(i,MEsp);
101     }
102   }
103 }
104
105 //=======================================================================
106 //function : ProcessCurveInterferences
107 //purpose  : 
108 //=======================================================================
109
110 void TopOpeBRepDS_Filter::ProcessCurveInterferences()
111 {
112   TopOpeBRepDS_DataStructure& BDS = myHDS->ChangeDS();
113   Standard_Integer i,ncurve = BDS.NbCurves();
114   for (i = 1; i <= ncurve; i++) {
115     ProcessCurveInterferences(i);
116   }
117 }
118
119 // ProcessFaceInterferences  : voir FilterFaceInterferences.cxx
120 // ProcessEdgeInterferences  : voir FilterEdgeInterferences.cxx
121 // ProcessCurveInterferences : voir FilterCurveInterferences.cxx