Skip to content

Commit

Permalink
Merge branch 'develop' of ssh://git.ecmwf.int/mag/magics into feature…
Browse files Browse the repository at this point in the history
…/revert
  • Loading branch information
sylvielamythepaut committed Dec 4, 2023
2 parents 973a146 + 131bb99 commit 7d35683
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
34 changes: 34 additions & 0 deletions src/params/SymbolPlotting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,40 @@ does it submit to any jurisdiction.
<documentation>With GeoSon : list of colours to use</documentation>
</parameter>

<parameter member="property_height_name"
to="string"
default="colour"
from="string"
name="symbol_property_lightness_name"
visible='off'>
<documentation>With GeoSon : property name to use to set the colour</documentation>
</parameter>
<parameter member="property_lightness_list"
to="floatarray"
default="floatarray()"
from="floatarray"
name="symbol_property_lightness_list"
visible='off'>
<documentation>With GeoSon : list of colours to use</documentation>
</parameter>
<parameter member="property_lightness_values_list"
to="floatarray"
default="floatarray()"
from="floatarray"
name="symbol_property_lightness_values_list"
visible='off'>
<documentation>With GeoSon : list of heights to use</documentation>
</parameter>

<parameter member="property_saturation_value"
to="float"
default="1"
from="float"
name="symbol_property_saturation_value"
visible='off'>
<documentation>With GeoSon : list of colours to use</documentation>
</parameter>

<parameter member="property_height_name"
to="string"
default="colour"
Expand Down
27 changes: 26 additions & 1 deletion src/visualisers/SymbolPlotting.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,32 @@ void SymbolPlotting::by_property(Data& data, BasicGraphicsObjectContainer& out)
property_lightness_list_.push_back(0.5);


IntervalMap<float> hueFinder;
auto value_hue = property_hue_values_list_.begin();
auto hue = property_hue_list_.begin();
IntervalMap<float> lightnessFinder;
auto value_lightness = property_lightness_values_list_.begin();
auto lightness = property_lightness_list_.begin();

while (true) {
if (value_hue + 1 == property_hue_values_list_.end())
break;

hueFinder[Interval(*value_hue, *(value_hue+1))] = *hue;
if (hue + 1 != property_hue_list_.end())
hue++;
++value_hue;
}
while (true) {
if (value_lightness + 1 == property_lightness_values_list_.end())
break;

lightnessFinder[Interval(*value_lightness, *(value_lightness+1))] = *lightness;
if (lightness + 1 != property_lightness_list_.end())
lightness++;
++value_lightness;
}

IntervalMap<float> hueFinder;
IntervalMap<float> lightnessFinder;

Expand Down Expand Up @@ -194,7 +220,6 @@ void SymbolPlotting::by_property(Data& data, BasicGraphicsObjectContainer& out)

Hsl hsl(hueFinder.find(hue, 0), property_saturation_value_, lightnessFinder.find(lightness, 0.5));
Colour colour(hsl);
cout << colour << endl;
symbol->setColour(colour);


Expand Down

0 comments on commit 7d35683

Please sign in to comment.