예제 #1
0
  /**
   * UI method - sets the driving model
   *
   * @param p_data input data
   */
  private final void web_static_setdrivemodel(final Map<String, Object> p_data) {
    if (CSimulation.getInstance().isRunning())
      throw new IllegalStateException(CCommon.getResourceString(this, "running"));
    if (!p_data.containsKey("id"))
      throw new IllegalArgumentException(CCommon.getResourceString(this, "nomodelname"));

    CSimulation.getInstance()
        .getWorld()
        .<CCarLayer>getTyped("Cars")
        .setDriveModel(CCarLayer.EDrivingModel.valueOf((String) p_data.get("id")));
  }
예제 #2
0
  /**
   * UI method - lists all driving model
   *
   * @return list wir driving models
   */
  private final Map<String, Object> web_static_listdrivemodel() {
    final CCarLayer l_layer = CSimulation.getInstance().getWorld().<CCarLayer>getTyped("Cars");
    for (final CCarLayer.EDrivingModel l_item : CCarLayer.EDrivingModel.values())
      m_drivingmodel.put(
          l_item.toString(),
          CCommon.getMap("active", l_layer.getDrivingModel().equals(l_item), "id", l_item.name()));

    return m_drivingmodel;
  }