1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <IFSelect_SelectSignedShared.hxx>
16 #include <IFSelect_Signature.hxx>
17 #include <Interface_EntityIterator.hxx>
18 #include <Interface_Graph.hxx>
19 #include <Standard_Transient.hxx>
20 #include <Standard_Type.hxx>
21 #include <TCollection_AsciiString.hxx>
23 IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectSignedShared,IFSelect_SelectExplore)
25 IFSelect_SelectSignedShared::IFSelect_SelectSignedShared
26 (const Handle(IFSelect_Signature)& matcher,
27 const Standard_CString signtext, const Standard_Boolean exact,
28 const Standard_Integer level)
29 : IFSelect_SelectExplore (level) ,
30 thematcher (matcher) , thesigntext (signtext) , theexact (exact) { }
32 Handle(IFSelect_Signature) IFSelect_SelectSignedShared::Signature () const
33 { return thematcher; }
35 const TCollection_AsciiString& IFSelect_SelectSignedShared::SignatureText () const
36 { return thesigntext; }
38 Standard_Boolean IFSelect_SelectSignedShared::IsExact () const
42 Standard_Boolean IFSelect_SelectSignedShared::Explore
43 (const Standard_Integer level, const Handle(Standard_Transient)& ent,
44 const Interface_Graph& G, Interface_EntityIterator& explored) const
46 if (thematcher->Matches (ent,G.Model(),thesigntext,theexact)) return Standard_True;
48 // sinon, on fait le tri ici
49 Interface_EntityIterator list = G.Shareds (ent);
50 // Si plus de Shared, alors c est cuit
51 if (list.NbEntities() == 0) return Standard_False;
53 // Sinon, trier si on est au niveau
54 if (level < Level()) { explored = list; return Standard_True; }
55 for (list.Start(); list.More(); list.Next()) {
56 if (thematcher->Matches (list.Value(),G.Model(),thesigntext,theexact))
57 explored.AddItem (list.Value());
63 TCollection_AsciiString IFSelect_SelectSignedShared::ExploreLabel () const
65 TCollection_AsciiString lab("Shared,");
66 lab.AssignCat (thematcher->Name());
67 if (theexact) lab.AssignCat(" matching ");
68 else lab.AssignCat(" containing ");
69 lab.AssignCat(thesigntext);