Logo ROOT   6.18/05
Reference Guide
RPadPos.cxx
Go to the documentation of this file.
1/// \file RPadPos.cxx
2/// \ingroup Gpad ROOT7
3/// \author Axel Naumann <axel@cern.ch>
4/// \date 2018-02-08
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-2018, 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/RPadPos.hxx"
17
18#include <ROOT/RPadExtent.hxx>
19#include <ROOT/RLogger.hxx>
20
21////////////////////////////////////////////////////////////////////////////////
22/// Initialize a RPadPos from a style string.
23/// Syntax: X, Y
24/// where X and Y are a series of numbers separated by "+", where each number is
25/// followed by one of `px`, `user`, `normal` to specify an extent in pixel,
26/// user or normal coordinates. Spaces between any part is allowed.
27/// Example: `100 px + 0.1 user, 0.5 normal` is a `RPadPos{100_px + 0.1_user, 0.5_normal}`.
28
30{
31 RPadPos ret;
32 ret.SetFromAttrString(val, name);
33 return ret;
34}
35
36////////////////////////////////////////////////////////////////////////////////
37/// Convert a RPadPos to a style string, matching what PosFromString can parse.
38
40{
41 std::string ret = ToAttributeString(pos.fHoriz);
42 ret += ", ";
43 ret += ToAttributeString(pos.fVert);
44 return ret;
45}
46
char name[80]
Definition: TGX11.cxx:109
std::string ToAttributeString(const RColor &val)
Return a std::string representation of a RColor, suitable as input to ColorFromString().
Definition: RColor.cxx:144
RColor FromAttributeString(const std::string &str, const std::string &name, RColor *)
Initialize a RColor from a string value.
Definition: RColor.cxx:132
void SetFromAttrString(const std::string &val, const std::string &name)
Initialize a RPadHorizVert from a style string.
Definition: RPadExtent.cxx:55
RPadLength fHoriz
Horizontal position.
Definition: RPadExtent.hxx:33
RPadLength fVert
Vertical position.
Definition: RPadExtent.hxx:34
A position (horizontal and vertical) in a RPad.
Definition: RPadPos.hxx:27