CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 // $Id: FWSimpleProxyBuilder.cc,v 1.13 2010/10/22 14:34:45 amraktad Exp $
12 //
13 
14 // system include files
15 #include <memory>
16 
17 // user include files
18 #include "TEveCompound.h"
21 
22 //
23 // constants, enums and typedefs
24 //
25 
26 //
27 // static data member definitions
28 //
29 
30 //
31 // constructors and destructor
32 //
33 FWSimpleProxyBuilder::FWSimpleProxyBuilder(const std::type_info& iType) :
34  m_helper(iType)
35 {
36 }
37 
38 // FWSimpleProxyBuilder::FWSimpleProxyBuilder(const FWSimpleProxyBuilder& rhs)
39 // {
40 // // do actual copying here;
41 // }
42 
44 {
45 }
46 
47 //
48 // assignment operators
49 //
50 // const FWSimpleProxyBuilder& FWSimpleProxyBuilder::operator=(const FWSimpleProxyBuilder& rhs)
51 // {
52 // //An exception safe implementation is
53 // FWSimpleProxyBuilder temp(rhs);
54 // swap(rhs);
55 //
56 // return *this;
57 // }
58 
59 //
60 // member functions
61 //
62 
63 void
65 {
66  for (Product_it i = m_products.begin(); i != m_products.end(); ++i)
67  {
68  if ((*i)->m_elements)
69  {
70  TEveElement* elms = (*i)->m_elements;
71  for (TEveElement::List_i it = elms->BeginChildren(); it != elms->EndChildren(); ++it)
72  (*it)->DestroyElements();
73  }
74  }
75 
76  cleanLocal();
77 }
78 
79 void
81 {
82  if (iItem)
83  {
84  m_helper.itemChanged(iItem);
85  }
86 }
87 
88 void
90  TEveElementList* product, const FWViewContext* vc)
91 {
92  size_t size = iItem->size();
93  TEveElement::List_i pIdx = product->BeginChildren();
94  for (int index = 0; index < static_cast<int>(size); ++index)
95  {
96  TEveElement* itemHolder = 0;
97  if (index < product->NumChildren())
98  {
99  itemHolder = *pIdx;
100  itemHolder->SetRnrSelfChildren(true, true);
101  ++pIdx;
102  }
103  else
104  {
105  itemHolder = createCompound();
106  product->AddElement(itemHolder);
107  }
108  if (iItem->modelInfo(index).displayProperties().isVisible())
109  {
110  const void* modelData = iItem->modelData(index);
111  build(m_helper.offsetObject(modelData),index, *itemHolder, vc);
112  }
113  }
114 }
115 
116 void
118  TEveElementList* product, FWViewType::EType viewType, const FWViewContext* vc)
119 {
120  size_t size = iItem->size();
121  TEveElement::List_i pIdx = product->BeginChildren();
122  for (int index = 0; index < static_cast<int>(size); ++index)
123  {
124  TEveElement* itemHolder = 0;
125  if (index < product->NumChildren())
126  {
127  itemHolder = *pIdx;
128  itemHolder->SetRnrSelfChildren(true, true);
129  ++pIdx;
130  }
131  else
132  {
133  itemHolder = createCompound();
134  product->AddElement(itemHolder);
135  }
136  if (iItem->modelInfo(index).displayProperties().isVisible())
137  {
138  const void* modelData = iItem->modelData(index);
139  buildViewType(m_helper.offsetObject(modelData),index, *itemHolder, viewType, vc);
140  }
141  }
142 }
143 
144 
145 bool
146 FWSimpleProxyBuilder::visibilityModelChanges(const FWModelId& iId, TEveElement* iCompound,
147  FWViewType::EType viewType, const FWViewContext* vc)
148 {
149  const FWEventItem::ModelInfo& info = iId.item()->modelInfo(iId.index());
150  bool returnValue = false;
151  if (info.displayProperties().isVisible() && iCompound->NumChildren()==0)
152  {
153  const void* modelData = iId.item()->modelData(iId.index());
154  if (haveSingleProduct())
155  build(m_helper.offsetObject(modelData),iId.index(),*iCompound, vc);
156  else
157  buildViewType(m_helper.offsetObject(modelData),iId.index(),*iCompound, viewType, vc);
158  returnValue=true;
159  }
160  return returnValue;
161 }
162 
163 
164 
165 //
166 // const member functions
167 //
168 
169 //
170 // static member functions
171 //
174 {
175  return std::string("simple#");
176 }
int i
Definition: DBlmapReader.cc:9
std::vector< Product * >::iterator Product_it
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:50
FWSimpleProxyHelper m_helper
virtual bool haveSingleProduct() const
size_t size() const
Definition: FWEventItem.cc:549
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:568
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:536
const FWEventItem * item() const
Definition: FWModelId.h:45
void itemChanged(const FWEventItem *)
tuple size
Write out results.
virtual void itemChangedImp(const FWEventItem *)
virtual void buildViewType(const FWEventItem *iItem, TEveElementList *product, FWViewType::EType viewType, const FWViewContext *)