Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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#include "TVirtualX.h"
15
16using namespace ROOT::Experimental;
17
18/** \class REveFrameBox
19\ingroup REve
20Description of a 2D or 3D frame that can be used to visually group
21a set of objects.
22*/
23
24////////////////////////////////////////////////////////////////////////////////
25
26REveFrameBox::REveFrameBox() :
27 fFrameType (kFT_None),
28 fFrameSize (0),
29 fFramePoints (nullptr),
30
31 fFrameWidth (1),
32 fFrameColor (1),
33 fBackColor (0),
34 fFrameFill (kFALSE),
35 fDrawBack (kFALSE)
36{
37 // Default constructor.
38
39 fFrameRGBA[0] = fFrameRGBA[1] = fFrameRGBA[2] = 0; fFrameRGBA[3] = 255;
40 fBackRGBA [0] = fBackRGBA [1] = fBackRGBA [2] = 255; fBackRGBA [3] = 255;
41}
42
43////////////////////////////////////////////////////////////////////////////////
44/// Destructor.
45
50
51////////////////////////////////////////////////////////////////////////////////
52/// Setup for axis-aligned rectangle with one corner at x, y, z and
53/// given sizes in x (dx) and y (dy).
54
56 Float_t dx, Float_t dy)
57{
59 fFrameSize = 12;
60 delete [] fFramePoints;
63 p[0] = x; p[1] = y; p[2] = z; p += 3;
64 p[0] = x+dx; p[1] = y; p[2] = z; p += 3;
65 p[0] = x+dx; p[1] = y+dy; p[2] = z; p += 3;
66 p[0] = x ; p[1] = y+dy; p[2] = z; p += 3;
67}
68
69////////////////////////////////////////////////////////////////////////////////
70/// Setup for axis-aligned rectangle with one corner at x, y, z and
71/// given sizes in x (dx) and z (dz).
72
74 Float_t dx, Float_t dz)
75{
77 fFrameSize = 12;
78 delete [] fFramePoints;
81 p[0] = x; p[1] = y; p[2] = z; p += 3;
82 p[0] = x+dx; p[1] = y; p[2] = z; p += 3;
83 p[0] = x+dx; p[1] = y; p[2] = z+dz; p += 3;
84 p[0] = x ; p[1] = y; p[2] = z+dz; p += 3;
85}
86
87////////////////////////////////////////////////////////////////////////////////
88/// Setup frame with explicitly given corner coordinates.
89/// Arguments:
90/// - pointArr - array containing the 3D points
91/// - nPoint - number of points, size of array divided by 3
92
93void REveFrameBox::SetQuadByPoints(const Float_t* pointArr, Int_t nPoints)
94{
96 fFrameSize = 3*nPoints;
97 delete [] fFramePoints;
99 memcpy(fFramePoints, pointArr, fFrameSize*sizeof(Float_t));
100}
101
102////////////////////////////////////////////////////////////////////////////////
103/// Setup for axis-aligned box with one corner at x, y, z and
104/// given sizes in x (dx), y (dy) and z (dz).
105
107 Float_t dx, Float_t dy, Float_t dz)
108{
110 fFrameSize = 24;
111 delete [] fFramePoints;
113
115 //bottom
116 p[0] = x; p[1] = y + dy; p[2] = z; p += 3;
117 p[0] = x + dx; p[1] = y + dy; p[2] = z; p += 3;
118 p[0] = x + dx; p[1] = y; p[2] = z; p += 3;
119 p[0] = x; p[1] = y; p[2] = z; p += 3;
120 //top
121 p[0] = x; p[1] = y + dy; p[2] = z + dz; p += 3;
122 p[0] = x + dx; p[1] = y + dy; p[2] = z + dz; p += 3;
123 p[0] = x + dx; p[1] = y; p[2] = z + dz; p += 3;
124 p[0] = x; p[1] = y; p[2] = z + dz;
125}
126
127////////////////////////////////////////////////////////////////////////////////
128/// Setup for axis-aligned box with center at x, y, z and given
129/// half-sizes in x (dx), y (dy) and z (dz).
130
132 Float_t dx, Float_t dy, Float_t dz)
133{
135 fFrameSize = 24;
136 delete [] fFramePoints;
138
140 //bottom
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 p[0] = x - dx; p[1] = y - dy; p[2] = z - dz; p += 3;
145 //top
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; p += 3;
149 p[0] = x - dx; p[1] = y - dy; p[2] = z + dz;
150}
151
152////////////////////////////////////////////////////////////////////////////////
153/// Set color of the frame.
154
160
161////////////////////////////////////////////////////////////////////////////////
162/// Set color of the frame.
163
168
169////////////////////////////////////////////////////////////////////////////////
170/// Set color of the frame.
171
180
181////////////////////////////////////////////////////////////////////////////////
182/// Set color of the background polygon.
183
189
190////////////////////////////////////////////////////////////////////////////////
191/// Set color of the background polygon.
192
197
198////////////////////////////////////////////////////////////////////////////////
199/// Set color of the background polygon.
200
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
#define b(i)
Definition RSha256.hxx:100
#define g(i)
Definition RSha256.hxx:105
#define a(i)
Definition RSha256.hxx:99
short Color_t
Color number (short)
Definition RtypesCore.h:100
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
Definition RtypesCore.h:53
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
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.
~REveFrameBox() override
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:187
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:1941
static Int_t Pixel2Number(ULong_t pixel)
Static method returning color number for color specified by system dependent pixel value.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Namespace for ROOT features in testing.
Definition TROOT.h:100