Exemplo n.º 1
0
  public void PlaneRemove(Plane p) {
    char id = p.getIdChar();
    UIPlane uiplane = null;
    synchronized (this) {
      uiplane = (UIPlane) (planes.get((Object) (new Character(id))));
    }
    if (uiplane == null) return;

    if (uiplane.radar_label != null) radarArea.remove(uiplane.radar_label);
    if (uiplane.info_label != null) infoArea.remove(uiplane.info_label);
    synchronized (this) {
      planes.remove((Object) (new Character(id)));
    }

    radarArea.repaint();
    infoArea.repaint();
  }
Exemplo n.º 2
0
 protected String getPlaneInfoText(Plane p) {
   String rs = new String(" ");
   rs += (new Character(p.getIdChar())).toString() + p.alt + " ";
   rs += p.destination.getName() + " ";
   if (p.dir_cmd != null) {
     if (p.dir_cmd instanceof CircleCommand) {
       rs += "C";
     } else {
       rs += ((TurnCommand) p.dir_cmd).dir.getDirName();
     }
     if (p.dir_cmd.pos_obj != null) {
       rs += "@";
       rs += p.dir_cmd.pos_obj.getName();
     }
   }
   return rs;
 }
Exemplo n.º 3
0
  public void PlaneNew(Plane p) {
    if (ATC.debug_flag) System.out.println("p.n.1");
    UIPlane uiplane = new UIPlane();
    char id = p.getIdChar();
    uiplane.radar_label = null;
    uiplane.info_label = new Label((new Character(id)).toString());
    if (ATC.debug_flag) System.out.println("p.n.2");
    infoArea.add(uiplane.info_label);
    if (ATC.debug_flag) System.out.println("p.n.2.1");
    infoArea.validate();
    if (ATC.debug_flag) System.out.println("p.n.3");
    synchronized (this) {
      planes.put((Object) (new Character(id)), (Object) uiplane);
    }

    if (ATC.debug_flag) System.out.println("p.n.4");
    PlaneUpdate(p);
    if (ATC.debug_flag) System.out.println("p.n.5");
  }
Exemplo n.º 4
0
  public void PlaneUpdate(Plane p) {
    if (ATC.debug_flag) System.out.println("p.u.1");
    char id = p.getIdChar();
    UIPlane uiplane = null;
    synchronized (this) {
      uiplane = (UIPlane) (planes.get((Object) (new Character(id))));
    }
    if (ATC.debug_flag) System.out.println("p.u.1 il=" + uiplane.info_label);
    if (uiplane == null) return;
    if (ATC.debug_flag) System.out.println("p.u.2");

    if (p.takeoff_flag) {
      if (uiplane.radar_label == null) {
        if (ATC.debug_flag) System.out.println("p.u.3");
        uiplane.radar_label = new JLabel(getPlaneText(p), dirToPlaneIcon(p.dir), JLabel.CENTER);
        uiplane.radar_label.setVerticalTextPosition(JLabel.TOP);
        uiplane.radar_label.setHorizontalTextPosition(JLabel.CENTER);
        uiplane.radar_label.setIconTextGap(text_gap);
        uiplane.radar_label.setForeground(text_color);
        radarArea.add(uiplane.radar_label, new Integer(2));
        if (ATC.debug_flag) System.out.println("p.u.4");
      } else {
        if (ATC.debug_flag) System.out.println("p.u.5");
        uiplane.radar_label.setText(getPlaneText(p));
        uiplane.radar_label.setIcon(dirToPlaneIcon(p.dir));
        if (ATC.debug_flag) System.out.println("p.u.6");
      }

      uiplane.radar_label.setBounds(
          convPos(p.pos.x) - plane_width / 2,
          convPos(p.pos.y) - plane_height + icon_size / 2,
          plane_width,
          plane_height);
      if (ATC.debug_flag) System.out.println("p.u.7");
    }

    uiplane.info_label.setText(getPlaneInfoText(p));
    if (ATC.debug_flag) System.out.println("p.u.8");
    infoArea.validate();

    if (ATC.debug_flag) System.out.println("p.u.9");
  }
Exemplo n.º 5
0
 protected String getPlaneText(Plane p) {
   return (new Character(p.getIdChar())).toString() + (new Integer(p.alt)).toString();
 }