diff --git a/src/attributes/EpsPlumeAttributes.cc b/src/attributes/EpsPlumeAttributes.cc index 5518fc28..dafaf992 100644 --- a/src/attributes/EpsPlumeAttributes.cc +++ b/src/attributes/EpsPlumeAttributes.cc @@ -37,7 +37,9 @@ EpsPlumeAttributes::EpsPlumeAttributes(): median_line_thickness_(ParameterManager::getInt("eps_plume_median_line_thickness")), shading_(ParameterManager::getBool("eps_plume_shading")), shading_levels_(ParameterManager::getDoubleArray("eps_plume_shading_level_list")), - shading_colours_(ParameterManager::getStringArray("eps_plume_shading_colour_list")) + shading_colours_(ParameterManager::getStringArray("eps_plume_shading_colour_list")), + background_level_list_(ParameterManager::getDoubleArray("eps_plume_background_level_list")), + background_colour_list_(ParameterManager::getStringArray("eps_plume_background_colour_list")) , line_colour_(MagTranslator().magics("eps_plume_line_colour")), line_style_(MagTranslator().magics("eps_plume_line_style")), @@ -78,6 +80,8 @@ void EpsPlumeAttributes::set(const std::map& params) setAttribute(prefix, "eps_plume_shading", shading_, params); setAttribute(prefix, "eps_plume_shading_level_list", shading_levels_, params); setAttribute(prefix, "eps_plume_shading_colour_list", shading_colours_, params); + setAttribute(prefix, "eps_plume_background_level_list", background_level_list_, params); + setAttribute(prefix, "eps_plume_background_colour_list", background_colour_list_, params); setMember(prefix, "eps_plume_line_colour", line_colour_, params); setAttribute(prefix, "eps_plume_line_style", line_style_, params); @@ -105,6 +109,8 @@ void EpsPlumeAttributes::copy(const EpsPlumeAttributes& other) shading_ = other.shading_; shading_levels_ = other.shading_levels_; shading_colours_ = other.shading_colours_; + background_level_list_ = other.background_level_list_; + background_colour_list_ = other.background_colour_list_; line_colour_ = unique_ptr(other.line_colour_->clone()); line_style_ = other.line_style_; forecast_line_colour_ = unique_ptr(other.forecast_line_colour_->clone()); @@ -164,6 +170,8 @@ void EpsPlumeAttributes::print(ostream& out) const out << " shading = " << shading_; out << " shading_levels = " << shading_levels_; out << " shading_colours = " << shading_colours_; + out << " background_level_list = " << background_level_list_; + out << " background_colour_list = " << background_colour_list_; out << " line_colour = " << *line_colour_; out << " line_style = " << line_style_; out << " forecast_line_colour = " << *forecast_line_colour_; @@ -205,6 +213,10 @@ void EpsPlumeAttributes::toxml(ostream& out) const niceprint(out,shading_levels_); out << ", \"eps_plume_shading_colour_list\":"; niceprint(out,shading_colours_); + out << ", \"eps_plume_background_level_list\":"; + niceprint(out,background_level_list_); + out << ", \"eps_plume_background_colour_list\":"; + niceprint(out,background_colour_list_); out << ", \"eps_plume_line_colour\":"; niceprint(out, *line_colour_); out << ", \"eps_plume_line_style\":"; @@ -237,6 +249,8 @@ static MagicsParameter eps_plume_median_line_thickness("eps_plume_median_li static MagicsParameter eps_plume_shading("eps_plume_shading", "off"); static MagicsParameter eps_plume_shading_level_list("eps_plume_shading_level_list", floatarray()); static MagicsParameter eps_plume_shading_colour_list("eps_plume_shading_colour_list", stringarray()); +static MagicsParameter eps_plume_background_level_list("eps_plume_background_level_list", floatarray()); +static MagicsParameter eps_plume_background_colour_list("eps_plume_background_colour_list", stringarray()); static MagicsParameter eps_plume_line_colour("eps_plume_line_colour", "magenta"); static MagicsParameter eps_plume_line_style("eps_plume_line_style", "solid"); static MagicsParameter eps_plume_forecast_line_colour("eps_plume_forecast_line_colour", "cyan"); diff --git a/src/attributes/EpsPlumeAttributes.h b/src/attributes/EpsPlumeAttributes.h index e233fbf2..59a7b33d 100644 --- a/src/attributes/EpsPlumeAttributes.h +++ b/src/attributes/EpsPlumeAttributes.h @@ -64,6 +64,8 @@ class EpsPlumeAttributes bool shading_; doublearray shading_levels_; stringarray shading_colours_; + doublearray background_level_list_; + stringarray background_colour_list_; unique_ptr line_colour_; LineStyle line_style_; unique_ptr forecast_line_colour_; diff --git a/src/attributes/EpsPlumeWrapper.cc b/src/attributes/EpsPlumeWrapper.cc index 1f9aac7b..a0e84600 100644 --- a/src/attributes/EpsPlumeWrapper.cc +++ b/src/attributes/EpsPlumeWrapper.cc @@ -121,6 +121,16 @@ void EpsPlumeWrapper::set(const MagRequest& request) shading_colours_value.push_back((string)request("EPS_PLUME_SHADING_COLOUR_LIST", i)); if ( !shading_colours_value.empty() ) epsplume_->shading_colours_ = shading_colours_value; + doublearray background_level_list_value; + for (int i = 0; i < request.countValues("EPS_PLUME_BACKGROUND_LEVEL_LIST"); i++) + background_level_list_value.push_back((double)request("EPS_PLUME_BACKGROUND_LEVEL_LIST", i)); + if ( !background_level_list_value.empty() ) + epsplume_->background_level_list_ = background_level_list_value; + stringarray background_colour_list_value; + for (int i = 0; i < request.countValues("EPS_PLUME_BACKGROUND_COLOUR_LIST"); i++) + background_colour_list_value.push_back((string)request("EPS_PLUME_BACKGROUND_COLOUR_LIST", i)); + if ( !background_colour_list_value.empty() ) + epsplume_->background_colour_list_ = background_colour_list_value; if (request.countValues("EPS_PLUME_LINE_COLOUR") ) { string line_colour_value = request("EPS_PLUME_LINE_COLOUR"); diff --git a/src/params/EpsPlume.xml b/src/params/EpsPlume.xml index ebc0eb7b..577a1312 100644 --- a/src/params/EpsPlume.xml +++ b/src/params/EpsPlume.xml @@ -164,5 +164,20 @@ does it submit to any jurisdiction. name="eps_plume_shading_colour_list"> colours used for plumes shading + + Background level list + + + Background colour list + + diff --git a/src/visualisers/EpsGraph.cc b/src/visualisers/EpsGraph.cc index a80ab7a6..56a45943 100644 --- a/src/visualisers/EpsGraph.cc +++ b/src/visualisers/EpsGraph.cc @@ -2660,7 +2660,44 @@ void EpsPlume::verticalprofile(Data& data, BasicGraphicsObjectContainer& visitor visitor.push_back(control); visitor.push_back(forecast); } + +void EpsPlume::background(BasicGraphicsObjectContainer& visitor) { + // Add background + const Transformation& transformation = visitor.transformation(); + + double from = transformation.getMinY(); + auto colour = background_colour_list_.begin(); + for (const auto& level : background_level_list_ ) { + Polyline* area = new Polyline(); + area->setColour(Colour(*colour)); + area->setFilled(true); + area->setShading(new FillShadingProperties()); + area->setFillColour(Colour(*colour)); + visitor.push_back(area); + area->push_back(PaperPoint(transformation.getMinX(), from)); + area->push_back(PaperPoint(transformation.getMinX(), level)); + area->push_back(PaperPoint(transformation.getMaxX(), level)); + area->push_back(PaperPoint(transformation.getMaxX(), from)); + area->push_back(PaperPoint(transformation.getMinX(), from)); + from = level; + colour++; + } + Polyline* area = new Polyline(); + area->setColour(Colour(*colour)); + area->setFilled(true); + area->setShading(new FillShadingProperties()); + area->setFillColour(Colour(*colour)); + visitor.push_back(area); + area->push_back(PaperPoint(transformation.getMinX(), from)); + area->push_back(PaperPoint(transformation.getMinX(), transformation.getMaxY())); + area->push_back(PaperPoint(transformation.getMaxX(), transformation.getMaxY())); + area->push_back(PaperPoint(transformation.getMaxX(), from)); + area->push_back(PaperPoint(transformation.getMinX(), from)); + +} + void EpsPlume::operator()(Data& data, BasicGraphicsObjectContainer& visitor) { + background(visitor); method_ = lowerCase(method_); std::map::iterator method = methods_.find(method_); if (method == methods_.end()) { @@ -2668,6 +2705,7 @@ void EpsPlume::operator()(Data& data, BasicGraphicsObjectContainer& visitor) { return; } (this->*method->second)(data, visitor); + } diff --git a/src/visualisers/EpsGraph.h b/src/visualisers/EpsGraph.h index 1c70ea87..849dded9 100644 --- a/src/visualisers/EpsGraph.h +++ b/src/visualisers/EpsGraph.h @@ -437,7 +437,7 @@ class EpsPlume : public Visdef, public EpsPlumeAttributes { vector shading_legend_; void timeserie(Data&, BasicGraphicsObjectContainer&); void verticalprofile(Data&, BasicGraphicsObjectContainer&); - + void background(BasicGraphicsObjectContainer& visitor); private: //! Copy constructor - No copy allowed EpsPlume(const EpsPlume&);