CDMS/src/CDMS/ImageNavigatorII
diff -u -r1.3 -r1.4
--- Tiler.java 28 Jul 2010 22:22:34 -0000 1.3
+++ Tiler.java 30 Jul 2010 00:08:00 -0000 1.4
@@ -26,9 +26,27 @@
public class Tiler {
public static void main(String[] args) throws IOException {
Date startDate = new Date();
- String path = "/Users/chriswilen/Documents/Work/Summer_2010/IZipG18M_TB_75x3/tiles/gmapviewer/";
- int numXimgs = 7;
- int numYimgs = 10;
+
+ String path = "/nfs/farm/g/ee/u15/cdms/CDMS_ImageNavigatorII/wilenc/IZipG47_Side1_Al/";
+ int numXimgs = 27;
+ int numYimgs = 37;
+
+ int numThreads = 1;
+ int thread = 0;
+ int lowestZoom = 0;
+ if(args.length>0) {
+ try {
+ numThreads = Integer.parseInt(args[0]);
+ if (Integer.parseInt(args[1])<=numThreads) thread = Integer.parseInt(args[1]);
+ else System.out.println("The thread number is larger than the number of threads.");
+ } catch (Exception e) {System.out.println("Arguements given were not integers: "+e );}
+ System.out.println("Running thread " + args[1]+" of "+args[0]);
+ }
+ try {
+ lowestZoom = Integer.parseInt(args[2]);
+ } catch (Exception e) { System.out.println("No zoom limit specified or not an int: will assume z=0."); }
+ System.out.println("Starting at zoom level " + lowestZoom);
+
int tileSize = 256;
//get info on imgs
@@ -64,13 +82,15 @@
} catch (Exception e) { System.out.println("out file could not be created: " + e); }
//loop through all zoom levels
- for (int zoom=0; zoom<=maxZoom; zoom++) {
+ for (int zoom=lowestZoom; zoom<=maxZoom; zoom++) {
double totalW = imgW*numXimgs/Math.pow(2, maxZoom-zoom);
double totalH = imgH*numYimgs/Math.pow(2, maxZoom-zoom);
int numXtiles = (int)Math.ceil(totalW/tileSize);
int numYtiles = (int)Math.ceil(totalH/tileSize);
- //loop through all the tiles for specified zoom level
- for (int row=0; row<numYtiles; row++) {
+ //loop through all the tiles for specified zoom level, continuing for only ones in the specified thread
+ int lowerThreadLimit = (int)Math.ceil(thread*numYtiles/numThreads);
+ int upperThreadLimit = (int)Math.floor((thread+1)*numYtiles/numThreads);
+ for (int row=lowerThreadLimit; row<upperThreadLimit; row++) {
for (int col=0; col<numXtiles; col++) {
BufferedImage toStore = new BufferedImage(tileSize,tileSize,img.getType());
Graphics2D g2 = toStore.createGraphics();