diff options
-rw-r--r-- | navit/item.h | 16 | ||||
-rw-r--r-- | navit/navit.c | 27 | ||||
-rw-r--r-- | navit/navit.h | 2 |
3 files changed, 43 insertions, 2 deletions
diff --git a/navit/item.h b/navit/item.h index d3e222196..d8aefeabe 100644 --- a/navit/item.h +++ b/navit/item.h @@ -61,6 +61,22 @@ extern int default_flags[]; || (item).type == type_path \ || (item).type == type_street_parking_lane \ || (item).type == type_footway ) +/** + * @brief Determines if the given item's type is a POI or not + * + * @param item The struct item + * @return Returns true if the item is a POI type otherwise returns false + */ +#define item_is_poi(item) (((item).type >= type_poi_lake && (item).type <= type_poi) \ + || ((item).type >= type_poi_land_feature && (item).type <= type_poi_zoo) \ + || ((item).type >= type_poi_gc_multi && (item).type <= type_poi_cafe) \ + || ((item).type >= type_poi_peak && (item).type <= type_poi_image) \ + || ((item).type >= type_poi_townhall && (item).type <= type_poi_ruins) \ + || ((item).type >= type_poi_post_box && (item).type <= type_poi_tennis) \ + || ((item).type >= type_poi_vending_machine && (item).type <= type_poi_shop_shoes) \ + || ((item).type >= type_poi_tree && (item).type <= type_poi_shop_photo) \ + || ((item).type >= type_poi_pub && (item).type <= type_poi_bahai) \ + || ((item).type >= type_poi_customh && (item).type <= type_poi_customf)) #define item_is_equal_id(a,b) ((a).id_hi == (b).id_hi && (a).id_lo == (b).id_lo) #define item_is_equal(a,b) (item_is_equal_id(a,b) && (a).map == (b).map) diff --git a/navit/navit.c b/navit/navit.c index 5248e10ea..671e5d9c0 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -800,7 +800,7 @@ void navit_zoom_in(struct navit *this_, int factor, struct point *p) { } /** - * Change the current zoom level + * Change the current zoom level, further to the ground * * @param navit The navit instance * @param factor The zoom factor, usually 2 @@ -2486,6 +2486,27 @@ void navit_set_center_cursor(struct navit *this_, int autozoom, int keep_orienta } /** + * @brief Drags (moves) the map + * + * Drags (moves) the map from origin point to the destination point + * + * @param navit The navit instance + * @param origin The point point where the drag starts + * @param destination The point where to map should be dragged to + * @returns nothing + */ + +void navit_drag_map(struct navit *this_, struct point *origin, struct point *destination) { + update_transformation(this_->trans, origin, destination); + graphics_draw_drag(this_->gra, NULL); + transform_copy(this_->trans, this_->trans_cursor); + graphics_overlay_disable(this_->gra, 0); + if (!this_->zoomed) + navit_set_timeout(this_); + navit_draw(this_); +} + +/** * @brief Recenters the map so that the vehicle cursor is visible * * This function first calls {@code navit_set_center_cursor()} to recalculate the map display, then @@ -2493,7 +2514,7 @@ void navit_set_center_cursor(struct navit *this_, int autozoom, int keep_orienta * *@param this_ The navit object */ -static void navit_set_center_cursor_draw(struct navit *this_) { +void navit_set_center_cursor_draw(struct navit *this_) { navit_set_center_cursor(this_,1,0); if (this_->ready == 3) navit_draw_async(this_, 1); @@ -2629,6 +2650,8 @@ static int navit_set_attr_do(struct navit *this_, struct attr *attr, int init) { #endif attr_updated=1; } + if (attr_updated && this_->ready == 3) + navit_draw(this_); } break; case attr_osd_configuration: diff --git a/navit/navit.h b/navit/navit.h index d715d814d..e0a127074 100644 --- a/navit/navit.h +++ b/navit/navit.h @@ -104,6 +104,8 @@ void navit_zoom_to_route(struct navit *this_, int orientation); void navit_set_center(struct navit *this_, struct pcoord *center, int set_timeout); void navit_set_center_cursor(struct navit *this_, int autozoom, int keep_orientation); void navit_set_center_screen(struct navit *this_, struct point *p, int set_timeout); +void navit_drag_map(struct navit *this_, struct point *origin, struct point *destination); +void navit_set_center_cursor_draw(struct navit *this_); int navit_set_attr(struct navit *this_, struct attr *attr); int navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter); struct layout *navit_get_layout_by_name(struct navit *this_, const char *layout_name); |