0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / TopOpeBRepDS / TopOpeBRepDS_FilterEdgeInterferences.cxx
1 // Created on: 1997-04-21
2 // Created by: Prestataire Mary FABIEN
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <TopoDS_Shape.hxx>
19 #include <TopOpeBRepDS_DataStructure.hxx>
20 #include <TopOpeBRepDS_define.hxx>
21 #include <TopOpeBRepDS_Filter.hxx>
22 #include <TopOpeBRepDS_HDataStructure.hxx>
23 #include <TopOpeBRepDS_Interference.hxx>
24 #include <TopOpeBRepDS_ListIteratorOfListOfInterference.hxx>
25 #include <TopOpeBRepDS_ListOfInterference.hxx>
26 #include <TopOpeBRepDS_ProcessInterferencesTool.hxx>
27
28 Standard_EXPORT Standard_Integer FUN_unkeepEinterferences(TopOpeBRepDS_ListOfInterference& LI,const TopOpeBRepDS_DataStructure& BDS,const Standard_Integer SIX);
29 Standard_EXPORT void FUN_unkeepEsymetrictransitions(TopOpeBRepDS_ListOfInterference& LI,const TopOpeBRepDS_DataStructure& BDS,const Standard_Integer SIX);
30 Standard_EXPORT void FUN_orderFFsamedomain(TopOpeBRepDS_ListOfInterference& LI,const Handle(TopOpeBRepDS_HDataStructure)& BDS,const Standard_Integer SIX);
31 Standard_EXPORT void FUN_orderSTATETRANS(TopOpeBRepDS_ListOfInterference& LI,const Handle(TopOpeBRepDS_HDataStructure)& BDS,const Standard_Integer SIX);
32 Standard_EXPORT void FUN_resolveEUNKNOWN(TopOpeBRepDS_ListOfInterference& LI,TopOpeBRepDS_DataStructure& BDS,const Standard_Integer SIX);
33 Standard_EXPORT void FUN_purgeDSonSE(const Handle(TopOpeBRepDS_HDataStructure)& HDS,const Standard_Integer EIX,TopOpeBRepDS_ListOfInterference& LI);
34
35 //------------------------------------------------------
36 static void FUN_FilterEdge
37 //------------------------------------------------------
38 (TopOpeBRepDS_ListOfInterference& LI,const Handle(TopOpeBRepDS_HDataStructure)& HDS,const Standard_Integer SIX)
39 {
40   TopOpeBRepDS_DataStructure& BDS = HDS->ChangeDS();
41
42   FUN_orderFFsamedomain(LI,HDS,SIX);
43   FUN_orderSTATETRANS(LI,HDS,SIX);
44   FUN_unkeepEinterferences(LI,BDS,SIX);
45   FUN_reducedoublons(LI,BDS,SIX);
46 }
47
48 //=======================================================================
49 //function : ProcessEdgeInterferences
50 //purpose  : Filter
51 //=======================================================================
52
53 void TopOpeBRepDS_Filter::ProcessEdgeInterferences
54 (const Standard_Integer SIX)
55 {
56   TopOpeBRepDS_DataStructure& BDS = myHDS->ChangeDS();
57 //                 BDS.Shape(SIX);
58   TopOpeBRepDS_ListOfInterference& LI = BDS.ChangeShapeInterferences(SIX);
59   TopOpeBRepDS_ListOfInterference lw, lE, lF, lUU, lall; lall.Assign(LI);
60
61   // xpu : 270398 : 
62   // deleting faulty interferences attached to section edge EIX
63   // I = (T(Ftrasha),G,Ftrasha), Ftrasha sdm with FancestorofEIX
64   FUN_purgeDSonSE(myHDS,SIX,lall);
65   // xpu : 270398 (pro1260, edge 49,ftrasha 93)
66   ::FUN_selectTRAUNKinterference(lall,lUU);
67   FUN_resolveEUNKNOWN(lUU,BDS,SIX);
68   lw.Append(lall);
69   lw.Append(lUU);
70   ::FUN_selectTRASHAinterference(lw,TopAbs_FACE,lF);
71   ::FUN_selectTRASHAinterference(lw,TopAbs_EDGE,lE);
72   ::FUN_FilterEdge(lF,myHDS,SIX);
73 //  ::FUN_unkeepEsymetrictransitions(lF,BDS,SIX);
74   ::FUN_FilterEdge(lE,myHDS,SIX);
75   
76   LI.Clear();
77   LI.Append(lF);
78   LI.Append(lE);
79 } //ProcessEdgeInterferences