0030153: Visualization, TKOpenGl - AIS_ColoredShape::SynchronizeAspects() doesn't...
[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
92efcf78 23IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectSignedSharing,IFSelect_SelectExplore)
24
b311480e 25IFSelect_SelectSignedSharing::IFSelect_SelectSignedSharing
7fd59977 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) { }
31
32 Handle(IFSelect_Signature) IFSelect_SelectSignedSharing::Signature () const
33 { return thematcher; }
34
35 const TCollection_AsciiString& IFSelect_SelectSignedSharing::SignatureText () const
36 { return thesigntext; }
37
38 Standard_Boolean IFSelect_SelectSignedSharing::IsExact () const
39 { return theexact; }
40
41
42 Standard_Boolean IFSelect_SelectSignedSharing::Explore
43 (const Standard_Integer level, const Handle(Standard_Transient)& ent,
44 const Interface_Graph& G, Interface_EntityIterator& explored) const
45{
46 if (thematcher->Matches (ent,G.Model(),thesigntext,theexact)) return Standard_True;
47
48// sinon, on fait le tri ici
49 Interface_EntityIterator list = G.Sharings (ent);
50// Si plus de Sharing, alors c est cuit
51 if (list.NbEntities() == 0) return Standard_False;
52
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());
58 }
59 return Standard_True;
60}
61
62
63 TCollection_AsciiString IFSelect_SelectSignedSharing::ExploreLabel () const
64{
65 TCollection_AsciiString lab("Sharing,");
66 lab.AssignCat (thematcher->Name());
67 if (theexact) lab.AssignCat(" matching ");
68 else lab.AssignCat(" containing ");
69 lab.AssignCat(thesigntext);
70 return lab;
71}