973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | #include <IFSelect_SelectSignedShared.ixx> |
15 | |
b311480e |
16 | |
17 | IFSelect_SelectSignedShared::IFSelect_SelectSignedShared |
7fd59977 |
18 | (const Handle(IFSelect_Signature)& matcher, |
19 | const Standard_CString signtext, const Standard_Boolean exact, |
20 | const Standard_Integer level) |
21 | : IFSelect_SelectExplore (level) , |
22 | thematcher (matcher) , thesigntext (signtext) , theexact (exact) { } |
23 | |
24 | Handle(IFSelect_Signature) IFSelect_SelectSignedShared::Signature () const |
25 | { return thematcher; } |
26 | |
27 | const TCollection_AsciiString& IFSelect_SelectSignedShared::SignatureText () const |
28 | { return thesigntext; } |
29 | |
30 | Standard_Boolean IFSelect_SelectSignedShared::IsExact () const |
31 | { return theexact; } |
32 | |
33 | |
34 | Standard_Boolean IFSelect_SelectSignedShared::Explore |
35 | (const Standard_Integer level, const Handle(Standard_Transient)& ent, |
36 | const Interface_Graph& G, Interface_EntityIterator& explored) const |
37 | { |
38 | if (thematcher->Matches (ent,G.Model(),thesigntext,theexact)) return Standard_True; |
39 | |
40 | // sinon, on fait le tri ici |
41 | Interface_EntityIterator list = G.Shareds (ent); |
42 | // Si plus de Shared, alors c est cuit |
43 | if (list.NbEntities() == 0) return Standard_False; |
44 | |
45 | // Sinon, trier si on est au niveau |
46 | if (level < Level()) { explored = list; return Standard_True; } |
47 | for (list.Start(); list.More(); list.Next()) { |
48 | if (thematcher->Matches (list.Value(),G.Model(),thesigntext,theexact)) |
49 | explored.AddItem (list.Value()); |
50 | } |
51 | return Standard_True; |
52 | } |
53 | |
54 | |
55 | TCollection_AsciiString IFSelect_SelectSignedShared::ExploreLabel () const |
56 | { |
57 | TCollection_AsciiString lab("Shared,"); |
58 | lab.AssignCat (thematcher->Name()); |
59 | if (theexact) lab.AssignCat(" matching "); |
60 | else lab.AssignCat(" containing "); |
61 | lab.AssignCat(thesigntext); |
62 | return lab; |
63 | } |