ClassImp(GeoNodeRnrEl)
GeoNodeRnrEl::GeoNodeRnrEl(TGeoNode* node) :
- RenderElementListBase(),
+ RenderElementListBase(),
+ TObject(),
fNode(node)
{
// Hack!! Should use cint to retrieve TAttLine::fLineColor offset.
// Checks if child-nodes have been imported ... imports them if not.
// Then calls RenderElementListBase::ExpandIntoListTree.
- if(fList.empty() && fNode->GetVolume()->GetNdaughters() > 0) {
+ if(fChildren.empty() && fNode->GetVolume()->GetNdaughters() > 0) {
TIter next(fNode->GetVolume()->GetNodes());
TGeoNode* dnode;
while((dnode = (TGeoNode*) next()) != 0) {
/**************************************************************************/
-void GeoNodeRnrEl::FullUpdate()
+void GeoNodeRnrEl::UpdateItems()
{
fRnrElement = fNode->TGeoAtt::IsVisible();
- RenderElementListBase::FullUpdate();
+ RenderElementListBase::UpdateItems();
}
/**************************************************************************/
void GeoNodeRnrEl::SetRnrElement(Bool_t rnr)
{
fNode->SetVisibility(rnr);
- FullUpdate();
+ UpdateItems();
}
/**************************************************************************/
void GeoNodeRnrEl::SetMainColor(Color_t color)
{
fNode->GetVolume()->SetLineColor(color);
- FullUpdate();
+ UpdateItems();
}
void GeoNodeRnrEl::SetMainColor(Pixel_t pixel)
// printf("%s node %s %p\n", eH.Data(), node->GetName(), node);
if(fNode == node)
- FullUpdate();
+ UpdateItems();
- for(lpRE_i i=fList.begin(); i!=fList.end(); ++i) {
+ for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
((GeoNodeRnrEl*)(*i))->UpdateNode(node);
}
// printf("%s volume %s %p\n", eH.Data(), volume->GetName(), volume);
if(fNode->GetVolume() == volume)
- FullUpdate();
+ UpdateItems();
- for(lpRE_i i=fList.begin(); i!=fList.end(); ++i) {
+ for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
((GeoNodeRnrEl*)(*i))->UpdateVolume(volume);
}
}
/**************************************************************************/
-void GeoTopNodeRnrEl::FullUpdate()
+void GeoTopNodeRnrEl::UpdateItems()
{
- RenderElementListBase::FullUpdate();
+ RenderElementListBase::UpdateItems();
}
/**************************************************************************/
gPad = pad;
TVirtualGeoPainter* vgp = fManager->GetGeomPainter();
if(vgp != 0) {
-#if ROOT_VERSION_CODE > ROOT_VERSION(5,11,7)
+#if ROOT_VERSION_CODE > ROOT_VERSION(5,11,6)
vgp->PaintNode(fNode, option, fUseNodeTrans ? fNode->GetMatrix() : fGlobalTrans);
#else
vgp->PaintNode(fNode, option);
namespace Reve {
-class GeoNodeRnrEl : public TObject, public RenderElementListBase
+class GeoNodeRnrEl : public RenderElementListBase,
+ public TObject
{
friend class GeoNodeRnrElEditor;
virtual Int_t ExpandIntoListTree(TGListTree* ltree, TGListTreeItem* parent);
- virtual void FullUpdate();
+ virtual void UpdateItems();
virtual Bool_t CanEditRnrElement() { return false; }
virtual void SetRnrElement(Bool_t rnr);
Int_t GetVisLevel() const { return fVisLevel; }
void SetVisLevel(Int_t vislvl);
- virtual void FullUpdate();
+ virtual void UpdateItems();
virtual Bool_t CanEditRnrElement() { return true; }
virtual void SetRnrElement(Bool_t rnr);
ClassImp(PointSet)
PointSet::PointSet(Int_t n_points, TreeVarType_e tv_type) :
- TPointSet3D(n_points),
RenderElement(fMarkerColor),
+ TPointSet3D(n_points),
TPointSelectorConsumer(tv_type)
{
fMarkerStyle = 20;
}
PointSet::PointSet(const Text_t* name, Int_t n_points, TreeVarType_e tv_type) :
- TPointSet3D(n_points),
RenderElement(fMarkerColor),
+ TPointSet3D(n_points),
TPointSelectorConsumer(tv_type)
{
fMarkerStyle = 20;
}
PointSet::PointSet(const Text_t* name, TTree* tree, TreeVarType_e tv_type) :
- TPointSet3D(tree->GetSelectedRows()),
RenderElement(fMarkerColor),
+ TPointSet3D(tree->GetSelectedRows()),
TPointSelectorConsumer(tv_type)
{
static const Exc_t eH("PointSet::PointSet ");
PointSetArray::PointSetArray(const Text_t* name,
const Text_t* title) :
- TNamed(name, title), RenderElementListBase(fMarkerColor),
+ RenderElementListBase(fMarkerColor),
+ TNamed(name, title),
fBins(0), fDefPointSetCapacity(128), fNBins(0)
{}
PointSetArray::~PointSetArray()
{
- DeleteBins();
+ printf("PointSetArray::~PointSetArray()\n");
+ delete [] fBins; fBins = 0;
+}
+
+void PointSetArray::RemoveElementLocal(RenderElement* el)
+{
+ for(Int_t i=0; i<fNBins; ++i) {
+ if(fBins[i] == el) {
+ fBins[i] = 0;
+ break;
+ }
+ }
+ RenderElementListBase::RemoveElementLocal(el);
+}
+
+void PointSetArray::RemoveElements()
+{
+ delete [] fBins; fBins = 0;
+ RenderElementListBase::RemoveElements();
}
/**************************************************************************/
void PointSetArray::SetMarkerColor(Color_t tcolor)
{
- for(lpRE_i i=fList.begin(); i!=fList.end(); ++i) {
+ for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
TAttMarker* m = dynamic_cast<TAttMarker*>((*i)->GetObject());
if(m && m->GetMarkerColor() == fMarkerColor)
m->SetMarkerColor(tcolor);
void PointSetArray::SetMarkerStyle(Style_t mstyle)
{
- for(lpRE_i i=fList.begin(); i!=fList.end(); ++i) {
+ for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
TAttMarker* m = dynamic_cast<TAttMarker*>((*i)->GetObject());
if(m && m->GetMarkerStyle() == fMarkerStyle)
m->SetMarkerStyle(mstyle);
void PointSetArray::SetMarkerSize(Size_t msize)
{
- for(lpRE_i i=fList.begin(); i!=fList.end(); ++i) {
+ for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
TAttMarker* m = dynamic_cast<TAttMarker*>((*i)->GetObject());
if(m && m->GetMarkerSize() == fMarkerSize)
m->SetMarkerSize(msize);
/**************************************************************************/
-void PointSetArray::InitBins(TGListTreeItem* tree_item, const Text_t* quant_name,
- Int_t nbins, Double_t min, Double_t max)
+void PointSetArray::InitBins(const Text_t* quant_name,
+ Int_t nbins, Double_t min, Double_t max,
+ Bool_t addRe)
{
static const Exc_t eH("PointSetArray::InitBins ");
if(nbins < 1) throw(eH + "nbins < 1.");
if(min > max) throw(eH + "min > max.");
- DeleteBins();
+ RemoveElements();
fQuantName = quant_name;
fNBins = nbins;
fBins[i]->SetMarkerColor(fMarkerColor);
fBins[i]->SetMarkerStyle(fMarkerStyle);
fBins[i]->SetMarkerSize(fMarkerSize);
- AddElement(fBins[i]);
- if(tree_item)
- gReve->AddRenderElement(tree_item, fBins[i]);
+ if(addRe)
+ gReve->AddRenderElement(this, fBins[i]);
+ else
+ AddElement(fBins[i]);
}
}
-void PointSetArray::DeleteBins()
-{
- if(fBins) {
- for(Int_t i=0; i<fNBins; ++i)
- delete fBins[i];
- delete [] fBins;
- fBins = 0; fNBins = 0;
- }
- RemoveElements();
-}
-
void PointSetArray::Fill(Double_t x, Double_t y, Double_t z, Double_t quant)
{
Int_t bin = Int_t( (quant - fMin)/fBinWidth );
- if(bin >= 0 && bin < fNBins)
+ if(bin >= 0 && bin < fNBins && fBins[bin] != 0)
fBins[bin]->SetNextPoint(x, y, z);
}
void PointSetArray::CloseBins()
{
for(Int_t i=0; i<fNBins; ++i) {
- // HACK! PolyMarker3D does half-management of array size.
- // In fact, the error is mine, in pointset3d(gl) i use fN instead of Size().
- // Fixed in my root, but not elsewhere.
- fBins[i]->fN = fBins[i]->fLastPoint;
- fBins[i]->ComputeBBox();
+ if(fBins[i] != 0) {
+ // HACK! PolyMarker3D does half-management of array size.
+ // In fact, the error is mine, in pointset3d(gl) i use fN instead of Size().
+ // Fixed in my root, but not elsewhere.
+ fBins[i]->fN = fBins[i]->fLastPoint;
+
+ fBins[i]->ComputeBBox();
+ }
}
}
Int_t low_b = (Int_t) Max(Double_t(0), Floor((min-fMin)/fBinWidth));
Int_t high_b = (Int_t) Min(Double_t(fNBins-1), Ceil((max-fMin)/fBinWidth));
for(Int_t i=0; i<fNBins; ++i) {
- fBins[i]->SetRnrElement(i>=low_b && i<=high_b);
+ if(fBins[i] != 0)
+ fBins[i]->SetRnrElement(i>=low_b && i<=high_b);
}
}
namespace Reve {
-class PointSet : public TPointSet3D,
- public RenderElement,
+class PointSet : public RenderElement,
+ public TPointSet3D,
public TPointSelectorConsumer
{
friend class PointSetArray;
/**************************************************************************/
-class PointSetArray : public TNamed, public TAttMarker,
- public RenderElementListBase,
- public TPointSelectorConsumer
+class PointSetArray : public RenderElementListBase,
+ public TNamed,
+ public TAttMarker,
+ public TPointSelectorConsumer
{
friend class PointSetArrayEditor;
PointSetArray(const Text_t* name="PointSetArray", const Text_t* title="");
virtual ~PointSetArray();
+ virtual void RemoveElementLocal(RenderElement* el);
+ virtual void RemoveElements();
+
virtual void Paint(Option_t* option="") { PaintElements(option); }
virtual void SetMarkerColor(Color_t tcolor=1);
virtual void TakeAction(TSelectorDraw*);
- void InitBins(TGListTreeItem* tree_item, const Text_t* quant_name,
- Int_t nbins, Double_t min, Double_t max);
- void DeleteBins();
+ void InitBins(const Text_t* quant_name, Int_t nbins, Double_t min, Double_t max,
+ Bool_t addRe=kTRUE);
void Fill(Double_t x, Double_t y, Double_t z, Double_t quant);
void CloseBins();
void GeoNodeRnrElEditor::DoVizNode()
{
fNodeRE->fNode->SetVisibility(fVizNode->IsOn());
- fNodeRE->FullUpdate();
+ fNodeRE->UpdateItems();
}
void GeoNodeRnrElEditor::DoVizNodeDaughters()
}
TrackList::TrackList(Int_t n_tracks) :
- TPolyMarker3D(n_tracks),
- RenderElementListBase()
+ RenderElementListBase(),
+ TPolyMarker3D(n_tracks)
{
Init();
}
TrackList::TrackList(const Text_t* name, Int_t n_tracks) :
- TPolyMarker3D(n_tracks),
- RenderElementListBase()
+ RenderElementListBase(),
+ TPolyMarker3D(n_tracks)
{
Init();
SetName(name);
TPolyMarker3D::Paint(option);
}
if(fRnrTracks) {
- for(lpRE_i i=fList.begin(); i!=fList.end(); ++i) {
+ for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
if((*i)->GetRnrElement())
(*i)->GetObject()->Paint(option);
}
void TrackList::MakeTracks()
{
- for(lpRE_i i=fList.begin(); i!=fList.end(); ++i) {
+ for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
((Track*)(*i))->MakeTrack();
}
gReve->Redraw3D();
void TrackList::MakeMarkers()
{
- Reset(fList.size());
- for(lpRE_i i=fList.begin(); i!=fList.end(); ++i) {
+ Reset(fChildren.size());
+ for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
Track& t = *((Track*)(*i));
if(t.GetN() > 0)
SetNextPoint(t.fV.x, t.fV.y, t.fV.z);
Float_t maxptsq = max_pt*max_pt;
Float_t ptsq;
- for(lpRE_i i=fList.begin(); i!=fList.end(); ++i) {
+ for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
ptsq = ((Track*)(*i))->fP.Perp2();
(*i)->SetRnrElement(ptsq >= minptsq && ptsq <= maxptsq);
}
void TrackList::ImportHits()
{
- for(lpRE_i i=fList.begin(); i!=fList.end(); ++i) {
+ for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
((Track*)(*i))->ImportHits();
}
}
void TrackList::ImportClusters()
{
- for(lpRE_i i=fList.begin(); i!=fList.end(); ++i) {
+ for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
((Track*)(*i))->ImportClusters();
}
}
class TrackRnrStyle;
class TrackList;
-class Track : public TPolyLine3D, public RenderElement
+class Track : public RenderElement,
+ public TPolyLine3D
{
friend class TrackList;
// TrackList
/**************************************************************************/
-class TrackList : public TPolyMarker3D, public RenderElementListBase
+class TrackList : public RenderElementListBase,
+ public TPolyMarker3D
{
private:
void Init();