Diff of /trunk/src/osm.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 42 by harbaum, Wed Jan 21 20:01:18 2009 UTC revision 158 by harbaum, Fri Apr 10 11:13:26 2009 UTC
# Line 27  Line 27 
27  #define OSM_FLAG_NEW      (1<<2)  #define OSM_FLAG_NEW      (1<<2)
28  #define OSM_FLAG_HIDDEN   (1<<3)  #define OSM_FLAG_HIDDEN   (1<<3)
29    
30  typedef gulong item_id_t;  /* item_id_t needs to be signed as osm2go uses negative ids for items */
31    /* not yet registered with the main osm database */
32    typedef glong item_id_t;
33    #define G_TYPE_ITEM_ID_T G_TYPE_LONG
34    
35  #define ID_ILLEGAL  ((item_id_t)0)  #define ID_ILLEGAL  ((item_id_t)0)
36    
# Line 53  typedef struct tag_s { Line 56  typedef struct tag_s {
56    
57  typedef struct node_s {  typedef struct node_s {
58    item_id_t id;    item_id_t id;
59      item_id_t version;
60    pos_t pos;    pos_t pos;
61    lpos_t lpos;    lpos_t lpos;
62    user_t *user;    user_t *user;
# Line 82  typedef struct node_chain { Line 86  typedef struct node_chain {
86    
87  typedef struct way_s {  typedef struct way_s {
88    item_id_t id;    item_id_t id;
89      item_id_t version;
90      item_id_t changeset;
91    user_t *user;    user_t *user;
92    gboolean visible;    gboolean visible;
93    time_t time;    time_t time;
# Line 96  typedef struct way_s { Line 102  typedef struct way_s {
102      gint width;      gint width;
103      float zoom_max;      float zoom_max;
104      gboolean dashed;      gboolean dashed;
105        guint dash_length;
106    
107      union {      union {
108        struct {        struct {
# Line 122  typedef struct way_chain { Line 129  typedef struct way_chain {
129    
130  typedef struct relation_s {  typedef struct relation_s {
131    item_id_t id;    item_id_t id;
132      item_id_t version;
133      item_id_t changeset;
134    user_t *user;    user_t *user;
135    gboolean visible;    gboolean visible;
136    time_t time;    time_t time;
# Line 144  typedef struct relation_chain_s { Line 153  typedef struct relation_chain_s {
153  /* the current hash table uses 16 bits. each table thus is */  /* the current hash table uses 16 bits. each table thus is */
154  /* 256 kbytes (2^16 * sizeof(void*)) in size */  /* 256 kbytes (2^16 * sizeof(void*)) in size */
155  #define ID2HASH(a) ((unsigned short)(a) ^ (unsigned short)((a)>>16))  #define ID2HASH(a) ((unsigned short)(a) ^ (unsigned short)((a)>>16))
   
156  typedef struct hash_item_s {  typedef struct hash_item_s {
157    union {    union {
158      node_t *node;      node_t *node;
# Line 163  typedef enum { Line 171  typedef enum {
171    ILLEGAL=0, NODE, WAY, RELATION, NODE_ID, WAY_ID, RELATION_ID    ILLEGAL=0, NODE, WAY, RELATION, NODE_ID, WAY_ID, RELATION_ID
172  } type_t;  } type_t;
173    
174  typedef struct member_s {  typedef struct {
175    type_t type;    type_t type;
   char   *role;  
   
176    union {    union {
177      node_t *node;      node_t *node;
178      way_t *way;      way_t *way;
179      relation_t *relation;      relation_t *relation;
180      item_id_t id;      item_id_t id;
181        void *ptr;
182    };    };
183    } object_t;
184    
185    typedef struct member_s {
186      object_t object;
187      char   *role;
188    struct member_s *next;    struct member_s *next;
189  } member_t;  } member_t;
190    
# Line 231  gboolean osm_is_creator_tag(tag_t *tag); Line 242  gboolean osm_is_creator_tag(tag_t *tag);
242  gboolean osm_tag_key_and_value_present(tag_t *haystack, tag_t *tag);  gboolean osm_tag_key_and_value_present(tag_t *haystack, tag_t *tag);
243  gboolean osm_tag_key_other_value_present(tag_t *haystack, tag_t *tag);  gboolean osm_tag_key_other_value_present(tag_t *haystack, tag_t *tag);
244    
245  char *osm_generate_xml_node(osm_t *osm, node_t *node);  char *osm_generate_xml_changeset(osm_t *osm, char *comment);
246  char *osm_generate_xml_way(osm_t *osm, way_t *way);  char *osm_generate_xml_node(osm_t *osm, item_id_t changeset, node_t *node);
247  char *osm_generate_xml_relation(osm_t *osm, relation_t *relation);  char *osm_generate_xml_way(osm_t *osm, item_id_t changeset, way_t *way);
248    char *osm_generate_xml_relation(osm_t *osm, item_id_t changeset,
249                                    relation_t *relation);
250    
251  node_t *osm_get_node_by_id(osm_t *osm, item_id_t id);  node_t *osm_get_node_by_id(osm_t *osm, item_id_t id);
252  way_t *osm_get_way_by_id(osm_t *osm, item_id_t id);  way_t *osm_get_way_by_id(osm_t *osm, item_id_t id);
# Line 247  way_chain_t *osm_node_to_way(osm_t *osm, Line 260  way_chain_t *osm_node_to_way(osm_t *osm,
260  /* ----------- edit functions ----------- */  /* ----------- edit functions ----------- */
261  node_t *osm_node_new(osm_t *osm, gint x, gint y);  node_t *osm_node_new(osm_t *osm, gint x, gint y);
262  void osm_node_attach(osm_t *osm, node_t *node);  void osm_node_attach(osm_t *osm, node_t *node);
263    void osm_node_restore(osm_t *osm, node_t *node);
264  way_chain_t *osm_node_delete(osm_t *osm, struct icon_s **icon, node_t *node,  way_chain_t *osm_node_delete(osm_t *osm, struct icon_s **icon, node_t *node,
265                               gboolean permanently, gboolean affect_ways);                               gboolean permanently, gboolean affect_ways);
266  void osm_way_delete(osm_t *osm, struct icon_s **icon, way_t *way,  void osm_way_delete(osm_t *osm, struct icon_s **icon, way_t *way,
# Line 259  gboolean osm_position_within_bounds(osm_ Line 273  gboolean osm_position_within_bounds(osm_
273  item_id_t osm_new_way_id(osm_t *osm);  item_id_t osm_new_way_id(osm_t *osm);
274  gboolean osm_way_ends_with_node(way_t *way, node_t *node);  gboolean osm_way_ends_with_node(way_t *way, node_t *node);
275    
276  void osm_way_revert(way_t *way);  void osm_way_reverse(way_t *way);
277    guint osm_way_reverse_direction_sensitive_tags(way_t *way);
278    guint osm_way_reverse_direction_sensitive_roles(osm_t *osm, way_t *way);
279    
280  void osm_node_remove_from_relation(osm_t *osm, node_t *node);  void osm_node_remove_from_relation(osm_t *osm, node_t *node);
281  void osm_way_remove_from_relation(osm_t *osm, way_t *way);  void osm_way_remove_from_relation(osm_t *osm, way_t *way);
# Line 270  void osm_way_rotate(way_t *way, gint off Line 286  void osm_way_rotate(way_t *way, gint off
286    
287  tag_t *osm_tags_copy(tag_t *tag, gboolean update_creator);  tag_t *osm_tags_copy(tag_t *tag, gboolean update_creator);
288    
289    relation_t *osm_relation_new(void);
290    void osm_relation_free(relation_t *relation);
291    void osm_relation_attach(osm_t *osm, relation_t *relation);
292    void osm_relation_delete(osm_t *osm, relation_t *relation,
293                             gboolean permanently);
294    gint osm_relation_members_num(relation_t *relation);
295    
296    char *osm_object_type_string(object_t *object);
297    char *osm_object_id_string(object_t *object);
298    char *osm_object_string(object_t *object);
299    tag_t *osm_object_get_tags(object_t *object);
300    void osm_object_set_flags(object_t *map_item, int set, int clr);
301    
302  #endif /* OSM_H */  #endif /* OSM_H */
303    
304  // vim:et:ts=8:sw=2:sts=2:ai  // vim:et:ts=8:sw=2:sts=2:ai

Legend:
Removed from v.42  
changed lines
  Added in v.158