jxmapviewer nightmare!

Associate
Joined
30 Oct 2004
Posts
112
Location
Whitstable
Hi everyone,

Right, basically I'm trying to create a java 'map' application, in the style of google maps (i.e. its a map made up of numerous tiles).

I have carved my map up, so I now have a series of images, in the format:

zoom_x_y.jpg

I am trying to use the jxmapviewer from swingx to display my tiles, but I can't figure out how to make it display them.

I have this code so far:

Code:
TileFactoryInfo tileFactoryInfo = new TileFactoryInfo(12, 17, 17, 256, true, true, "/src/images/", "x", "y", "z") {
			public String getTileUrl(int x, int y, int zoom) {

				File file = new File("images/" + zoom + "_" + x + "_" + y + ".jpg");
				boolean fileExists = file.exists();
				
				System.out.println(this.baseURL + zoom +"_" + x + "_" + y + ".jpg " + fileExists);
		        return this.baseURL + zoom +"_" + x + "_" + y + ".jpg";
		    }
		};

The 'fileExists' stuff is some debug code to make sure the files exist.

However, I can never seem to get it to display the tiles! I don't know what I am doing wrong!

I have, for example, a tile which has the filename "17_65857_43653.jpg", and as far as I can tell, the program is picking up the '17' (zoom) part, but not the other parameters!

If anyone knows of any good tutorials or help online with this, I would be really grateful, or if anyone knows what I am doing wrong/have not done, then pleeeeeeeeeeeeeeease let me know!

TIA
 
Back
Top Bottom