/*
 * draw_favorites.c
 * Copyright (C) Steffen Pohle 2011 <steffen@gulpe.de>
 * 
 * main.c is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * main.c is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU  General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <sys/time.h>
#include <math.h>

#include "osmroute.h"
#include "draw.h"
#include "map.h"
#include "gps.h"
#include "favorites.h"


void draw_gui_favorites () {
	struct line_style tmplinestyle;
	iPoint center = {gfx_screensize.x/2, gfx_screensize.y/2};
	int i;

	for (i = 0; i < favorites_cnt; i++) {
		iPoint p;
		tmplinestyle.width = 2.0;
		tmplinestyle.c = color[COLOR_pink][3];
		tmplinestyle.borderc = color[COLOR_blue][3];

		p = draw_geo2screen (view_lon, view_lat, favorites[i].pos.lon, favorites[i].pos.lat);
		p.x += center.x;
		p.y += center.y;
		
		if (p.x < 0 || p.x > gfx_screensize.x || p.y < 0 || p.y > gfx_screensize.y) continue;
		draw_line (NULL, p.x-5, p.y-5, p.x+5, p.y+5, tmplinestyle);
		draw_line (NULL, p.x+5, p.y-5, p.x-5, p.y+5, tmplinestyle);
	}
};
