Skip to content

Commit

Permalink
Revert OutofBond
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvielamythepaut committed Dec 4, 2023
1 parent bb9506d commit fbd5204
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 59 deletions.
4 changes: 1 addition & 3 deletions src/visualisers/ColourTechnique.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@

using namespace magics;

ColourTechnique::ColourTechnique() : policy_(ListPolicy::LASTONE),
minOutOfBound_(false), maxOutOfBound_(false)
{}
ColourTechnique::ColourTechnique() : policy_(ListPolicy::LASTONE) {}


ColourTechnique::~ColourTechnique() {}
Expand Down
6 changes: 1 addition & 5 deletions src/visualisers/ColourTechnique.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ class ColourTechnique : public map<double, ColourInfo>,
void visit(LegendVisitor&);
ListPolicy getPolicy() const { return policy_; }

bool minOutOfBound() const { return minOutOfBound_; }
bool maxOutOfBound() const { return maxOutOfBound_; }

protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
Expand All @@ -98,9 +96,7 @@ class ColourTechnique : public map<double, ColourInfo>,
map<double, pair<double, double> > ranges_;
double maxLevel_;

bool minOutOfBound_;
bool maxOutOfBound_;


ListPolicy policy_;


Expand Down
60 changes: 10 additions & 50 deletions src/visualisers/LevelListSelectionType.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,47 +45,12 @@ void LevelListSelectionType::print(ostream& out) const {
void LevelListSelectionType::calculate(double min, double max, bool shading) {
clear();

double min_level=list_.front();
double max_level=list_.back();


if ( MINSET(min_) )
min_level = min_;

if ( MAXSET(max_) )
max_level = max_;

if ( shading && MINSET(shade_min_) )
min_level = shade_min_;

if ( shading && MAXSET(shade_max_) )
max_level = shade_max_;



minOutOfBond_ = oob_min_ > min_level;
maxOutOfBond_ = oob_max_ < max_level;




if (minOutOfBond_) {
push_back(min);
push_back(oob_min_);
min_level = oob_min_;
}

if (maxOutOfBond_) {
max_level = oob_max_;
}



doublearray::const_iterator last = list_.begin();
double prevVal = min_;
for (doublearray::const_iterator val = list_.begin(); val != list_.end(); ++val) {
MagLog::dev() << "LevelListSelectionType::calculate(double min, double max)--->" << *val << "\n";
if (min_level <= *val && *val <= max_level) {
if (min_ <= *val && *val <= max_) {
if (*val < prevVal) {
MagLog::error() << " level list values should increase, but " << *val << " follows " << prevVal << endl;
break;
Expand All @@ -95,24 +60,19 @@ void LevelListSelectionType::calculate(double min, double max, bool shading) {
}
++last;
}
if (maxOutOfBond_) {
push_back(oob_max_);
push_back(max);
}


// Just in case add another level to close the last interval !
if (last != list_.end())
push_back(*last);


// ostringstream print;
// print << "LevelListSelectionType::calculate-->";
// string sep = "[";
// for (vector<double>::const_iterator val = begin(); val != end(); ++val) {
// print << sep << *val;
// sep = ", ";
// }
// print << "]";
// cout << print.str() << endl;
ostringstream print;
print << "LevelListSelectionType::calculate-->";
string sep = "[";
for (vector<double>::const_iterator val = begin(); val != end(); ++val) {
print << sep << *val;
sep = ", ";
}
print << "]";
MagLog::dev() << print.str() << endl;
}
1 change: 0 additions & 1 deletion src/visualisers/PolyShadingTechnique.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ struct LegendEntryBuilder {
box->setColour(colours_.right(min));

LegendEntry* entry = new BoxEntry(min, max, box);
entry->oob(colours_.minOutOfBound(), colours_.maxOutOfBound());
if (first_) {
first_ = false;
entry->first();
Expand Down

0 comments on commit fbd5204

Please sign in to comment.