コード例 #1
0
ファイル: EventLayer.java プロジェクト: usuallycwdillon/gama
    private void executeEvent(final int x, final int y) {
      if (executer == null) {
        return;
      }
      final ILocation pp = getModelCoordinatesFrom(x, y, surface);
      if (pp.getX() < 0
          || pp.getY() < 0
          || pp.getX() >= surface.getEnvWidth()
          || pp.getY() >= surface.getEnvHeight()) {
        return;
      }
      final Arguments args = new Arguments();
      final Collection<IAgent> agentset = surface.selectAgent(x, y);
      if (pointArg != null) {
        args.put(
            pointArg, ConstantExpressionDescription.create(new GamaPoint(pp.getX(), pp.getY())));
      }
      if (listArg != null) {
        args.put(listArg, ConstantExpressionDescription.create(agentset));
      }

      executer.setRuntimeArgs(args);
      GAMA.run(
          new GAMA.InScope.Void() {

            @Override
            public void process(final IScope scope) {
              executer.executeOn(scope);
            }
          });
      if (surface.getOutput().isPaused() || GAMA.isPaused()) {
        surface.updateDisplay(true);
      }
    }