Changeset 7343 in osm for applications/editors/josm/plugins/slippy_map_chooser/src/SlippyMapChooser.java
- Timestamp:
- 2008-04-12T15:59:42+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/slippy_map_chooser/src/SlippyMapChooser.java
r7199 r7343 185 185 OsmTile t = iTileDB.get(OsmTile.key(iZoomlevel, (-iOffsetX + x*OsmTile.WIDTH)/OsmTile.WIDTH, ((-iOffsetY+ y*OsmTile.HEIGHT)/OsmTile.HEIGHT))); 186 186 if(t != null){ 187 t.paint(g );187 t.paint(g,iTileDB); 188 188 } 189 189 } … … 204 204 205 205 iSizeButton.paint(g); 206 207 208 if(SlippyMapChooserPlugin.DEBUG_MODE){ 209 g.setColor(Color.black); 210 g.drawString("Free Memory: " + Runtime.getRuntime().freeMemory()/1024 + "/" + Runtime.getRuntime().totalMemory()/1024 + "kB" , 5, 50); 211 g.drawString("Tiles in DB: " + iTileDB.getCachedTilesSize(), 5, 65); 212 g.drawString("Loading Queue Size: " + iTileDB.getLoadingQueueSize(), 5, 80); 213 214 } 206 215 } 207 216 … … 356 365 * Callback for OsmMapControl. Zoom out one level 357 366 */ 358 void zoomIn( ){367 void zoomIn(Point curPos){ 359 368 360 369 //cache center of screen and the selection rectangle 361 LatLon l = getLatLonOfScreenPoint( new Point(getWidth()/2, getHeight()/2));370 LatLon l = getLatLonOfScreenPoint(curPos); 362 371 LatLon selStart = null; 363 372 LatLon selEnd = null; … … 374 383 } 375 384 376 //center on cached location 377 centerOnLatLon(l); 385 setLatLonAtPoint(l, curPos); 378 386 379 387 //restore selection … … 394 402 * Callback for OsmMapControl. 395 403 */ 396 void zoomOut( ){404 void zoomOut(Point curPos){ 397 405 //cache center of screen and the selction rect 398 LatLon l = getLatLonOfScreenPoint( new Point(getWidth()/2, getHeight()/2));406 LatLon l = getLatLonOfScreenPoint(curPos); 399 407 LatLon selStart = null; 400 408 LatLon selEnd = null; … … 411 419 } 412 420 413 //center on cached location 414 centerOnLatLon(l); 421 setLatLonAtPoint(l, curPos); 415 422 416 423 //restore selection … … 485 492 * @param aLatLon the location to center on 486 493 */ 487 private void centerOnLatLon(LatLon aLatLon){ 494 private void centerOnLatLon(LatLon aLatLon){ 495 setLatLonAtPoint(aLatLon, new Point(getWidth()/2,getHeight()/2)); 496 } 497 498 /** 499 * Moves the map that the specified latLon is shown at the point on screen 500 * given 501 * @param aLatLon a position 502 * @param p a point on the screen 503 */ 504 private void setLatLonAtPoint(LatLon aLatLon, Point p){ 488 505 int x = OsmMercator.LonToX(aLatLon.lon(), iZoomlevel); 489 506 int y = OsmMercator.LatToY(aLatLon.lat(), iZoomlevel); 490 iOffsetX = - x +getWidth()/2;491 iOffsetY = - y +getHeight()/2;507 iOffsetX = - x + p.x; 508 iOffsetY = - y + p.y; 492 509 repaint(); 493 510 }
Note:
See TracChangeset
for help on using the changeset viewer.