Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TWebPainting.h
Go to the documentation of this file.
1// Author: Sergey Linev, GSI 10/04/2017
2
3/*************************************************************************
4 * Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_TWebPainting
12#define ROOT_TWebPainting
13
14#include "TObject.h"
15#include "TAttLine.h"
16#include "TAttFill.h"
17#include "TAttText.h"
18#include "TAttMarker.h"
19#include "TArrayF.h"
20
21class TColor;
22
23#include <string>
24
25class TWebPainting : public TObject {
26
27 protected:
28 std::string fClassName; ///< class name of object produced this painting
29 std::string fObjectName; ///< object name
30 std::string fOper; ///< list of operations, separated by semicolons
31 Int_t fSize{0}; ///<! filled buffer size
32 TArrayF fBuf; ///< array of points for all operations
33 TAttLine fLastLine; ///<! last line attributes
34 TAttFill fLastFill; ///<! last fill attributes
35 TAttMarker fLastMarker; ///<! last marker attributes
36
37 public:
38
40 ~TWebPainting() override = default;
41
42 void SetClassName(const std::string &classname) { fClassName = classname; }
43 const std::string &GetClassName() const { return fClassName; }
44
45 void SetObjectName(const std::string &objname) { fObjectName = objname; }
46 const std::string &GetObjectName() const { return fObjectName; }
47
48 Bool_t IsEmpty() const { return fOper.empty() && (fBuf.GetSize() == 0); }
49
50 void AddOper(const std::string &oper);
51
52 void AddLineAttr(const TAttLine &attr);
53 void AddFillAttr(const TAttFill &attr);
54 void AddTextAttr(const TAttText &attr);
55 void AddMarkerAttr(const TAttMarker &attr);
56
58
59 void AddColor(Int_t indx, TColor *col);
60
61 // Set actual filled size
62 void FixSize() { fBuf.Set(fSize); }
63
64 static std::string MakeTextOper(const char *str);
65
66
67 ClassDefOverride(TWebPainting, 2) // store for all paint operation of TVirtualPadPainter
68};
69
70#endif
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
Array of floats (32 bits per element).
Definition TArrayF.h:27
void Set(Int_t n) override
Set size of this array to n floats.
Definition TArrayF.cxx:105
Int_t GetSize() const
Definition TArray.h:47
Fill Area Attributes class.
Definition TAttFill.h:19
Line Attributes class.
Definition TAttLine.h:18
Marker Attributes class.
Definition TAttMarker.h:19
Text Attributes class.
Definition TAttText.h:18
The color creation and management class.
Definition TColor.h:21
Mother of all ROOT objects.
Definition TObject.h:41
Object used to store paint operations and deliver them to JSROOT.
void AddColor(Int_t indx, TColor *col)
Add custom color to operations.
TWebPainting()
Constructor.
void AddTextAttr(const TAttText &attr)
Store text attributes If attributes were not changed - ignore operation.
TAttMarker fLastMarker
! last marker attributes
void SetObjectName(const std::string &objname)
void AddMarkerAttr(const TAttMarker &attr)
Store marker attributes If attributes were not changed - ignore operation.
~TWebPainting() override=default
const std::string & GetObjectName() const
void AddLineAttr(const TAttLine &attr)
Store line attributes If attributes were not changed - ignore operation.
static std::string MakeTextOper(const char *str)
Create text operation If text include special symbols - use simple hex coding.
const std::string & GetClassName() const
std::string fObjectName
object name
Int_t fSize
! filled buffer size
std::string fClassName
class name of object produced this painting
TAttFill fLastFill
! last fill attributes
std::string fOper
list of operations, separated by semicolons
void AddOper(const std::string &oper)
Add next custom operator to painting Operations are separated by semicolons Following operations are ...
Float_t * Reserve(Int_t sz)
Reserve place in the float buffer Returns pointer on first element in reserved area.
TArrayF fBuf
array of points for all operations
TAttLine fLastLine
! last line attributes
void AddFillAttr(const TAttFill &attr)
Store fill attributes If attributes were not changed - ignore operation.
Bool_t IsEmpty() const
void SetClassName(const std::string &classname)