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 <IFGraph_SubPartsIterator.hxx>
16 #include <IFSelect_DispPerSignature.hxx>
17 #include <IFSelect_Selection.hxx>
18 #include <IFSelect_SignCounter.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <Interface_Graph.hxx>
21 #include <Interface_InterfaceError.hxx>
22 #include <Standard_Type.hxx>
23 #include <TCollection_AsciiString.hxx>
24 #include <TCollection_HAsciiString.hxx>
25 #include <TColStd_HSequenceOfHAsciiString.hxx>
26 #include <TColStd_HSequenceOfTransient.hxx>
29 IMPLEMENT_STANDARD_RTTIEXT(IFSelect_DispPerSignature,IFSelect_Dispatch)
31 IFSelect_DispPerSignature::IFSelect_DispPerSignature () { }
33 Handle(IFSelect_SignCounter) IFSelect_DispPerSignature::SignCounter () const
36 void IFSelect_DispPerSignature::SetSignCounter
37 (const Handle(IFSelect_SignCounter)& sign)
38 { thesign = sign; thesign->SetList (Standard_True); }
40 Standard_CString IFSelect_DispPerSignature::SignName () const
41 { return (Standard_CString ) (thesign.IsNull() ? "???" : thesign->Name()); }
43 TCollection_AsciiString IFSelect_DispPerSignature::Label () const
46 sprintf (lab,"One File per Signature %s",SignName());
47 return TCollection_AsciiString(lab);
50 Standard_Boolean IFSelect_DispPerSignature::LimitedMax
51 (const Standard_Integer nbent, Standard_Integer& max) const
57 void IFSelect_DispPerSignature::Packets
58 (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
60 if (thesign.IsNull()) {
62 packs.GetFromIter (FinalSelection()->RootResult(G));
67 thesign->AddList (FinalSelection()->RootResult(G).Content(),G.Model());
68 Handle(TColStd_HSequenceOfHAsciiString) list = thesign->List();
69 Standard_Integer i,nb,is,nbs = list->Length();
70 Handle(TCollection_HAsciiString) asign;
71 Handle(TColStd_HSequenceOfTransient) ents;
72 for (is = 1; is <= nbs; is ++) {
73 asign = list->Value(is);
74 ents = thesign->Entities (asign->ToCString());
75 if (ents.IsNull()) continue;
78 for (i = 1; i <= nb; i ++)
79 packs.GetFromEntity (ents->Value(i),Standard_False);