//import java.applet.Applet; //import java.awt.HeadlessException; public class DecodePolyline { public int [] Decode(String code) { // make sure the code does not contain double backslashes // they are included in the original string in the HTML file // but they should be removed String newCode = ""; boolean prevIsBS = false; for(int i=0; i < code.length(); i++) { if(code.charAt(i) == '\\') { if(prevIsBS) { // skip this one prevIsBS = false; } else { prevIsBS = true; newCode = newCode + code.charAt(i); } } else { newCode = newCode + code.charAt(i); } } code = newCode; //Lb.prototype.decodePolyline=function(Vb) { //I.start("Polyline","decodePolyline"); int Ih = code.length(); //var Ih=Vb.length; //System.out.println(Ih + " -- " + code); int pb = 0; //var pb=0; int ba[] = new int[Ih]; //var ba=new Array(); int idx = 0; int Ka = 0; //var Ka=0; int Pa = 0; //var Pa=0; while(pb < Ih) { //while(pb= 32); //} while(ub>=32); if((Fa&1) != 0) { Ka = Ka + ~(Fa>>1); } else { //Ka=Ka+(Fa&1?~(Fa>>1):Fa>>1); Ka = Ka + (Fa>>1); } ba[idx++] = Ka; //ba.push(Ka); oc=0; //oc=0; Fa=0; //Fa=0; do { //do { ub=code.charAt(pb++) - 63; //ub=Vb.charCodeAt(pb++)-63; Fa|=(ub&31)<=32); //} while(ub>=32); if((Fa&1) != 0) { Pa = Pa + ~(Fa>>1); } else { //Pa=Pa+(Fa&1?~(Fa>>1):Fa>>1); Pa = Pa + (Fa>>1); } ba[idx++] = Pa; // ba.push(Pa) } //this.points=ba; // this.numPoints=this.points.length>>1; //I.end("Polyline","decodePolyline") // copy the result into an array of the right size int retVal[] = new int[idx]; int i; for(i=0; i