use of il.ac.technion.cs.yp.btw.citysimulation.CityTrafficLight in project BTW by TechnionYearlyProject.
the class MapGraphics method createCircles.
/**
* @author: shay
* @date: 20/1/18
* creating the array of circles, each circle for a traffic light.
* @param trafficLights - trafficlights in the map
*/
// TODO: change the color according to real time loads.
private void createCircles(Set<CityTrafficLight> trafficLights) {
int x = 0;
for (CityTrafficLight currTrafficLight : trafficLights) {
Point point = calculateTrafficLightLocation(currTrafficLight);
Circle circle = new Circle(point.getCoordinateX(), point.getCoordinateY(), 0.0001);
if (currTrafficLight.getState() == CityTrafficLight.TrafficLightState.GREEN)
circle.setFill(Color.GREEN);
else
circle.setFill(Color.RED);
circle.setOnMouseClicked(event -> {
System.out.println(currTrafficLight.getName());
});
circles.add(new Pair(circle, currTrafficLight.getName()));
x++;
}
}
Aggregations