コード例 #1
0
  /**
   * @param a the width of the panel
   * @param b the height of the panel
   * @param s the slam object to be used
   */
  public EvaulationMapPanel(double a, double b, EvaluationGUI frameUI) {

    setSize((int) a, (int) b);
    percentageZoom = 1;
    // System.out.println(getHeight());

    map = frameUI.getSlam2().getMap();

    frame = frameUI;

    main = frame.getSlam2();

    mapSize =
        new Point(getSlam2().getMap().getGrid()[0].length, getSlam2().getMap().getGrid().length);

    currentCell = new Point(getSlam2().getCurrentIndexX(), getSlam2().getCurrentIndexY());

    totalCells = 0;

    cellsVisited = 0;

    if (map.getMaxPoint() == null) {
      map.setMaxPoint(new Point(currentCell.getX() + 1, currentCell.getY() + 1));
    }

    if (map.getMinPoint() == null) {
      map.setMinPoint(new Point(currentCell.getX() - 1, currentCell.getY() - 1));
    }

    if (map.getMapPoint() == null) {
      map.setMapPoint(
          new Point(this.getWidth() / calculateCellSize(), this.getHeight() / calculateCellSize()));
    }

    setAutoscrolls(true);

    mouseListener mouse = new mouseListener();
    addMouseWheelListener(mouse);
  }