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 bool AddImageDir(std::string_view dir);
58 static const std::string &GetImageDir() { return sImageDir; }
59
60 /// Either a file name inside the registered image directory, or an absolute
61 /// URL the client fetches directly. A remote URL fails silently on CORS,
62 /// mixed content or a bad certificate; serve locally via SetImageDir().
63 // clang-format off
64 const std::string &GetFile() const { return fFile; }
65 void SetFile(std::string_view f) { fFile = f; StampObjProps(); }
66
67 Float_t GetPosX() const { return fPosX; }
68 Float_t GetPosY() const { return fPosY; }
70
71 Float_t GetSize() const { return fSize; }
72 void SetSize(Float_t s) { fSize = s; StampObjProps(); }
73
74 Float_t GetOpacity() const { return fOpacity; }
76
77 EImageSource_e GetSource() const { return fSource; }
79
80 Bool_t GetResizable() const { return fResizable; }
82 // clang-format on
83
84 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
85 void BuildRenderData() override;
86 void ComputeBBox() override { BBoxNotInWorld(); }
87};
88
89} // namespace Experimental
90} // namespace ROOT
91
92#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:64
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
static bool AddImageDir(std::string_view dir)
Add a directory images are served from, searched after the ones registered before it.
Definition REveLogo.cxx:113
void SetFile(std::string_view f)
Definition REveLogo.hxx:65
static const std::string & GetImageDir()
Definition REveLogo.hxx:58
void SetOpacity(Float_t o)
Definition REveLogo.hxx:75
void SetSource(EImageSource_e s)
Definition REveLogo.hxx:78
Float_t GetOpacity() const
Definition REveLogo.hxx:74
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:70
void BuildRenderData() override
Name the client factory makeLogo. No geometry is sent.
Definition REveLogo.cxx:146
EImageSource_e GetSource() const
Definition REveLogo.hxx:77
void ComputeBBox() override
Compute the bounding box in the element's own frame, before fMainTrans.
Definition REveLogo.hxx:86
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Stream the file, source, position, size, opacity and resizability.
Definition REveLogo.cxx:128
static std::string sImageDir
Definition REveLogo.hxx:48
void SetPosition(Float_t x, Float_t y)
Definition REveLogo.hxx:69
REveLogo & operator=(const REveLogo &)=delete
Bool_t GetResizable() const
Definition REveLogo.hxx:80
static bool SetImageDir(std::string_view dir)
Register the directory images are served from, mapped under "eve-images/".
Definition REveLogo.cxx:98
void SetResizable(Bool_t r)
Definition REveLogo.hxx:81
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16