Here a bsh script from your pseudo code.
It need some adjustments with the definition of origins at each zoom level....
Try this with MOBAC and MapEvaluator for tweeking...
It need some adjustments with the definition of origins at each zoom level....
Code Select
static import java.lang.Math.*;
name = "Michelin2012";
tileType = "png";
tileSize = 256;
minZoom = 2;
maxZoom = 16;
tileUpdate = TileUpdate.IfModifiedSince;
backgroundColor = "#ffffff";
ignoreError = "True";
String urlstring(int zm,int r,int c) {
int[] tile;
int new_zoom=zm-2;
String zs;
switch (new_zoom) {
case 0 : zs="wot_0180m_r02" ; break;
case 1 : zs="woc_0090m_r02" ; break;
case 2 : zs="woc_0045m_r02" ; break;
case 3 : zs="woc_0024m_r02" ; break;
case 4 : zs="woc_0012m_r02" ; break;
case 5 : zs="woc_6000k_r02" ; break;
case 6 : zs="woc_3000k_r02" ; break;
case 7 : zs="woc_1500k_r02" ; break;
case 8 : zs="eur_c_1000k_r05" ; break;
case 9 : zs="fra_c_0275k_r061"; break;
case 10 : zs="fra_c_0185k_r061"; break;
case 11 : zs="eur_c_0060k_r08" ; break;
case 12 : zs="eur_c_0024k_r08" ; break;
case 13 : zs="eur_c_0012k_r08" ; break;
case 14 : zs="eur_c_0006k_r08" ; break;
}
tile = rc2tile(r,c);
int tileA = tile[0];
int tileB = tile[1];
String tilestring = tiles2string(String.valueOf(tileA),String.valueOf(tileB));
String mapb64string = Tools.encodeBase64(zs.getBytes( "UTF-8" ));
String tileb64string = Tools.encodeBase64(tilestring.getBytes( "UTF-8" ));
return mapb64string + ";"+tileb64string;
}
int[] rc2tile(int r,int c) {
int[] tile2;
int A;
int B;
//javax.swing.JOptionPane.showMessageDialog(null,r+" "+c);
if ((r==1)&&(c==1)) {
A = 0;
B = 0;
}
else {
Double r0=(Double)r;
Double c0=(Double)c;
int r2 = round(r0/2);
int c2 = round(c0/2);
tile2 = rc2tile(r2,c2);
int tile2A = tile2[0];
int tile2B = tile2[1];
A = tile2B * 2 + ((r-1) % 2);
B = tile2A * 2 + ((c-1) % 2);
// note that the A/B switch above is intentional
}
return new int[] {A,B};
}
String tiles2string(String a,String b) {
String ps="";
String qs="";
int p=a.length();
int q=b.length();
for(i=0;i<(10-p);p++)
ps=ps+"0";
for(i=0;i<(10-q);q++)
qs=qs+"0";
return ps + a + qs + b;
}
String getTileUrl( int zoom, int x, int y ) {
return "http://m10.viamichelin.com/mapsgene/dm/mapdirect;" + urlstring(zoom,x+1,y+1);
}
Try this with MOBAC and MapEvaluator for tweeking...