]>
Commit | Line | Data |
---|---|---|
32e219c2 | 1 | // $Header$ |
2 | ||
3 | #ifndef REVE_DigitSetBase_H | |
4 | #define REVE_DigitSetBase_H | |
5 | ||
6 | #include <TNamed.h> | |
7 | #include <TQObject.h> | |
8 | #include <TAtt3D.h> | |
9 | #include <TAttBBox.h> | |
10 | ||
11 | #include <Reve/Reve.h> | |
12 | #include <Reve/RenderElement.h> | |
13 | #include <Reve/FrameBox.h> | |
14 | #include <Reve/RGBAPalette.h> | |
15 | #include <Reve/Plex.h> | |
16 | #include <Reve/ZTrans.h> | |
17 | ||
18 | #include <TObject.h> | |
19 | ||
20 | namespace Reve { | |
21 | ||
22 | class DigitSet : public RenderElement, | |
23 | public TNamed, public TQObject, | |
24 | public TAtt3D, | |
25 | public TAttBBox | |
26 | { | |
27 | friend class DigitSetEditor; | |
28 | ||
29 | DigitSet(const DigitSet&); // Not implemented | |
30 | DigitSet& operator=(const DigitSet&); // Not implemented | |
31 | ||
32 | public: | |
33 | enum RenderMode_e { RM_AsIs, RM_Line, RM_Fill }; | |
34 | ||
35 | protected: | |
36 | struct DigitBase | |
37 | { | |
cec82a67 | 38 | // Base-class for digit representation classes. |
32e219c2 | 39 | |
cec82a67 | 40 | Int_t fValue; // signal value of a digit (can be direct RGBA color) |
41 | TRef fId; // external object reference | |
32e219c2 | 42 | |
43 | DigitBase(Int_t v=0) : fValue(v), fId() {} | |
44 | }; | |
45 | ||
cec82a67 | 46 | Int_t fDefaultValue; // Default signal value. |
47 | Bool_t fValueIsColor; // Interpret signal value as RGBA color. | |
48 | Bool_t fOwnIds; // Flag specifying if id-objects are owned by the DigitSet | |
49 | VoidCPlex fPlex; // Container of digit data. | |
50 | DigitBase* fLastDigit; //! The last digit added to collection. | |
32e219c2 | 51 | |
cec82a67 | 52 | FrameBox* fFrame; // Pointer to frame structure. |
53 | RGBAPalette* fPalette; // Pointer to signal-color palette. | |
54 | RenderMode_e fRenderMode; // Render mode: as-is / line / filled. | |
55 | Bool_t fDisableLigting; // Disable lighting for rendering. | |
56 | Bool_t fEmitSignals; // Emit signals on secondary-select. | |
57 | Bool_t fHistoButtons; // Show histogram buttons in object editor. | |
58 | ZTrans fHMTrans; // Overall transformation of whole collection. | |
32e219c2 | 59 | |
60 | DigitBase* NewDigit(); | |
61 | void ReleaseIds(); | |
62 | ||
63 | public: | |
64 | DigitSet(const Text_t* n="DigitSet", const Text_t* t=""); | |
65 | virtual ~DigitSet(); | |
66 | ||
67 | virtual Bool_t CanEditMainColor() { return kTRUE; } | |
68 | virtual void SetMainColor(Color_t color); | |
69 | ||
cec82a67 | 70 | // Implemented in sub-classes: |
32e219c2 | 71 | // virtual void Reset(QuadType_e quadType, Bool_t valIsCol, Int_t chunkSize); |
72 | ||
73 | void RefitPlex(); | |
74 | void ScanMinMaxValues(Int_t& min, Int_t& max); | |
75 | ||
76 | // -------------------------------- | |
77 | ||
78 | void DigitValue(Int_t value); | |
79 | void DigitColor(Color_t ci); | |
80 | void DigitColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255); | |
81 | void DigitColor(UChar_t* rgba); | |
82 | ||
83 | void DigitId(TObject* id); | |
84 | ||
cec82a67 | 85 | Bool_t GetOwnIds() const { return fOwnIds; } |
86 | void SetOwnIds(Bool_t o) { fOwnIds = o; } | |
32e219c2 | 87 | |
88 | DigitBase* GetDigit(Int_t n) { return (DigitBase*) fPlex.Atom(n); } | |
cec82a67 | 89 | TObject* GetId(Int_t n) { return GetDigit(n)->fId.GetObject(); } |
32e219c2 | 90 | |
91 | // -------------------------------- | |
92 | ||
cec82a67 | 93 | // Implemented in subclasses: |
94 | // virtual void ComputeBBox(); | |
95 | ||
32e219c2 | 96 | virtual void Paint(Option_t* option=""); |
97 | ||
98 | virtual void DigitSelected(Int_t idx); | |
99 | virtual void CtrlClicked(DigitSet* qs, Int_t idx); // *SIGNAL* | |
100 | ||
101 | // -------------------------------- | |
102 | ||
103 | VoidCPlex* GetPlex() { return &fPlex; } | |
104 | ||
105 | FrameBox* GetFrame() const { return fFrame; } | |
106 | void SetFrame(FrameBox* b); | |
107 | ||
108 | Bool_t GetValueIsColor() const { return fValueIsColor; } | |
109 | ||
110 | RGBAPalette* GetPalette() const { return fPalette; } | |
111 | void SetPalette(RGBAPalette* p); | |
112 | RGBAPalette* AssertPalette(); | |
113 | ||
114 | RenderMode_e GetRenderMode() const { return fRenderMode; } | |
115 | void SetRenderMode(RenderMode_e rm) { fRenderMode = rm; } | |
116 | ||
117 | Bool_t GetEmitSignals() const { return fEmitSignals; } | |
118 | void SetEmitSignals(Bool_t f) { fEmitSignals = f; } | |
119 | ||
120 | Bool_t GetHistoButtons() const { return fHistoButtons; } | |
121 | void SetHistoButtons(Bool_t f) { fHistoButtons = f; } | |
122 | ||
123 | ZTrans& RefHMTrans() { return fHMTrans; } | |
124 | void SetTransMatrix(Double_t* carr) { fHMTrans.SetFrom(carr); } | |
125 | void SetTransMatrix(const TGeoMatrix& mat) { fHMTrans.SetFrom(mat); } | |
126 | ||
cec82a67 | 127 | ClassDef(DigitSet, 1); // Base-class for visual digit collections. |
32e219c2 | 128 | }; // endclass DigitSet |
129 | ||
130 | } | |
131 | ||
132 | #endif |