Diff of /trunk/src/osm.h

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

revision 155 by harbaum, Tue Mar 31 10:19:50 2009 UTC revision 191 by harbaum, Tue Jul 7 07:36:27 2009 UTC
# Line 29  Line 29 
29    
30  /* item_id_t needs to be signed as osm2go uses negative ids for items */  /* item_id_t needs to be signed as osm2go uses negative ids for items */
31  /* not yet registered with the main osm database */  /* not yet registered with the main osm database */
32  typedef glong item_id_t;  #if 1
33  #define G_TYPE_ITEM_ID_T G_TYPE_LONG  /* currently 31 bit is still sufficient since there are less than */
34    /* 2 billion nodes or changesets */
35    typedef gint32 item_id_t;
36    #define G_TYPE_ITEM_ID_T G_TYPE_INT
37    #define ITEM_ID_FORMAT  "%" G_GINT32_FORMAT
38    #else
39    /* the future may require us to switch to 64 bits */
40    typedef gint64 item_id_t;
41    #define G_TYPE_ITEM_ID_T G_TYPE_INT64
42    #define ITEM_ID_FORMAT  "%" G_GINT64_FORMAT
43    #endif
44    
45  #define ID_ILLEGAL  ((item_id_t)0)  #define ID_ILLEGAL  ((item_id_t)0)
46    
# Line 56  typedef struct tag_s { Line 66  typedef struct tag_s {
66    
67  typedef struct node_s {  typedef struct node_s {
68    item_id_t id;    item_id_t id;
69      item_id_t version;
70    pos_t pos;    pos_t pos;
71    lpos_t lpos;    lpos_t lpos;
72    user_t *user;    user_t *user;
# Line 85  typedef struct node_chain { Line 96  typedef struct node_chain {
96    
97  typedef struct way_s {  typedef struct way_s {
98    item_id_t id;    item_id_t id;
99      item_id_t version;
100      item_id_t changeset;
101    user_t *user;    user_t *user;
102    gboolean visible;    gboolean visible;
103    time_t time;    time_t time;
# Line 126  typedef struct way_chain { Line 139  typedef struct way_chain {
139    
140  typedef struct relation_s {  typedef struct relation_s {
141    item_id_t id;    item_id_t id;
142      item_id_t version;
143      item_id_t changeset;
144    user_t *user;    user_t *user;
145    gboolean visible;    gboolean visible;
146    time_t time;    time_t time;
# Line 148  typedef struct relation_chain_s { Line 163  typedef struct relation_chain_s {
163  /* the current hash table uses 16 bits. each table thus is */  /* the current hash table uses 16 bits. each table thus is */
164  /* 256 kbytes (2^16 * sizeof(void*)) in size */  /* 256 kbytes (2^16 * sizeof(void*)) in size */
165  #define ID2HASH(a) ((unsigned short)(a) ^ (unsigned short)((a)>>16))  #define ID2HASH(a) ((unsigned short)(a) ^ (unsigned short)((a)>>16))
   
166  typedef struct hash_item_s {  typedef struct hash_item_s {
167    union {    union {
168      node_t *node;      node_t *node;
# Line 202  typedef struct osm_s { Line 216  typedef struct osm_s {
216  #include <libxml/parser.h>  #include <libxml/parser.h>
217  #include <libxml/tree.h>  #include <libxml/tree.h>
218    
219  osm_t *osm_parse(char *filename);  osm_t *osm_parse(char *path, char *filename);
220  gboolean osm_sanity_check(GtkWidget *parent, osm_t *osm);  gboolean osm_sanity_check(GtkWidget *parent, osm_t *osm);
221  tag_t *osm_parse_osm_tag(osm_t *osm, xmlDocPtr doc, xmlNode *a_node);  tag_t *osm_parse_osm_tag(osm_t *osm, xmlDocPtr doc, xmlNode *a_node);
222  node_chain_t *osm_parse_osm_way_nd(osm_t *osm, xmlDocPtr doc, xmlNode *a_node);  node_chain_t *osm_parse_osm_way_nd(osm_t *osm, xmlDocPtr doc, xmlNode *a_node);
# Line 238  gboolean osm_is_creator_tag(tag_t *tag); Line 252  gboolean osm_is_creator_tag(tag_t *tag);
252  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);
253  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);
254    
255  char *osm_generate_xml_node(osm_t *osm, node_t *node);  char *osm_generate_xml_changeset(osm_t *osm, char *comment);
256  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);
257  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);
258    char *osm_generate_xml_relation(osm_t *osm, item_id_t changeset,
259                                    relation_t *relation);
260    
261  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);
262  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 249  relation_t *osm_get_relation_by_id(osm_t Line 265  relation_t *osm_get_relation_by_id(osm_t
265  guint osm_way_number_of_nodes(way_t *way);  guint osm_way_number_of_nodes(way_t *way);
266  relation_chain_t *osm_node_to_relation(osm_t *osm, node_t *node);  relation_chain_t *osm_node_to_relation(osm_t *osm, node_t *node);
267  relation_chain_t *osm_way_to_relation(osm_t *osm, way_t *way);  relation_chain_t *osm_way_to_relation(osm_t *osm, way_t *way);
268    relation_chain_t *osm_relation_to_relation(osm_t *osm, relation_t *relation);
269    relation_chain_t *osm_object_to_relation(osm_t *osm, object_t *object);
270    void osm_relation_chain_free(relation_chain_t *relation_chain);
271  way_chain_t *osm_node_to_way(osm_t *osm, node_t *node);  way_chain_t *osm_node_to_way(osm_t *osm, node_t *node);
272    
273  /* ----------- edit functions ----------- */  /* ----------- edit functions ----------- */

Legend:
Removed from v.155  
changed lines
  Added in v.191