CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
FWSimpleProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWGlimpseSimpleProxyBuilder
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones, Alja Mrak-Tadel
10 // Created: Tue March 28 09:46:41 EST 2010
11 //
12 
13 // system include files
14 #include <memory>
15 
16 // user include files
17 #include "TEveCompound.h"
20 
21 //
22 // constants, enums and typedefs
23 //
24 
25 //
26 // static data member definitions
27 //
28 
29 //
30 // constructors and destructor
31 //
32 FWSimpleProxyBuilder::FWSimpleProxyBuilder(const std::type_info& iType) : m_helper(iType) {}
33 
34 // FWSimpleProxyBuilder::FWSimpleProxyBuilder(const FWSimpleProxyBuilder& rhs)
35 // {
36 // // do actual copying here;
37 // }
38 
40 
41 //
42 // assignment operators
43 //
44 // const FWSimpleProxyBuilder& FWSimpleProxyBuilder::operator=(const FWSimpleProxyBuilder& rhs)
45 // {
46 // //An exception safe implementation is
47 // FWSimpleProxyBuilder temp(rhs);
48 // swap(rhs);
49 //
50 // return *this;
51 // }
52 
53 //
54 // member functions
55 //
56 
58  for (Product_it i = m_products.begin(); i != m_products.end(); ++i) {
59  if ((*i)->m_elements) {
60  TEveElement* elms = (*i)->m_elements;
61  for (TEveElement::List_i it = elms->BeginChildren(); it != elms->EndChildren(); ++it)
62  (*it)->DestroyElements();
63  }
64  }
65 
66  cleanLocal();
67 }
68 
70  if (iItem) {
71  m_helper.itemChanged(iItem);
72  }
73 }
74 
75 void FWSimpleProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext* vc) {
76  size_t size = iItem->size();
77  TEveElement::List_i pIdx = product->BeginChildren();
78  for (int index = 0; index < static_cast<int>(size); ++index) {
79  TEveElement* itemHolder = nullptr;
80  if (index < product->NumChildren()) {
81  itemHolder = *pIdx;
82  itemHolder->SetRnrSelfChildren(true, true);
83  ++pIdx;
84  } else {
85  itemHolder = createCompound();
86  product->AddElement(itemHolder);
87  }
88  if (iItem->modelInfo(index).displayProperties().isVisible()) {
89  const void* modelData = iItem->modelData(index);
90  build(m_helper.offsetObject(modelData), index, *itemHolder, vc);
91  }
92  }
93 }
94 
96  TEveElementList* product,
97  FWViewType::EType viewType,
98  const FWViewContext* vc) {
99  size_t size = iItem->size();
100  TEveElement::List_i pIdx = product->BeginChildren();
101  for (int index = 0; index < static_cast<int>(size); ++index) {
102  TEveElement* itemHolder = nullptr;
103  if (index < product->NumChildren()) {
104  itemHolder = *pIdx;
105  itemHolder->SetRnrSelfChildren(true, true);
106  ++pIdx;
107  } else {
108  itemHolder = createCompound();
109  product->AddElement(itemHolder);
110  }
111  if (iItem->modelInfo(index).displayProperties().isVisible()) {
112  const void* modelData = iItem->modelData(index);
113  buildViewType(m_helper.offsetObject(modelData), index, *itemHolder, viewType, vc);
114  }
115  }
116 }
117 
119  TEveElement* iCompound,
120  FWViewType::EType viewType,
121  const FWViewContext* vc) {
122  const FWEventItem::ModelInfo& info = iId.item()->modelInfo(iId.index());
123  bool returnValue = false;
124  if (info.displayProperties().isVisible() && iCompound->NumChildren() == 0) {
125  const void* modelData = iId.item()->modelData(iId.index());
126  if (haveSingleProduct())
127  build(m_helper.offsetObject(modelData), iId.index(), *iCompound, vc);
128  else
129  buildViewType(m_helper.offsetObject(modelData), iId.index(), *iCompound, viewType, vc);
130  returnValue = true;
131  }
132  return returnValue;
133 }
134 
135 //
136 // const member functions
137 //
138 
139 //
140 // static member functions
141 //
std::vector< Product * >::iterator Product_it
static const TGPicture * info(bool iBackgroundIsBlack)
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:64
bool visibilityModelChanges(const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *) override
std::vector< Product * > m_products
FWSimpleProxyBuilder(const std::type_info &iType)
virtual void cleanLocal()
const void * offsetObject(const void *iObj) const
int index() const
Definition: FWModelId.h:41
FWSimpleProxyHelper m_helper
void buildViewType(const FWEventItem *iItem, TEveElementList *product, FWViewType::EType viewType, const FWViewContext *) override
virtual bool haveSingleProduct() const
size_t size() const
Definition: FWEventItem.cc:457
static std::string typeOfBuilder()
Used by the plugin system to determine how the proxy uses the data from FWEventItem.
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:466
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
const FWEventItem * item() const
Definition: FWModelId.h:39
void itemChanged(const FWEventItem *)
tuple size
Write out results.
virtual void itemChangedImp(const FWEventItem *)