0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / IFSelect / IFSelect_SelectSignedSharing.cxx
CommitLineData
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
42cf5bc1 15#include <IFSelect_SelectSignedSharing.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>
b311480e 22
23IFSelect_SelectSignedSharing::IFSelect_SelectSignedSharing
7fd59977 24 (const Handle(IFSelect_Signature)& matcher,
25 const Standard_CString signtext, const Standard_Boolean exact,
26 const Standard_Integer level)
27 : IFSelect_SelectExplore (level) ,
28 thematcher (matcher) , thesigntext (signtext) , theexact (exact) { }
29
30 Handle(IFSelect_Signature) IFSelect_SelectSignedSharing::Signature () const
31 { return thematcher; }
32
33 const TCollection_AsciiString& IFSelect_SelectSignedSharing::SignatureText () const
34 { return thesigntext; }
35
36 Standard_Boolean IFSelect_SelectSignedSharing::IsExact () const
37 { return theexact; }
38
39
40 Standard_Boolean IFSelect_SelectSignedSharing::Explore
41 (const Standard_Integer level, const Handle(Standard_Transient)& ent,
42 const Interface_Graph& G, Interface_EntityIterator& explored) const
43{
44 if (thematcher->Matches (ent,G.Model(),thesigntext,theexact)) return Standard_True;
45
46// sinon, on fait le tri ici
47 Interface_EntityIterator list = G.Sharings (ent);
48// Si plus de Sharing, alors c est cuit
49 if (list.NbEntities() == 0) return Standard_False;
50
51// Sinon, trier si on est au niveau
52 if (level < Level()) { explored = list; return Standard_True; }
53 for (list.Start(); list.More(); list.Next()) {
54 if (thematcher->Matches (list.Value(),G.Model(),thesigntext,theexact))
55 explored.AddItem (list.Value());
56 }
57 return Standard_True;
58}
59
60
61 TCollection_AsciiString IFSelect_SelectSignedSharing::ExploreLabel () const
62{
63 TCollection_AsciiString lab("Sharing,");
64 lab.AssignCat (thematcher->Name());
65 if (theexact) lab.AssignCat(" matching ");
66 else lab.AssignCat(" containing ");
67 lab.AssignCat(thesigntext);
68 return lab;
69}