Example #1
0
void SlippyMapWidget::setViewportArea(QRectF theRect)
{
    qreal zoom = 360.0 / theRect.width();
    zoom = log10(zoom)/log10(2.0);
    if (zoom < MINZOOMLEVEL)
        zoom = MINZOOMLEVEL;
    if (zoom > MAXZOOMLEVEL)
        zoom = MAXZOOMLEVEL;
    p->VpZoom = int(zoom);

    p->VpLon = long2tile(theRect.topRight().x(), p->VpZoom);
    p->VpLat = lat2tile(theRect.topRight().y(), p->VpZoom);
}
Example #2
0
	//-------------------------------------------------------------------------
	MapTileCoordinate OpenStreetMapSource::lonLatToTile( LonLat lonlat, MagnificationType magnification )
	//-------------------------------------------------------------------------
	{
		return MapTileCoordinate( long2tile( lonlat.lon, magnification ), lat2tile( lonlat.lat, magnification ), magnification );
	}