Logo ROOT  
Reference Guide
REveFrameBox.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 "ROOT/REveFrameBox.hxx"
13#include "TColor.h"
14
15using namespace ROOT::Experimental;
16
17/** \class REveFrameBox
18\ingroup REve
19Description of a 2D or 3D frame that can be used to visually group
20a set of objects.
21*/
22
23////////////////////////////////////////////////////////////////////////////////
24
25REveFrameBox::REveFrameBox() :
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 REveFrameBox::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
Pixel value.
Definition: GuiTypes.h:40
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:45
unsigned char UChar_t
Definition: RtypesCore.h:38
const Bool_t kFALSE
Definition: RtypesCore.h:101
short Color_t
Definition: RtypesCore.h:92
float Float_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:100
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).
void SetFrameColor(Color_t ci)
Set color of the frame.
void SetBackColor(Color_t ci)
Set color of the background polygon.
void SetQuadByPoints(const Float_t *pointArr, Int_t nPoints)
Setup frame with explicitly given corner coordinates.
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 SetFrameColorPixel(Pixel_t pix)
Set color of the frame.
virtual ~REveFrameBox()
Destructor.
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).
void SetFrameColorRGBA(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255)
Set color of the frame.
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 SetBackColorRGBA(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255)
Set color of the background polygon.
void SetBackColorPixel(Pixel_t pix)
Set color of the background polygon.
static void ColorFromIdx(Color_t ci, UChar_t col[4], Bool_t alpha=kTRUE)
Fill col with RGBA values corresponding to index ci.
Definition: REveUtil.cxx:118
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:1775
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
auto * a
Definition: textangle.C:12