コード例 #1
0
ファイル: map_management.c プロジェクト: shenki/foxtrotgps
void
set_mapcenter(	float lat,
		float lon,
		int zoom)
{
	int pixel_x, pixel_y;
	
	lat = deg2rad(lat);
	lon = deg2rad(lon);
	
	
	pixel_x = lon2pixel(zoom, lon);
	pixel_y = lat2pixel(zoom, lat);

	
	osd_speed(TRUE);
	fill_tiles_pixel (	pixel_x - global_drawingarea_width/2, 
				pixel_y - global_drawingarea_height/2,
				zoom, FALSE);
	paint_track();
	paint_loaded_track();
	paint_friends();
	paint_photos();
	paint_pois();
	paint_wp();
	paint_route();
}
コード例 #2
0
void
set_mapcenter(	float lat,
		float lon,
		int zoom)
{
	int pixel_x, pixel_y;
	
	lat = deg2rad(lat);
	lon = deg2rad(lon);
	
	
	pixel_x = lon2pixel(zoom, lon);
	pixel_y = lat2pixel(zoom, lat);

	printf("fill_tiles_latlon(): lat %f  %i -- lon %f  %i\n",
	lat,pixel_y,lon,pixel_x);
	
	osd_speed();
	global_x = pixel_x - global_drawingarea_width/2; 
	global_y = pixel_y - global_drawingarea_height/2; 
	global_zoom = zoom;
	fill_tiles_pixel (	pixel_x - global_drawingarea_width/2, 
				pixel_y - global_drawingarea_height/2,
				zoom);
	print_track();
	paint_friends();
	paint_photos();
	paint_pois();
	paint_wp();
	osd_speed(); 


}
コード例 #3
0
ファイル: map_management.c プロジェクト: shenki/foxtrotgps
void
fill_tiles_latlon(	float lat,
			float lon,
			int zoom)
{
	int pixel_x, pixel_y;
	
	
	pixel_x = lon2pixel(zoom, lon);

	pixel_y = lat2pixel(zoom, lat);

	fill_tiles_pixel (pixel_x, pixel_y, zoom, FALSE);
}
コード例 #4
0
void
fill_tiles_latlon_hack(	float lat,
			float lon,
			int zoom)
{
	int pixel_x, pixel_y;
	
	
	pixel_x = lon2pixel(zoom, lon);

	pixel_y = lat2pixel(zoom, lat);

	printf("fill_tiles_latlon(): lat %f  %i -- lon %f  %i\n",
	lat,pixel_y,lon,pixel_x);
	
	fill_tiles_pixel (pixel_x - 240, pixel_y - 300, zoom);
}
コード例 #5
0
QImage *DataSourceManager::getImage(int x, int y, int zoom, int width, int height, TileInfo &tile_info, bool outlineMap)
{
	TileList missingTiles;
	QImage *mapImg = NULL;

	QImage **cachedImg = NULL;
	TileList *cache = NULL;
	int *cacheSize = NULL;
	TileInfo *cacheTileInfo = NULL;

	/* Change cache in dependancy of requested map typ (normal or outline/overview map) */
	if(!outlineMap)
	{
		cache = &_cache;
		cacheSize = &_cacheSize;
		cachedImg = &_mapImg;
		cacheTileInfo = &_tileInfo;
	}
	else
	{
		cache = &_outlineCache;
		cacheSize = &_outlineCacheSize;
		cachedImg = &_outlineMapImg;
		cacheTileInfo = &_outlineTileInfo;
	}

	/* generate list of tiles which are needed for the current x, y and zoom level */
	TileList *requested_tiles = get_necessary_tiles(x, y, zoom, width, height, _mapPath, tile_info);

	/* check if the same tile rect is requested as the last time */
	if(cachedImg && !_gotMissingTiles &&
	   cacheTileInfo->min_tile_x == tile_info.min_tile_x &&
	   cacheTileInfo->min_tile_y == tile_info.min_tile_y &&
	   cacheTileInfo->max_tile_x == tile_info.max_tile_x &&
	   cacheTileInfo->max_tile_y == tile_info.max_tile_y)
	{
		mapImg = *cachedImg;
	}
	else
	{
		/* Let's center the coordinates here using width + height of map widget */
		mapImg = fill_tiles_pixel(requested_tiles, &missingTiles, cache, tile_info.nx, tile_info.ny);
		delete *cachedImg;
		*cachedImg = mapImg;
	}

	memcpy(cacheTileInfo, &tile_info, sizeof(TileInfo));
	delete requested_tiles;

	/*
		The "if" is needed so the system doesn't remove the "update" flag for the UI map
		when called second time for outlinemap
	*/
	if(!outlineMap)
	{
		if(missingTiles.length() > 0)
			_gotMissingTiles = true;
		else
			_gotMissingTiles = false;
	}
	else
	{
		if(missingTiles.length() > 0)
			_gotMissingTiles = true;
	}

	/* check tile cache for MAX items */
	while(cache->length() > *cacheSize)
	{
		Tile mytile = cache->takeFirst();
		if(mytile._img)
			delete mytile._img;
	}

	/* -------------------------------------------------- */
	/* The following stuff got nothing to do with drawing */
	/* -------------------------------------------------- */

	/* request missing tiles from internet/renderer */
		for(int i = 0; i < missingTiles.length(); i++)
			_dsHttp->loadMapTile(new Tile(missingTiles[i]._x, missingTiles[i]._y, missingTiles[i]._z, _mapPath, _mapUrl));

	return  mapImg;
}