示例#1
0
文件: MapPanel.java 项目: TimJin/map
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    if (transformer.isSetupDone()) {
      thread.checkSetup(transformer, config);
      Graphics2D g2 = ((Graphics2D) g.create());

      // paint the background
      g2.setColor(MapPanel.BG_COLOR);
      g2.fillRect(0, 0, getWidth(), getHeight());

      MapPanelThread.PaintInfo paintInfo = thread.getPaintInfo(transformer);
      if (paintInfo != null) {
        /*g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
        RenderingHints.VALUE_INTERPOLATION_BILINEAR);*/
        g2.drawImage(paintInfo.image, paintInfo.x, paintInfo.y, paintInfo.w, paintInfo.h, this);
      }
    }
  }
示例#2
0
文件: MapPanel.java 项目: TimJin/map
  /** Create a dependent MapPanel, with its converter and maps provided from outside. */
  public MapPanel(ImgFilesBag map, MapTransformer<COORD> transformer) {
    this.map = map;
    this.transformer = transformer;
    thread = new MapPanelThread<COORD>(this, config);
    thread.start();

    addComponentListener(
        new ComponentListener() {
          public void componentResized(ComponentEvent e) {
            MapPanel.this.componentResized();
          }

          public void componentMoved(ComponentEvent e) {}

          public void componentShown(ComponentEvent e) {}

          public void componentHidden(ComponentEvent e) {}
        });

    transformer.setDimensions(getWidth(), getHeight());
  }
示例#3
0
文件: MapPanel.java 项目: TimJin/map
 protected void transformerChanged() {
   thread.checkSetup(transformer, config);
 }
示例#4
0
文件: MapPanel.java 项目: TimJin/map
 public void setShading(boolean enabled) {
   config.setWantShading(enabled);
   thread.checkSetup(transformer, config);
 }
示例#5
0
文件: MapPanel.java 项目: TimJin/map
 public void setDetailLevel(int detailLevel) {
   config.setDetailLevel(detailLevel);
   thread.checkSetup(transformer, config);
 }
示例#6
0
文件: MapPanel.java 项目: TimJin/map
 public void setPoiThreshold(int threshold) {
   config.setPoiThreshold(threshold);
   thread.checkSetup(transformer, config);
 }
示例#7
0
文件: MapPanel.java 项目: TimJin/map
 public void setShowPointLabel(boolean showPointLabel) {
   config.setShowPointLabel(showPointLabel);
   thread.checkSetup(transformer, config);
 }
示例#8
0
文件: MapPanel.java 项目: TimJin/map
 /** Does not trigger a repaint... */
 public void setQuality(MapConfig.Quality quality) {
   config.setQuality(quality);
   thread.checkSetup(transformer, config);
 }
示例#9
0
文件: MapPanel.java 项目: TimJin/map
 public void clearMaps() throws IOException {
   map.clear();
   thread.scheduleComputeMap();
 }
示例#10
0
文件: MapPanel.java 项目: TimJin/map
 public void addMapLocation(File location) throws IOException {
   if (location.isDirectory()) map.addDirectory(location);
   else map.addFile(location);
   thread.scheduleComputeMap();
 }
示例#11
0
文件: MapPanel.java 项目: TimJin/map
 /**
  * If an external class changed manually the transformer, it must call this method to make the
  * change effective.
  */
 public void transformerChangedManually() {
   thread.checkSetup(transformer, config);
   repaint();
 }