Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SimAquaLife
GR3D
Commits
c8e7b6ca
Commit
c8e7b6ca
authored
Apr 26, 2021
by
patrick.lambert
Browse files
with the correct color
parent
35b51d6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/environment/RIOBasinNetworkObserverPresence.java
View file @
c8e7b6ca
...
...
@@ -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
*
(
1
f
-
(
float
)
value
),
1
f
,
0.4f
+
0.45f
*
(
1
f
-
(
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment