00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TEveProjectionBases.h"
00013 #include "TEveProjectionManager.h"
00014 #include "TEveManager.h"
00015
00016 #include <cassert>
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 ClassImp(TEveProjectable);
00037
00038
00039 TEveProjectable::TEveProjectable()
00040 {
00041
00042 }
00043
00044
00045 TEveProjectable::~TEveProjectable()
00046 {
00047
00048
00049
00050 while ( ! fProjectedList.empty())
00051 {
00052 TEveProjected* p = fProjectedList.front();
00053 p->UnRefProjectable(this);
00054 TEveElement* el = p->GetProjectedAsElement();
00055 assert(el);
00056 {
00057 gEve->PreDeleteElement(el);
00058 delete el;
00059 }
00060 }
00061 }
00062
00063
00064 void TEveProjectable::AnnihilateProjecteds()
00065 {
00066
00067
00068
00069
00070 for (ProjList_i i=fProjectedList.begin(); i!=fProjectedList.end(); ++i)
00071 {
00072 (*i)->UnRefProjectable(this, kFALSE);
00073 (*i)->GetProjectedAsElement()->Annihilate();
00074 }
00075 fProjectedList.clear();
00076 }
00077
00078
00079 void TEveProjectable::ClearProjectedList()
00080 {
00081 fProjectedList.clear();
00082 }
00083
00084
00085 void TEveProjectable::AddProjectedsToSet(std::set<TEveElement*>& set)
00086 {
00087
00088
00089
00090 for (ProjList_i i=fProjectedList.begin(); i!=fProjectedList.end(); ++i)
00091 {
00092 set.insert((*i)->GetProjectedAsElement());
00093 }
00094 }
00095
00096
00097
00098
00099 void TEveProjectable::PropagateVizParams(TEveElement* el)
00100 {
00101
00102
00103
00104
00105 if (el == 0)
00106 el = dynamic_cast<TEveElement*>(this);
00107
00108 for (ProjList_i i=fProjectedList.begin(); i!=fProjectedList.end(); ++i)
00109 {
00110 (*i)->GetProjectedAsElement()->CopyVizParams(el);
00111 }
00112 }
00113
00114
00115 void TEveProjectable::PropagateRenderState(Bool_t rnr_self, Bool_t rnr_children)
00116 {
00117
00118
00119 for (ProjList_i i=fProjectedList.begin(); i!=fProjectedList.end(); ++i)
00120 {
00121 if ((*i)->GetProjectedAsElement()->SetRnrSelfChildren(rnr_self, rnr_children))
00122 (*i)->GetProjectedAsElement()->ElementChanged();
00123 }
00124 }
00125
00126
00127 void TEveProjectable::PropagateMainColor(Color_t color, Color_t old_color)
00128 {
00129
00130
00131 for (ProjList_i i=fProjectedList.begin(); i!=fProjectedList.end(); ++i)
00132 {
00133 if ((*i)->GetProjectedAsElement()->GetMainColor() == old_color)
00134 (*i)->GetProjectedAsElement()->SetMainColor(color);
00135 }
00136 }
00137
00138
00139 void TEveProjectable::PropagateMainTransparency(Char_t t, Char_t old_t)
00140 {
00141
00142
00143
00144 for (ProjList_i i=fProjectedList.begin(); i!=fProjectedList.end(); ++i)
00145 {
00146 if ((*i)->GetProjectedAsElement()->GetMainTransparency() == old_t)
00147 (*i)->GetProjectedAsElement()->SetMainTransparency(t);
00148 }
00149 }
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 ClassImp(TEveProjected);
00166
00167
00168 TEveProjected::TEveProjected() :
00169 fManager (0),
00170 fProjectable (0),
00171 fDepth (0)
00172 {
00173
00174 }
00175
00176
00177 TEveProjected::~TEveProjected()
00178 {
00179
00180
00181
00182
00183 if (fProjectable) fProjectable->RemoveProjected(this);
00184 }
00185
00186
00187 TEveElement* TEveProjected::GetProjectedAsElement()
00188 {
00189
00190
00191 return dynamic_cast<TEveElement*>(this);
00192 }
00193
00194
00195 void TEveProjected::SetProjection(TEveProjectionManager* mng, TEveProjectable* model)
00196 {
00197
00198
00199
00200
00201 fManager = mng;
00202 if (fProjectable) fProjectable->RemoveProjected(this);
00203 fProjectable = model;
00204 if (fProjectable) fProjectable->AddProjected(this);
00205 }
00206
00207
00208 void TEveProjected::UnRefProjectable(TEveProjectable* assumed_parent, bool notifyParent)
00209 {
00210
00211
00212 static const TEveException eH("TEveProjected::UnRefProjectable ");
00213
00214 assert(fProjectable == assumed_parent);
00215
00216 if (notifyParent) fProjectable->RemoveProjected(this);
00217 fProjectable = 0;
00218 }
00219
00220
00221 void TEveProjected::SetDepth(Float_t d)
00222 {
00223
00224
00225
00226
00227 if (fManager->GetProjection()->Is2D())
00228 {
00229 SetDepthLocal(d);
00230 }
00231 else
00232 {
00233 fDepth = d;
00234 }
00235 }
00236
00237
00238 void TEveProjected::SetDepthCommon(Float_t d, TEveElement* el, Float_t* bbox)
00239 {
00240
00241
00242
00243
00244 Float_t delta = d - fDepth;
00245 fDepth = d;
00246 if (bbox) {
00247 bbox[4] += delta;
00248 bbox[5] += delta;
00249 el->StampTransBBox();
00250 }
00251 }
00252
00253
00254 void TEveProjected::SetDepthLocal(Float_t d)
00255 {
00256
00257
00258 fDepth = d;
00259 }