Exemple #1
0
  public HashMap<String, String> getEntityParameters() {

    HashMap<String, String> parameters = new HashMap<String, String>();

    for (String name : _map.getEntity(_map.getEntityID(_posSelected)).getParamNames()) {

      if ((!name.equals(Map.ENTITY_TYPE))
          && (!name.equals(Map.ENTITY_DIMENSION))
          && (!name.equals(Map.ENTITY_POSITION)))
        parameters.put(name, _map.getEntity(_map.getEntityID(_posSelected)).getParameter(name));
    }

    return parameters;
  }
Exemple #2
0
  public void removeEntity() {

    Position entityPosition = _map.getCell(_posSelected).getPrimaryEntity();

    int entityID = _map.getEntityID(entityPosition);

    EntityType entity = _map.getEntity(entityID).getType();

    Position[] posList =
        new Position[_preferences.getEntityHeight(entity) * _preferences.getEntityWidth(entity)];

    int i = 0;

    for (int x = entityPosition.getX();
        x < (entityPosition.getX() + _preferences.getEntityWidth(entity));
        x++)
      for (int y = entityPosition.getY();
          y < (entityPosition.getY() + _preferences.getEntityHeight(entity));
          y++) {

        posList[i] = new Position(x, y);

        i++;
      }

    if (_map.removeEntity(posList, entityID)) {

      notifyRemoveEntity(posList);
      notifyCellDeSelected();
    }
  }
Exemple #3
0
  public void setEntityParameters(HashMap<String, String> parameters) {

    int entityID = _map.getEntityID(_posSelected);

    _map.removeAllEntityParameters(entityID);

    if (!parameters.isEmpty())
      for (String name : parameters.keySet()) {

        _map.newEntityParameter(entityID, name, parameters.get(name));
      }
  }
Exemple #4
0
  private void notifyAllSelectChanges() {

    notifyCellSelected();
    notifyShowCellType();
    notifyShowEntityMessage();

    if (_map.getCell(_posSelected).getEntity() > 0) {

      Entity entity = _map.getEntity(_map.getEntityID(_posSelected));

      Set<String> paramNames = entity.getParamNames();

      for (String name : paramNames) {

        notifyShowEntityParameter(name, entity.getParameter(name));
      }
    }
  }