b311480e |
1 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
2 | // |
3 | // The content of this file is subject to the Open CASCADE Technology Public |
4 | // License Version 6.5 (the "License"). You may not use the content of this file |
5 | // except in compliance with the License. Please obtain a copy of the License |
6 | // at http://www.opencascade.org and read it completely before using this file. |
7 | // |
8 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
9 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
10 | // |
11 | // The Original Code and all software distributed under the License is |
12 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
13 | // Initial Developer hereby disclaims all such warranties, including without |
14 | // limitation, any warranties of merchantability, fitness for a particular |
15 | // purpose or non-infringement. Please see the License for the specific terms |
16 | // and conditions governing the rights and limitations under the License. |
17 | |
7fd59977 |
18 | #include <IFSelect_DispPerSignature.ixx> |
19 | #include <IFSelect_Selection.hxx> |
20 | #include <TColStd_HSequenceOfHAsciiString.hxx> |
21 | #include <TCollection_HAsciiString.hxx> |
22 | #include <TColStd_HSequenceOfTransient.hxx> |
23 | #include <Interface_EntityIterator.hxx> |
24 | #include <stdio.h> |
25 | |
26 | |
b311480e |
27 | IFSelect_DispPerSignature::IFSelect_DispPerSignature () { } |
7fd59977 |
28 | |
29 | Handle(IFSelect_SignCounter) IFSelect_DispPerSignature::SignCounter () const |
30 | { return thesign; } |
31 | |
32 | void IFSelect_DispPerSignature::SetSignCounter |
33 | (const Handle(IFSelect_SignCounter)& sign) |
34 | { thesign = sign; thesign->SetList (Standard_True); } |
35 | |
36 | Standard_CString IFSelect_DispPerSignature::SignName () const |
37 | { return (Standard_CString ) (thesign.IsNull() ? "???" : thesign->Name()); } |
38 | |
39 | TCollection_AsciiString IFSelect_DispPerSignature::Label () const |
40 | { |
41 | char lab[50]; |
42 | sprintf (lab,"One File per Signature %s",SignName()); |
43 | return TCollection_AsciiString(lab); |
44 | } |
45 | |
46 | Standard_Boolean IFSelect_DispPerSignature::LimitedMax |
47 | (const Standard_Integer nbent, Standard_Integer& max) const |
48 | { |
49 | max = nbent; |
50 | return Standard_True; |
51 | } |
52 | |
53 | void IFSelect_DispPerSignature::Packets |
54 | (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const |
55 | { |
56 | if (thesign.IsNull()) { |
57 | packs.AddPart(); |
58 | packs.GetFromIter (FinalSelection()->RootResult(G)); |
59 | return; |
60 | } |
61 | |
62 | thesign->Clear(); |
63 | thesign->AddList (FinalSelection()->RootResult(G).Content(),G.Model()); |
64 | Handle(TColStd_HSequenceOfHAsciiString) list = thesign->List(); |
65 | Standard_Integer i,nb,is,nbs = list->Length(); |
66 | Handle(TCollection_HAsciiString) asign; |
67 | Handle(TColStd_HSequenceOfTransient) ents; |
68 | for (is = 1; is <= nbs; is ++) { |
69 | asign = list->Value(is); |
70 | ents = thesign->Entities (asign->ToCString()); |
71 | if (ents.IsNull()) continue; |
72 | packs.AddPart(); |
73 | nb = ents->Length(); |
74 | for (i = 1; i <= nb; i ++) |
75 | packs.GetFromEntity (ents->Value(i),Standard_False); |
76 | } |
77 | } |