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
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.
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.
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.
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 #include <TopOpeBRepDS_ProcessInterferencesTool.hxx>
29 #include <TopOpeBRepDS_define.hxx>
32 extern Standard_Boolean TopOpeBRepDS_GettracePEI();
33 extern Standard_Boolean TopOpeBRepDS_GettracePI();
34 extern Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer);
35 extern Standard_Boolean TopOpeBRepDS_GettraceEDPR();
36 static Standard_Boolean TRCE(const Standard_Integer SIX) {
37 Standard_Boolean b1 = TopOpeBRepDS_GettracePEI();
38 Standard_Boolean b2 = TopOpeBRepDS_GettracePI();
39 Standard_Boolean b3 = TopOpeBRepDS_GettraceSPSX(SIX);
40 return (b1 || b2 || b3);
42 Standard_EXPORT void debfilterPEI(const Standard_Integer i){cout<<endl<<"++ debfilterPEI e"<<i<<endl;}
43 Standard_EXPORT void debfilter(const Standard_Integer i) {cout<<endl<<"++ debfilter e"<<i<<endl;}
46 Standard_EXPORT Standard_Integer FUN_unkeepEinterferences(TopOpeBRepDS_ListOfInterference& LI,const TopOpeBRepDS_DataStructure& BDS,const Standard_Integer SIX);
47 Standard_EXPORT void FUN_unkeepEsymetrictransitions(TopOpeBRepDS_ListOfInterference& LI,const TopOpeBRepDS_DataStructure& BDS,const Standard_Integer SIX);
48 Standard_EXPORT void FUN_orderFFsamedomain(TopOpeBRepDS_ListOfInterference& LI,const Handle(TopOpeBRepDS_HDataStructure)& BDS,const Standard_Integer SIX);
49 Standard_EXPORT void FUN_orderSTATETRANS(TopOpeBRepDS_ListOfInterference& LI,const Handle(TopOpeBRepDS_HDataStructure)& BDS,const Standard_Integer SIX);
50 Standard_EXPORT void FUN_resolveEUNKNOWN(TopOpeBRepDS_ListOfInterference& LI,TopOpeBRepDS_DataStructure& BDS,const Standard_Integer SIX);
51 Standard_EXPORT void FUN_purgeDSonSE(const Handle(TopOpeBRepDS_HDataStructure)& HDS,const Standard_Integer EIX,TopOpeBRepDS_ListOfInterference& LI);
53 //------------------------------------------------------
54 static void FUN_FilterEdge
55 //------------------------------------------------------
56 (TopOpeBRepDS_ListOfInterference& LI,const Handle(TopOpeBRepDS_HDataStructure)& HDS,const Standard_Integer SIX)
58 TopOpeBRepDS_DataStructure& BDS = HDS->ChangeDS();
61 Standard_Boolean TRC=TRCE(SIX);
62 if (TRC) debfilter(SIX);
63 if (TRC) cout<<"FUN_FilterEdge on "<<SIX<<" nI = "<<LI.Extent()<<endl;
66 FUN_orderFFsamedomain(LI,HDS,SIX);
67 FUN_orderSTATETRANS(LI,HDS,SIX);
68 FUN_unkeepEinterferences(LI,BDS,SIX);
69 FUN_reducedoublons(LI,BDS,SIX);
72 if (TRC) cout<<"FUN_FilterEdge on "<<SIX<<" returns nI = "<<LI.Extent()<<endl;
77 //=======================================================================
78 //function : ProcessEdgeInterferences
80 //=======================================================================
82 void TopOpeBRepDS_Filter::ProcessEdgeInterferences
83 (const Standard_Integer SIX)
85 TopOpeBRepDS_DataStructure& BDS = myHDS->ChangeDS();
88 Standard_Boolean TRC=TRCE(SIX);if (TRC) debfilterPEI(SIX);
92 TopOpeBRepDS_ListOfInterference& LI = BDS.ChangeShapeInterferences(SIX);
93 TopOpeBRepDS_ListOfInterference lw, lE, lF, lUU, lall; lall.Assign(LI);
96 // deleting faulty interferences attached to section edge EIX
97 // I = (T(Ftrasha),G,Ftrasha), Ftrasha sdm with FancestorofEIX
98 FUN_purgeDSonSE(myHDS,SIX,lall);
99 // xpu : 270398 (pro1260, edge 49,ftrasha 93)
102 //Standard_Integer nUU =
104 ::FUN_selectTRAUNKinterference(lall,lUU);
105 FUN_resolveEUNKNOWN(lUU,BDS,SIX);
110 Standard_Integer nF =
112 ::FUN_selectTRASHAinterference(lw,TopAbs_FACE,lF);
114 Standard_Integer nE =
116 ::FUN_selectTRASHAinterference(lw,TopAbs_EDGE,lE);
120 if(nE||nF){cout<<endl;cout<<"-----------------------"<<endl;}
121 if(nF){cout<<"EDGE "<<SIX<<" (FACE) : "<<nF<<endl;::FDS_dumpLI(lF," ");}
122 if(nE){cout<<"EDGE "<<SIX<<" (EDGE) : "<<nE<<endl;::FDS_dumpLI(lE," ");}
123 cout<<"Filter::ProcessEdgeInterferences on "<<SIX;
124 cout<<" nlF = "<<nF<<" nlE = "<<nE<<endl;
129 if (TRC) cout <<" on lF :"<<endl;
131 ::FUN_FilterEdge(lF,myHDS,SIX);
134 if (TRC) cout <<" on lF :"<<endl;
136 // ::FUN_unkeepEsymetrictransitions(lF,BDS,SIX);
139 if (TRC) cout <<" on lE :"<<endl;
141 ::FUN_FilterEdge(lE,myHDS,SIX);
149 cout<<"Filter::ProcessEdgeInterferences on "<<SIX;
150 cout<<" returns nlF = "<<nF<<" nlE = "<<nE<<endl;
154 } //ProcessEdgeInterferences