From 2ab60299fc1533243c982c3b84bea4d25036c0e7 Mon Sep 17 00:00:00 2001 From: Sylvie Lamy-Thepaut Date: Mon, 4 Dec 2023 16:27:42 +0000 Subject: [PATCH] Revert OutofBond --- src/attributes/ColourTechniqueAttributes.cc | 16 +------ src/attributes/ColourTechniqueAttributes.h | 2 - src/attributes/ColourTechniqueWrapper.cc | 8 ---- src/common/ColourTableDefinitionCompute.cc | 9 ++-- src/params/ColourTechnique.xml | 16 ------- src/visualisers/ColourTechnique.cc | 46 ++------------------- src/visualisers/IntervalSelectionType.cc | 2 +- src/visualisers/LevelSelection.h | 8 +--- 8 files changed, 12 insertions(+), 95 deletions(-) diff --git a/src/attributes/ColourTechniqueAttributes.cc b/src/attributes/ColourTechniqueAttributes.cc index 77857f215..2af62957e 100644 --- a/src/attributes/ColourTechniqueAttributes.cc +++ b/src/attributes/ColourTechniqueAttributes.cc @@ -24,9 +24,7 @@ using namespace magics; -ColourTechniqueAttributes::ColourTechniqueAttributes(): - oob_min_colour_(ParameterManager::getString("contour_out_of_bound_min_colour")), - oob_max_colour_(ParameterManager::getString("contour_out_of_bound_max_colour")) +ColourTechniqueAttributes::ColourTechniqueAttributes() { @@ -45,16 +43,12 @@ void ColourTechniqueAttributes::set(const std::map& params) int i = 0; prefix[i++] = ""; - setAttribute(prefix, "contour_out_of_bound_min_colour", oob_min_colour_, params); - setAttribute(prefix, "contour_out_of_bound_max_colour", oob_max_colour_, params); } void ColourTechniqueAttributes::copy(const ColourTechniqueAttributes& other) { - oob_min_colour_ = other.oob_min_colour_; - oob_max_colour_ = other.oob_max_colour_; } @@ -93,8 +87,6 @@ void ColourTechniqueAttributes::set(const XmlNode& node) void ColourTechniqueAttributes::print(ostream& out) const { out << "Attributes["; - out << " oob_min_colour = " << oob_min_colour_; - out << " oob_max_colour = " << oob_max_colour_; out << "]" << "\n"; } @@ -102,12 +94,6 @@ void ColourTechniqueAttributes::print(ostream& out) const void ColourTechniqueAttributes::toxml(ostream& out) const { out << "\"\""; - out << ", \"contour_out_of_bound_min_colour\":"; - niceprint(out,oob_min_colour_); - out << ", \"contour_out_of_bound_max_colour\":"; - niceprint(out,oob_max_colour_); } -static MagicsParameter contour_out_of_bound_min_colour("contour_out_of_bound_min_colour", "automatic"); -static MagicsParameter contour_out_of_bound_max_colour("contour_out_of_bound_max_colour", "automatic"); diff --git a/src/attributes/ColourTechniqueAttributes.h b/src/attributes/ColourTechniqueAttributes.h index f4d011342..532f28a55 100644 --- a/src/attributes/ColourTechniqueAttributes.h +++ b/src/attributes/ColourTechniqueAttributes.h @@ -50,8 +50,6 @@ class ColourTechniqueAttributes virtual void toxml(std::ostream& out) const; // -- members: string tag_; - string oob_min_colour_; - string oob_max_colour_; private: diff --git a/src/attributes/ColourTechniqueWrapper.cc b/src/attributes/ColourTechniqueWrapper.cc index 740661f99..e615ccaed 100644 --- a/src/attributes/ColourTechniqueWrapper.cc +++ b/src/attributes/ColourTechniqueWrapper.cc @@ -55,14 +55,6 @@ void ColourTechniqueWrapper::set(const MagRequest& request) - if (request.countValues("CONTOUR_OUT_OF_BOUND_MIN_COLOUR") ) { - string oob_min_colour_value = request("CONTOUR_OUT_OF_BOUND_MIN_COLOUR"); - colourtechnique_->oob_min_colour_ = oob_min_colour_value; - } - if (request.countValues("CONTOUR_OUT_OF_BOUND_MAX_COLOUR") ) { - string oob_max_colour_value = request("CONTOUR_OUT_OF_BOUND_MAX_COLOUR"); - colourtechnique_->oob_max_colour_ = oob_max_colour_value; - } } diff --git a/src/common/ColourTableDefinitionCompute.cc b/src/common/ColourTableDefinitionCompute.cc index 8abf2042c..a62a6b515 100644 --- a/src/common/ColourTableDefinitionCompute.cc +++ b/src/common/ColourTableDefinitionCompute.cc @@ -275,10 +275,6 @@ void ColourTableDefinitionCompute::hcl(ColourTable& table, int nb) { void ColourTableDefinitionCompute::set(ColourTable& table, int nb) { prepare(); - MagLog::dev() << "ColourTableDefinitionCompute::set->min-->" << minColour_ << endl; - MagLog::dev() << "ColourTableDefinitionCompute::set->max-->" << maxColour_ << endl; - MagLog::dev() << "nb interval-->" << nb << endl; - if (nb == 1) { table.push_back(minColour_); return; @@ -292,6 +288,8 @@ void ColourTableDefinitionCompute::set(ColourTable& table, int nb) { table.push_back(maxColour_); return; } + + std::map::iterator method = methods_.find(lowerCase(method_)); if (method == methods_.end()) hsl(table, nb); @@ -394,6 +392,8 @@ void ColourTableDefinitionCompute::set(const stringarray& from, ColourTable& to, int nb, ColourListPolicy policy, const string& method) { + + cout << "SET" << policy << endl; auto colour = from.begin(); if (policy == ColourListPolicy::DYNAMIC) { auto helper = dynamicMethods_.find(method); @@ -409,6 +409,7 @@ void ColourTableDefinitionCompute::set(const stringarray& from, ColourTable& to, } for (int i = 0; i < nb - 1; i++) { + cout << i << "->" << *colour << endl; if (colour == from.end()) { if (policy == ColourListPolicy::LASTONE) { to.push_back(Colour(from.back())); diff --git a/src/params/ColourTechnique.xml b/src/params/ColourTechnique.xml index d0e223401..8826bfcc2 100644 --- a/src/params/ColourTechnique.xml +++ b/src/params/ColourTechnique.xml @@ -9,23 +9,7 @@ does it submit to any jurisdiction. - - Colour to use below the out of bound minimum value - - - Colour to use below the out of bound maximum value - diff --git a/src/visualisers/ColourTechnique.cc b/src/visualisers/ColourTechnique.cc index 5a063675a..33a88be7f 100644 --- a/src/visualisers/ColourTechnique.cc +++ b/src/visualisers/ColourTechnique.cc @@ -45,53 +45,15 @@ void ColourTechnique::print(ostream& out) const { } void ColourTechnique::prepare(LevelSelection& out, LevelSelection& levels, bool rainbow) { - if (levels.empty()) + if (levels.empty()) return; - - clear(); bands_.clear(); ColourTable table; - - - - minOutOfBound_ = out.minOutOfBond(); - maxOutOfBound_ = out.maxOutOfBond(); - - - if (rainbow) set(out, levels, table, levels.size() + 1); - else { - - LevelSelection newlevels; - int count = levels.size(); - if (out.minOutOfBond()) count--; - - if (out.maxOutOfBond()) count--; - - - - set(out, levels, table, count); - if (out.minOutOfBond()) { - Colour min_colour = magCompare(oob_min_colour_, "automatic") ? - table.front().colour() : Colour(oob_min_colour_); - table.insert(table.begin(), min_colour); - } - if (out.maxOutOfBond()) { - Colour max_colour = magCompare(oob_max_colour_, "automatic") ? - table.back().colour() : Colour(oob_max_colour_); - table.push_back(max_colour); - } - } - - - // cout << "ColourTechnique::after(" << endl; - // for (auto l = levels.begin(); l != levels.end(); ++l) - // cout << *l << endl; - - // cout << "-------------------" << endl; - + else + set(out, levels, table, levels.size()); if (table.empty()) table.push_back(Colour("none")); @@ -131,8 +93,6 @@ void ColourTechnique::prepare(LevelSelection& out, LevelSelection& levels, bool if (!rainbow) bands_.insert(make_pair(Interval(levels.back(), levels.back() + EPSILON), left)); - - MagLog::dev() << levels.back() << "<<" << left << "<<" << levels.back() + EPSILON << endl; } diff --git a/src/visualisers/IntervalSelectionType.cc b/src/visualisers/IntervalSelectionType.cc index 8b48f8bac..1ca7e2d0a 100644 --- a/src/visualisers/IntervalSelectionType.cc +++ b/src/visualisers/IntervalSelectionType.cc @@ -95,7 +95,7 @@ void IntervalSelectionType::calculate(double min, double max, bool shading) { push_back(*level); } out << "]" << endl; - // cout << out.str() << endl; + MagLog::dev() << out.str() << endl; } diff --git a/src/visualisers/LevelSelection.h b/src/visualisers/LevelSelection.h index 218d342b6..1be70cc61 100644 --- a/src/visualisers/LevelSelection.h +++ b/src/visualisers/LevelSelection.h @@ -58,15 +58,11 @@ class LevelSelection : public LevelSelectionAttributes, public doublearray { virtual double reference(int) const; virtual void thinLevels(int frequency, vector&) const; - bool minOutOfBond() { return minOutOfBond_; } - bool maxOutOfBond() { return maxOutOfBond_; } - + protected: //! Method to print string about this class on to a stream of type ostream (virtual). virtual void print(ostream&) const override; - bool minOutOfBond_; - bool maxOutOfBond_; -; + private: //! Copy constructor - No copy allowed