Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGSpeedo.h
Go to the documentation of this file.
1// @(#)root/gui:$Id: TGSpeedo.h
2// Author: Bertrand Bellenot 26/10/06
3
4/*************************************************************************
5 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TGSpeedo
13#define ROOT_TGSpeedo
14
15
16#include "TGFrame.h"
17#include "TGWidget.h"
18#include "TGPicture.h"
19#include "TImage.h"
20
21
22class TGSpeedo : public TGFrame, public TGWidget {
23
24public:
26
27protected:
28 TImage *fImage; ///< image used as background
29 TImage *fImage2; ///< intermediate image used as background
30 const TGPicture *fBase; ///< picture used as background
31 FontStruct_t fTextFS, fCounterFS; ///< font structures for text rendering
32 Int_t fCounter; ///< small odo meter (4 digits)
33 TString fPicName; ///< name of picture used as background
34 TString fLabel1; ///< main label (first line)
35 TString fLabel2; ///< main label (second line)
36 TString fDisplay1; ///< first line in the small display
37 TString fDisplay2; ///< second line in the small display
38 Float_t fAngle, fValue; ///< needle angle and corresponding value
39 Float_t fPeakVal; ///< maximum peak mark
40 Float_t fMeanVal; ///< mean value mark
41 Float_t fAngleMin, fAngleMax; ///< needle min and max angle
42 Float_t fScaleMin, fScaleMax; ///< needle min and max scale
43 Float_t fThreshold[3]; ///< glowing thresholds
44 EGlowColor fThresholdColor[3]; ///< glowing threshold colors
45 Bool_t fThresholdActive; ///< kTRUE if glowing thresholds are active
46 Bool_t fPeakMark; ///< kTRUE if peak mark is active
47 Bool_t fMeanMark; ///< kTRUE if mean mark is active
48 Int_t fBufferSize; ///< circular buffer size
49 Int_t fBufferCount; ///< circular buffer count
50 std::vector<Float_t> fBuffer; ///< circular buffer for mean calculation
51
52 void DoRedraw() override;
53 void DrawNeedle();
54 void DrawText();
55 void Translate(Float_t val, Float_t angle, Int_t *x, Int_t *y);
56
57public:
58 TGSpeedo(const TGWindow *p = nullptr, int id = -1);
59 TGSpeedo(const TGWindow *p, Float_t smin, Float_t smax,
60 const char *lbl1 = "", const char *lbl2 = "",
61 const char *dsp1 = "", const char *dsp2 = "", int id = -1);
62 virtual ~TGSpeedo();
63
64 TGDimension GetDefaultSize() const override;
66
67 const TGPicture *GetPicture() const { return fBase; }
68 TImage *GetImage() const { return fImage; }
69 Int_t GetOdoVal() const { return fCounter; }
70 Float_t GetPeakVal() const { return fPeakVal; }
71 Float_t GetScaleMin() const { return fScaleMin; }
72 Float_t GetScaleMax() const { return fScaleMax; }
75
76 void Build();
77 void Glow(EGlowColor col = kGreen);
78 void StepScale(Float_t step);
79 void SetScaleValue(Float_t val);
80 void SetScaleValue(Float_t val, Int_t damping);
81 void SetOdoValue(Int_t val);
82 void SetDisplayText(const char *text1, const char *text2 = "");
83 void SetLabelText(const char *text1, const char *text2 = "");
84 void SetMinMaxScale(Float_t min, Float_t max);
85 void SetThresholds(Float_t th1 = 0.0, Float_t th2 = 0.0, Float_t th3 = 0.0)
86 { fThreshold[0] = th1; fThreshold[1] = th2; fThreshold[2] = th3; }
88 { fThresholdColor[0] = col1; fThresholdColor[1] = col2; fThresholdColor[2] = col3; }
96 void SetMeanValue(Float_t mean) { fMeanVal = mean; fClient->NeedRedraw(this); }
98
99 void OdoClicked() { Emit("OdoClicked()"); } // *SIGNAL*
100 void LedClicked() { Emit("LedClicked()"); } // *SIGNAL*
101
102 ClassDefOverride(TGSpeedo,0) // Base class for analog meter widget
103};
104
105#endif
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint angle
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:372
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
TGSpeedo is a widget looking like a speedometer, with a needle, a counter and a small odometer window...
Definition TGSpeedo.h:22
const TGPicture * fBase
picture used as background
Definition TGSpeedo.h:30
Int_t fBufferSize
circular buffer size
Definition TGSpeedo.h:48
void SetOdoValue(Int_t val)
Set actual value of odo meter.
Definition TGSpeedo.cxx:334
virtual ~TGSpeedo()
TGSpeedo widget Destructor.
Definition TGSpeedo.cxx:208
void ResetPeakVal()
Definition TGSpeedo.h:95
Float_t GetMean()
Compute and return the mean of the circular buffer content.
Definition TGSpeedo.cxx:231
Bool_t HandleButton(Event_t *event) override
Handle mouse button event.
Definition TGSpeedo.cxx:290
Float_t GetScaleMin() const
Definition TGSpeedo.h:71
void DisableMeanMark()
Definition TGSpeedo.h:94
void EnableThreshold()
Definition TGSpeedo.h:89
TString fLabel1
main label (first line)
Definition TGSpeedo.h:34
void StepScale(Float_t step)
Increment/decrement scale (needle position) of "step" value.
Definition TGSpeedo.cxx:484
FontStruct_t fTextFS
Definition TGSpeedo.h:31
EGlowColor fThresholdColor[3]
glowing threshold colors
Definition TGSpeedo.h:44
void SetDisplayText(const char *text1, const char *text2="")
Set small display text (two lines).
Definition TGSpeedo.cxx:347
Float_t fAngleMin
Definition TGSpeedo.h:41
TString fDisplay1
first line in the small display
Definition TGSpeedo.h:36
Float_t fScaleMin
Definition TGSpeedo.h:42
@ kOrange
Definition TGSpeedo.h:25
@ kNoglow
Definition TGSpeedo.h:25
Float_t fAngle
Definition TGSpeedo.h:38
Bool_t IsThresholdActive()
Definition TGSpeedo.h:73
void Glow(EGlowColor col=kGreen)
Make speedo glowing.
Definition TGSpeedo.cxx:241
void SetMinMaxScale(Float_t min, Float_t max)
Set min and max scale values.
Definition TGSpeedo.cxx:377
Float_t fMeanVal
mean value mark
Definition TGSpeedo.h:40
const TGPicture * GetPicture() const
Definition TGSpeedo.h:67
Int_t fCounter
small odo meter (4 digits)
Definition TGSpeedo.h:32
TImage * fImage
image used as background
Definition TGSpeedo.h:28
Float_t GetPeakVal() const
Definition TGSpeedo.h:70
void OdoClicked()
Definition TGSpeedo.h:99
void DisableThreshold()
Definition TGSpeedo.h:90
void SetBufferSize(Int_t size)
Change the circular buffer size (used for the automatic mean calculation).
Definition TGSpeedo.cxx:322
FontStruct_t fCounterFS
font structures for text rendering
Definition TGSpeedo.h:31
void DrawText()
Draw text in speedo widget.
Definition TGSpeedo.cxx:554
void SetThresholds(Float_t th1=0.0, Float_t th2=0.0, Float_t th3=0.0)
Definition TGSpeedo.h:85
void SetThresholdColors(EGlowColor col1, EGlowColor col2, EGlowColor col3)
Definition TGSpeedo.h:87
TString fDisplay2
second line in the small display
Definition TGSpeedo.h:37
Int_t GetOdoVal() const
Definition TGSpeedo.h:69
Float_t fScaleMax
needle min and max scale
Definition TGSpeedo.h:42
Float_t fPeakVal
maximum peak mark
Definition TGSpeedo.h:39
Int_t fBufferCount
circular buffer count
Definition TGSpeedo.h:49
TString fPicName
name of picture used as background
Definition TGSpeedo.h:33
Bool_t fThresholdActive
kTRUE if glowing thresholds are active
Definition TGSpeedo.h:45
void Translate(Float_t val, Float_t angle, Int_t *x, Int_t *y)
Translate distance from center and angle to xy coordinates.
Definition TGSpeedo.cxx:492
Float_t fThreshold[3]
glowing thresholds
Definition TGSpeedo.h:43
void SetLabelText(const char *text1, const char *text2="")
Set main label text (two lines).
Definition TGSpeedo.cxx:361
TImage * fImage2
intermediate image used as background
Definition TGSpeedo.h:29
void SetScaleValue(Float_t val)
Set actual scale (needle position) value.
Definition TGSpeedo.cxx:393
Bool_t fMeanMark
kTRUE if mean mark is active
Definition TGSpeedo.h:47
void EnableMeanMark()
Definition TGSpeedo.h:93
void SetMeanValue(Float_t mean)
Definition TGSpeedo.h:96
void EnablePeakMark()
Definition TGSpeedo.h:91
std::vector< Float_t > fBuffer
circular buffer for mean calculation
Definition TGSpeedo.h:50
Float_t GetScaleMax() const
Definition TGSpeedo.h:72
TString fLabel2
main label (second line)
Definition TGSpeedo.h:35
Float_t fAngleMax
needle min and max angle
Definition TGSpeedo.h:41
TGDimension GetDefaultSize() const override
Return default dimension of the widget.
Definition TGSpeedo.cxx:221
void DisablePeakMark()
Definition TGSpeedo.h:92
void LedClicked()
Definition TGSpeedo.h:100
TImage * GetImage() const
Definition TGSpeedo.h:68
void Build()
Build TGSpeedo widget.
Definition TGSpeedo.cxx:119
void DoRedraw() override
Redraw speedo widget.
Definition TGSpeedo.cxx:608
void DrawNeedle()
Draw needle in speedo widget.
Definition TGSpeedo.cxx:503
Bool_t fPeakMark
kTRUE if peak mark is active
Definition TGSpeedo.h:46
Float_t fValue
needle angle and corresponding value
Definition TGSpeedo.h:38
The widget base class.
Definition TGWidget.h:43
ROOT GUI Window base class.
Definition TGWindow.h:23
An abstract interface to image processing library.
Definition TImage.h:29
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Basic string class.
Definition TString.h:139
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174
auto * th3
Definition textalign.C:22
auto * th2
Definition textalign.C:18
auto * th1
Definition textalign.C:14