Logo ROOT   6.18/05
Reference Guide
RFrame.hxx
Go to the documentation of this file.
1/// \file ROOT/RFrame.hxx
2/// \ingroup Gpad ROOT7
3/// \author Axel Naumann <axel@cern.ch>
4/// \date 2017-09-26
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-2017, 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#ifndef ROOT7_RFrame
17#define ROOT7_RFrame
18
19#include "ROOT/RAttrBox.hxx"
21#include "ROOT/RPadUserAxis.hxx"
22#include "ROOT/RPalette.hxx"
23
24#include <memory>
25
26namespace ROOT {
27namespace Experimental {
28
29/** \class ROOT::Experimental::RFrame
30 Holds a user coordinate system with a palette.
31 */
32
33class RFrame {
34public:
36 public:
37 RAttrBox Frame() { return {"frame", *this}; }
38 };
39
40private:
41 /// Mapping of user coordinates to normal coordinates, one entry per dimension.
42 std::vector<std::unique_ptr<RPadUserAxisBase>> fUserCoord;
43
44 /// Palette used to visualize user coordinates.
46
47 /// Drawing options.
49
50public:
51 // Default constructor
53 {
55 }
56
57 /// Constructor taking user coordinate system, position and extent.
58 explicit RFrame(std::vector<std::unique_ptr<RPadUserAxisBase>> &&coords, const DrawingOpts &opts);
59
60 // Constructor taking position and extent.
61 explicit RFrame(const DrawingOpts &opts)
62 : RFrame({}, opts)
63 {}
64
66
67 /// Create `nDimensions` default axes for the user coordinate system.
68 void GrowToDimensions(size_t nDimensions);
69
70 /// Get the number of axes.
71 size_t GetNDimensions() const { return fUserCoord.size(); }
72
73 /// Get the current user coordinate system for a given dimension.
74 RPadUserAxisBase &GetUserAxis(size_t dimension) const { return *fUserCoord[dimension]; }
75
76 /// Set the user coordinate system.
77 void SetUserAxis(std::vector<std::unique_ptr<RPadUserAxisBase>> &&axes) { fUserCoord = std::move(axes); }
78
79 /// Convert user coordinates to normal coordinates.
80 std::array<RPadLength::Normal, 2> UserToNormal(const std::array<RPadLength::User, 2> &pos) const
81 {
82 return {{fUserCoord[0]->ToNormal(pos[0]), fUserCoord[1]->ToNormal(pos[1])}};
83 }
84};
85
86} // namespace Experimental
87} // namespace ROOT
88
89#endif
class ROOT::Experimental::RAttrBox Drawing attributes for a box: rectangular lines with size and posi...
Definition: RAttrBox.hxx:31
Holds a user coordinate system with a palette.
Definition: RFrame.hxx:33
std::array< RPadLength::Normal, 2 > UserToNormal(const std::array< RPadLength::User, 2 > &pos) const
Convert user coordinates to normal coordinates.
Definition: RFrame.hxx:80
void GrowToDimensions(size_t nDimensions)
Create nDimensions default axes for the user coordinate system.
Definition: RFrame.cxx:27
RPalette fPalette
Palette used to visualize user coordinates.
Definition: RFrame.hxx:45
size_t GetNDimensions() const
Get the number of axes.
Definition: RFrame.hxx:71
void SetUserAxis(std::vector< std::unique_ptr< RPadUserAxisBase > > &&axes)
Set the user coordinate system.
Definition: RFrame.hxx:77
std::vector< std::unique_ptr< RPadUserAxisBase > > fUserCoord
Mapping of user coordinates to normal coordinates, one entry per dimension.
Definition: RFrame.hxx:42
DrawingOpts fOpts
Drawing options.
Definition: RFrame.hxx:48
DrawingOpts & GetDrawingOpts()
Definition: RFrame.hxx:65
RPadUserAxisBase & GetUserAxis(size_t dimension) const
Get the current user coordinate system for a given dimension.
Definition: RFrame.hxx:74
RFrame(const DrawingOpts &opts)
Definition: RFrame.hxx:61
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21