Diff of /trunk/src/osm.h

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

src/osm.h revision 1 by harbaum, Tue Dec 9 20:06:06 2008 UTC trunk/src/osm.h revision 64 by harbaum, Mon Feb 9 13:23:17 2009 UTC
# Line 95  typedef struct way_s { Line 95  typedef struct way_s {
95      gulong color;      gulong color;
96      gint width;      gint width;
97      float zoom_max;      float zoom_max;
98        gboolean dashed;
99        guint dash_length;
100    
101      union {      union {
102        struct {        struct {
# Line 136  typedef struct relation_chain_s { Line 138  typedef struct relation_chain_s {
138    struct relation_chain_s *next;    struct relation_chain_s *next;
139  } relation_chain_t;  } relation_chain_t;
140    
141    /* two of these hash tables are used, one for nodes and one for ways */
142    /* currently relations aren't used often enough to justify the use */
143    /* of a hash table */
144    
145    /* the current hash table uses 16 bits. each table thus is */
146    /* 256 kbytes (2^16 * sizeof(void*)) in size */
147    #define ID2HASH(a) ((unsigned short)(a) ^ (unsigned short)((a)>>16))
148    
149    typedef struct hash_item_s {
150      union {
151        node_t *node;
152        way_t *way;
153        relation_t *relation;
154      } data;
155    
156      struct hash_item_s *next;
157    } hash_item_t;
158    
159    typedef struct {
160      hash_item_t *hash[65536];
161    } hash_table_t;
162    
163  typedef enum {  typedef enum {
164    ILLEGAL=0, NODE, WAY, RELATION, NODE_ID, WAY_ID, RELATION_ID    ILLEGAL=0, NODE, WAY, RELATION, NODE_ID, WAY_ID, RELATION_ID
165  } type_t;  } type_t;
# Line 157  typedef struct member_s { Line 181  typedef struct member_s {
181  typedef struct osm_s {  typedef struct osm_s {
182    bounds_t *bounds;   // original bounds as they appear in the file    bounds_t *bounds;   // original bounds as they appear in the file
183    user_t *user;    user_t *user;
184    
185    node_t *node;    node_t *node;
186      hash_table_t *node_hash;
187    
188    way_t  *way;    way_t  *way;
189      hash_table_t *way_hash;
190    
191      // hashing relations doesn't yet make much sense as relations are quite rare
192    relation_t  *relation;    relation_t  *relation;
193    
194  } osm_t;  } osm_t;
195    
196  #include <libxml/parser.h>  #include <libxml/parser.h>
# Line 217  way_chain_t *osm_node_to_way(osm_t *osm, Line 248  way_chain_t *osm_node_to_way(osm_t *osm,
248  /* ----------- edit functions ----------- */  /* ----------- edit functions ----------- */
249  node_t *osm_node_new(osm_t *osm, gint x, gint y);  node_t *osm_node_new(osm_t *osm, gint x, gint y);
250  void osm_node_attach(osm_t *osm, node_t *node);  void osm_node_attach(osm_t *osm, node_t *node);
251    void osm_node_restore(osm_t *osm, node_t *node);
252  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,
253                               gboolean permanently, gboolean affect_ways);                               gboolean permanently, gboolean affect_ways);
254  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 240  void osm_way_rotate(way_t *way, gint off Line 272  void osm_way_rotate(way_t *way, gint off
272    
273  tag_t *osm_tags_copy(tag_t *tag, gboolean update_creator);  tag_t *osm_tags_copy(tag_t *tag, gboolean update_creator);
274    
275    char *osm_type_string(type_t type);
276    char *osm_object_string(type_t type, void *object);
277    
278  #endif /* OSM_H */  #endif /* OSM_H */
279    
280    // vim:et:ts=8:sw=2:sts=2:ai

Legend:
Removed from v.1  
changed lines
  Added in v.64