21#include <unordered_map>
27static constexpr const char *
kUnits[] = {
"B",
"KB",
"MB",
"GB",
"TB",
"PB",
"EB"};
33 uint64_t
h = 14695981039346656037ULL;
35 h = (
h ^
static_cast<uint8_t
>(
c)) * 1099511628211ULL;
45static std::string
GetFloatStr(
const float &
n,
const uint8_t &precision)
47 std::stringstream stream;
48 stream << std::fixed << std::setprecision(precision) <<
n;
54 const uint64_t order = std::log10(
bytes) / 3.0f;
55 const std::string unit =
kUnits[order];
56 const float finalSize =
static_cast<float>(
bytes) / std::pow(1000, order);
60static std::vector<std::pair<std::string, uint64_t>>
GetDiskOccupation(
const std::vector<RTreeMapBase::Node> &nodes)
62 std::unordered_map<std::string, uint64_t>
acc;
63 for (
const auto &node : nodes) {
64 if (node.fNChildren > 0)
66 acc[node.fType] += node.fSize;
69 std::vector<std::pair<std::string, uint64_t>>
vec;
72 vec.emplace_back(std::move(
p.first),
p.second);
74 std::sort(
vec.begin(),
vec.end(), [](
const auto &
a,
const auto &
b) { return a.second > b.second; });
85 for (
const auto &
child : row)
90 for (
const auto &
child : row) {
100static std::vector<std::pair<RTreeMapBase::Node, RTreeMapBase::Rect>>
109 std::vector<std::pair<RTreeMapBase::Node, RTreeMapBase::Rect>>
result;
112 std::vector<RTreeMapBase::Node> row;
130 for (
const auto &
child : row)
136 float position = 0.0f;
137 for (
const auto &
child : row) {
168 const auto &typeName =
entry.first;
173 const auto offset = 0.835f, factor = 0.05f;
214 std::vector<RTreeMapBase::Node> children;
215 for (std::uint64_t i = 0; i <
element.fNChildren; ++i)
218 for (
const auto &
child : children)
static std::vector< std::pair< RTreeMapBase::Node, RTreeMapBase::Rect > > SquarifyChildren(const std::vector< RTreeMapBase::Node > &children, RTreeMapBase::Rect rect, bool horizontalRows, uint64_t totalSize)
static float ComputeWorstRatio(const std::vector< RTreeMapBase::Node > &row, float width, float height, uint64_t totalSize, bool horizontalRows)
static constexpr float kTextSizeFactor
static std::string GetDataStr(uint64_t bytes)
static constexpr const char * kUnits[]
static constexpr float kIndentationOffset
static std::string GetFloatStr(const float &n, const uint8_t &precision)
static constexpr float kPadTextOffset
static RTreeMapBase::RGBColor ComputeColor(const std::string &str)
static std::vector< std::pair< std::string, uint64_t > > GetDiskOccupation(const std::vector< RTreeMapBase::Node > &nodes)
static uint64_t ComputeFnv(const std::string &str)
static void indent(ostringstream &buf, int indent_level)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t rect
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t bytes
Option_t Option_t TPoint TPoint percent
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
virtual void AddText(const Vec2 &pos, const std::string &content, float size, const RGBColor &color=RGBColor(0, 0, 0), bool alignCenter=false) const =0
Logic for drawing a text.
std::vector< Node > fNodes
void DrawLegend() const
Logic for drawing the legend of leaf types.
virtual void AddBox(const Rect &rect, const RGBColor &color, float borderWidth=0.15f) const =0
Logic for drawing a box.
void DrawTreeMap(const Node &elem, Rect rect, int depth) const
Logic for drawing the entirety of the treemap.
const_iterator begin() const
const_iterator end() const