1 // Created on: 1997-01-24
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <TNaming_ShapesSet.ixx>
18 #include <TNaming_IteratorOnShapesSet.hxx>
19 #include <TNaming_Iterator.hxx>
21 #include <TopoDS_Shape.hxx>
22 #include <TopoDS_Iterator.hxx>
23 #include <TopExp_Explorer.hxx>
25 //#define MDTV_DEB_INT
26 //=======================================================================
27 //function : TNaming_ShapesSet
29 //=======================================================================
31 TNaming_ShapesSet::TNaming_ShapesSet (const TopoDS_Shape& CS,
32 const TopAbs_ShapeEnum Type)
34 if (CS.IsNull()) return;
36 cout << "ShapeSet: CS TShape = " <<CS.TShape() << " Type = " << Type <<endl;
38 if (Type == TopAbs_SHAPE) {
39 if (CS.ShapeType() == TopAbs_SOLID ||
40 CS.ShapeType() == TopAbs_FACE ||
41 CS.ShapeType() == TopAbs_EDGE ||
42 CS.ShapeType() == TopAbs_VERTEX ) {
46 for (TopoDS_Iterator it(CS) ; it.More(); it.Next()) {
53 // corrected by vro 13.09.00:
54 if (Type > CS.ShapeType()) {
55 for (TopExp_Explorer exp(CS,Type) ; exp.More(); exp.Next()) {
58 cout << "ShapeSet: sub-shape TShape = " <<exp.Current().TShape() <<endl;
62 // for (TopoDS_Iterator it(CS) ; it.More(); it.Next()) {
67 // end of correction by vro.
72 //=======================================================================
75 //=======================================================================
77 void TNaming_ShapesSet::Add(const TNaming_ShapesSet& Shapes)
79 TNaming_IteratorOnShapesSet it(Shapes);
80 for (; it.More(); it.Next()) {
81 myMap.Add(it.Value());
86 //=======================================================================
89 //=======================================================================
91 void TNaming_ShapesSet::Filter(const TNaming_ShapesSet& Shapes)
94 TNaming_ShapesSet ToRemove;
95 TNaming_IteratorOnShapesSet it(*this);
96 for (; it.More(); it.Next()) {
97 const TopoDS_Shape& S = it.Value();
98 if (!Shapes.Contains(S)) {
105 //=======================================================================
108 //=======================================================================
110 void TNaming_ShapesSet::Remove(const TNaming_ShapesSet& Shapes)
112 TNaming_IteratorOnShapesSet it(Shapes);
113 for (; it.More(); it.Next()) {
114 myMap.Remove(it.Value());