Currently working on my second semester working on a project where we have used an Enum class for the first time. Currently it holds WayTypes which we use to color in our MapCanvas class. I'd like to iterate through this class and assign the different colors to the different Enums during this iteration, but I can't figure out how.
Currently my Enum class looks like this:
public enum WayType {
UNKNOWN, BUILDING, WATER, COASTLINE, LANDUSE, LEISURE, FARMLAND,
BICYCLE, FOOTWAY, PRIMARYROAD, MOTORWAY, TERTIARYROAD, SECONDARYROAD;
}
How we apply the color in our MapCanvas at this moment:
gc.setFill(Color.LIGHTGREEN);
for (Drawable way : model.getWaysOfType(WayType.LANDUSE))
way.fill(gc);
for (Drawable way : model.getWaysOfType(WayType.LANDUSE))
way.stroke(gc);
Stroke and fill methods looks like this:
public void stroke(GraphicsContext gc) {
gc.beginPath();
trace(gc);
gc.stroke();
}
And
public void fill(GraphicsContext gc) {
gc.beginPath();
trace(gc);
gc.fill();
}
Any help is greatly appreciated. Thanks in advance :)