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;
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)
352 parent->AddElement(el);
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);
401 TEveElement::List_t matches;
402 holder->FindChildren(matches, name.c_str());
403 for (TEveElement::List_i
m = matches.begin();
m != matches.end(); ++
m) {
404 (*m)->SetMainTransparency(transp);
const fireworks::Context & context() const
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
const FWDisplayProperties & defaultDisplayProperties() const
const edm::EventSetup & c
const FWDisplayProperties & displayProperties() const
static std::string typeOfBuilder()
Used by the plugin system to determine how the proxy uses the data from FWEventItem.
std::vector< Product * > m_products
virtual void itemBeingDestroyed(const FWEventItem *)
virtual bool havePerViewProduct(FWViewType::EType) const
sigc::signal< void(const FWViewContext *)> scaleChanged_
const std::string & name() const
virtual bool visibilityModelChanges(const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *)
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
static bool representsSubPart()
const FWViewContext * m_viewContext
virtual void cleanLocal()
void scaleChanged(const FWViewContext *)
const FWEventItem * m_item
void added(TEveElement *, unsigned int)
const FWEventItem * item() const
constexpr std::array< uint8_t, layerIndexSize > layer
sigc::connection m_scaleConnection
TEveElementList * m_elements
virtual void localModelChanges(const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
Char_t transparency() const
Product(FWViewType::EType t, const FWViewContext *c)
std::set< FWModelId > FWModelIds
void set_color(TEveElement *element, Color_t color, float alpha, unsigned int levels)
virtual void setItem(const FWEventItem *iItem)
const fireworks::Context & context() const
void removePerViewProduct(FWViewType::EType, const FWViewContext *vc)
virtual ~FWProxyBuilderBase()
void setHaveWindow(bool iFlag)
virtual bool haveSingleProduct() const
virtual bool canHandle(const FWEventItem &)
FWInteractionList * m_interactionList
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
TEveElementList * createProduct(FWViewType::EType, const FWViewContext *)
ModelInfo modelInfo(int iIndex) const
const std::string & purpose() const
void setProjectionLayer(float)
void increaseComponentTransparency(unsigned int index, TEveElement *holder, const std::string &name, Char_t transpOffset)
FWViewType::EType m_viewType
void itemChanged(const FWEventItem *)
void modelChanges(const FWModelIds &)
virtual void setInteractionList(FWInteractionList *, const std::string &)
void setupElement(TEveElement *el, bool color=true) const