19#include "TGLIncludes.h"
50 fScaleColor(-1), fScaleTransparency(0),
51 fScaleCoordX(0.85), fScaleCoordY(0.65),
52 fScaleW(0), fScaleH(0),
53 fCellX(-1), fCellY(-1),
55 fFrameColor(-1), fFrameLineTransp(70), fFrameBgTransp(90),
57 fMouseX(0), fMouseY(0),
62 fPlaneAxis(0), fAxisPlaneColor(
kGray),
72 fActiveID(-1), fActiveCol(
kRed-4)
111 switch (
event->fType)
152 switch (
event->fType)
263 glVertex2f(
x/vp.
Width(), 1);
271 glBitmap(0, 0, 0, 0,
x,
y, 0);
282 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LINE_BIT | GL_POINT_BIT);
283 glEnable(GL_POINT_SMOOTH);
284 glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
285 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
286 glEnable(GL_POLYGON_OFFSET_FILL);
287 glPolygonOffset(0.1, 1);
288 glDisable(GL_CULL_FACE);
290 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
309 glVertex2f( bwt, bh);
310 glVertex2f(-bwt, bh);
317 glVertex2f(0, 0); glVertex2f(0, bh);
318 glVertex2f((bw+bwt)*0.5, bh*0.5); glVertex2f(-(bw+bwt)*0.5, bh*0.5);
325 glVertex2f( bwt, bh);
326 glVertex2f(-bwt, bh);
397 while(cellY > scaleStepY)
409 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LINE_BIT | GL_POINT_BIT);
411 glDisable(GL_CULL_FACE);
412 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
413 glEnable(GL_POLYGON_OFFSET_FILL);
414 glPolygonOffset(0.1, 1);
426 for (
Int_t i=0; i < ne; ++i)
429 dx = 0.5* cellX * valFac;
430 dy = 0.5* cellY * valFac;
432 glVertex2f( - dx, pos - dy);
433 glVertex2f( - dx, pos + dy);
434 glVertex2f( + dx, pos + dy);
435 glVertex2f( + dx, pos - dy);
441 for (
Int_t i=0; i < ne; ++i)
442 glVertex2f(0, i* scaleStepY);
453 Float_t llx, lly, llz, urx, ury, urz;
454 fontB.
BBox(
"10", llx, lly, llz, urx, ury, urz);
461 glTranslatef(0.5*scaleStepX, 0, 0.1);
462 for (
Int_t i = 0; i < ne; ++i)
468 else if ( i == (maxe -1))
475 fontB.
BBox(
Form(
"%d", maxe-i), llx, lly, llz, urx, ury, urz);
476 if (expOff > urx/vp.
Width()) expOff = urx/vp.
Width();
483 if (expOff < 1) expX += expOff;
488 fScaleW = scaleStepX + expX+ frameOff*2;
489 fScaleH = scaleStepY * ne + frameOff*2;
500 glVertex3f(x0, y0, zf); glVertex3f(
x1, y0, zf);
501 glVertex3f(
x1, y1, zf); glVertex3f(x0, y1, zf);
506 glVertex2f(x0, y0); glVertex2f(
x1, y0);
507 glVertex2f(
x1, y1); glVertex2f(x0, y1);
521 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LINE_BIT);
523 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
524 glEnable(GL_POLYGON_OFFSET_FILL);
525 glPolygonOffset(0.1, 1);
568 for (TGLAxisPainter::LabVec_t::iterator it = labVec.begin(); it != labVec.end(); ++it)
571 glColor4ub(
c[0],
c[1],
c[2],
c[3]);
574 glVertex3f( -w,
y -
h, zf); glVertex3f( +w,
y -
h, zf);
575 glVertex3f( +w,
y +
h, zf); glVertex3f( -w,
y +
h, zf);
581 for (TGLAxisPainter::LabVec_t::iterator it = labVec.begin(); it != labVec.end(); ++it)
584 glVertex3f( -w,
y -
h, zf); glVertex3f( +w,
y -
h, zf);
585 glVertex3f( +w,
y +
h, zf); glVertex3f( -w,
y +
h, zf);
603 glGetFloatv(GL_DEPTH_RANGE, old_depth_range);
604 glDepthRange(0, 0.001);
606 glMatrixMode(GL_PROJECTION);
613 gluPickMatrix(rect.
X(), rect.
Y(), rect.
Width(), rect.
Height(),
616 glMatrixMode(GL_MODELVIEW);
620 glTranslatef(-1, -1, 0);
658 for (
Int_t i=1 ; i<=nb; i++)
660 if (sq >
a->GetBinWidth(i)) sq =
a->GetBinWidth(i);
665 for (
Int_t i=1 ; i<=nb; i++)
667 if (sq >
a->GetBinWidth(i)) sq =
a->GetBinWidth(i);
700 glMatrixMode(GL_PROJECTION);
702 glMatrixMode(GL_MODELVIEW);
704 glDepthRange(old_depth_range[0], old_depth_range[1]);
static const double x1[5]
char * Form(const char *fmt,...)
static struct mg_connection * fc(struct mg_context *ctx)
Manages histogram axis attributes.
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels.
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length.
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
Class to manage histogram axis.
virtual void SetLimits(Double_t xmin, Double_t xmax)
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates, that is,...
virtual void GetCellData(const CellId_t &id, CellData_t &data) const =0
virtual TAxis * GetEtaBins() const
virtual TAxis * GetPhiBins() const
OpenGL renderer class for TEveCaloLego.
GL-overlay control GUI for TEveCaloLego.
Bool_t fInDrag
last mouse position
void RenderPlaneInterface(TGLRnrCtx &rnrCtx)
Render menu for plane-value and the plane if marked.
virtual void Render(TGLRnrCtx &rnrCtx)
Display coordinates info of current frustum.
void RenderHeader(TGLRnrCtx &rnrCtx)
void SetScaleColorTransparency(Color_t colIdx, Char_t transp)
Set color and transparency of scales.
Char_t fScaleTransparency
TEveCaloLegoOverlay()
Constructor.
void RenderPaletteScales(TGLRnrCtx &rnrCtx)
virtual void MouseLeave()
Mouse has left overlay area.
Bool_t SetSliderVal(Event_t *event, TGLRnrCtx &rnrCtx)
void SetScalePosition(Double_t x, Double_t y)
Set scale coordinates in range [0,1].
virtual Bool_t MouseEnter(TGLOvlSelectRecord &selRec)
Mouse has entered overlay area.
void RenderLogaritmicScales(TGLRnrCtx &rnrCtx)
virtual Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event)
Handle overlay event.
void SetFrameAttribs(Color_t frameCol, Char_t lineTransp, Char_t bgTransp)
Set frame attributes.
Color_t GetFontColor() const
void SetHPlaneVal(Float_t s)
TEveCaloData::vCellId_t fCellList
void SetDrawHPlane(Bool_t s)
Float_t GetEtaMin() const
TEveRGBAPalette * GetPalette() const
Float_t GetPhiRng() const
Float_t GetMaxVal() const
TEveCaloData * GetData() const
Float_t GetEtaMax() const
Float_t GetPhiMax() const
Float_t GetEtaRng() const
Float_t GetPhiMin() const
const UChar_t * ColorFromValue(Int_t val) const
void RnrLabels() const
Render label reading prepared list ov value-pos pairs.
void SetLabelFont(TGLRnrCtx &rnrCtx, const char *fontName, Int_t pixelSize=64, Double_t font3DSize=-1)
Set label font derived from TAttAxis.
void SetLabelAlign(TGLFont::ETextAlignH_e, TGLFont::ETextAlignV_e)
Set label align.
std::vector< Lab_t > LabVec_t
void SetTextFormat(Double_t min, Double_t max, Double_t binWidth)
Construct print format from given primary bin width.
void SetAttAxis(TAttAxis *a)
void SetLabelPixelFontSize(Int_t fs)
std::pair< Float_t, Float_t > Lab_t
TGLVector3 & RefTMOff(Int_t i)
void PaintAxis(TGLRnrCtx &ctx, TAxis *ax)
GL render TAxis.
A GL overlay element which displays camera furstum.
TGLAxisPainter * fAxisPainter
void SetFrustum(TGLCamera &cam)
Set frustum values from given camera.
virtual void Render(TGLRnrCtx &rnrCtx)
Display coordinates info of current frustum.
TAttAxis * GetAttAxis()
Get axis attributes.
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
virtual Bool_t IsPerspective() const
TGLVector3 WorldDeltaToViewport(const TGLVertex3 &worldRef, const TGLVector3 &worldDelta) const
Convert a 3D vector worldDelta (shift) about vertex worldRef to a viewport (screen) '3D' vector.
void WindowToViewport(Int_t &, Int_t &y) const
virtual Bool_t IsOrthographic() const
Color_t GetColorIndex() const
Returns color-index representing the color.
A wrapper class for FTFont.
void BBox(const char *txt, Float_t &llx, Float_t &lly, Float_t &llz, Float_t &urx, Float_t &ury, Float_t &urz) const
Get bounding box.
void Render(const char *txt, Double_t x, Double_t y, Double_t angle, Double_t mgn) const
virtual void PostRender() const
Reset GL state after FTFont rendering.
virtual void PreRender(Bool_t autoLight=kTRUE, Bool_t lightOn=kFALSE) const
Set-up GL state before FTFont rendering.
Selection record for overlay objects.
Viewport (pixel base) 2D rectangle class.
const Int_t * CArr() const
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
TGLRect * GetPickRectangle()
Return current pick rectangle.
void RegisterFontNoScale(Int_t size, Int_t file, Int_t mode, TGLFont &out)
Get font in the GL rendering context.
TGLColorSet & ColorSet()
Return reference to current color-set (top of the stack).
TGLViewerBase & RefViewer()
UInt_t GetItem(Int_t i) const
static void Color4f(Float_t r, Float_t g, Float_t b, Float_t a)
Wrapper for glColor4f.
static void ColorTransparency(Color_t color_index, Char_t transparency=0)
Set color from color_index and ROOT-style transparency (default 0).
static void Color(const TGLColor &color)
Set color from TGLColor.
static Float_t PointSize()
Get the point-size, taking the global scaling into account.
static Float_t LineWidth()
Get the line-width, taking the global scaling into account.
3 component (x/y/z) vector class.
3 component (x/y/z) vertex class.
void Set(Double_t x, Double_t y, Double_t z)
TGLLogicalShape * FindLogicalInScenes(TObject *id)
Find logical-shape representing object id in the list of scenes.
static void Optimize(Double_t A1, Double_t A2, Int_t nold, Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BWID, Option_t *option="")
Static function to compute reasonable axis limits.
const char * Data() const
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Short_t Max(Short_t a, Short_t b)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Int_t CeilNint(Double_t x)
Double_t Log10(Double_t x)
Cell data inner structure.