Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <memory>
00016
00017
00018 #include "TEveCompound.h"
00019 #include "Fireworks/Core/interface/FWSimpleProxyBuilder.h"
00020 #include "Fireworks/Core/interface/FWEventItem.h"
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 FWSimpleProxyBuilder::FWSimpleProxyBuilder(const std::type_info& iType) :
00034 m_helper(iType)
00035 {
00036 }
00037
00038
00039
00040
00041
00042
00043 FWSimpleProxyBuilder::~FWSimpleProxyBuilder()
00044 {
00045 }
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 void
00064 FWSimpleProxyBuilder::clean()
00065 {
00066 for (Product_it i = m_products.begin(); i != m_products.end(); ++i)
00067 {
00068 if ((*i)->m_elements)
00069 {
00070 TEveElement* elms = (*i)->m_elements;
00071 for (TEveElement::List_i it = elms->BeginChildren(); it != elms->EndChildren(); ++it)
00072 (*it)->DestroyElements();
00073 }
00074 }
00075
00076 cleanLocal();
00077 }
00078
00079 void
00080 FWSimpleProxyBuilder::itemChangedImp(const FWEventItem* iItem)
00081 {
00082 if (iItem)
00083 {
00084 m_helper.itemChanged(iItem);
00085 }
00086 }
00087
00088 void
00089 FWSimpleProxyBuilder::build(const FWEventItem* iItem,
00090 TEveElementList* product, const FWViewContext* vc)
00091 {
00092 size_t size = iItem->size();
00093 TEveElement::List_i pIdx = product->BeginChildren();
00094 for (int index = 0; index < static_cast<int>(size); ++index)
00095 {
00096 TEveElement* itemHolder = 0;
00097 if (index < product->NumChildren())
00098 {
00099 itemHolder = *pIdx;
00100 itemHolder->SetRnrSelfChildren(true, true);
00101 ++pIdx;
00102 }
00103 else
00104 {
00105 itemHolder = createCompound();
00106 product->AddElement(itemHolder);
00107 }
00108 if (iItem->modelInfo(index).displayProperties().isVisible())
00109 {
00110 const void* modelData = iItem->modelData(index);
00111 build(m_helper.offsetObject(modelData),index, *itemHolder, vc);
00112 }
00113 }
00114 }
00115
00116 void
00117 FWSimpleProxyBuilder::buildViewType(const FWEventItem* iItem,
00118 TEveElementList* product, FWViewType::EType viewType, const FWViewContext* vc)
00119 {
00120 size_t size = iItem->size();
00121 TEveElement::List_i pIdx = product->BeginChildren();
00122 for (int index = 0; index < static_cast<int>(size); ++index)
00123 {
00124 TEveElement* itemHolder = 0;
00125 if (index < product->NumChildren())
00126 {
00127 itemHolder = *pIdx;
00128 itemHolder->SetRnrSelfChildren(true, true);
00129 ++pIdx;
00130 }
00131 else
00132 {
00133 itemHolder = createCompound();
00134 product->AddElement(itemHolder);
00135 }
00136 if (iItem->modelInfo(index).displayProperties().isVisible())
00137 {
00138 const void* modelData = iItem->modelData(index);
00139 buildViewType(m_helper.offsetObject(modelData),index, *itemHolder, viewType, vc);
00140 }
00141 }
00142 }
00143
00144
00145 bool
00146 FWSimpleProxyBuilder::visibilityModelChanges(const FWModelId& iId, TEveElement* iCompound,
00147 FWViewType::EType viewType, const FWViewContext* vc)
00148 {
00149 const FWEventItem::ModelInfo& info = iId.item()->modelInfo(iId.index());
00150 bool returnValue = false;
00151 if (info.displayProperties().isVisible() && iCompound->NumChildren()==0)
00152 {
00153 const void* modelData = iId.item()->modelData(iId.index());
00154 if (haveSingleProduct())
00155 build(m_helper.offsetObject(modelData),iId.index(),*iCompound, vc);
00156 else
00157 buildViewType(m_helper.offsetObject(modelData),iId.index(),*iCompound, viewType, vc);
00158 returnValue=true;
00159 }
00160 return returnValue;
00161 }
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 std::string
00173 FWSimpleProxyBuilder::typeOfBuilder()
00174 {
00175 return std::string("simple#");
00176 }