public int compare(LatLng p1, LatLng p2) {
return new Double(p1.getLongitude()).compareTo(new Double(
p2.getLongitude()));
}
});
Polyline pline = new Polyline(points);
map.addOverlay(pline);
if (pline.getVertexCount() != NUM_POINTS) {
Window.alert("Created polyline with " + NUM_POINTS
+ " vertices, but now it has " + pline.getVertexCount());
}
}
break;
case TEST_POLYLINE_ENCODED: {
// Add a polyline encoded in a string
map.setCenter(LatLng.newInstance(40.71213418976525, -73.96785736083984), 15);
Polyline pline = Polyline.fromEncoded("#3333cc", 10, 1.0,
ENCODED_POINTS, 32, ENCODED_LEVELS, 4);
map.addOverlay(pline);
}
break;
case TEST_POLYLINE_GEODESIC: {
LatLng nycToZurich[] = {LatLng.newInstance(40.75, -73.90), // New York
LatLng.newInstance(47.3, 8.5) // Zurich
};
map.setCenter(LatLng.newInstance(40, -25), 2);
Polyline pline = new Polyline(nycToZurich, "#FF0000", 1, .75,
PolylineOptions.newInstance(false, true));
map.addOverlay(pline);
}
break;
case TEST_POLYLINE_ENCODED_TRANSPARENT: {
// Add a polyline with transparency
map.setCenter(LatLng.newInstance(40.71213418976525, -73.96785736083984), 15);
Polyline pline = Polyline.fromEncoded(ENCODED_POINTS, 32,
ENCODED_LEVELS, 4);
map.addOverlay(pline);
}
break;