Logo ROOT   6.18/05
Reference Guide
RHistPainter.cxx
Go to the documentation of this file.
1/// \file RHistPainter.cxx
2/// \ingroup HistPainter ROOT7
3/// \author Axel Naumann <axel@cern.ch>
4/// \date 2015-07-09
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8/*************************************************************************
9 * Copyright (C) 1995-2016, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16//#include "ROOT/RHistPainter.hxx" see ROOT/RHistDrawable.h
17
19#include "ROOT/RPadPainter.hxx"
20#include "ROOT/RDisplayItem.hxx"
21
22#include <iostream>
23#include <cassert>
24
25using namespace ROOT::Experimental;
26using namespace ROOT::Experimental::Internal;
27
28namespace {
29class RHistPainter1D : public RHistPainterBase<1> {
30public:
31 void Paint(RDrawable &drw, const RHistDrawingOpts<1> & /*opts*/, RPadPainter &pad) final
32 {
33 assert(dynamic_cast<RHistDrawable<1> *>(&drw) && "Wrong drawable type");
34 RHistDrawable<1> &hd = static_cast<RHistDrawable<1> &>(drw);
35
36 pad.AddDisplayItem(
38 }
39 virtual ~RHistPainter1D() final {}
40};
41
42class RHistPainter2D : public RHistPainterBase<2> {
43public:
44 void Paint(RDrawable &drw, const RHistDrawingOpts<2> & /*opts*/, RPadPainter &pad) final
45 {
46 assert(dynamic_cast<RHistDrawable<2> *>(&drw) && "Wrong drawable type");
47 RHistDrawable<2> &hd = static_cast<RHistDrawable<2> &>(drw);
48
49 pad.AddDisplayItem(
51 }
52 virtual ~RHistPainter2D() final {}
53};
54
55class RHistPainter3D : public RHistPainterBase<3> {
56public:
57 void Paint(RDrawable &hist, const RHistDrawingOpts<3> & /*opts*/, RPadPainter & /*canv*/) final
58 {
59 // TODO: paint!
60 std::cout << "Painting 3D histogram (to be done) @" << &hist << '\n';
61 }
62 virtual ~RHistPainter3D() final {}
63};
64
65struct HistPainterReg {
66 RHistPainter1D fPainter1D;
67 RHistPainter2D fPainter2D;
68 RHistPainter3D fPainter3D;
69} histPainterReg;
70} // unnamed namespace
virtual void Paint(RDrawable &obj, const RHistDrawingOpts< DIMENSION > &opts, RPadPainter &pad)=0
Paint a RHist. All we need is access to its GetBinContent()
Abstract interface for object painting on the pad/canvas.
Definition: RPadPainter.hxx:37
Base class for drawable entities: objects that can be painted on a RPad.
Definition: RDrawable.hxx:37
Drawing options for a 1D histogram.
Drawing options for a 2D histogram.
Drawing options for a 3D histogram.