Logo ROOT   6.16/01
Reference Guide
TEveFrameBox.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, 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#include "TEveFrameBox.h"
13#include "TColor.h"
14
15/** \class TEveFrameBox
16\ingroup TEve
17Description of a 2D or 3D frame that can be used to visually group
18a set of objects.
19*/
20
22
23////////////////////////////////////////////////////////////////////////////////
24
26 fFrameType (kFT_None),
27 fFrameSize (0),
28 fFramePoints (0),
29
30 fFrameWidth (1),
31 fFrameColor (1),
32 fBackColor (0),
33 fFrameFill (kFALSE),
34 fDrawBack (kFALSE)
35{
36 // Default constructor.
37
38 fFrameRGBA[0] = fFrameRGBA[1] = fFrameRGBA[2] = 0; fFrameRGBA[3] = 255;
39 fBackRGBA [0] = fBackRGBA [1] = fBackRGBA [2] = 255; fBackRGBA [3] = 255;
40}
41
42////////////////////////////////////////////////////////////////////////////////
43/// Destructor.
44
46{
47 delete [] fFramePoints;
48}
49
50////////////////////////////////////////////////////////////////////////////////
51/// Setup for axis-aligned rectangle with one corner at x, y, z and
52/// given sizes in x (dx) and y (dy).
53
55 Float_t dx, Float_t dy)
56{
58 fFrameSize = 12;
59 delete [] fFramePoints;
62 p[0] = x; p[1] = y; p[2] = z; p += 3;
63 p[0] = x+dx; p[1] = y; p[2] = z; p += 3;
64 p[0] = x+dx; p[1] = y+dy; p[2] = z; p += 3;
65 p[0] = x ; p[1] = y+dy; p[2] = z; p += 3;
66}
67
68////////////////////////////////////////////////////////////////////////////////
69/// Setup for axis-aligned rectangle with one corner at x, y, z and
70/// given sizes in x (dx) and z (dz).
71
73 Float_t dx, Float_t dz)
74{
76 fFrameSize = 12;
77 delete [] fFramePoints;
80 p[0] = x; p[1] = y; p[2] = z; p += 3;
81 p[0] = x+dx; p[1] = y; p[2] = z; p += 3;
82 p[0] = x+dx; p[1] = y; p[2] = z+dz; p += 3;
83 p[0] = x ; p[1] = y; p[2] = z+dz; p += 3;
84}
85
86////////////////////////////////////////////////////////////////////////////////
87/// Setup frame with explicitly given corner coordinates.
88/// Arguments:
89/// - pointArr - array containing the 3D points
90/// - nPoint - number of points, size of array divided by 3
91
92void TEveFrameBox::SetQuadByPoints(const Float_t* pointArr, Int_t nPoints)
93{
95 fFrameSize = 3*nPoints;
96 delete [] fFramePoints;
98 memcpy(fFramePoints, pointArr, fFrameSize*sizeof(Float_t));
99}
100
101////////////////////////////////////////////////////////////////////////////////
102/// Setup for axis-aligned box with one corner at x, y, z and
103/// given sizes in x (dx), y (dy) and z (dz).
104
106 Float_t dx, Float_t dy, Float_t dz)
107{
109 fFrameSize = 24;
110 delete [] fFramePoints;
112
114 //bottom
115 p[0] = x; p[1] = y + dy; p[2] = z; p += 3;
116 p[0] = x + dx; p[1] = y + dy; p[2] = z; p += 3;
117 p[0] = x + dx; p[1] = y; p[2] = z; p += 3;
118 p[0] = x; p[1] = y; p[2] = z; p += 3;
119 //top
120 p[0] = x; p[1] = y + dy; p[2] = z + dz; p += 3;
121 p[0] = x + dx; p[1] = y + dy; p[2] = z + dz; p += 3;
122 p[0] = x + dx; p[1] = y; p[2] = z + dz; p += 3;
123 p[0] = x; p[1] = y; p[2] = z + dz;
124}
125
126////////////////////////////////////////////////////////////////////////////////
127/// Setup for axis-aligned box with center at x, y, z and given
128/// half-sizes in x (dx), y (dy) and z (dz).
129
131 Float_t dx, Float_t dy, Float_t dz)
132{
134 fFrameSize = 24;
135 delete [] fFramePoints;
137
139 //bottom
140 p[0] = x - dx; p[1] = y + dy; p[2] = z - dz; p += 3;
141 p[0] = x + dx; p[1] = y + dy; p[2] = z - dz; p += 3;
142 p[0] = x + dx; p[1] = y - dy; p[2] = z - dz; p += 3;
143 p[0] = x - dx; p[1] = y - dy; p[2] = z - dz; p += 3;
144 //top
145 p[0] = x - dx; p[1] = y + dy; p[2] = z + dz; p += 3;
146 p[0] = x + dx; p[1] = y + dy; p[2] = z + dz; p += 3;
147 p[0] = x + dx; p[1] = y - dy; p[2] = z + dz; p += 3;
148 p[0] = x - dx; p[1] = y - dy; p[2] = z + dz;
149}
150
151////////////////////////////////////////////////////////////////////////////////
152/// Set color of the frame.
153
155{
156 fFrameColor = ci;
158}
159
160////////////////////////////////////////////////////////////////////////////////
161/// Set color of the frame.
162
164{
166}
167
168////////////////////////////////////////////////////////////////////////////////
169/// Set color of the frame.
170
172{
174 fFrameRGBA[0] = r;
175 fFrameRGBA[1] = g;
176 fFrameRGBA[2] = b;
177 fFrameRGBA[3] = a;
178}
179
180////////////////////////////////////////////////////////////////////////////////
181/// Set color of the background polygon.
182
184{
185 fBackColor = ci;
187}
188
189////////////////////////////////////////////////////////////////////////////////
190/// Set color of the background polygon.
191
193{
195}
196
197////////////////////////////////////////////////////////////////////////////////
198/// Set color of the background polygon.
199
201{
203 fBackRGBA[0] = r;
204 fBackRGBA[1] = g;
205 fBackRGBA[2] = b;
206 fBackRGBA[3] = a;
207}
ULong_t Pixel_t
Definition: GuiTypes.h:39
ROOT::R::TRInterface & r
Definition: Object.C:4
#define b(i)
Definition: RSha256.hxx:100
#define g(i)
Definition: RSha256.hxx:105
int Int_t
Definition: RtypesCore.h:41
unsigned char UChar_t
Definition: RtypesCore.h:34
const Bool_t kFALSE
Definition: RtypesCore.h:88
short Color_t
Definition: RtypesCore.h:79
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:363
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition: TColor.cxx:1758
Description of a 2D or 3D frame that can be used to visually group a set of objects.
Definition: TEveFrameBox.h:19
void SetFrameColor(Color_t ci)
Set color of the frame.
void SetBackColorRGBA(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255)
Set color of the background polygon.
void SetBackColor(Color_t ci)
Set color of the background polygon.
Color_t fFrameColor
Definition: TEveFrameBox.h:35
Color_t fBackColor
Definition: TEveFrameBox.h:36
Float_t * fFramePoints
Definition: TEveFrameBox.h:32
void SetAABoxCenterHalfSize(Float_t x, Float_t y, Float_t z, Float_t dx, Float_t dy, Float_t dz)
Setup for axis-aligned box with center at x, y, z and given half-sizes in x (dx), y (dy) and z (dz).
void SetAAQuadXY(Float_t x, Float_t y, Float_t z, Float_t dx, Float_t dy)
Setup for axis-aligned rectangle with one corner at x, y, z and given sizes in x (dx) and y (dy).
void SetBackColorPixel(Pixel_t pix)
Set color of the background polygon.
EFrameType_e fFrameType
Definition: TEveFrameBox.h:30
void SetAABox(Float_t x, Float_t y, Float_t z, Float_t dx, Float_t dy, Float_t dz)
Setup for axis-aligned box with one corner at x, y, z and given sizes in x (dx), y (dy) and z (dz).
Int_t fFrameSize
Definition: TEveFrameBox.h:31
void SetFrameColorRGBA(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255)
Set color of the frame.
virtual ~TEveFrameBox()
Destructor.
UChar_t fBackRGBA[4]
Definition: TEveFrameBox.h:38
void SetQuadByPoints(const Float_t *pointArr, Int_t nPoints)
Setup frame with explicitly given corner coordinates.
void SetFrameColorPixel(Pixel_t pix)
Set color of the frame.
UChar_t fFrameRGBA[4]
Definition: TEveFrameBox.h:37
void SetAAQuadXZ(Float_t x, Float_t y, Float_t z, Float_t dx, Float_t dz)
Setup for axis-aligned rectangle with one corner at x, y, z and given sizes in x (dx) and z (dz).
static void ColorFromIdx(Color_t ci, UChar_t col[4], Bool_t alpha=kTRUE)
Fill col with RGBA values corresponding to index ci.
Definition: TEveUtil.cxx:192
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
auto * a
Definition: textangle.C:12