navit
0.5.3-trunk
|
Go to the source code of this file.
Data Structures | |
struct | item_methods |
struct | item_id |
struct | item |
Represents an object on a map. More... | |
struct | item_range |
Macros | |
#define | ITEM2(x, y) type_##y=x, |
#define | ITEM(x) type_##x, |
#define | route_item_first type_street_0 |
#define | route_item_last type_street_parking_lane |
#define | item_type_is_area(type) ((type) >= type_area) |
#define | item_is_town(item) ((item).type >= type_town_label && (item).type <= type_district_label_1e7) |
#define | item_is_district(item) ((item).type >= type_district_label && (item).type <= type_district_label_1e7) |
#define | item_is_poly_place(item) ((item).type >= type_poly_place1 && (item).type <= type_poly_place6) |
#define | item_is_point(item) ((item).type < type_line) |
#define | item_is_custom_poi(item) ((item).type >= type_poi_customg && (item).type < type_line) |
#define | item_is_street(item) |
#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) |
#define | ITEM_ID_FMT "(0x%x,0x%x)" |
#define | ITEM_ID_ARGS(x) (x).id_hi,(x).id_lo |
Enumerations | |
enum | item_type |
enum | change_mode { change_mode_delete , change_mode_modify , change_mode_append , change_mode_prepend } |
Functions | |
void | item_create_hash (void) |
void | item_destroy_hash (void) |
int * | item_get_default_flags (enum item_type type) |
void | item_coord_rewind (struct item *it) |
Resets the "coordinate pointer" of an item. More... | |
int | item_coords_left (struct item *it) |
Gets the number of coordinates left for this item. More... | |
int | item_coord_get (struct item *it, struct coord *c, int count) |
Gets the next coordinates from an item. More... | |
int | item_coord_set (struct item *it, struct coord *c, int count, enum change_mode mode) |
Sets coordinates of an item. More... | |
int | item_coord_get_within_selection (struct item *it, struct coord *c, int count, struct map_selection *sel) |
Get coordinates within selection This function returns the coordinates of an item if at least one coordinate of that item is inside the selection. If the given buffer is too small, it returns the buffer size if at least one coordinate intersects with the selection, otherwise it returnes 0. More... | |
int | item_coord_get_within_range (struct item *i, struct coord *c, int max, struct coord *start, struct coord *end) |
Gets all the coordinates of an item within a specified range. More... | |
int | item_coord_get_pro (struct item *it, struct coord *c, int count, enum projection to) |
Gets the next coordinates from an item and reprojects them. More... | |
int | item_coord_is_node (struct item *it) |
Whether the current coordinates of an item correspond to a node. More... | |
void | item_attr_rewind (struct item *it) |
Resets the "attribute pointer" of an item. More... | |
int | item_attr_get (struct item *it, enum attr_type attr_type, struct attr *attr) |
Gets the next matching attribute from an item. More... | |
int | item_attr_set (struct item *it, struct attr *attr, enum change_mode mode) |
Sets an attribute of an item. More... | |
int | item_type_set (struct item *it, enum item_type type) |
Sets the type of a map item. More... | |
struct item * | item_new (char *type, int zoom) |
enum item_type | item_from_name (const char *name) |
char * | item_to_name (enum item_type item) |
unsigned int | item_id_hash (const void *key) |
int | item_id_equal (const void *a, const void *b) |
void | item_id_from_ptr (struct item *item, void *id) |
Derive item id_lo and id_hi from pointer, considering pointer could be 32 or 64 bit wide but both ids are 32 bit. More... | |
struct item_hash * | item_hash_new (void) |
void | item_hash_insert (struct item_hash *h, struct item *item, void *val) |
int | item_hash_remove (struct item_hash *h, struct item *item) |
void * | item_hash_lookup (struct item_hash *h, struct item *item) |
void | item_hash_destroy (struct item_hash *h) |
int | item_range_intersects_range (struct item_range *range1, struct item_range *range2) |
int | item_range_contains_item (struct item_range *range, enum item_type type) |
void | item_dump_attr (struct item *item, struct map *map, FILE *out) |
void | item_dump_filedesc (struct item *item, struct map *map, FILE *out) |
void | item_cleanup (void) |
Variables | |
int | default_flags [] |
struct item_range | item_range_all |
struct item | busy_item |
An item indicating that the map driver is busy fetching more items. More... | |
#define ITEM | ( | x | ) | type_##x, |
#define ITEM2 | ( | x, | |
y | |||
) | type_##y=x, |
#define ITEM_ID_ARGS | ( | x | ) | (x).id_hi,(x).id_lo |
#define ITEM_ID_FMT "(0x%x,0x%x)" |
#define item_is_district | ( | item | ) | ((item).type >= type_district_label && (item).type <= type_district_label_1e7) |
#define item_is_equal | ( | a, | |
b | |||
) | (item_is_equal_id(a,b) && (a).map == (b).map) |
#define item_is_equal_id | ( | a, | |
b | |||
) | ((a).id_hi == (b).id_hi && (a).id_lo == (b).id_lo) |
#define item_is_poly_place | ( | item | ) | ((item).type >= type_poly_place1 && (item).type <= type_poly_place6) |
#define item_is_street | ( | item | ) |
#define item_is_town | ( | item | ) | ((item).type >= type_town_label && (item).type <= type_district_label_1e7) |
#define route_item_first type_street_0 |
#define route_item_last type_street_parking_lane |
enum change_mode |
enum item_type |
Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation.
This program 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Gets the next matching attribute from an item.
This function returns the next attribute matching attr_type
from an item and advances the "attribute pointer" accordingly, so that at the next call the next attribute will be returned.
IMPORTANT: Unless you are iterating over attributes, or operating on a “fresh” item (from which no other code has had a chance to retrieve an attribute), be sure to call item_attr_rewind(struct item *) before each call to this method. Not doing so may result in unpredictable behavior, i.e. attributes not being found if the attribute pointer is already past the requested attribute (which depends on the physical ordering of attributes and on the last attribute retrieved from the item).
This function is not safe to call after destroying the item's map rect, and doing so may cause errors with some map implementations.
[in] | it | The map item whose attribute to retrieve. This must be the active item, i.e. the last one retrieved from the . There can only be one active item per . |
[in] | attr_type | The attribute type to retrieve, or attr_any to retrieve the next attribute |
[out] | attr | Receives the attribute retrieved |
References item_methods::item_attr_get, item::meth, and item::priv_data.
Referenced by NGQPoint::_coordName(), NGQPoint::_setUrl(), binmap_search_by_index(), binmap_search_new(), binmap_search_street_by_place(), bookmarks_load_hash(), country_id_from_iso2(), destination_address(), display_add(), display_add_holes(), do_draw(), duplicate_test(), Backend::get_bookmarks(), get_icon(), Backend::get_pois(), NGQProxyBookmarks::getBookmarks(), NGQPoint::getInformation(), NGQPoint::getPOI(), graphics_process_selection_item(), gui_gtk_bookmarks_update(), gui_gtk_destinations_update(), gui_internal_cmd_bookmarks(), gui_internal_cmd_formerdests(), gui_internal_cmd_load_bookmarks_as_waypoints(), gui_internal_cmd_pois(), gui_internal_cmd_pois_item_selected(), gui_internal_cmd_position_do(), gui_internal_cmd_replace_bookmarks_from_waypoints(), gui_internal_cmd_show_satellite_status(), gui_internal_cmd_view_attribute_details(), gui_internal_cmd_view_attributes(), gui_internal_cmd_view_in_browser(), gui_internal_compose_item_address_string(), gui_internal_dbus_signal(), gui_internal_poi_icon(), gui_internal_populate_route_table(), gui_internal_search_list_set_default_country(), gui_internal_select_waypoint(), gui_qml_dbus_signal(), housenumber_attr_get(), item_dump_attr(), item_get_heightline(), Java_org_navitproject_navit_NavitGraphics_getDefaultCountry(), map_filter_attr_get(), map_route_occluded_attr_get(), map_search_setup(), model_poi(), navigation_get_attr(), navigation_itm_new(), navigation_itm_update(), navigation_itm_ways_update(), navigation_update_idle(), navigation_way_init(), navit_speak(), navit_window_roadbook_update(), NGQProxySearch::NGQProxySearch(), osd_route_guard_init(), osd_speed_cam_draw(), osd_text_draw(), phase1_map(), popup_show_attrs(), read_former_destination_map_as_list(), request_navit_route_export_geojson(), request_navit_route_export_gpx(), request_navit_traffic_export_gpx(), route_get_destination_description(), route_graph_add_street(), route_graph_add_traffic_distortion(), search_list_common_new(), search_list_country_new(), search_list_get_result(), search_list_house_number_new(), search_list_street_new(), search_list_town_new(), NGQProxyBookmarks::setPoint(), statusbar_route_update(), street_get_data(), street_name_attr_get(), tm_find_item(), tracking_get_attr(), traffic_location_match_attributes(), traffic_location_populate_route_graph(), traffic_message_restore_segments(), traffic_point_match_attributes(), and traffic_point_match_segment_attributes().
void item_attr_rewind | ( | struct item * | it | ) |
Resets the "attribute pointer" of an item.
This function resets the "attribute pointer" of an item to point to the first attribute, so that at the next call to
the first attribute will be returned.
This function is not safe to call after destroying the item's map rect, and doing so may cause errors with some map implementations.
it | The map item whose pointer is to be reset. This must be the active item, i.e. the last one retrieved from the . There can only be one active item per . |
References item_methods::item_attr_rewind, item::meth, and item::priv_data.
Referenced by display_add(), display_add_holes(), gui_internal_cmd_pois(), map_filter_attr_rewind(), map_route_occluded_attr_rewind(), request_navit_traffic_export_gpx(), route_graph_add_street(), route_graph_add_traffic_distortion(), tm_find_item(), traffic_location_match_attributes(), traffic_location_populate_route_graph(), traffic_message_restore_segments(), traffic_point_match_attributes(), and traffic_point_match_segment_attributes().
int item_attr_set | ( | struct item * | it, |
struct attr * | attr, | ||
enum change_mode | mode | ||
) |
Sets an attribute of an item.
This function supports different modes:
change_mode_delete
: Deletes the attribute change_mode_modify
: Replaces an attribute change_mode_append
: Appends an attribute change_mode_prepend
: Prepends an attributeTODO which attribute is deleted/modified? The last one retrieved, the next one, the first matching one?
TODO where are attributes appended/prepended? Beginning/end or current position?
This function is not safe to call after destroying the item's map rect, and doing so may cause errors with some map implementations.
it | The map item whose coordinates to retrieve. This must be the active item, i.e. the last one retrieved from the . There can only be one active item per . |
attr | TODO new attr, also store for old attr (delete/modify)? Required in delete mode (type of attr to delete)? |
mode | The change mode, see description |
References item_methods::item_attr_set, item::meth, and item::priv_data.
Referenced by navit_cmd_map_item_set_attr(), and navit_populate_search_results_map().
void item_cleanup | ( | void | ) |
References default_flags_hash.
Gets the next coordinates from an item.
This function returns a list of coordinates from an item and advances the "coordinate pointer" by the number of coordinates returned, so that at the next call the next coordinates will be returned.
Coordinates are stored in the projection of the item's map. If you need them in a different projection, call
instead.
This function is not safe to call after destroying the item's map rect, and doing so may cause errors with some map implementations.
it | The map item whose coordinates to retrieve. This must be the active item, i.e. the last one retrieved from the . There can only be one active item per . |
c | Points to a buffer that will receive the coordinates. The buffer must be at least bytes in size. |
count | The number of coordinates to retrieve. Attempts to read past the end are handled gracefully and only the available number of coordinates is returned. |
References c, item_methods::item_coord_get, item::meth, and item::priv_data.
Referenced by binmap_get_estimated_boundaries(), binmap_search_get_item(), binmap_search_new(), binmap_search_street_by_place(), bookmarks_load_hash(), duplicate_test(), Backend::get_bookmarks(), NGQProxyBookmarks::getBookmarks(), graphics_process_selection_item(), gui_gtk_bookmarks_update(), gui_gtk_destinations_update(), gui_internal_cmd2_route_height_profile(), gui_internal_cmd_bookmarks(), gui_internal_cmd_formerdests(), gui_internal_cmd_load_bookmarks_as_waypoints(), gui_internal_populate_route_table(), gui_internal_select_waypoint(), item_coord_get_pro(), item_coord_get_within_range(), item_coord_get_within_selection(), item_inside_poly_list(), map_filter_coord_get(), map_route_occluded_bbox(), map_selection_contains_item_rect(), model_poi(), navigation_itm_new(), navigation_way_get_max_delta(), navigation_way_init(), navit_add_former_destinations_from_file(), navit_zoom_to_route(), osd_route_guard_init(), osd_speed_cam_draw(), pedestrian_draw_arrows(), phase1_map(), popup_show_item(), popup_traffic_distortion(), read_former_destination_map_as_list(), request_navit_route_export_geojson(), request_navit_route_export_gpx(), request_navit_traffic_export_gpx(), route_graph_add_street(), route_graph_add_traffic_distortion(), route_graph_add_turn_restriction(), route_graph_remove_traffic_distortion(), search_house_number_coordinate(), search_list_street_new(), search_list_town_new(), NGQProxyBookmarks::setPoint(), street_get_data(), traffic_location_get_matching_points(), traffic_location_populate_route_graph(), traffic_message_restore_segments(), and vehicle_demo_timer().
int item_coord_get_pro | ( | struct item * | it, |
struct coord * | c, | ||
int | count, | ||
enum projection | to | ||
) |
Gets the next coordinates from an item and reprojects them.
This function returns a list of coordinates from an item and advances the "coordinate pointer" by the number of coordinates returned, so that at the next call the next coordinates will be returned.
it | The map item whose coordinates to retrieve. This must be the active item, i.e. the last one retrieved from the . There can only be one active item per . |
c | Points to a buffer that will receive the coordinates. The buffer must be at least |
count | The number of coordinates to retrieve. Attempts to read past the end are handled gracefully and only the available number of coordinates is returned. |
projection | The projection into which the coordinates will be transformed |
References c, item_coord_get(), item::map, map_projection(), and transform_from_to().
Referenced by Backend::get_pois(), NGQPoint::getPOI(), gui_internal_cmd_delete_waypoint(), and gui_internal_cmd_pois().
int item_coord_get_within_range | ( | struct item * | i, |
struct coord * | c, | ||
int | max, | ||
struct coord * | start, | ||
struct coord * | end | ||
) |
Gets all the coordinates of an item within a specified range.
This will get all the coordinates of the item i
, starting with start
and ending with end
, and return them in c
, up to max
coordinates.
If i
does not contain the coordinates in start
, no coordinates are retrieved and zero is returned.
If i
contains the coordinates in start
but not those in end
, all coordinates beginning with start
are retrieved, ending with the last coordinate of i
or after max
coordinates have been retrieved, whichever occurs first.
This function is not safe to call after destroying the item's map rect, and doing so may cause errors with some map implementations.
@important Make sure that c
points to a buffer large enough to hold max
coordinates!
i | The item to get the coordinates of |
c | Pointer to memory allocated for holding the coordinates |
max | Maximum number of coordinates to return |
start | First coordinate to get |
end | Last coordinate to get |
c
References c, c1, item::id_hi, item::id_lo, item, item_coord_get(), item::map, map_rect_destroy(), map_rect_get_item_byid(), map_rect_new(), max, p, coord::x, and coord::y.
Referenced by route_path_add_item_from_graph(), and traffic_message_add_segments().
int item_coord_get_within_selection | ( | struct item * | it, |
struct coord * | c, | ||
int | count, | ||
struct map_selection * | sel | ||
) |
Get coordinates within selection This function returns the coordinates of an item if at least one coordinate of that item is inside the selection. If the given buffer is too small, it returns the buffer size if at least one coordinate intersects with the selection, otherwise it returnes 0.
If the return value equals count, the content of c is undefined.
it | requested item |
c | preallocated buffer for the result |
count | number of coordinates in c |
sel | current map selection |
References bbox(), c, map_selection::c_rect, item_coord_get(), coord_rect::lu, map_selection::next, coord_rect::rl, map_selection::u, coord::x, pcoord::x, coord::y, and pcoord::y.
Referenced by do_draw().
int item_coord_is_node | ( | struct item * | it | ) |
Whether the current coordinates of an item correspond to a node.
TODO which coordinates? Last retrieved or next (to be) retrieved?
This function is not safe to call after destroying the item's map rect, and doing so may cause errors with some map implementations.
it | The item |
References item_methods::item_coord_is_node, item::meth, and item::priv_data.
Referenced by route_graph_add_street(), and traffic_location_populate_route_graph().
void item_coord_rewind | ( | struct item * | it | ) |
Resets the "coordinate pointer" of an item.
This function resets the "coordinate pointer" of an item to point to the first coordinate pair, so that at the next call to
the first coordinates will be returned.
This function is not safe to call after destroying the item's map rect, and doing so may cause errors with some map implementations.
it | The map item whose pointer is to be reset. This must be the active item, i.e. the last one retrieved from the . There can only be one active item per . |
References item_methods::item_coord_rewind, item::meth, and item::priv_data.
Referenced by binmap_search_get_item(), do_draw(), item_inside_poly_list(), map_filter_coord_rewind(), map_route_occluded_coord_rewind(), navigation_way_get_max_delta(), request_navit_traffic_export_gpx(), route_graph_add_street(), route_graph_add_traffic_distortion(), route_graph_add_turn_restriction(), route_graph_remove_traffic_distortion(), search_house_number_coordinate(), traffic_location_populate_route_graph(), and traffic_message_restore_segments().
int item_coord_set | ( | struct item * | it, |
struct coord * | c, | ||
int | count, | ||
enum change_mode | mode | ||
) |
Sets coordinates of an item.
This function supports different modes:
change_mode_delete
: Deletes the specified number of coordinates change_mode_modify
: Replaces existing coordinates with new ones change_mode_append
: Appends new coordinates change_mode_prepend
: Prepends new coordinatesTODO which coordinates are deleted/modified? Starting from the last coordinate retrieved, or the one after, or...?
TODO what if count
in delete or modify mode is bigger then the number of coordinates left?
TODO where are coordinates appended/prepended? Beginning/end or current position?
This function is not safe to call after destroying the item's map rect, and doing so may cause errors with some map implementations.
it | The map item whose coordinates to retrieve. This must be the active item, i.e. the last one retrieved from the . There can only be one active item per . |
c | TODO new coordinates, also store for old coordinates (delete/modify)? Required in delete mode? |
count | TODO number of coordinates to add, delete or modify? |
mode | The change mode, see description |
References c, item_methods::item_coord_set, item::meth, and item::priv_data.
Referenced by navit_cmd_map_add_curr_pos(), and navit_populate_search_results_map().
int item_coords_left | ( | struct item * | it | ) |
Gets the number of coordinates left for this item.
This function returnes the number of coordinates left to get for this item. It does not change the "coordinates pointer".
it | The map item |
References item_methods::item_coords_left, item::meth, and item::priv_data.
Referenced by do_draw().
void item_create_hash | ( | void | ) |
References item_names, and name.
Referenced by config_load().
void item_destroy_hash | ( | void | ) |
Referenced by config_load().
References attr_to_name(), attr_to_text(), item_attr_get(), item_to_name(), attr::type, and item::type.
Referenced by map_dump_filedesc(), and popup_item_dump().
enum item_type item_from_name | ( | const char * | name | ) |
int* item_get_default_flags | ( | enum item_type | type | ) |
References default_flags2, default_flags_hash, and type.
Referenced by map_resolve_coords_and_split_at_intersections(), osm_end_way(), popup_show_item(), route_find_nearest_street(), route_graph_add_street(), street_get(), street_get_data(), tracking_doupdate_lines(), traffic_location_populate_route_graph(), traffic_message_restore_segments(), and vehicleprofile_apply_roadprofile().
void item_hash_destroy | ( | struct item_hash * | h | ) |
References item_hash::h.
Referenced by navigation_destroy(), and route_path_destroy().
References dbg, item_hash::h, item::id_hi, item::id_lo, item, and lvl_info.
Referenced by navigation_itm_new(), and route_path_add_item_from_graph().
References item_hash::h.
Referenced by navigation_update_idle(), route_contains(), and route_path_add_item_from_graph().
struct item_hash* item_hash_new | ( | void | ) |
References item_hash::h, item_hash_equal(), and item_hash_hash().
Referenced by navigation_new(), route_get_coord_dist(), and route_path_new().
References dbg, item_hash::h, item::id_hi, item::id_lo, and lvl_info.
Referenced by navigation_destroy_itms_cmds(), and route_extract_segment_from_path().
int item_id_equal | ( | const void * | a, |
const void * | b | ||
) |
References item_id::id_hi, and item_id::id_lo.
void item_id_from_ptr | ( | struct item * | item, |
void * | id | ||
) |
Derive item id_lo and id_hi from pointer, considering pointer could be 32 or 64 bit wide but both ids are 32 bit.
it | reference to the item. |
id | pointer to derive item id from. |
References item::id_hi, and item::id_lo.
Referenced by rm_get_item().
unsigned int item_id_hash | ( | const void * | key | ) |
References key.
struct item* item_new | ( | char * | type, |
int | zoom | ||
) |
Referenced by csv_create_item(), and map_new_csv().
int item_range_contains_item | ( | struct item_range * | range, |
enum item_type | type | ||
) |
References max, range::min, and type.
Referenced by map_selection_contains_item().
int item_range_intersects_range | ( | struct item_range * | range1, |
struct item_range * | range2 | ||
) |
References item_range::max.
Referenced by map_selection_contains_item_range().
char* item_to_name | ( | enum item_type | item | ) |
References item_names, and item_name::name.
Referenced by NGQPoint::_coordName(), attr_to_text_ext(), do_draw(), encode_attr(), Backend::get_pois(), NGQProxyBookmarks::getBookmarks(), NGQPoint::getPOI(), gui_internal_cmd_pois_item(), gui_internal_cmd_pois_item_selected(), gui_internal_cmd_position_do(), gui_internal_cmd_view_attributes(), gui_internal_poi_icon(), is_turn_allowed(), item_bin_dump(), item_dump_attr(), maneuver_required2(), map_route_occluded_get_item(), map_search_setup(), navigation_analyze_roundabout(), navigation_itm_ways_update(), navigation_map_item_attr_get(), navit_zoom_to_route(), osd_nav_next_turn_draw(), osd_text_draw(), popup_show_item(), request_navit_route_export_gpx(), route_get_destination_description(), route_graph_add_turn_restriction(), route_graph_process_restriction_segment(), search_house_number_coordinate(), tm_item_dump_to_file(), traffic_dump_messages_to_xml(), traffic_message_dump_to_stderr(), vehicleprofile_apply_roadprofile(), vehicleprofile_debug_roadprofile(), and write_former_destinations().
Sets the type of a map item.
it | The item |
type | The new type for the item. Setting it to type_none is expected to delete item from the map. |
References item_methods::item_type_set, item::meth, item::priv_data, and type.
Referenced by navit_populate_search_results_map(), and tm_item_unref().
|
extern |
An item indicating that the map driver is busy fetching more items.
This is a “magic” item which may be returned by one of the query methods of a map driver. Receiving this item means that the map driver is currently busy fetching more items, and they can be retrieved at a later point in time.
Referenced by do_draw(), map_binfile_open(), and map_rect_get_item_binfile().
|
extern |
struct item_range item_range_all |