Skip to content
Snippets Groups Projects
Commit 8e0d4d0e authored by Matevz Tadel's avatar Matevz Tadel
Browse files

Implement virtual method TEveElement::CopyVizParams(element) for the

following classes: TEvePointSet, TEveLine, TEveTrack, TEveTrackList
and TEveStraightLineSet.

Implemented TEveProjectable::PropagateVizParams().

In TEveGedEditor::Update() call PropagateVizParamsToProjecteds() so
that all representation of given element receive the potential
updates.


git-svn-id: http://root.cern.ch/svn/root/trunk@24004 27541ba8-7e3a-0410-8455-c3a389f83636
parent 091c64ed
No related branches found
No related tags found
No related merge requests found
Showing with 145 additions and 39 deletions
...@@ -40,7 +40,6 @@ public: ...@@ -40,7 +40,6 @@ public:
Bool_t IsCompoundOpen() const { return fCompoundOpen > 0; } Bool_t IsCompoundOpen() const { return fCompoundOpen > 0; }
virtual void SetMainColor(Color_t color); virtual void SetMainColor(Color_t color);
virtual void PropagateVizParams();
virtual void AddElement(TEveElement* el); virtual void AddElement(TEveElement* el);
virtual void RemoveElementLocal(TEveElement* el); virtual void RemoveElementLocal(TEveElement* el);
...@@ -72,7 +71,6 @@ public: ...@@ -72,7 +71,6 @@ public:
virtual ~TEveCompoundProjected() {} virtual ~TEveCompoundProjected() {}
virtual void SetMainColor(Color_t color); virtual void SetMainColor(Color_t color);
virtual void PropagateVizParams();
// Abstract from TEveProjected, we seem not to care. // Abstract from TEveProjected, we seem not to care.
virtual void SetDepth(Float_t /*d*/) {} virtual void SetDepth(Float_t /*d*/) {}
......
...@@ -109,7 +109,7 @@ public: ...@@ -109,7 +109,7 @@ public:
const TString& GetVizTag() const { return fVizTag; } const TString& GetVizTag() const { return fVizTag; }
void SetVizTag(const TString& tag) { fVizTag = tag; } void SetVizTag(const TString& tag) { fVizTag = tag; }
virtual void PropagateVizParams(); virtual void PropagateVizParamsToProjecteds();
virtual void CopyVizParams(const TEveElement* el); virtual void CopyVizParams(const TEveElement* el);
virtual void CopyVizParamsFromDB(); virtual void CopyVizParamsFromDB();
......
...@@ -55,6 +55,8 @@ public: ...@@ -55,6 +55,8 @@ public:
Bool_t GetSmooth() const { return fSmooth; } Bool_t GetSmooth() const { return fSmooth; }
void SetSmooth(Bool_t r) { fSmooth = r; } void SetSmooth(Bool_t r) { fSmooth = r; }
virtual void CopyVizParams(const TEveElement* el);
virtual TClass* ProjectedClass() const; virtual TClass* ProjectedClass() const;
static Bool_t GetDefaultSmooth() { return fgDefaultSmooth; } static Bool_t GetDefaultSmooth() { return fgDefaultSmooth; }
......
...@@ -84,6 +84,8 @@ public: ...@@ -84,6 +84,8 @@ public:
virtual const TGPicture* GetListTreeIcon(Bool_t open=kFALSE); virtual const TGPicture* GetListTreeIcon(Bool_t open=kFALSE);
virtual void CopyVizParams(const TEveElement* el);
virtual TClass* ProjectedClass() const; virtual TClass* ProjectedClass() const;
ClassDef(TEvePointSet, 1); // Set of 3D points with same marker attributes; optionally each point can be assigned an external TRef or a number of integer indices. ClassDef(TEvePointSet, 1); // Set of 3D points with same marker attributes; optionally each point can be assigned an external TRef or a number of integer indices.
......
...@@ -56,6 +56,7 @@ public: ...@@ -56,6 +56,7 @@ public:
virtual void AddProjectedsToSet(std::set<TEveElement*>& set); virtual void AddProjectedsToSet(std::set<TEveElement*>& set);
virtual void PropagateVizParams(TEveElement* el=0);
virtual void PropagateRenderState(Bool_t rnr_self, Bool_t rnr_children); virtual void PropagateRenderState(Bool_t rnr_self, Bool_t rnr_children);
virtual void PropagateMainColor(Color_t color, Color_t old_color); virtual void PropagateMainColor(Color_t color, Color_t old_color);
......
...@@ -91,17 +91,19 @@ public: ...@@ -91,17 +91,19 @@ public:
TEveChunkManager& GetLinePlex() { return fLinePlex; } TEveChunkManager& GetLinePlex() { return fLinePlex; }
TEveChunkManager& GetMarkerPlex() { return fMarkerPlex; } TEveChunkManager& GetMarkerPlex() { return fMarkerPlex; }
virtual void ComputeBBox();
virtual void Paint(Option_t* option="");
virtual Bool_t GetRnrMarkers() { return fRnrMarkers; } virtual Bool_t GetRnrMarkers() { return fRnrMarkers; }
virtual Bool_t GetRnrLines() { return fRnrLines; } virtual Bool_t GetRnrLines() { return fRnrLines; }
virtual void SetRnrMarkers(Bool_t x) { fRnrMarkers = x; } virtual void SetRnrMarkers(Bool_t x) { fRnrMarkers = x; }
virtual void SetRnrLines(Bool_t x) { fRnrLines = x; } virtual void SetRnrLines(Bool_t x) { fRnrLines = x; }
virtual void CopyVizParams(const TEveElement* el);
virtual TClass* ProjectedClass() const; virtual TClass* ProjectedClass() const;
virtual void ComputeBBox();
virtual void Paint(Option_t* option="");
ClassDef(TEveStraightLineSet, 1); // Set of straight lines with optional markers along the lines. ClassDef(TEveStraightLineSet, 1); // Set of straight lines with optional markers along the lines.
}; };
......
...@@ -107,6 +107,8 @@ public: ...@@ -107,6 +107,8 @@ public:
virtual const TGPicture* GetListTreeIcon(Bool_t open=kFALSE); virtual const TGPicture* GetListTreeIcon(Bool_t open=kFALSE);
virtual void CopyVizParams(const TEveElement* el);
virtual TClass* ProjectedClass() const; virtual TClass* ProjectedClass() const;
ClassDef(TEveTrack, 1); // Track with given vertex, momentum and optional referece-points (path-marks) along its path. ClassDef(TEveTrack, 1); // Track with given vertex, momentum and optional referece-points (path-marks) along its path.
...@@ -193,6 +195,8 @@ public: ...@@ -193,6 +195,8 @@ public:
void ImportHits(); // *MENU* void ImportHits(); // *MENU*
void ImportClusters(); // *MENU* void ImportClusters(); // *MENU*
virtual void CopyVizParams(const TEveElement* el);
virtual TClass* ProjectedClass() const; virtual TClass* ProjectedClass() const;
ClassDef(TEveTrackList, 1); // A list of tracks supporting change of common attributes and selection based on track parameters. ClassDef(TEveTrackList, 1); // A list of tracks supporting change of common attributes and selection based on track parameters.
......
...@@ -42,6 +42,7 @@ void TEveCompound::SetMainColor(Color_t color) ...@@ -42,6 +42,7 @@ void TEveCompound::SetMainColor(Color_t color)
Color_t old_color = GetMainColor(); Color_t old_color = GetMainColor();
TEveElement::SetMainColor(color); TEveElement::SetMainColor(color);
for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i) for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
{ {
if ((*i)->GetCompound() == this && (*i)->GetMainColor() == old_color) if ((*i)->GetCompound() == this && (*i)->GetMainColor() == old_color)
...@@ -49,14 +50,6 @@ void TEveCompound::SetMainColor(Color_t color) ...@@ -49,14 +50,6 @@ void TEveCompound::SetMainColor(Color_t color)
} }
} }
//______________________________________________________________________________
void TEveCompound::PropagateVizParams()
{
// Propagate visualization parameters to dependent elements.
TEveElement::PropagateVizParams();
}
//****************************************************************************** //******************************************************************************
//______________________________________________________________________________ //______________________________________________________________________________
...@@ -161,10 +154,3 @@ void TEveCompoundProjected::SetMainColor(Color_t color) ...@@ -161,10 +154,3 @@ void TEveCompoundProjected::SetMainColor(Color_t color)
TEveElement::SetMainColor(color); TEveElement::SetMainColor(color);
} }
//______________________________________________________________________________
void TEveCompoundProjected::PropagateVizParams()
{
// Propagate visualization parameters to dependent elements.
}
...@@ -207,10 +207,15 @@ void TEveElement::SetElementNameTitle(const Text_t* name, const Text_t* title) ...@@ -207,10 +207,15 @@ void TEveElement::SetElementNameTitle(const Text_t* name, const Text_t* title)
//****************************************************************************** //******************************************************************************
//______________________________________________________________________________ //______________________________________________________________________________
void TEveElement::PropagateVizParams() void TEveElement::PropagateVizParamsToProjecteds()
{ {
// Propagate visualization parameters to dependent elements. // Propagate visualization parameters to dependent elements.
TEveProjectable* pable = dynamic_cast<TEveProjectable*>(this);
if (pable && pable->HasProjecteds())
{
pable->PropagateVizParams();
}
} }
//______________________________________________________________________________ //______________________________________________________________________________
...@@ -222,8 +227,10 @@ void TEveElement::CopyVizParams(const TEveElement* el) ...@@ -222,8 +227,10 @@ void TEveElement::CopyVizParams(const TEveElement* el)
// See, for example, TEvePointSet::CopyVizParams(), // See, for example, TEvePointSet::CopyVizParams(),
// TEveLine::CopyVizParams() and TEveTrack::CopyVizParams(). // TEveLine::CopyVizParams() and TEveTrack::CopyVizParams().
SetMainColor(el->GetMainColor()); // Color is propagate in SetMainColor().
// rnr-self/children ??? // Render state is not propagated. Maybe it should be, at least optionally.
StampObjProps();
} }
//______________________________________________________________________________ //______________________________________________________________________________
......
...@@ -19,13 +19,16 @@ ...@@ -19,13 +19,16 @@
#include "TClass.h" #include "TClass.h"
//______________________________________________________________________________ //==============================================================================
// TEveGedEditor // TEveGedEditor
//==============================================================================
//______________________________________________________________________________
// //
// Specialization of TGedEditor for proper update propagation to // Specialization of TGedEditor for proper update propagation to
// TEveManager. // TEveManager.
ClassImp(TEveGedEditor) ClassImp(TEveGedEditor);
//______________________________________________________________________________ //______________________________________________________________________________
TEveGedEditor::TEveGedEditor(TCanvas* canvas, Int_t width, Int_t height) : TEveGedEditor::TEveGedEditor(TCanvas* canvas, Int_t width, Int_t height) :
...@@ -110,6 +113,7 @@ void TEveGedEditor::Update(TGedFrame* /*gframe*/) ...@@ -110,6 +113,7 @@ void TEveGedEditor::Update(TGedFrame* /*gframe*/)
if (fElement) { if (fElement) {
fElement->ElementChanged(); fElement->ElementChanged();
fElement->PropagateVizParamsToProjecteds();
} }
gEve->Redraw3D(); gEve->Redraw3D();
......
...@@ -49,6 +49,23 @@ TEveLine::TEveLine(const Text_t* name, Int_t n_points, ETreeVarType_e tv_type) : ...@@ -49,6 +49,23 @@ TEveLine::TEveLine(const Text_t* name, Int_t n_points, ETreeVarType_e tv_type) :
fMainColorPtr = &fLineColor; fMainColorPtr = &fLineColor;
} }
//______________________________________________________________________________
void TEveLine::CopyVizParams(const TEveElement* el)
{
// Copy visualization parameters from element el.
const TEveLine* m = dynamic_cast<const TEveLine*>(el);
if (m)
{
TAttLine::operator=(*m);
fRnrLine = m->fRnrLine;
fRnrPoints = m->fRnrPoints;
fSmooth = m->fSmooth;
}
TEvePointSet::CopyVizParams(el);
}
//______________________________________________________________________________ //______________________________________________________________________________
TClass* TEveLine::ProjectedClass() const TClass* TEveLine::ProjectedClass() const
{ {
......
...@@ -316,6 +316,22 @@ void TEvePointSet::TakeAction(TEvePointSelector* sel) ...@@ -316,6 +316,22 @@ void TEvePointSet::TakeAction(TEvePointSelector* sel)
/******************************************************************************/ /******************************************************************************/
//______________________________________________________________________________
void TEvePointSet::CopyVizParams(const TEveElement* el)
{
// Copy visualization parameters from element el.
const TEvePointSet* m = dynamic_cast<const TEvePointSet*>(el);
if (m)
{
TAttMarker::operator=(*m);
fOption = m->fOption;
}
TEveElement::CopyVizParams(el);
}
//______________________________________________________________________________ //______________________________________________________________________________
TClass* TEvePointSet::ProjectedClass() const TClass* TEvePointSet::ProjectedClass() const
{ {
......
...@@ -71,6 +71,24 @@ void TEveProjectable::AddProjectedsToSet(std::set<TEveElement*>& set) ...@@ -71,6 +71,24 @@ void TEveProjectable::AddProjectedsToSet(std::set<TEveElement*>& set)
} }
} }
//==============================================================================
//______________________________________________________________________________
void TEveProjectable::PropagateVizParams(TEveElement* el)
{
// Set visualization parameters of projecteds.
// Use element el as model. If el == 0 (default), this casted to
// TEveElement is used.
if (el == 0)
el = dynamic_cast<TEveElement*>(this);
for (ProjList_i i=fProjectedList.begin(); i!=fProjectedList.end(); ++i)
{
dynamic_cast<TEveElement*>(*i)->CopyVizParams(el);
}
}
//______________________________________________________________________________ //______________________________________________________________________________
void TEveProjectable::PropagateRenderState(Bool_t rnr_self, Bool_t rnr_children) void TEveProjectable::PropagateRenderState(Bool_t rnr_self, Bool_t rnr_children)
{ {
......
...@@ -66,8 +66,6 @@ void TEveStraightLineSet::AddLine(Float_t x1, Float_t y1, Float_t z1, ...@@ -66,8 +66,6 @@ void TEveStraightLineSet::AddLine(Float_t x1, Float_t y1, Float_t z1,
fLastLine = new (fLinePlex.NewAtom()) Line_t(x1, y1, z1, x2, y2, z2); fLastLine = new (fLinePlex.NewAtom()) Line_t(x1, y1, z1, x2, y2, z2);
} }
/******************************************************************************/
//______________________________________________________________________________ //______________________________________________________________________________
void TEveStraightLineSet::AddMarker(Int_t line, Float_t pos) void TEveStraightLineSet::AddMarker(Int_t line, Float_t pos)
{ {
...@@ -78,6 +76,35 @@ void TEveStraightLineSet::AddMarker(Int_t line, Float_t pos) ...@@ -78,6 +76,35 @@ void TEveStraightLineSet::AddMarker(Int_t line, Float_t pos)
/******************************************************************************/ /******************************************************************************/
void TEveStraightLineSet::CopyVizParams(const TEveElement* el)
{
// Copy visualization parameters from element el.
const TEveStraightLineSet* m = dynamic_cast<const TEveStraightLineSet*>(el);
if (m)
{
TAttLine::operator=(*m);
TAttMarker::operator=(*m);
fRnrMarkers = m->fRnrMarkers;
fRnrLines = m->fRnrLines;
}
TEveElement::CopyVizParams(el);
}
/******************************************************************************/
//______________________________________________________________________________
TClass* TEveStraightLineSet::ProjectedClass() const
{
// Return class of projected object.
// Virtual from TEveProjectable.
return TEveStraightLineSetProjected::Class();
}
/******************************************************************************/
//______________________________________________________________________________ //______________________________________________________________________________
void TEveStraightLineSet::ComputeBBox() void TEveStraightLineSet::ComputeBBox()
{ {
...@@ -123,17 +150,6 @@ void TEveStraightLineSet::Paint(Option_t* /*option*/) ...@@ -123,17 +150,6 @@ void TEveStraightLineSet::Paint(Option_t* /*option*/)
Error(eH, "only direct GL rendering supported."); Error(eH, "only direct GL rendering supported.");
} }
/******************************************************************************/
//______________________________________________________________________________
TClass* TEveStraightLineSet::ProjectedClass() const
{
// Return class of projected object.
// Virtual from TEveProjectable.
return TEveStraightLineSetProjected::Class();
}
//============================================================================== //==============================================================================
//============================================================================== //==============================================================================
......
...@@ -368,6 +368,16 @@ void TEveTrack::MakeTrack(Bool_t recurse) ...@@ -368,6 +368,16 @@ void TEveTrack::MakeTrack(Bool_t recurse)
/******************************************************************************/ /******************************************************************************/
//______________________________________________________________________________
void TEveTrack::CopyVizParams(const TEveElement* el)
{
// Copy visualization parameters from element el.
// No local parameters.
TEveLine::CopyVizParams(el);
}
//______________________________________________________________________________ //______________________________________________________________________________
TClass* TEveTrack::ProjectedClass() const TClass* TEveTrack::ProjectedClass() const
{ {
...@@ -1140,6 +1150,29 @@ void TEveTrackList::ImportClusters() ...@@ -1140,6 +1150,29 @@ void TEveTrackList::ImportClusters()
/******************************************************************************/ /******************************************************************************/
//______________________________________________________________________________
void TEveTrackList::CopyVizParams(const TEveElement* el)
{
// Copy visualization parameters from element el.
const TEveTrackList* m = dynamic_cast<const TEveTrackList*>(el);
if (m)
{
TAttMarker::operator=(*m);
TAttLine::operator=(*m);
fRecurse = m->fRecurse;
fRnrLine = m->fRnrLine;
fMinPt = m->fMinPt;
fMaxPt = m->fMaxPt;
fLimPt = m->fLimPt;
fMinP = m->fMinP;
fMaxP = m->fMaxP;
fLimP = m->fLimP;
}
TEveElement::CopyVizParams(el);
}
//______________________________________________________________________________ //______________________________________________________________________________
TClass* TEveTrackList::ProjectedClass() const TClass* TEveTrackList::ProjectedClass() const
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment