Skip to content
16 changes: 16 additions & 0 deletions navit/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
27 changes: 25 additions & 2 deletions navit/navit.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,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
Expand Down Expand Up @@ -2459,6 +2459,27 @@ void navit_set_center_cursor(struct navit *this_, int autozoom, int keep_orienta
navit_autozoom(this_, &nv->coord, nv->speed, 0);
}

/**
* @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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this shall get a "public" function, I suggest to do some sanity checking here, like aborting if some of the parameters is NULL, issuing some err message if this is not expected. May help future users of this in calling the function right.

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
*
Expand All @@ -2467,7 +2488,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);
Expand Down Expand Up @@ -2602,6 +2623,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:
Expand Down
2 changes: 2 additions & 0 deletions navit/navit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down