Search in sources :

Example 1 with ProxyHttpTile

use of com.codename1.maps.ProxyHttpTile in project CodenameOne by codenameone.

the class GoogleMapsProvider method tileFor.

/**
 * {@inheritDoc}
 */
public Tile tileFor(BoundingBox bbox) {
    StringBuilder sb = new StringBuilder(_url);
    Coord ne = bbox.getNorthEast();
    Coord c = projection().toWGS84(new Coord(ne.getLatitude() - bbox.latitudeDifference() / 2, ne.getLongitude() - bbox.longitudeDifference() / 2, true));
    sb.append("center=");
    sb.append(c.getLatitude());
    sb.append(",");
    sb.append(c.getLongitude());
    sb.append("&format=png");
    sb.append("&zoom=" + _zoomLevel);
    sb.append("&size=");
    sb.append(tileSize);
    sb.append("x");
    sb.append(tileSize);
    sb.append("&sensor=");
    sb.append(sensor);
    if (language != null) {
        sb.append("&language=");
        sb.append(language);
    }
    if (type == SATELLITE) {
        sb.append("&maptype=satellite");
    } else if (type == HYBRID) {
        sb.append("&maptype=hybrid");
    }
    sb.append("&key=" + apiKey);
    return new ProxyHttpTile(tileSize(), bbox, sb.toString());
}
Also used : Coord(com.codename1.maps.Coord) ProxyHttpTile(com.codename1.maps.ProxyHttpTile)

Aggregations

Coord (com.codename1.maps.Coord)1 ProxyHttpTile (com.codename1.maps.ProxyHttpTile)1