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 973a146 commit 2ab6029
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 95 deletions.
16 changes: 1 addition & 15 deletions src/attributes/ColourTechniqueAttributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()


{
Expand All @@ -45,16 +43,12 @@ void ColourTechniqueAttributes::set(const std::map<string, string>& 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_;

}

Expand Down Expand Up @@ -93,21 +87,13 @@ 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";
}

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<string> contour_out_of_bound_min_colour("contour_out_of_bound_min_colour", "automatic");
static MagicsParameter<string> contour_out_of_bound_max_colour("contour_out_of_bound_max_colour", "automatic");
2 changes: 0 additions & 2 deletions src/attributes/ColourTechniqueAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 0 additions & 8 deletions src/attributes/ColourTechniqueWrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


}
Expand Down
9 changes: 5 additions & 4 deletions src/common/ColourTableDefinitionCompute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -292,6 +288,8 @@ void ColourTableDefinitionCompute::set(ColourTable& table, int nb) {
table.push_back(maxColour_);
return;
}


std::map<string, ComputeFunction>::iterator method = methods_.find(lowerCase(method_));
if (method == methods_.end())
hsl(table, nb);
Expand Down Expand Up @@ -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);
Expand All @@ -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()));
Expand Down
16 changes: 0 additions & 16 deletions src/params/ColourTechnique.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,7 @@ does it submit to any jurisdiction.
<magics>
<class directory="visualisers" name="ColourTechnique" python="mcont">

<parameter from="string"
name="contour_out_of_bound_min_colour"
default="automatic"
member="oob_min_colour"
to="string"
inherit_parent_reqs="no">
<documentation>Colour to use below the out of bound minimum value</documentation>
</parameter>

<parameter from="string"
name="contour_out_of_bound_max_colour"
default="automatic"
member="oob_max_colour"
to="string"
inherit_parent_reqs="no">
<documentation>Colour to use below the out of bound maximum value</documentation>
</parameter>
</class>

</magics>
46 changes: 3 additions & 43 deletions src/visualisers/ColourTechnique.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/visualisers/IntervalSelectionType.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;


}
Expand Down
8 changes: 2 additions & 6 deletions src/visualisers/LevelSelection.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,11 @@ class LevelSelection : public LevelSelectionAttributes, public doublearray {
virtual double reference(int) const;
virtual void thinLevels(int frequency, vector<double>&) 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
Expand Down

0 comments on commit 2ab6029

Please sign in to comment.