Logo ROOT  
Reference Guide
RFrame.hxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
9#ifndef ROOT7_RFrame
10#define ROOT7_RFrame
11
12#include "ROOT/RDrawable.hxx"
13
14#include "ROOT/RAttrBox.hxx"
15#include "ROOT/RPadUserAxis.hxx"
16#include "ROOT/RPalette.hxx"
17
18#include <memory>
19
20namespace ROOT {
21namespace Experimental {
22
23/** \class RFrame
24\ingroup GpadROOT7
25\brief Holds a user coordinate system with a palette.
26\author Axel Naumann <axel@cern.ch>
27\date 2017-09-26
28\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
29*/
30
31class RFrame : public RDrawable {
32public:
33
34private:
35 /// Mapping of user coordinates to normal coordinates, one entry per dimension.
36 std::vector<std::unique_ptr<RPadUserAxisBase>> fUserCoord;
37
38 /// Palette used to visualize user coordinates.
40
41public:
42 // Default constructor
43 RFrame() : RDrawable("frame")
44 {
46 }
47
48 /// Constructor taking user coordinate system, position and extent.
49 explicit RFrame(std::vector<std::unique_ptr<RPadUserAxisBase>> &&coords);
50
51 /// Create `nDimensions` default axes for the user coordinate system.
52 void GrowToDimensions(size_t nDimensions);
53
54 /// Get the number of axes.
55 size_t GetNDimensions() const { return fUserCoord.size(); }
56
57 /// Get the current user coordinate system for a given dimension.
58 RPadUserAxisBase &GetUserAxis(size_t dimension) const { return *fUserCoord[dimension]; }
59
60 /// Set the user coordinate system.
61 void SetUserAxis(std::vector<std::unique_ptr<RPadUserAxisBase>> &&axes) { fUserCoord = std::move(axes); }
62
63 /// Convert user coordinates to normal coordinates.
64 std::array<RPadLength::Normal, 2> UserToNormal(const std::array<RPadLength::User, 2> &pos) const
65 {
66 return {{fUserCoord[0]->ToNormal(pos[0]), fUserCoord[1]->ToNormal(pos[1])}};
67 }
68};
69
70} // namespace Experimental
71} // namespace ROOT
72
73#endif
Base class for drawable entities: objects that can be painted on a RPad.
Definition: RDrawable.hxx:99
Holds a user coordinate system with a palette.
Definition: RFrame.hxx:31
std::array< RPadLength::Normal, 2 > UserToNormal(const std::array< RPadLength::User, 2 > &pos) const
Convert user coordinates to normal coordinates.
Definition: RFrame.hxx:64
void GrowToDimensions(size_t nDimensions)
Create nDimensions default axes for the user coordinate system.
Definition: RFrame.cxx:22
RPalette fPalette
Palette used to visualize user coordinates.
Definition: RFrame.hxx:39
size_t GetNDimensions() const
Get the number of axes.
Definition: RFrame.hxx:55
void SetUserAxis(std::vector< std::unique_ptr< RPadUserAxisBase > > &&axes)
Set the user coordinate system.
Definition: RFrame.hxx:61
std::vector< std::unique_ptr< RPadUserAxisBase > > fUserCoord
Mapping of user coordinates to normal coordinates, one entry per dimension.
Definition: RFrame.hxx:36
RPadUserAxisBase & GetUserAxis(size_t dimension) const
Get the current user coordinate system for a given dimension.
Definition: RFrame.hxx:58
Base class for user coordinates (e.g.
VSD Structures.
Definition: StringConv.hxx:21