18 #include "TEveElement.h" 19 #include "TEveCompound.h" 20 #include "TEveManager.h" 21 #include "TEveProjectionManager.h" 22 #include "TEveSelection.h" 44 : m_viewType(
t), m_viewContext(
c), m_elements(nullptr) {
45 m_elements =
new TEveElementList(
"ProxyProduct");
51 TEveProjectable* pable =
dynamic_cast<TEveProjectable*
>(m_elements);
53 for (TEveProjectable::ProjList_i
i = pable->BeginProjecteds();
i != pable->EndProjecteds(); ++
i) {
54 TEveElement* projected = (*i)->GetProjectedAsElement();
55 (*projected->BeginParents())->RemoveElement(projected);
59 while (m_elements->HasParents()) {
60 TEveElement*
parent = *m_elements->BeginParents();
61 parent->RemoveElement(m_elements);
64 m_elements->Annihilate();
89 if (iFlag && !oldValue) {
103 (*i)->m_scaleConnection.disconnect();
118 TEveElementList* elms = (*i)->m_elements;
119 size_t oldSize = elms->NumChildren();
130 TEveProjectable* pable =
dynamic_cast<TEveProjectable*
>(elms);
131 if (pable->HasProjecteds()) {
133 for (TEveProjectable::ProjList_i
i = pable->BeginProjecteds();
i != pable->EndProjecteds(); ++
i) {
134 TEveProjectionManager* pmgr = (*i)->GetManager();
135 Float_t oldDepth = pmgr->GetCurrentDepth();
139 TEveElement* projectedAsElement = (*i)->GetProjectedAsElement();
140 TEveElement::List_i parentIt = projectedAsElement->BeginChildren();
141 for (TEveElement::List_i prodIt = elms->BeginChildren(); prodIt != elms->EndChildren(); ++prodIt, ++cnt) {
144 if ((*parentIt)->NumChildren()) {
146 for (TEveElement::List_i pci = (*parentIt)->BeginChildren(); pci != (*parentIt)->EndChildren(); pci++)
147 pmgr->ProjectChildrenRecurse(*parentIt);
150 pmgr->SubImportChildren(*prodIt, *parentIt);
154 }
else if (cnt < itemSize) {
156 pmgr->SubImportElements(*prodIt, projectedAsElement);
161 pmgr->SetCurrentDepth(oldDepth);
166 TEveElement::List_i elIt = elms->BeginChildren();
167 for (
size_t cnt = 0; cnt < itemSize; ++cnt, ++elIt) {
173 }
catch (
const std::runtime_error& iException) {
175 << iException.what() << std::endl;
184 TEveElementList* elms =
p->m_elements;
186 "can not use default modelChanges implementation");
188 TEveElement::List_i itElement = elms->BeginChildren();
190 for (FWModelIds::const_iterator
it = iIds.begin(), itEnd = iIds.end();
it != itEnd; ++
it, ++itElement, ++
index) {
191 assert(itElement != elms->EndChildren());
192 while (index < it->
index()) {
195 assert(itElement != elms->EndChildren());
198 elms->ProjectChild(*itElement);
245 if (viewType == (*i)->m_viewType)
246 return (*i)->m_elements;
272 if ((*i)->m_elements)
273 (*i)->m_elements->DestroyElements();
275 if ((*i)->m_viewContext)
276 (*i)->m_scaleConnection.disconnect();
308 scaleProduct((*i)->m_elements, (*i)->m_viewType, (*i)->m_viewContext);
317 if ((*i)->m_elements)
318 (*i)->m_elements->DestroyElements();
330 "virtual build(const FWEventItem*, TEveElementList*, const FWViewContext*) not implemented by inherited class");
335 "virtual buildViewType(const FWEventItem*, TEveElementList*, FWViewType::EType, const FWViewContext*) not " 336 "implemented by inherited class");
342 TEveProjectable* pable =
static_cast<TEveProjectable*
>((*pIt)->m_elements);
343 for (TEveProjectable::ProjList_i
i = pable->BeginProjecteds();
i != pable->EndProjecteds(); ++
i)
359 el->CSCTakeAnyParentAsMaster();
360 el->SetPickable(
true);
363 el->CSCApplyMainColorToMatchingChildren();
364 el->CSCApplyMainTransparencyToMatchingChildren();
375 TEveCompound*
c =
new TEveCompound();
376 c->CSCTakeAnyParentAsMaster();
377 c->CSCImplySelectAllChildren();
378 c->SetPickable(
true);
383 if (propagate_color_to_all_children) {
384 c->CSCApplyMainColorToAllChildren();
385 c->CSCApplyMainTransparencyToAllChildren();
387 c->CSCApplyMainColorToMatchingChildren();
388 c->CSCApplyMainTransparencyToMatchingChildren();
396 Char_t transpOffset) {
400 Char_t transp =
TMath::Min(100, transpOffset + (100 - transpOffset) * transparency / 100);
404 (*m)->SetMainTransparency(transp);
virtual void buildViewType(const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
virtual void scaleProduct(TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
std::vector< Product * >::iterator Product_it
static std::string typeOfBuilder()
Used by the plugin system to determine how the proxy uses the data from FWEventItem.
std::vector< Product * > m_products
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
virtual void itemBeingDestroyed(const FWEventItem *)
sigc::signal< void(const FWViewContext *)> scaleChanged_
virtual bool visibilityModelChanges(const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *)
Char_t transparency() const
static bool representsSubPart()
virtual void cleanLocal()
virtual bool haveSingleProduct() const
void scaleChanged(const FWViewContext *)
const FWDisplayProperties & displayProperties() const
const FWEventItem * m_item
void added(TEveElement *, unsigned int)
const fireworks::Context & context() const
sigc::connection m_scaleConnection
TEveElementList * m_elements
const fireworks::Context & context() const
virtual void localModelChanges(const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
Product(FWViewType::EType t, const FWViewContext *c)
std::set< FWModelId > FWModelIds
void set_color(TEveElement *element, Color_t color, float alpha, unsigned int levels)
const FWDisplayProperties & defaultDisplayProperties() const
virtual void setItem(const FWEventItem *iItem)
void removePerViewProduct(FWViewType::EType, const FWViewContext *vc)
void setupElement(TEveElement *el, bool color=true) const
virtual ~FWProxyBuilderBase()
void setHaveWindow(bool iFlag)
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
virtual bool canHandle(const FWEventItem &)
const std::string & name() const
FWInteractionList * m_interactionList
const std::string & purpose() const
virtual bool havePerViewProduct(FWViewType::EType) const
TEveElementList * createProduct(FWViewType::EType, const FWViewContext *)
ModelInfo modelInfo(int iIndex) const
const FWEventItem * item() const
void setProjectionLayer(float)
void increaseComponentTransparency(unsigned int index, TEveElement *holder, const std::string &name, Char_t transpOffset)
void itemChanged(const FWEventItem *)
void modelChanges(const FWModelIds &)
virtual void setInteractionList(FWInteractionList *, const std::string &)