using namespace Reve;
-//______________________________________________________________________
+//______________________________________________________________________________
// BoxSet
//
+// A collection of 3D-boxes. The way how the boxes are defined depends
+// on the fBoxType data-member.
+// BT_FreeBox arbitrary box: specify 8*(x,y,z) box corners
+// BT_AABox axis-aligned box: specify (x,y,z) and (w, h, d)
+// BT_AABoxFixedDim axis-aligned box w/ fixed dimensions: specify (x,y,z)
+// also set fDefWidth, fDefHeight and fDefDepth
+//
+// Each box can be assigned:
+// a) Color or signal value. Thresholds and signal-to-color mapping
+// can then be set dynamically via the RGBAPalette class.
+// b) External TObject* (stored as TRef).
+//
+// See also base-class DigitSet for more information.
ClassImp(BoxSet)
+//______________________________________________________________________________
BoxSet::BoxSet(const Text_t* n, const Text_t* t) :
DigitSet (n, t),
fDefHeight (1),
fDefDepth (1)
{
+ // Constructor.
+
// Override from DigitSet.
fDisableLigting = kFALSE;
}
/**************************************************************************/
+//______________________________________________________________________________
Int_t BoxSet::SizeofAtom(BoxSet::BoxType_e bt)
{
+ // Return size of data-structure describing a box of type bt.
+
static const Exc_t eH("BoxSet::SizeofAtom ");
switch (bt) {
/**************************************************************************/
+//______________________________________________________________________________
void BoxSet::Reset(BoxSet::BoxType_e boxType, Bool_t valIsCol, Int_t chunkSize)
{
+ // Reset the data containers to zero size.
+ // The arguments describe the basic parameters of data storage.
+
fBoxType = boxType;
fValueIsColor = valIsCol;
fDefaultValue = valIsCol ? 0 : kMinInt;
fPlex.Reset(SizeofAtom(fBoxType), chunkSize);
}
+//______________________________________________________________________________
void BoxSet::Reset()
{
+ // Reset the data containers to zero size.
+ // Keep the old data-storage parameters.
+
if (fOwnIds)
ReleaseIds();
fPlex.Reset(SizeofAtom(fBoxType), TMath::Max(fPlex.N(), 64));
/**************************************************************************/
+//______________________________________________________________________________
void BoxSet::AddBox(const Float_t* verts)
{
// Create a new box from a set of 8 vertices.
memcpy(b->fVertices, verts, sizeof(b->fVertices));
}
+//______________________________________________________________________________
void BoxSet::AddBox(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h, Float_t d)
{
// Create a new axis-aligned box from at a given position and with
box->fW = w; box->fH = h; box->fD = d;
}
+//______________________________________________________________________________
void BoxSet::AddBox(Float_t a, Float_t b, Float_t c)
{
// Create a new axis-aligned box from at a given position.
/**************************************************************************/
+//______________________________________________________________________________
void BoxSet::ComputeBBox()
{
// Fill bounding-box information of the base-class TAttBBox (virtual method).
fBBox[0], fBBox[1], fBBox[2], fBBox[3], fBBox[4], fBBox[5]);
}
-/*
-void BoxSet::Paint(Option_t* option)
-{
- TBuffer3D buff(TBuffer3DTypes::kGeneric);
-
- // Section kCore
- buff.fID = this;
- buff.fColor = 1;
- buff.fTransparency = 0;
- fHMTrans.SetBuffer3D(buff);
- buff.SetSectionsValid(TBuffer3D::kCore);
-
- Int_t reqSections = gPad->GetViewer3D()->AddObject(buff);
- if (reqSections == TBuffer3D::kNone) {
- // printf("BoxSet::Paint viewer was happy with Core buff3d.\n");
- return;
- }
-
- if (reqSections & TBuffer3D::kRawSizes) {
- Int_t nbPnts = fBoxes.size()*8;
- Int_t nbSegs = fBoxes.size()*12;
- Int_t nbPoly = fBoxes.size()*6;
- if (!buff.SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPoly, nbPoly*6)) {
- return;
- }
- buff.SetSectionsValid(TBuffer3D::kRawSizes);
- }
-
- if ((reqSections & TBuffer3D::kRaw) && buff.SectionsValid(TBuffer3D::kRawSizes)) {
- // Points
- Int_t pidx = 0;
- for (std::vector<Box>::iterator i=fBoxes.begin(); i!=fBoxes.end(); ++i) {
- for (Int_t k=0; k<24; ++k) {
- buff.fPnts[pidx] = (*i).vertices[k];
- pidx++;
- }
- }
- Int_t c = 2; // color; !!! wrong
- Int_t eoff; // polygon or segment offset in fPols and fSegs array
- Int_t voff; // vertex offset
- Int_t soff; // offset in counting segments
- Int_t nspp = 4; // number of segments per polygon
-
- // Segments & Polygons
- for (Int_t q = 0; q < (Int_t)fBoxes.size(); ++q) {
- eoff = q*36;
- soff = q*12;
- voff = q*8;
- //bottom
- buff.fSegs[ 0 + eoff] = c; buff.fSegs[ 1 + eoff] = 0 + voff; buff.fSegs[ 2 + eoff] = 1 + voff;
- buff.fSegs[ 3 + eoff] = c; buff.fSegs[ 4 + eoff] = 1 + voff; buff.fSegs[ 5 + eoff] = 2 + voff;
- buff.fSegs[ 6 + eoff] = c; buff.fSegs[ 7 + eoff] = 2 + voff; buff.fSegs[ 8 + eoff] = 3 + voff;
- buff.fSegs[ 9 + eoff] = c; buff.fSegs[10 + eoff] = 3 + voff; buff.fSegs[11 + eoff] = 0 + voff;
- // top
- buff.fSegs[12 + eoff] = c; buff.fSegs[13 + eoff] = 4 + voff; buff.fSegs[14 + eoff] = 5 + voff;
- buff.fSegs[15 + eoff] = c; buff.fSegs[16 + eoff] = 5 + voff; buff.fSegs[17 + eoff] = 6 + voff;
- buff.fSegs[18 + eoff] = c; buff.fSegs[19 + eoff] = 6 + voff; buff.fSegs[20 + eoff] = 7 + voff;
- buff.fSegs[21 + eoff] = c; buff.fSegs[22 + eoff] = 7 + voff; buff.fSegs[23 + eoff] = 4 + voff;
- //sides
- buff.fSegs[24 + eoff] = c; buff.fSegs[25 + eoff] = 0 + voff; buff.fSegs[26 + eoff] = 4 + voff;
- buff.fSegs[27 + eoff] = c; buff.fSegs[28 + eoff] = 1 + voff; buff.fSegs[29 + eoff] = 5 + voff;
- buff.fSegs[30 + eoff] = c; buff.fSegs[31 + eoff] = 2 + voff; buff.fSegs[32 + eoff] = 6 + voff;
- buff.fSegs[33 + eoff] = c; buff.fSegs[34 + eoff] = 3 + voff; buff.fSegs[35 + eoff] = 7 + voff;
-
- buff.fPols[ 0 + eoff] = c; buff.fPols[ 1 + eoff] = nspp;
- buff.fPols[ 2 + eoff] = 0 + soff; buff.fPols[ 3 + eoff] = 9 + soff;
- buff.fPols[ 4 + eoff] = 4 + soff; buff.fPols[ 5 + eoff] = 8 + soff;
- buff.fPols[ 6 + eoff] = c; buff.fPols[ 7 + eoff] = nspp;
- buff.fPols[ 8 + eoff] = 1 + soff; buff.fPols[ 9 + eoff] = 10 + soff;
- buff.fPols[10 + eoff] = 5 + soff; buff.fPols[11 + eoff] = 9 + soff;
- buff.fPols[12 + eoff] = c; buff.fPols[13 + eoff] = nspp;
- buff.fPols[14 + eoff] = 2 + soff; buff.fPols[15 + eoff] = 11 + soff;
- buff.fPols[16 + eoff] = 6 + soff; buff.fPols[17 + eoff] = 10 + soff;
- buff.fPols[18 + eoff] = c; buff.fPols[19 + eoff] = nspp;
- buff.fPols[20 + eoff] = 3 + soff; buff.fPols[21 + eoff] = 8 + soff;
- buff.fPols[22 + eoff] = 7 + soff; buff.fPols[23 + eoff] = 11 + soff;
- buff.fPols[24 + eoff] = c; buff.fPols[25 + eoff] = nspp;
- buff.fPols[26 + eoff] = 0 + soff; buff.fPols[27 + eoff] = 3 + soff;
- buff.fPols[28 + eoff] = 2 + soff; buff.fPols[29 + eoff] = 1 + soff;
- buff.fPols[30 + eoff] = c; buff.fPols[31 + eoff] = nspp;
- buff.fPols[32 + eoff] = 4 + soff; buff.fPols[33 + eoff] = 5 + soff;
- buff.fPols[34 + eoff] = 6 + soff; buff.fPols[35 + eoff] = 7 + soff;
- }
- buff.fColor = 2; // colors on polygons are ignored
- buff.SetSectionsValid(TBuffer3D::kRaw);
- }
- gPad->GetViewer3D()->AddObject(buff);
-}
-*/
-
/**************************************************************************/
+//______________________________________________________________________________
void BoxSet::Test(Int_t nboxes)
{
+ // Fill the structure with a random set of boxes.
+
Reset(BT_AABox, kTRUE, nboxes);
TRandom rnd(0);
const Float_t origin = 10, size = 2;
struct BOrigin : public DigitBase { Float_t fA, fB, fC; };
- struct BAABox : public BOrigin { Float_t fW, fH, fD; };
+ struct BAABox : public BOrigin { Float_t fW, fH, fD; };
struct BAABoxFixedDim : public BOrigin {};
protected:
- BoxType_e fBoxType;
+ BoxType_e fBoxType; // Type of rendered box.
- Float_t fDefWidth; // Breadth assigned to first coordinate (A)
- Float_t fDefHeight; // Breadth assigned to second coordinate (B)
- Float_t fDefDepth; // Breadth assigned to third coordinate (C)
+ Float_t fDefWidth; // Breadth assigned to first coordinate (A).
+ Float_t fDefHeight; // Breadth assigned to second coordinate (B).
+ Float_t fDefDepth; // Breadth assigned to third coordinate (C).
static Int_t SizeofAtom(BoxType_e bt);
void SetDefHeight(Float_t v) { fDefHeight = v ; }
void SetDefDepth(Float_t v) { fDefDepth = v ; }
- ClassDef(BoxSet, 1);
+ ClassDef(BoxSet, 1); // Visual class showing a set of boxes.
}; // endclass BoxSet
}
using namespace Reve;
-//______________________________________________________________________
+//______________________________________________________________________________
// BoxSetGL
//
+// A GL rendering class for BoxSet.
+//
ClassImp(BoxSetGL)
+//______________________________________________________________________________
BoxSetGL::BoxSetGL() : fM(0), fBoxDL(0)
{
+ // Default constructor.
+
// fDLCache = false; // Disable display list.
}
+//______________________________________________________________________________
BoxSetGL::~BoxSetGL()
-{}
+{
+ // Destructor. Noop.
+}
/**************************************************************************/
// Protected methods
/**************************************************************************/
+//______________________________________________________________________________
Int_t BoxSetGL::PrimitiveType() const
{
+ // Return GL primitive used to render the boxes, based on the
+ // render-mode specified in the model object.
+
return (fM->fRenderMode != DigitSet::RM_Line) ? GL_QUADS : GL_LINE_LOOP;
}
+//______________________________________________________________________________
inline Bool_t BoxSetGL::SetupColor(const DigitSet::DigitBase& q) const
{
+ // Set GL color for given primitive.
+
if (fM->fValueIsColor)
{
glColor4ubv((UChar_t*) & q.fValue);
}
}
-void BoxSetGL::MakeOriginBox(Float_t* p, Float_t dx, Float_t dy, Float_t dz) const
+//______________________________________________________________________________
+void BoxSetGL::MakeOriginBox(Float_t p[24], Float_t dx, Float_t dy, Float_t dz) const
{
+ // Fill array p to represent a box (0,0,0) - (dx,dy,dz).
+
// bottom
p[0] = 0; p[1] = dy; p[2] = 0; p += 3;
p[0] = dx; p[1] = dy; p[2] = 0; p += 3;
p[0] = 0; p[1] = 0; p[2] = dz;
}
-inline void BoxSetGL::RenderBox(const Float_t* p) const
+//______________________________________________________________________________
+inline void BoxSetGL::RenderBox(const Float_t p[24]) const
{
+ // Render a box specified by points in array p.
+
// bottom: 0123
glNormal3f(0, 0, -1);
glVertex3fv(p); glVertex3fv(p + 3);
glVertex3fv(p + 18); glVertex3fv(p + 6);
}
+//______________________________________________________________________________
void BoxSetGL::MakeDisplayList() const
{
+ // Create a display-list for rendering a single box, based on the
+ // current box-type.
+ // Some box-types don't benefit from the display-list rendering and
+ // so display-list is not created.
+
if (fM->fBoxType == BoxSet::BT_AABox ||
fM->fBoxType == BoxSet::BT_AABoxFixedDim)
{
// Virtuals from base-classes
/**************************************************************************/
+//______________________________________________________________________________
Bool_t BoxSetGL::ShouldDLCache(const TGLRnrCtx & rnrCtx) const
{
+ // Determines if display-list will be used for rendering.
+ // Virtual from TGLLogicalShape.
+
MakeDisplayList();
if (rnrCtx.DrawPass() == TGLRnrCtx::kPassOutlineLine)
return TGLObject::ShouldDLCache(rnrCtx);
}
+//______________________________________________________________________________
void BoxSetGL::DLCacheDrop()
{
+ // Called when display lists have been destroyed externally and the
+ // internal display-list data needs to be cleare.
+ // Virtual from TGLLogicalShape.
+
fBoxDL = 0;
TGLObject::DLCacheDrop();
}
+//______________________________________________________________________________
void BoxSetGL::DLCachePurge()
{
+ // Called when display-lists need to be returned to the system.
+ // Virtual from TGLLogicalShape.
+
static const Exc_t eH("BoxSetGL::DLCachePurge ");
if (fBoxDL == 0) return;
/**************************************************************************/
+//______________________________________________________________________________
Bool_t BoxSetGL::SetModel(TObject* obj, const Option_t* /*opt*/)
{
+ // Set model object.
+ // Virtual from TGLObject.
+
Bool_t isok = SetModelCheckClass(obj, Reve::BoxSet::Class());
fM = isok ? dynamic_cast<Reve::BoxSet*>(obj) : 0;
return isok;
}
+//______________________________________________________________________________
void BoxSetGL::SetBBox()
{
+ // Fill the bounding-box data of the logical-shape.
+ // Virtual from TGLObject.
+
SetAxisAlignedBBox(fM->AssertBBox());
}
+//______________________________________________________________________________
void BoxSetGL::DirectDraw(TGLRnrCtx & rnrCtx) const
{
+ // Actual rendering code.
+ // Virtual from TGLLogicalShape.
+
static const Exc_t eH("BoxSetGL::DirectDraw ");
if (rnrCtx.DrawPass() == TGLRnrCtx::kPassOutlineLine)
glPopAttrib();
}
-/**************************************************************************/
/**************************************************************************/
//______________________________________________________________________________
fM->DigitSelected(rec.GetItem(1));
}
+//______________________________________________________________________________
void BoxSetGL::Render(TGLRnrCtx & rnrCtx)
{
- // Interface for direct rendering from classes that include BoxSet as a member.
+ // Interface for direct rendering from classes that include BoxSet
+ // as a member.
MakeDisplayList();
DirectDraw(rnrCtx);
BoxSetGL& operator=(const BoxSetGL&); // Not implemented
protected:
- BoxSet* fM;
+ BoxSet* fM; // Model object.
- mutable UInt_t fBoxDL;
+ mutable UInt_t fBoxDL; // Display-list id for a box atom.
virtual void DirectDraw(TGLRnrCtx & rnrCtx) const;
Int_t PrimitiveType() const;
Bool_t SetupColor(const DigitSet::DigitBase& q) const;
- void MakeOriginBox(Float_t* p, Float_t dx, Float_t dy, Float_t dz) const;
- void RenderBox(const Float_t* p) const;
+ void MakeOriginBox(Float_t p[24], Float_t dx, Float_t dy, Float_t dz) const;
+ void RenderBox(const Float_t p[24]) const;
void MakeDisplayList() const;
public:
virtual void Render(TGLRnrCtx & rnrCtx);
- ClassDef(BoxSetGL, 0);
+ ClassDef(BoxSetGL, 0); // GL rendering class for BoxSet.
}; // endclass BoxSetGL
}
using namespace Reve;
-//______________________________________________________________________
+//______________________________________________________________________________
// DigitSet
//
+// Base-class for displaying a digit collection.
+// Provdies common services for:
+// - specifying signal / color per digit
+// - specifying object reference per digit
+// - controlling palette and thresholds (external object RGBAPalette)
+// - showing a frame around the digits (external object FrameBox)
+// - specifying transformation matrix for the whole collection
+// by data-member of class ZTrans.
+//
+// See also:
+// QuadSet: rectangle, hexagon or line per digit
+// BoxSet a 3D box per digit
ClassImp(DigitSet)
+//______________________________________________________________________________
DigitSet::DigitSet(const Text_t* n, const Text_t* t) :
RenderElement (),
TNamed (n, t),
fHistoButtons (kTRUE),
fHMTrans ()
{
-
+ // Constructor.
}
+//______________________________________________________________________________
DigitSet::~DigitSet()
{
+ // Destructor.
+ // Unreference frame and palette. Destroy referenced objects if they
+ // are owned by the DigitSet.
+
SetFrame(0);
SetPalette(0);
if (fOwnIds)
ReleaseIds();
}
-/**************************************************************************/
+/******************************************************************************/
+//______________________________________________________________________________
DigitSet::DigitBase* DigitSet::NewDigit()
{
+ // Protected method called whenever a new digit is added.
+
fLastDigit = new (fPlex.NewAtom()) DigitBase(fDefaultValue);
return fLastDigit;
}
+//______________________________________________________________________________
void DigitSet::ReleaseIds()
{
+ // Protected method. Release and delete the referenced objects, the
+ // ownership is *NOT* checked.
+
VoidCPlex::iterator qi(fPlex);
while (qi.next()) {
DigitBase& q = * (DigitBase*) qi();
}
}
-/**************************************************************************/
-/**************************************************************************/
+/******************************************************************************/
+/******************************************************************************/
+//______________________________________________________________________________
void DigitSet::SetMainColor(Color_t color)
{
// Override from RenderElement, forward to Frame.
gReve->Redraw3D();
}
-/**************************************************************************/
-/**************************************************************************/
+/******************************************************************************/
+/******************************************************************************/
+//______________________________________________________________________________
void DigitSet::RefitPlex()
{
// Instruct underlying memory allocator to regroup itself into a
fPlex.Refit();
}
-/**************************************************************************/
+/******************************************************************************/
+//______________________________________________________________________________
void DigitSet::ScanMinMaxValues(Int_t& min, Int_t& max)
{
+ // Iterate over the digits and detmine min and max signal values.
+
if (fValueIsColor || fPlex.Size() == 0) return;
min = kMaxInt;
max = kMinInt;
--min;
}
-/**************************************************************************/
-
+/******************************************************************************/
+//______________________________________________________________________________
void DigitSet::DigitValue(Int_t value)
{
+ // Set signal value for the last digit added.
+
fLastDigit->fValue = value;
}
+//______________________________________________________________________________
void DigitSet::DigitColor(Color_t ci)
{
+ // Set color for the last digit added.
+
ColorFromIdx(ci, (UChar_t*) & fLastDigit->fValue, kTRUE);
}
+//______________________________________________________________________________
void DigitSet::DigitColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a)
{
+ // Set color for the last digit added.
+
UChar_t* x = (UChar_t*) & fLastDigit->fValue;
x[0] = r; x[1] = g; x[2] = b; x[3] = a;
}
+//______________________________________________________________________________
void DigitSet::DigitColor(UChar_t* rgba)
{
+ // Set color for the last digit added.
+
UChar_t* x = (UChar_t*) & fLastDigit->fValue;
x[0] = rgba[0]; x[1] = rgba[1]; x[2] = rgba[2]; x[3] = rgba[3];
}
-/**************************************************************************/
-
+//______________________________________________________________________________
void DigitSet::DigitId(TObject* id)
{
+ // Set external object reference for the last digit added.
+
fLastDigit->fId = id;
}
-/**************************************************************************/
-/**************************************************************************/
+/******************************************************************************/
+/******************************************************************************/
+//______________________________________________________________________________
void DigitSet::Paint(Option_t* /*option*/)
{
+ // Paint this object. Only direct rendering is supported.
+
static const Exc_t eH("DigitSet::Paint ");
TBuffer3D buff(TBuffer3DTypes::kGeneric);
Error(eH, "only direct GL rendering supported.");
}
+//______________________________________________________________________________
void DigitSet::DigitSelected(Int_t idx)
{
+ // Called from renderer when a digit with index idx is selected.
+
if (fEmitSignals) {
CtrlClicked(this, idx);
} else {
}
}
+//______________________________________________________________________________
void DigitSet::CtrlClicked(DigitSet* qs, Int_t idx)
{
+ // Emit a CtrlClicked signal.
+
Long_t args[2];
args[0] = (Long_t) qs;
args[1] = (Long_t) idx;
Emit("CtrlClicked(Reve::DigitSet*, Int_t)", args);
}
-/**************************************************************************/
+/******************************************************************************/
// Getters / Setters for Frame, RGBAPalette, ZTrans
-/**************************************************************************/
+/******************************************************************************/
+//______________________________________________________________________________
void DigitSet::SetFrame(FrameBox* b)
{
+ // Set FrameBox pointer.
+
if (fFrame == b) return;
if (fFrame) fFrame->DecRefCount(this);
fFrame = b;
}
}
+//______________________________________________________________________________
void DigitSet::SetPalette(RGBAPalette* p)
{
+ // Set RGBAPalette pointer.
+
if (fPalette == p) return;
if (fPalette) fPalette->DecRefCount();
fPalette = p;
if (fPalette) fPalette->IncRefCount();
}
+//______________________________________________________________________________
RGBAPalette* DigitSet::AssertPalette()
{
+ // Make sure the RGBAPalette pointer is not null.
+ // If it is not set, a new one is instantiated and the range is set
+ // to current min/max signal values.
+
if (fPalette == 0) {
fPalette = new RGBAPalette;
if (!fValueIsColor) {
protected:
struct DigitBase
{
- Int_t fValue;
- TRef fId;
+ // Base-class for digit representation classes.
- // Here could have additional integer (like time, second threshold).
+ Int_t fValue; // signal value of a digit (can be direct RGBA color)
+ TRef fId; // external object reference
DigitBase(Int_t v=0) : fValue(v), fId() {}
};
- Int_t fDefaultValue;
- Bool_t fValueIsColor;
- Bool_t fOwnIds; //Flag specifying if id-objects are owned by the DigitSet
- VoidCPlex fPlex;
- DigitBase* fLastDigit; //!
+ Int_t fDefaultValue; // Default signal value.
+ Bool_t fValueIsColor; // Interpret signal value as RGBA color.
+ Bool_t fOwnIds; // Flag specifying if id-objects are owned by the DigitSet
+ VoidCPlex fPlex; // Container of digit data.
+ DigitBase* fLastDigit; //! The last digit added to collection.
- FrameBox* fFrame;
- RGBAPalette* fPalette;
- RenderMode_e fRenderMode;
- Bool_t fDisableLigting;
- Bool_t fEmitSignals;
- Bool_t fHistoButtons;
- ZTrans fHMTrans;
+ FrameBox* fFrame; // Pointer to frame structure.
+ RGBAPalette* fPalette; // Pointer to signal-color palette.
+ RenderMode_e fRenderMode; // Render mode: as-is / line / filled.
+ Bool_t fDisableLigting; // Disable lighting for rendering.
+ Bool_t fEmitSignals; // Emit signals on secondary-select.
+ Bool_t fHistoButtons; // Show histogram buttons in object editor.
+ ZTrans fHMTrans; // Overall transformation of whole collection.
DigitBase* NewDigit();
void ReleaseIds();
virtual Bool_t CanEditMainColor() { return kTRUE; }
virtual void SetMainColor(Color_t color);
+ // Implemented in sub-classes:
// virtual void Reset(QuadType_e quadType, Bool_t valIsCol, Int_t chunkSize);
void RefitPlex();
void DigitId(TObject* id);
- Bool_t GetOwnIds() const { return fOwnIds; }
- void SetOwnIds(Bool_t o) { fOwnIds = o; }
+ Bool_t GetOwnIds() const { return fOwnIds; }
+ void SetOwnIds(Bool_t o) { fOwnIds = o; }
DigitBase* GetDigit(Int_t n) { return (DigitBase*) fPlex.Atom(n); }
- TObject* GetId(Int_t n) { return GetDigit(n)->fId.GetObject(); }
+ TObject* GetId(Int_t n) { return GetDigit(n)->fId.GetObject(); }
// --------------------------------
- // virtual void ComputeBBox(); // implement in subclass
+ // Implemented in subclasses:
+ // virtual void ComputeBBox();
+
virtual void Paint(Option_t* option="");
virtual void DigitSelected(Int_t idx);
void SetTransMatrix(Double_t* carr) { fHMTrans.SetFrom(carr); }
void SetTransMatrix(const TGeoMatrix& mat) { fHMTrans.SetFrom(mat); }
- ClassDef(DigitSet, 1);
+ ClassDef(DigitSet, 1); // Base-class for visual digit collections.
}; // endclass DigitSet
}
using namespace Reve;
-//______________________________________________________________________
+//______________________________________________________________________________
// DigitSetEditor
//
+// GUI editor for class DigitSet.
+//
ClassImp(DigitSetEditor)
+//______________________________________________________________________________
DigitSetEditor::DigitSetEditor(const TGWindow *p, Int_t width, Int_t height,
UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
fHistoButtFrame(0),
fInfoFrame(0)
{
+ // Constructor.
+
MakeTitle("Transformation matrix");
fHMTrans = new ZTransSubEditor(this);
CreateInfoTab();
}
+//______________________________________________________________________________
DigitSetEditor::~DigitSetEditor()
-{}
+{
+ // Destructor. Noop.
+}
/*************************************************************************/
+
+//______________________________________________________________________________
void DigitSetEditor::CreateInfoTab()
{
+ // Create information tab.
fInfoFrame = CreateEditorTabSubFrame("Info");
/**************************************************************************/
+//______________________________________________________________________________
void DigitSetEditor::SetModel(TObject* obj)
{
+ // Set model object.
+
fM = dynamic_cast<DigitSet*>(obj);
fHMTrans->SetDataFromTrans(&fM->fHMTrans);
fPalette->MapWindow();
}
- // Set values of widgets
- // fXYZZ->SetValue(fM->GetXYZZ());
-
if (fM->fHistoButtons)
fHistoButtFrame->MapWindow();
else
/**************************************************************************/
+//______________________________________________________________________________
void DigitSetEditor::DoHisto()
{
+ // Show histogram slot.
+
Int_t min, max;
if (fM->fPalette) {
min = fM->fPalette->GetLowLimit();
PlotHisto(min, max);
}
+//______________________________________________________________________________
void DigitSetEditor::DoRangeHisto()
{
+ // Show ranged histogram slot.
+
Int_t min, max;
if (fM->fPalette) {
min = fM->fPalette->GetMinVal();
PlotHisto(min, max);
}
+//______________________________________________________________________________
void DigitSetEditor::PlotHisto(Int_t min, Int_t max)
{
+ // Plots a histogram from digit vales with given range.
+
Int_t nbins = max-min+1;
while (nbins > 200)
nbins /= 2;
void CreateInfoTab();
protected:
- DigitSet* fM; // fModel dynamic-casted to DigitSetEditor
+ DigitSet * fM; // Model object.
- ZTransSubEditor* fHMTrans;
- RGBAPaletteSubEditor* fPalette;
+ ZTransSubEditor *fHMTrans; // ZTrans sub-editor.
+ RGBAPaletteSubEditor *fPalette; // Palette sub-editor.
- TGHorizontalFrame* fHistoButtFrame;
- TGVerticalFrame* fInfoFrame;
+ TGHorizontalFrame *fHistoButtFrame; // Frame holding histogram display buttons.
+ TGVerticalFrame *fInfoFrame; // Frame displaying basic digit statistics.
public:
DigitSetEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30, UInt_t options = kChildFrame, Pixel_t back=GetDefaultFrameBackground());
void DoRangeHisto();
void PlotHisto(Int_t min, Int_t max);
- ClassDef(DigitSetEditor, 1); // Editor for DigitSet
+ ClassDef(DigitSetEditor, 1); // Editor for DigitSet class.
}; // endclass DigitSetEditor
}