示例#1
0
  /** Refreshes preview image. */
  private void refreshPreviewImage() {

    if (originalBackgroundImage != null) {
      this.scalingRatioToFitContainer =
          Utilities.getScalingRatioToFitContainer(
              this.originalBackgroundImage, PANEL_WIDTH, PANEL_HEIGHT);
      this.backgroundImage =
          Utilities.scaleImageToFitContainer(this.backgroundImage, PANEL_WIDTH, PANEL_HEIGHT);
      this.repaint();
    }
  }
示例#2
0
  /**
   * Changes the panel image. When changed, any <code>ReceiverView</code>s placed on the map will be
   * removed and <code>CoordinateZeroMarkerView</code>'s will be set to (0,0) position.
   *
   * @param file <code>File</code> Image file
   * @see <code>ReceiverView</code>
   */
  public void setPreviewImage(File file) {

    try {
      this.backgroundImage = ImageIO.read(file);
      this.originalBackgroundImage = ImageIO.read(file);
      this.scalingRatioToFitContainer =
          Utilities.getScalingRatioToFitContainer(
              this.originalBackgroundImage, PANEL_WIDTH, PANEL_HEIGHT);
      this.backgroundImage =
          Utilities.scaleImageToFitContainer(this.backgroundImage, PANEL_WIDTH, PANEL_HEIGHT);
      this.map.setImage(originalBackgroundImage);
      this.map.setPath(file.getAbsolutePath());
    } catch (IOException e) {
      logger.severe("Reading of the image failed.\n" + e.getMessage());
    }
  }