Plotting Map Tiles
I'm pretty inexperienced when it comes to Java GUI stuff, so bear with me.
I'm working on a program that can plot topographic/aerial maps. The maps are split into jpg tile chunks. I'm not sure how to plot the tiles and join them seamlessly in the GUI. I'm looking for functionality like Google Earth, where you can drag the map, and any tiles that are off the screen will be loaded and displayed as the user drags the map. Can I get a push in the right direction?
Richard D. Reavis
It sounds like you want to break up a large image into chunks and draw a section of it on the screen.
This is easiest if all of the map tiles are of the same size. Then you can store that size somewhere and put all of the tiles in a matrix. Then if the upper-left of your screen is (x,y) the tile you want is at the matrix location (x/tileWidth, y/tileHeight). Similarly simple maths for figuring where exactly to draw it and how to loop over the screen.
Depending on the size of your map, it's up to you to decide whether to load all tiles into the matrix as Images first or to load them as String directions to an image file that can be loaded once they're actually on screen.
Thanks for the response. After much reevaluation of my requirements, I think this project has transitioned into the 3D domain. I'll be sure to post any questions in the appropriate forums.