CMS 3D CMS Logo

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) :
33  m_helper(iType)
34 {
35 }
36 
37 // FWSimpleProxyBuilder::FWSimpleProxyBuilder(const FWSimpleProxyBuilder& rhs)
38 // {
39 // // do actual copying here;
40 // }
41 
43 {
44 }
45 
46 //
47 // assignment operators
48 //
49 // const FWSimpleProxyBuilder& FWSimpleProxyBuilder::operator=(const FWSimpleProxyBuilder& rhs)
50 // {
51 // //An exception safe implementation is
52 // FWSimpleProxyBuilder temp(rhs);
53 // swap(rhs);
54 //
55 // return *this;
56 // }
57 
58 //
59 // member functions
60 //
61 
62 void
64 {
65  for (Product_it i = m_products.begin(); i != m_products.end(); ++i)
66  {
67  if ((*i)->m_elements)
68  {
69  TEveElement* elms = (*i)->m_elements;
70  for (TEveElement::List_i it = elms->BeginChildren(); it != elms->EndChildren(); ++it)
71  (*it)->DestroyElements();
72  }
73  }
74 
75  cleanLocal();
76 }
77 
78 void
80 {
81  if (iItem)
82  {
83  m_helper.itemChanged(iItem);
84  }
85 }
86 
87 void
89  TEveElementList* product, const FWViewContext* vc)
90 {
91  size_t size = iItem->size();
92  TEveElement::List_i pIdx = product->BeginChildren();
93  for (int index = 0; index < static_cast<int>(size); ++index)
94  {
95  TEveElement* itemHolder = 0;
96  if (index < product->NumChildren())
97  {
98  itemHolder = *pIdx;
99  itemHolder->SetRnrSelfChildren(true, true);
100  ++pIdx;
101  }
102  else
103  {
104  itemHolder = createCompound();
105  product->AddElement(itemHolder);
106  }
107  if (iItem->modelInfo(index).displayProperties().isVisible())
108  {
109  const void* modelData = iItem->modelData(index);
110  build(m_helper.offsetObject(modelData),index, *itemHolder, vc);
111  }
112  }
113 }
114 
115 void
117  TEveElementList* product, FWViewType::EType viewType, const FWViewContext* vc)
118 {
119  size_t size = iItem->size();
120  TEveElement::List_i pIdx = product->BeginChildren();
121  for (int index = 0; index < static_cast<int>(size); ++index)
122  {
123  TEveElement* itemHolder = 0;
124  if (index < product->NumChildren())
125  {
126  itemHolder = *pIdx;
127  itemHolder->SetRnrSelfChildren(true, true);
128  ++pIdx;
129  }
130  else
131  {
132  itemHolder = createCompound();
133  product->AddElement(itemHolder);
134  }
135  if (iItem->modelInfo(index).displayProperties().isVisible())
136  {
137  const void* modelData = iItem->modelData(index);
138  buildViewType(m_helper.offsetObject(modelData),index, *itemHolder, viewType, vc);
139  }
140  }
141 }
142 
143 
144 bool
145 FWSimpleProxyBuilder::visibilityModelChanges(const FWModelId& iId, TEveElement* iCompound,
146  FWViewType::EType viewType, const FWViewContext* vc)
147 {
148  const FWEventItem::ModelInfo& info = iId.item()->modelInfo(iId.index());
149  bool returnValue = false;
150  if (info.displayProperties().isVisible() && iCompound->NumChildren()==0)
151  {
152  const void* modelData = iId.item()->modelData(iId.index());
153  if (haveSingleProduct())
154  build(m_helper.offsetObject(modelData),iId.index(),*iCompound, vc);
155  else
156  buildViewType(m_helper.offsetObject(modelData),iId.index(),*iCompound, viewType, vc);
157  returnValue=true;
158  }
159  return returnValue;
160 }
161 
162 
163 
164 //
165 // const member functions
166 //
167 
168 //
169 // static member functions
170 //
173 {
174  return std::string("simple#");
175 }
size
Write out results.
std::vector< Product * >::iterator Product_it
static const TGPicture * info(bool iBackgroundIsBlack)
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:68
std::vector< Product * > m_products
virtual bool visibilityModelChanges(const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *)
FWSimpleProxyBuilder(const std::type_info &iType)
virtual void cleanLocal()
const void * offsetObject(const void *iObj) const
int index() const
Definition: FWModelId.h:49
FWSimpleProxyHelper m_helper
virtual bool haveSingleProduct() const
size_t size() const
Definition: FWEventItem.cc:550
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:569
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
const FWEventItem * item() const
Definition: FWModelId.h:44
void itemChanged(const FWEventItem *)
virtual void itemChangedImp(const FWEventItem *)
virtual void buildViewType(const FWEventItem *iItem, TEveElementList *product, FWViewType::EType viewType, const FWViewContext *)