0022735: Data races in BRepMesh working in parallel mode
[occt.git] / src / IFSelect / IFSelect_DispPerSignature.cxx
1 #include <IFSelect_DispPerSignature.ixx>
2 #include <IFSelect_Selection.hxx>
3 #include <TColStd_HSequenceOfHAsciiString.hxx>
4 #include <TCollection_HAsciiString.hxx>
5 #include <TColStd_HSequenceOfTransient.hxx>
6 #include <Interface_EntityIterator.hxx>
7 #include <stdio.h>
8
9
10     IFSelect_DispPerSignature::IFSelect_DispPerSignature ()    {  }
11
12     Handle(IFSelect_SignCounter)  IFSelect_DispPerSignature::SignCounter () const
13 {  return thesign;  }
14
15     void  IFSelect_DispPerSignature::SetSignCounter
16   (const Handle(IFSelect_SignCounter)& sign)
17 {  thesign = sign;  thesign->SetList (Standard_True);  }
18
19     Standard_CString  IFSelect_DispPerSignature::SignName () const
20 {  return (Standard_CString ) (thesign.IsNull() ? "???" : thesign->Name());  }
21
22     TCollection_AsciiString  IFSelect_DispPerSignature::Label () const
23 {
24   char lab[50];
25   sprintf (lab,"One File per Signature %s",SignName());
26   return TCollection_AsciiString(lab);
27 }
28
29     Standard_Boolean  IFSelect_DispPerSignature::LimitedMax
30   (const Standard_Integer nbent, Standard_Integer& max) const
31 {
32   max = nbent;
33   return Standard_True;
34 }
35
36     void  IFSelect_DispPerSignature::Packets
37   (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
38 {
39   if (thesign.IsNull()) {
40     packs.AddPart();
41     packs.GetFromIter (FinalSelection()->RootResult(G));
42     return;
43   }
44
45   thesign->Clear();
46   thesign->AddList (FinalSelection()->RootResult(G).Content(),G.Model());
47   Handle(TColStd_HSequenceOfHAsciiString) list = thesign->List();
48   Standard_Integer i,nb,is,nbs = list->Length();
49   Handle(TCollection_HAsciiString) asign;
50   Handle(TColStd_HSequenceOfTransient) ents;
51   for (is = 1; is <= nbs; is ++) {
52     asign = list->Value(is);
53     ents = thesign->Entities (asign->ToCString());
54     if (ents.IsNull()) continue;
55     packs.AddPart();
56     nb = ents->Length();
57     for (i = 1; i <= nb; i ++)
58       packs.GetFromEntity (ents->Value(i),Standard_False);
59   }
60 }