From d5d1aa3f6adb37798fddf88f78c121a1fbefa9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Brochet?= Date: Fri, 15 Jan 2016 17:00:21 +0100 Subject: [PATCH] Allow the user to set the line style per line --- include/types.h | 27 +++++++++---- src/TH1Plotter.cc | 6 +-- src/plotIt.cc | 14 +++---- src/types.cc | 36 ++++++++++++------ ...fault_configuration_lines_inline_style.pdf | Bin 0 -> 45187 bytes test/unit_tests/tests.py | 25 +++++++++++- 6 files changed, 77 insertions(+), 31 deletions(-) create mode 100644 test/golden/default_configuration_lines_inline_style.pdf diff --git a/include/types.h b/include/types.h index 1f57594..637677d 100644 --- a/include/types.h +++ b/include/types.h @@ -1,7 +1,9 @@ #pragma once -#include #include +#include +#include + #include #include @@ -78,7 +80,18 @@ namespace plotIt { Summary summary; }; - struct PlotStyle { + struct LineStyle { + float line_width = 1; + int16_t line_color = 1; + int16_t line_type = 1; + + LineStyle() = default; + LineStyle(const YAML::Node& node); + + void parse(const YAML::Node& node); + }; + + struct PlotStyle: public LineStyle { // Style float marker_size; @@ -86,9 +99,6 @@ namespace plotIt { int16_t marker_type; int16_t fill_color; int16_t fill_type; - float line_width; - int16_t line_color; - int16_t line_type; std::string drawing_options; // Legend @@ -210,6 +220,8 @@ namespace plotIt { Point start; Point end; + boost::optional style; + bool operator==(const Line& other) { return ((start == other.start) && (end == other.end)); } @@ -224,6 +236,7 @@ namespace plotIt { start = *c.begin(); end = *(c.begin() + 1); } + Line(const YAML::Node& node, Orientation); }; @@ -349,9 +362,7 @@ namespace plotIt { int16_t ratio_fit_error_fill_color = 42; int16_t ratio_fit_error_fill_style = 1001; - int16_t line_color = 0; - int16_t line_width = 1; - int16_t line_style = 1; + LineStyle line_style; std::vector