Changeset 9784 in osm for applications/viewer
- Timestamp:
- 2008-08-13T16:04:30+02:00 (16 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
r9780 r9784 103 103 setLayout(null); 104 104 initializeZoomSlider(); 105 setMinimumSize(new Dimension(Tile. WIDTH, Tile.HEIGHT));105 setMinimumSize(new Dimension(Tile.SIZE, Tile.SIZE)); 106 106 setPreferredSize(new Dimension(400, 400)); 107 107 try { … … 302 302 int iMove = 0; 303 303 304 int tilex = center.x / Tile.WIDTH; 305 int tiley = center.y / Tile.HEIGHT; 306 int off_x = (center.x % Tile.WIDTH); 307 int off_y = (center.y % Tile.HEIGHT); 308 309 int posx = getWidth() / 2 - off_x; 310 int posy = getHeight() / 2 - off_y; 304 int tilex = center.x / Tile.SIZE; 305 int tiley = center.y / Tile.SIZE; 306 int off_x = (center.x % Tile.SIZE); 307 int off_y = (center.y % Tile.SIZE); 308 309 int w2 = getWidth() / 2; 310 int h2 = getHeight() / 2; 311 int posx = w2 - off_x; 312 int posy = h2 - off_y; 311 313 312 314 int diff_left = off_x; 313 int diff_right = Tile. WIDTH- off_x;315 int diff_right = Tile.SIZE - off_x; 314 316 int diff_top = off_y; 315 int diff_bottom = Tile. HEIGHT- off_y;317 int diff_bottom = Tile.SIZE - off_y; 316 318 317 319 boolean start_left = diff_left < diff_right; … … 329 331 iMove = 0; 330 332 } // calculate the visibility borders 331 int x_min = -Tile. WIDTH;332 int y_min = -Tile. HEIGHT;333 int x_min = -Tile.SIZE; 334 int y_min = -Tile.SIZE; 333 335 int x_max = getWidth(); 334 336 int y_max = getHeight(); … … 350 352 tile.paint(g, posx, posy); 351 353 if (tileGridVisible) 352 g.drawRect(posx, posy, Tile. WIDTH, Tile.HEIGHT);354 g.drawRect(posx, posy, Tile.SIZE, Tile.SIZE); 353 355 } 354 356 } 355 357 Point p = move[iMove]; 356 posx += p.x * Tile. WIDTH;357 posy += p.y * Tile. HEIGHT;358 posx += p.x * Tile.SIZE; 359 posy += p.y * Tile.SIZE; 358 360 tilex += p.x; 359 361 tiley += p.y; … … 371 373 marker.paint(g, p); 372 374 } 375 // outer border of the map 376 int mapSize = Tile.SIZE << zoom; 377 g.drawRect(w2 - center.x, h2 - center.y, mapSize, mapSize); 373 378 } 374 379 … … 445 450 * was not found in the cache. 446 451 */ 447 protected Tile getTile( final int tilex, final int tiley, finalint zoom) {452 protected Tile getTile(int tilex, int tiley, int zoom) { 448 453 int max = (1 << zoom); 449 454 if (tilex < 0 || tilex >= max || tiley < 0 || tiley >= max) -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Tile.java
r9780 r9784 31 31 protected boolean loaded = false; 32 32 protected boolean loading = false; 33 public static final int WIDTH = 256; 34 public static final int HEIGHT = 256; 33 public static final int SIZE = 256; 35 34 36 35 /** … … 63 62 */ 64 63 public void loadPlaceholderFromCache(TileCache cache) { 65 BufferedImage tmpImage = new BufferedImage( WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);64 BufferedImage tmpImage = new BufferedImage(SIZE, SIZE, BufferedImage.TYPE_INT_RGB); 66 65 Graphics2D g = (Graphics2D) tmpImage.getGraphics(); 67 66 // g.drawImage(image, 0, 0, null); … … 83 82 if (tile != null && tile.isLoaded()) { 84 83 paintedTileCount++; 85 tile.paint(g, x * WIDTH, y * HEIGHT);84 tile.paint(g, x * SIZE, y * SIZE); 86 85 } 87 86 } … … 100 99 double scale = (double) factor; 101 100 AffineTransform at = new AffineTransform(); 102 int translate_x = (xtile % factor) * WIDTH;103 int translate_y = (ytile % factor) * HEIGHT;101 int translate_x = (xtile % factor) * SIZE; 102 int translate_y = (ytile % factor) * SIZE; 104 103 at.setTransform(scale, 0, 0, scale, -translate_x, -translate_y); 105 104 g.setTransform(at);
Note:
See TracChangeset
for help on using the changeset viewer.