コード例 #1
0
  /**
   * creates a Station for animation
   *
   * @param owner
   * @param name Name and ID of Station
   * @param pos position
   * @param showInAnimation
   */
  public TransportStationAnimation(
      ModelAnimation owner, String name, Position pos, boolean showInAnimation) {
    super(owner, name);
    this.model = owner;
    this.name = name;
    this.cmdGen = owner.getCmdGen();
    this.showInAnimation = showInAnimation;
    this.id = this.cmdGen.createInternId(name);
    TimeInstant simTime = this.model.presentTime();
    boolean init = this.cmdGen.isInitPhase();
    this.position = pos;
    Command c;
    Point p = pos.getPoint();

    if (this.showInAnimation) {
      try {
        if (init)
          c = Command.getCommandInit("createStation", this.cmdGen.getAnimationTime(simTime));
        else c = Command.getCommandTime("createStation", this.cmdGen.getAnimationTime(simTime));
        c.addParameter("StationId", this.id);
        c.addParameter("Name", this.name);
        c.addParameter("Point", pos.getView() + "|" + p.x + "|" + p.y);
        c.setRemark(this.getGeneratedBy(TransportStationAnimation.class.getSimpleName()));
        cmdGen.checkAndLog(c);
        cmdGen.write(c);
      } catch (CommandException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
コード例 #2
0
  /**
   * create animation with full parameterization
   *
   * @param id internal objectId for animation. Must be unique.
   * @param pos middle point of animation object
   * @param form form of animation object
   * @param showInAnimation switch animation on or off
   */
  public void createAnimation(Position pos, FormExt form, boolean showInAnimation) {

    this.showInAnimation = showInAnimation;
    // Achtung super aendert den Namen
    switch (masterSortOrder) {
      case WaitQueueAnimation.FIFO:
        // Neue Elemente werden in der Queue hinten angefuegt. (Hohe Rankzahl)
        this.masterPriorityAttribute = List.PRIO_LAST;
        break;
      case WaitQueueAnimation.LIFO:
        // Neue Elemente werden in der Queue vorne angefuegt. (Kleine Rankzahl)
        this.masterPriorityAttribute = List.PRIO_FIRST;
        break;
      default:
        this.masterPriorityAttribute = List.PRIO_LAST;
    }
    switch (slaveSortOrder) {
      case WaitQueueAnimation.FIFO:
        // Neue Elemente werden in der Queue hinten angefuegt. (Hohe Rankzahl)
        this.slavePriorityAttribute = List.PRIO_LAST;
        break;
      case WaitQueueAnimation.LIFO:
        // Neue Elemente werden in der Queue vorne angefuegt. (Kleine Rankzahl)
        this.slavePriorityAttribute = List.PRIO_FIRST;
        break;
      default:
        this.slavePriorityAttribute = List.PRIO_LAST;
    }
    TimeInstant simTime = this.getModel().presentTime();
    boolean init = this.cmdGen.isInitPhase();
    Command c;
    Point p = pos.getPoint();
    Dimension deltaSize = form.getDeltaSize();
    String[] pointA = {pos.getView(), Integer.toString(p.x), Integer.toString(p.y)};
    if (deltaSize == null) deltaSize = new Dimension(0, 0);
    String[] deltaSizeA = {Integer.toString(deltaSize.width), Integer.toString(deltaSize.height)};

    if (this.showInAnimation) {
      try {
        if (init)
          c = Command.getCommandInit("createWaitQueue", this.cmdGen.getAnimationTime(simTime));
        else c = Command.getCommandTime("createWaitQueue", this.cmdGen.getAnimationTime(simTime));
        c.addParameter("WaitQueueId", this.id);
        c.addParameter("Name", this.getName());
        c.addParameter("Point", Parameter.cat(pointA));
        c.addParameter("DefaultEntityType", form.getDefaultType());
        c.addParameter("AnzVisible", Integer.toString(form.getNrVisible()));
        c.addParameter("Form", form.isHorizontal() ? "horizontal" : "vertikal");
        c.addParameter("DeltaSize", Parameter.cat(deltaSizeA));
        c.setRemark(this.getGeneratedBy(WaitQueueAnimation.class.getSimpleName()));
        cmdGen.checkAndLog(c);
        cmdGen.write(c);

      } catch (CommandException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }