0024023: Revamp the OCCT Handle -- downcast (automatic)
[occt.git] / src / TopOpeBRepDS / TopOpeBRepDS_FilterCurveInterferences.cxx
CommitLineData
b311480e 1// Created on: 1997-04-22
2// Created by: Prestataire Mary FABIEN
3// Copyright (c) 1997-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17#include <TopOpeBRepDS_Filter.ixx>
18
19#include <TopOpeBRepDS_Interference.hxx>
20#include <TopOpeBRepDS_ListOfInterference.hxx>
21#include <TopOpeBRepDS_ListIteratorOfListOfInterference.hxx>
22#include <TopOpeBRepDS_ProcessInterferencesTool.hxx>
23
0797d9d3 24#ifdef OCCT_DEBUG
1d0a9d4d 25extern Standard_Boolean TopOpeBRepDS_GettracePI();
26extern Standard_Boolean TopOpeBRepDS_GettracePCI();
7fd59977 27static Standard_Boolean TRCC() {
28 Standard_Boolean b2 = TopOpeBRepDS_GettracePI();
29 Standard_Boolean b3 = TopOpeBRepDS_GettracePCI();
30 return (b2 || b3);
31}
32#endif
33
34//=======================================================================
35//function : ProcessCurveInterferences
36//purpose :
37//=======================================================================
38
39void TopOpeBRepDS_Filter::ProcessCurveInterferences
40(const Standard_Integer CIX)
41{
42 TopOpeBRepDS_DataStructure& BDS = myHDS->ChangeDS();
43 TopOpeBRepDS_ListOfInterference& LI = BDS.ChangeCurveInterferences(CIX);
44 TopOpeBRepDS_ListIteratorOfListOfInterference it1(LI);
45
46 // process interferences of LI with VERTEX geometry
47 while( it1.More() ) {
48 const Handle(TopOpeBRepDS_Interference)& I1 = it1.Value();
49 Standard_Integer G1 = I1->Geometry();
50 TopOpeBRepDS_Kind GT1 = I1->GeometryType();
51 TopAbs_Orientation O1 = I1->Transition().Orientation(TopAbs_IN);
52
53 if ( GT1 == TopOpeBRepDS_VERTEX ) {
54
55 TopOpeBRepDS_ListIteratorOfListOfInterference it2(it1);
56 it2.Next();
57
58 while ( it2.More() ) {
59 const Handle(TopOpeBRepDS_Interference)& I2 = it2.Value();
60 Standard_Integer G2 = I2->Geometry();
61 TopOpeBRepDS_Kind GT2 = I2->GeometryType();
62 TopAbs_Orientation O2 = I2->Transition().Orientation(TopAbs_IN);
63
64// Standard_Boolean remove = (GT2 == GT1) && (G2 == G1);
65 // xpu140898 : USA60111 : CPI(FORWARD,v10,C1) + CPIREV(REVERSED,v10,C1)
66 // do NOT delete CPIREV!!
67 Standard_Boolean remove = (GT2 == GT1) && (G2 == G1) && (O1 == O2);
68 if ( remove ) {
0797d9d3 69#ifdef OCCT_DEBUG
7fd59977 70 if ( TRCC() ){
71 cout<<"remove ";I2->Dump(cout);cout<<" from C "<<CIX<<endl;
72 }
73#endif
74 LI.Remove(it2);
75 }
76 else it2.Next();
77 }
78 }
79 it1.Next();
80 }
81}