Commit c8e7b6ca authored by patrick.lambert's avatar patrick.lambert
Browse files

with the correct color

parent 35b51d6a
......@@ -336,7 +336,8 @@ public class RIOBasinNetworkObserverPresence extends ObserverListener implements
g.setColor(Color.WHITE);
else
g.setColor(Color.GRAY);
}
} else
g.setColor(Color.BLUE);
g2d.fill(displayShape);
}
......@@ -346,7 +347,8 @@ public class RIOBasinNetworkObserverPresence extends ObserverListener implements
public enum ColorScaleEnum {
RedsScale(new RedsScale()), BluesScale(new BluesScale()), BicolorScale(new BicolorScale()), GraysScale(new GraysScale());
RedsScale(new RedsScale()), BluesScale(new BluesScale()), BicolorScale(new BicolorScale()), GraysScale(
new GraysScale()), GreenScale(new GreenScale());
private ColorScale scale;
......@@ -409,6 +411,41 @@ public class RIOBasinNetworkObserverPresence extends ObserverListener implements
}
public static class GreenScale implements ColorScale {
@Override
public Color getColor(double value) {
return new Color(0.4f + 0.45f * (1f - (float) value), 1f, 0.4f + 0.45f * (1f - (float) value));
}
@Override
public void drawLegend(Graphics2D g2d, double threshold) {
int nbLegend = 11;
for (int i = 0; i < nbLegend; i++) {
float col = (float) i / (float) (nbLegend - 1);
g2d.setColor(getColor(col));
g2d.fillRect(10, 30 + 10 * (nbLegend - 1 - i), 20, 10);
double limit = Math.round(threshold * i / (nbLegend - 1) * 10.) / 10.;
g2d.setColor(Color.BLACK);
g2d.drawString(String.valueOf(limit), 32, 20 + 10 * (nbLegend + 1 - i));
}
}
@Override
public Color getSeaBasinColor() {
return new Color(0, 102, 255);
}
@Override
public Color getRiverBasinColor() {
return new Color(0, 204, 255);
}
}
public static class RedsScale implements ColorScale {
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment