StudentLifeMap / drawMap.h
drawMap.h
Raw
#pragma once

#include "ezgl/application.hpp"
#include "ezgl/graphics.hpp"


extern std::string default_map_path; 

// GLOBAL VARIBLES
// stores xy coordinates
std::pair <float, float> coord;
// vector to store the intesection data
std::vector <struct intersection_data> intersections;
double max_lat;
double min_lat;
double max_lon;
double min_lon;
float avgLat;
bool noSubways;

std::vector<const OSMWay *> osm_highways;
std::vector<const OSMWay *> osm_main_roads;
std::vector<const OSMWay *> osm_residential;
std::vector<const OSMRelation *> osm_subway_lines;
std::vector<TypedOSMID> all_stations;

std::vector<ezgl::point2d> intersectionPoint2d;
std::vector<std::vector<ezgl::point2d>> featuresInPoint2d;
std::vector<ezgl::point2d> subwayStationsxy;

// function: draw_main_canvas
// this function is called everytime the map is reloaded to redraw the main canvas
// function that defines the colours, and other visual settings  
void draw_main_canvas(ezgl::renderer *g); 

// function: drawMap 
// function that draws the map
void drawMap();

// function: draw_features
// this function draws all the features on a map like rivers, streams, greenspace,
// buildings, and bodies of water
void draw_features(ezgl::renderer *g);

// function: draw_roads
// this function draws all the roads in layers starting with residential roads, 
// main roads and lastly highways/motorways
void draw_road(ezgl::renderer *g);

// function showStreetNames
// this function shows all the street names according to the zoom
void showStreetNames(ezgl::renderer *g);

// function showPathNames
// this function shows all the path names according to the zoom
void showPathNames(ezgl::renderer *g);

// function: show_subways
// shows all the subway stations that are in a city
void show_subways(ezgl::renderer *g);

// function: show_cafes
// shows all the cafes/ coffee shops that are in a city
void show_cafes(ezgl::renderer *g, std::string amenity);

// function: show_food
// shows all the food in visible world based on search
void show_food(ezgl::renderer *g);

//function: label_intersections
// label intersections with a dot
void label_intersections(ezgl::renderer *g);

// function: highlight_intersections
// highlight intersections upon mouse press
void highlight_intersections(ezgl::application *application, double x, double y); 

// function: poi_click
// shows dialog box for cafe click
void poi_click(ezgl::application *application, double x, double y);

// function: intersect_toggle
// toggles intersections
void intersect_toggle(ezgl::renderer *g, ezgl::point2d drawPosition); 

// function: initial_setup 
// call before activation of application to create buttons and connect widgets to their
// callback functions
void initial_setup(ezgl::application *application, bool /*new_window*/);

// calback function: changeMap
// allows the user to choose a place and map to change
gboolean changeMap(GtkWidget * /*widget*/, gpointer data);

// callback function: searchForFirst
// finds name of street from user input and autocompletes
gboolean searchForFirst(GtkWidget */*widget*/, gpointer data);

// callback function:searchForSecond
// finds name of seconf street from user input and autocompletes
gboolean searchForSecond(GtkWidget */*widget*/, gpointer data);

// callback function: searchForThird
// finds name of street from user input and autocompletes
gboolean searchForThird(GtkWidget */*widget*/, gpointer data);

// callback function:searchForFourth
// finds name of seconf street from user input and autocompletes
gboolean searchForFourth(GtkWidget */*widget*/, gpointer data);

// callback function: searchforPOI
// searches for food and coffee shops
gboolean searchforFood(GtkWidget * /*widget*/, gpointer data);

// callback function: find_intersection_button
// finds intersection using input given by the user
void go_button(GtkWidget */*widget*/, ezgl::application *application);

// callback function: dark_mode_button
// toggles the dark mode button 
void dark_mode_button(GtkWidget *widget, ezgl::application *application);

// callback function: subways_button
// toggles the subways button
void subways_button(GtkWidget *widget, ezgl::application *application);

// callback function: coffee_shops_button
// toggles the coffee shops button
void coffee_shops_button(GtkWidget */*widget*/, ezgl::application *application);

// callback function: school_life_button
// toggles the coffee shops button
void school_life_button(GtkWidget * /*widget*/, ezgl::application *application);

// callback function: food_near_me_button
// toggles the search bar
void food_near_me_button(GtkWidget * /*widget*/, ezgl::application *application);

// callback function: twoIntersect_button
// toggles select two intersections mode 
void twoIntersect_button(GtkWidget * /*widget*/, ezgl::application *application); 

// callback function: new_map_button
// toggles the new map button to move to a new map
void new_map_button(GtkWidget */*widget*/, ezgl::application *application);

// callback function: proceed_button
// toggles the proceed button to exit the program
void proceed_button(GtkWidget */*widget*/, ezgl::application *application);

// callback function: help_button
// toggling this button displays a user manual
void help_button(GtkWidget * /*widget*/);

// function: act_on_mouse_press
// is triggered every time the mouse clicks on the map
void act_on_mouse_press(ezgl::application *application, GdkEventButton *event, double x, double y); 

// function: draw_path
// is called to draw path found between two intersections
void draw_intpath(ezgl::renderer *g);

// function: display_directions
// pop up dialog with directions for the user
void display_directions();



//function: draw_orang_flag
// draws the orang flag - need to draw flag after the path
void draw_orang_flag(ezgl::renderer *g);