Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
REveDataSimpleProxyBuilder.cxx
Go to the documentation of this file.
2 
3 // user include files
5 #include <ROOT/REveCompound.hxx>
6 
7 using namespace ROOT::Experimental;
8 namespace REX = ROOT::Experimental;
9 
10 REveDataSimpleProxyBuilder::REveDataSimpleProxyBuilder(const std::string &type) : REveDataProxyBuilderBase(type)
11 {
12 }
13 
14 
15 REveDataSimpleProxyBuilder::~REveDataSimpleProxyBuilder()
16 {
17 }
18 
19 void
20 REveDataSimpleProxyBuilder::Clean()
21 {
22  for (auto &p: m_products)
23  {
24  if (p->m_elements)
25  {
26  REveElement *elms = p->m_elements;
27  for (auto &c: elms->RefChildren())
28  c->DestroyElements();
29  }
30  }
31 
32  CleanLocal();
33 }
34 
35 //______________________________________________________________________________
36 
37 void
38 REveDataSimpleProxyBuilder::Build(const REveDataCollection *collection,
39  REveElement* product, const REveViewContext* vc)
40 {
41  auto size = collection->GetNItems();
42  auto pIdx = product->RefChildren().begin();
43  for (int index = 0; index < size; ++index)
44  {
45  auto di = Collection()->GetDataItem(index);
46  REveElement *itemHolder = nullptr;
47 
48  if (index < product->NumChildren())
49  {
50  itemHolder = *pIdx;
51  itemHolder->SetRnrSelfChildren(true, true);
52  ++pIdx;
53  }
54  else
55  {
56  itemHolder = CreateCompound(true, true);
57  itemHolder->SetMainColor(collection->GetMainColor());
58  itemHolder->SetName(Form("%s %d", collection->GetCName(), index));
59 
60  product->AddElement(itemHolder);
61  }
62 
63  di->AddNiece(itemHolder);
64  itemHolder->SetSelectionMaster(di);
65 
66  if (di->GetRnrSelf() && !di->GetFiltered())
67  {
68  Build(collection->GetDataPtr(index), index, itemHolder, vc);
69  }
70  }
71 }
72 
73 void
74 REveDataSimpleProxyBuilder::BuildViewType(const REveDataCollection* collection,
75  REveElement* product, std::string viewType, const REveViewContext* vc)
76 {
77  auto size = collection->GetNItems();
78  auto pIdx = product->RefChildren().begin();
79  for (int index = 0; index < size; ++index)
80  {
81  auto di = Collection()->GetDataItem(index);
82  REveElement* itemHolder = nullptr;
83 
84  if (index < product->NumChildren())
85  {
86  itemHolder = *pIdx;
87  itemHolder->SetRnrSelfChildren(true, true);
88  ++pIdx;
89  }
90  else
91  {
92  itemHolder = CreateCompound(true, true);
93  itemHolder->SetMainColor(collection->GetMainColor());
94  itemHolder->SetName(Form("%s %d", collection->GetCName(), index));
95 
96  product->AddElement(itemHolder);
97  }
98 
99  di->AddNiece(itemHolder);
100  itemHolder->SetSelectionMaster(di);
101 
102  if (di->GetRnrSelf() && !di->GetFiltered())
103  {
104  BuildViewType(collection->GetDataPtr(index), index, itemHolder, viewType, vc);
105  }
106  }
107 }
108 
109 //______________________________________________________________________________
110 
111 bool
112 REveDataSimpleProxyBuilder::VisibilityModelChanges(int idx, REveElement* iCompound, const REveViewContext* vc)
113 {
114  REveDataItem* item = Collection()->GetDataItem(idx);
115  bool returnValue = false;
116  if (item->GetRnrSelf() && iCompound->NumChildren()==0)
117  {
118  printf("REveDataSimpleProxyBuilder::VisibilityModelChanges BUILD %d \n", idx);
119  Build(Collection()->GetDataPtr(idx), idx, iCompound, vc);
120  returnValue=true;
121  }
122  return returnValue;
123 }