From 935385fc6dc7103c8b6f1cca74b6a56bb582c74e Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Thu, 16 Feb 2023 15:21:40 +0000 Subject: [PATCH] Axis: axis_grid_background_colour ( none) background colour for axis. --- src/attributes/AxisAttributes.cc | 7 +++++++ src/attributes/AxisAttributes.h | 1 + src/attributes/AxisWrapper.cc | 6 ++++++ src/params/Axis.xml | 8 +++++++- src/visualisers/Axis.cc | 16 ++++++++++++++++ 5 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/attributes/AxisAttributes.cc b/src/attributes/AxisAttributes.cc index 446ea50d..c0bb27ce 100644 --- a/src/attributes/AxisAttributes.cc +++ b/src/attributes/AxisAttributes.cc @@ -74,6 +74,7 @@ AxisAttributes::AxisAttributes(): line_colour_(MagTranslator().magics("axis_line_colour")), line_style_(MagTranslator().magics("axis_line_style")), grid_colour_(MagTranslator().magics("axis_grid_colour")), + grid_background_colour_(MagTranslator().magics("axis_grid_background_colour")), grid_style_(MagTranslator().magics("axis_grid_line_style")), minor_grid_colour_(MagTranslator().magics("axis_minor_grid_colour")), minor_grid_style_(MagTranslator().magics("axis_minor_grid_line_style")), @@ -152,6 +153,7 @@ void AxisAttributes::set(const std::map& params) setMember(prefix, "axis_line_colour", line_colour_, params); setAttribute(prefix, "axis_line_style", line_style_, params); setMember(prefix, "axis_grid_colour", grid_colour_, params); + setMember(prefix, "axis_grid_background_colour", grid_background_colour_, params); setAttribute(prefix, "axis_grid_line_style", grid_style_, params); setMember(prefix, "axis_minor_grid_colour", minor_grid_colour_, params); setAttribute(prefix, "axis_minor_grid_line_style", minor_grid_style_, params); @@ -217,6 +219,7 @@ void AxisAttributes::copy(const AxisAttributes& other) line_colour_ = unique_ptr(other.line_colour_->clone()); line_style_ = other.line_style_; grid_colour_ = unique_ptr(other.grid_colour_->clone()); + grid_background_colour_ = unique_ptr(other.grid_background_colour_->clone()); grid_style_ = other.grid_style_; minor_grid_colour_ = unique_ptr(other.minor_grid_colour_->clone()); minor_grid_style_ = other.minor_grid_style_; @@ -319,6 +322,7 @@ void AxisAttributes::print(ostream& out) const out << " line_colour = " << *line_colour_; out << " line_style = " << line_style_; out << " grid_colour = " << *grid_colour_; + out << " grid_background_colour = " << *grid_background_colour_; out << " grid_style = " << grid_style_; out << " minor_grid_colour = " << *minor_grid_colour_; out << " minor_grid_style = " << minor_grid_style_; @@ -434,6 +438,8 @@ void AxisAttributes::toxml(ostream& out) const niceprint(out, line_style_); out << ", \"axis_grid_colour\":"; niceprint(out, *grid_colour_); + out << ", \"axis_grid_background_colour\":"; + niceprint(out, *grid_background_colour_); out << ", \"axis_grid_line_style\":"; niceprint(out, grid_style_); out << ", \"axis_minor_grid_colour\":"; @@ -509,6 +515,7 @@ static MagicsParameter axis_type("axis_type", "regular"); static MagicsParameter axis_line_colour("axis_line_colour", "automatic"); static MagicsParameter axis_line_style("axis_line_style", "solid"); static MagicsParameter axis_grid_colour("axis_grid_colour", "black"); +static MagicsParameter axis_grid_background_colour("axis_grid_background_colour", "none"); static MagicsParameter axis_grid_line_style("axis_grid_line_style", "solid"); static MagicsParameter axis_minor_grid_colour("axis_minor_grid_colour", "black"); static MagicsParameter axis_minor_grid_line_style("axis_minor_grid_line_style", "solid"); diff --git a/src/attributes/AxisAttributes.h b/src/attributes/AxisAttributes.h index 1410aff3..a04e0f96 100644 --- a/src/attributes/AxisAttributes.h +++ b/src/attributes/AxisAttributes.h @@ -100,6 +100,7 @@ class AxisAttributes unique_ptr line_colour_; LineStyle line_style_; unique_ptr grid_colour_; + unique_ptr grid_background_colour_; LineStyle grid_style_; unique_ptr minor_grid_colour_; LineStyle minor_grid_style_; diff --git a/src/attributes/AxisWrapper.cc b/src/attributes/AxisWrapper.cc index a45b68f4..0f5096f4 100644 --- a/src/attributes/AxisWrapper.cc +++ b/src/attributes/AxisWrapper.cc @@ -289,6 +289,11 @@ void AxisWrapper::set(const MagRequest& request) axis_->grid_colour_ = unique_ptr(MagTranslator()(grid_colour_value)); } + if (request.countValues("AXIS_GRID_BACKGROUND_COLOUR") ) { + string grid_background_colour_value = request("AXIS_GRID_BACKGROUND_COLOUR"); + axis_->grid_background_colour_ = unique_ptr(MagTranslator()(grid_background_colour_value)); + } + if (request.countValues("AXIS_GRID_LINE_STYLE") ) { string grid_style_value = request("AXIS_GRID_LINE_STYLE"); @@ -403,3 +408,4 @@ static SimpleObjectMaker Axis_axis_ty + diff --git a/src/params/Axis.xml b/src/params/Axis.xml index 64e33e2c..9b79fdc2 100644 --- a/src/params/Axis.xml +++ b/src/params/Axis.xml @@ -91,7 +91,13 @@ does it submit to any jurisdiction. from="string" name="axis_grid_colour"> Colour of grid lines - 2.13.5 - Default changed fronm YELLOW to BLACK + + + Colour of grid background none()) { + Polyline* area = new Polyline(); + area->setColour(*grid_background_colour_); + area->setFilled(true); + area->setShading(new FillShadingProperties()); + area->setFillColour(*grid_background_colour_); + out.push_back(area); + area->push_back(PaperPoint(left, bottom)); + area->push_back(PaperPoint(left, top)); + area->push_back(PaperPoint(right, top)); + area->push_back(PaperPoint(right, bottom)); + area->push_back(PaperPoint(left, bottom)); + } + if (!grid_) { if (grid_reference_level_ != INT_MAX) { for (AxisItems::const_iterator x = items_.begin(); x != items_.end(); ++x) {