blob: 40d5ff54cbfc09c0ea1820c9aff9a7dc8a96981d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
// File: TNaming_ShapesSet.cxx
// Created: Fri Jan 24 15:42:31 1997
// Author: Yves FRICAUD
// <yfr@claquox.paris1.matra-dtv.fr>
#include <TNaming_ShapesSet.ixx>
#include <TNaming_IteratorOnShapesSet.hxx>
#include <TNaming_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#define BUC60862
//#define MDTV_DEB_INT
//=======================================================================
//function : TNaming_ShapesSet
//purpose :
//=======================================================================
TNaming_ShapesSet::TNaming_ShapesSet (const TopoDS_Shape& CS,
const TopAbs_ShapeEnum Type)
{
if (CS.IsNull()) return;
#ifdef MDTV_DEB_INT
cout << "ShapeSet: CS TShape = " <<CS.TShape() << " Type = " << Type <<endl;
#endif
if (Type == TopAbs_SHAPE) {
if (CS.ShapeType() == TopAbs_SOLID ||
CS.ShapeType() == TopAbs_FACE ||
CS.ShapeType() == TopAbs_EDGE ||
CS.ShapeType() == TopAbs_VERTEX ) {
Add(CS);
}
else {
for (TopoDS_Iterator it(CS) ; it.More(); it.Next()) {
Add(it.Value());
}
}
}
else {
#ifdef BUC60862
// corrected by vro 13.09.00:
if (Type > CS.ShapeType()) {
for (TopExp_Explorer exp(CS,Type) ; exp.More(); exp.Next()) {
Add(exp.Current());
#ifdef MDTV_DEB_INT
cout << "ShapeSet: sub-shape TShape = " <<exp.Current().TShape() <<endl;
#endif
}
} else {
// for (TopoDS_Iterator it(CS) ; it.More(); it.Next()) {
// Add(it.Value());
// }
Add(CS);
}
// end of correction by vro.
#else
for (TopExp_Explorer exp(CS,Type) ; exp.More(); exp.Next()) {
Add(exp.Current());
}
#endif
}
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
void TNaming_ShapesSet::Add(const TNaming_ShapesSet& Shapes)
{
TNaming_IteratorOnShapesSet it(Shapes);
for (; it.More(); it.Next()) {
myMap.Add(it.Value());
}
}
//=======================================================================
//function : Filter
//purpose :
//=======================================================================
void TNaming_ShapesSet::Filter(const TNaming_ShapesSet& Shapes)
{
TNaming_ShapesSet ToRemove;
TNaming_IteratorOnShapesSet it(*this);
for (; it.More(); it.Next()) {
const TopoDS_Shape& S = it.Value();
if (!Shapes.Contains(S)) {
ToRemove.Add(S);
}
}
Remove(ToRemove);
}
//=======================================================================
//function : Remove
//purpose :
//=======================================================================
void TNaming_ShapesSet::Remove(const TNaming_ShapesSet& Shapes)
{
TNaming_IteratorOnShapesSet it(Shapes);
for (; it.More(); it.Next()) {
myMap.Remove(it.Value());
}
}
|