Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveText.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Authors: Alja & Matevz Tadel 2008
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 "TEveText.h"
13#include "TEveTrans.h"
14
15#include "TGLFontManager.h"
16#include "TObjArray.h"
17#include "TObjString.h"
18#include "TString.h"
19#include "TMath.h"
20
21/** \class TEveText
22\ingroup TEve
23TEveElement class used for displaying FreeType GL fonts. Holds a
24set of parameters to define FTGL font and its rendering style.
25*/
26
27
28////////////////////////////////////////////////////////////////////////////////
29/// Constructor.
30
31TEveText::TEveText(const char* txt) :
32 TEveElement(fTextColor),
33 TNamed("TEveText", ""),
34 TAtt3D(),
35 TAttBBox(),
36 fText(txt),
37 fTextColor(0),
38
39 fFontSize(12),
40 fFontFile(4),
41 fFontMode(-1),
42 fExtrude(1.0f),
43
44 fAutoLighting(kTRUE),
45 fLighting(kFALSE)
46{
47 fPolygonOffset[0] = 0;
48 fPolygonOffset[1] = 0;
49
54}
55
56////////////////////////////////////////////////////////////////////////////////
57/// Set valid font size.
58
60{
61 if (validate) {
64 Int_t idx = TMath::BinarySearch(ns, fsp, val);
65 fFontSize = fsp[idx];
66 } else {
67 fFontSize = val;
68 }
69}
70
71////////////////////////////////////////////////////////////////////////////////
72/// Set font file regarding to static TGLFontManager fgFontFileArray.
73
74void TEveText::SetFontFile(const char* name)
75{
77 TIter next_base(fa);
78 TObjString* os;
79 Int_t idx = 0;
80 while ((os = (TObjString*) next_base()) != nullptr) {
81 if (os->GetString() == name) {
82 SetFontFile(idx);
83 return;
84 }
85 idx++;
86 }
87}
88
89////////////////////////////////////////////////////////////////////////////////
90/// Set FTFont class ID.
91
101
102////////////////////////////////////////////////////////////////////////////////
103/// Set the scale and units used to calculate depth values.
104/// See glPolygonOffset manual page.
105
107{
108 fPolygonOffset[0] = factor;
110}
111
112////////////////////////////////////////////////////////////////////////////////
113/// Paint this object. Only direct rendering is supported.
114
116{
117 PaintStandard(this);
118}
119
120////////////////////////////////////////////////////////////////////////////////
121/// Fill bounding-box information. Virtual from TAttBBox.
122/// If member 'TEveFrameBox* fFrame' is set, frame's corners are
123/// used as bbox.
124
126{
127 BBoxZero();
128}
129
130////////////////////////////////////////////////////////////////////////////////
131/// Return TEveText icon.
132
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char mode
char name[80]
Definition TGX11.cxx:110
Use this attribute class when an object should have 3D capabilities.
Definition TAtt3D.h:19
Helper for management of bounding-box information.
Definition TAttBBox.h:18
void BBoxZero(Float_t epsilon=0, Float_t x=0, Float_t y=0, Float_t z=0)
Create cube of volume (2*epsilon)^3 at (x,y,z).
Definition TAttBBox.cxx:41
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
virtual void InitMainTrans(Bool_t can_edit=kTRUE)
Initialize the main transformation to identity matrix.
virtual TEveTrans & RefMainTrans()
Return reference to main transformation.
Bool_t fCanEditMainTransparency
Definition TEveElement.h:95
Bool_t fCanEditMainColor
Definition TEveElement.h:94
static const TGPicture * fgListTreeIcons[9]
Definition TEveElement.h:54
virtual void PaintStandard(TObject *id)
Paint object – a generic implementation for EVE elements.
Float_t fPolygonOffset[2]
Definition TEveText.h:43
void Paint(Option_t *option="") override
Paint this object. Only direct rendering is supported.
Definition TEveText.cxx:115
void SetFontFile(Int_t file)
Definition TEveText.h:53
void SetFontMode(Int_t mode)
Set FTFont class ID.
Definition TEveText.cxx:92
const TGPicture * GetListTreeIcon(Bool_t open=kFALSE) override
Return TEveText icon.
Definition TEveText.cxx:133
void SetFontSize(Int_t size, Bool_t validate=kTRUE)
Set valid font size.
Definition TEveText.cxx:59
TEveText(const TEveText &)
void SetPolygonOffset(Float_t factor, Float_t units)
Set the scale and units used to calculate depth values.
Definition TEveText.cxx:106
Int_t fFontSize
Definition TEveText.h:34
Int_t fFontMode
Definition TEveText.h:36
void ComputeBBox() override
Fill bounding-box information.
Definition TEveText.cxx:125
TEveTrans is a 4x4 transformation matrix for homogeneous coordinates stored internally in a column-ma...
Definition TEveTrans.h:27
void SetEditRotation(Bool_t x)
Definition TEveTrans.h:171
void SetEditScale(Bool_t x)
Definition TEveTrans.h:172
static FontSizeVec_t * GetFontSizeArray()
Get valid font size vector.
static TObjArray * GetFontFileArray()
Get id to file name map.
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
An array of TObjects.
Definition TObjArray.h:31
Collectable string class.
Definition TObjString.h:28
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Binary search in an array of n values to locate value.
Definition TMathBase.h:348