7fd59977 |
1 | #include <IFSelect_GraphCounter.ixx> |
2 | #include <Interface_EntityIterator.hxx> |
3 | #include <IFSelect_SelectPointed.hxx> |
4 | #include <stdio.h> |
5 | #include <string.h> |
6 | |
7 | |
8 | IFSelect_GraphCounter::IFSelect_GraphCounter |
9 | (const Standard_Boolean withmap, const Standard_Boolean withlist) |
10 | : IFSelect_SignCounter (withmap,withlist) { } |
11 | |
12 | Handle(IFSelect_SelectDeduct) IFSelect_GraphCounter::Applied () const |
13 | { return theapplied; } |
14 | |
15 | void IFSelect_GraphCounter::SetApplied |
16 | (const Handle(IFSelect_SelectDeduct)& applied) |
17 | { theapplied = applied; } |
18 | |
19 | void IFSelect_GraphCounter::AddWithGraph |
20 | (const Handle(TColStd_HSequenceOfTransient)& list, |
21 | const Interface_Graph& graph) |
22 | { |
23 | if (theapplied.IsNull()) { AddList (list,graph.Model()); return; } |
24 | if (list.IsNull()) return; |
25 | Standard_Integer i, nb = list->Length(); |
26 | for (i = 1; i <= nb; i ++) { |
27 | char val[12]; |
28 | Handle(Standard_Transient) ent = list->Value(i); |
29 | theapplied->Alternate()->SetEntity (ent); |
30 | Interface_EntityIterator iter = theapplied->UniqueResult(graph); |
31 | Standard_Integer n = iter.NbEntities(); |
32 | switch (n) { |
33 | case 0: Add (ent,"0"); break; |
34 | case 1: Add (ent,"1"); break; |
35 | case 2: Add (ent,"2"); break; |
36 | case 3: Add (ent,"3"); break; |
37 | case 4: Add (ent,"4"); break; |
38 | case 5: Add (ent,"5"); break; |
39 | case 6: Add (ent,"6"); break; |
40 | case 7: Add (ent,"7"); break; |
41 | case 8: Add (ent,"8"); break; |
42 | case 9: Add (ent,"9"); break; |
43 | default : |
44 | sprintf (val,"%d",n); |
45 | Add (ent,val); |
46 | break; |
47 | } |
48 | } |
49 | } |