Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveLogo.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, 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#ifndef ROOT7_REveLogo
13#define ROOT7_REveLogo
14
15#include <ROOT/REveElement.hxx>
16
17#include <string>
18
19namespace ROOT {
20namespace Experimental {
21
22class REveLogo : public REveElement {
23public:
24 /// Where the image comes from: a directory registered with SetImageDir()
25 /// (the default), ui5/eve7/textures/, or an absolute URL fetched by the
26 /// browser. The constructor selects kRemote for a URL; SetFile() does not.
27 // clang-format off
29 // clang-format on
30
31private:
32 REveLogo(const REveLogo &) = delete;
33 REveLogo &operator=(const REveLogo &) = delete;
34
35protected:
36 // clang-format off
37 std::string fFile; ///< file name or URL, interpreted according to fSource
38
39 Float_t fPosX{0.06}; ///< position in the (0,1) overlay box; the image is centred on it
41 Float_t fSize{96}; ///< height in CSS pixels; width follows the image aspect
42 Float_t fOpacity{0.8}; ///< resting opacity; the client brightens it on hover
43
46 // clang-format on
47
48 static std::string sImageDir;
49
50public:
51 REveLogo(std::string_view file, const Text_t *n = "REveLogo", const Text_t *t = "");
52 ~REveLogo() override {}
53
54 static bool IsRemote(const std::string &f);
55
56 static bool SetImageDir(std::string_view dir);
57 static const std::string &GetImageDir() { return sImageDir; }
58
59 /// Either a file name inside the registered image directory, or an absolute
60 /// URL the client fetches directly. A remote URL fails silently on CORS,
61 /// mixed content or a bad certificate; serve locally via SetImageDir().
62 // clang-format off
63 const std::string &GetFile() const { return fFile; }
64 void SetFile(std::string_view f) { fFile = f; StampObjProps(); }
65
66 Float_t GetPosX() const { return fPosX; }
67 Float_t GetPosY() const { return fPosY; }
69
70 Float_t GetSize() const { return fSize; }
71 void SetSize(Float_t s) { fSize = s; StampObjProps(); }
72
73 Float_t GetOpacity() const { return fOpacity; }
75
76 EImageSource_e GetSource() const { return fSource; }
78
79 Bool_t GetResizable() const { return fResizable; }
81 // clang-format on
82
83 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
84 void BuildRenderData() override;
85};
86
87} // namespace Experimental
88} // namespace ROOT
89
90#endif
#define f(i)
Definition RSha256.hxx:104
char Text_t
General string (char)
Definition RtypesCore.h:77
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
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
Float_t fPosX
position in the (0,1) overlay box; the image is centred on it
Definition REveLogo.hxx:39
REveLogo(const REveLogo &)=delete
EImageSource_e
Where the image comes from: a directory registered with SetImageDir() (the default),...
Definition REveLogo.hxx:28
const std::string & GetFile() const
Either a file name inside the registered image directory, or an absolute URL the client fetches direc...
Definition REveLogo.hxx:63
Float_t fSize
height in CSS pixels; width follows the image aspect
Definition REveLogo.hxx:41
Float_t fOpacity
resting opacity; the client brightens it on hover
Definition REveLogo.hxx:42
void SetFile(std::string_view f)
Definition REveLogo.hxx:64
static const std::string & GetImageDir()
Definition REveLogo.hxx:57
void SetOpacity(Float_t o)
Definition REveLogo.hxx:74
void SetSource(EImageSource_e s)
Definition REveLogo.hxx:77
Float_t GetOpacity() const
Definition REveLogo.hxx:73
std::string fFile
file name or URL, interpreted according to fSource
Definition REveLogo.hxx:37
static bool IsRemote(const std::string &f)
Is the file an absolute URL, to be fetched by the client directly?
Definition REveLogo.cxx:53
void BuildRenderData() override
Name the client factory makeLogo. No geometry is sent.
Definition REveLogo.cxx:110
EImageSource_e GetSource() const
Definition REveLogo.hxx:76
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Stream the file, source, position, size, opacity and resizability.
Definition REveLogo.cxx:92
static std::string sImageDir
Definition REveLogo.hxx:48
void SetPosition(Float_t x, Float_t y)
Definition REveLogo.hxx:68
REveLogo & operator=(const REveLogo &)=delete
Bool_t GetResizable() const
Definition REveLogo.hxx:79
static bool SetImageDir(std::string_view dir)
Register the directory images are served from, mapped under "eve-images/".
Definition REveLogo.cxx:62
void SetResizable(Bool_t r)
Definition REveLogo.hxx:80
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16