Exemplo n.º 1
0
 public synchronized void changeColor(Coordinate3D coordinate, LedColor color) {
   for (Sphere s : leds) {
     if (s.getUserData().equals(coordinate)) {
       s.setMaterial(new PhongMaterial(color.getColor()));
     }
   }
 }
Exemplo n.º 2
0
 private synchronized void fireOnClick(MouseEvent event) {
   System.out.println("fire on click");
   Sphere s = (Sphere) event.getSource();
   Coordinate3D c = (Coordinate3D) s.getUserData();
   LedColor color = getColor(c);
   for (CubeInputListener l : listeners) {
     System.out.println("notifying l for " + color);
     l.onPixelChange(c.getX(), c.getY(), c.getZ(), color != LedColor.ON);
     l.flush();
   }
 }
Exemplo n.º 3
0
 public synchronized LedColor getColor(Coordinate3D coordinate) {
   for (Sphere s : leds) {
     if (s.getUserData().equals(coordinate)) {
       PhongMaterial m = (PhongMaterial) s.getMaterial();
       for (LedColor c : LedColor.values()) {
         if (c.getColor().equals(m.getDiffuseColor())) {
           return c;
         }
       }
     }
   }
   return null;
 }