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