]> mj.ucw.cz Git - leo.git/blobdiff - osm.h
Průvodce: More styling
[leo.git] / osm.h
diff --git a/osm.h b/osm.h
index 4eb90ef4b0a09738da628ad9342c49b1a7be0f0c..e9d18a01f745c9cebd74343c7cc90e89a05f2d89 100644 (file)
--- a/osm.h
+++ b/osm.h
@@ -4,8 +4,8 @@
  *     (c) 2014 Martin Mares <mj@ucw.cz>
  */
 
-#ifndef _BRUM_OSM_H
-#define _BRUM_OSM_H
+#ifndef _LEO_OSM_H
+#define _LEO_OSM_H
 
 #include "dict.h"
 
@@ -53,6 +53,7 @@ struct osm_node {
    * For UTM, x is easting and y northing.
    * After map scaling, x is horizontal (left-to-right) and y vertical (top-to-bottom) on the paper.
    */
+  struct graph_vertex *vertex;
 };
 
 struct osm_way {
@@ -77,15 +78,25 @@ struct osm_mpg_boundary {
   clist nodes;                 // List of osm_ref's (without back-references, since the boundary is not a regular object)
 };
 
-void osm_init(void);
-void osm_dump(void);
+struct osm {
+  struct mempool *pool;
+  clist obj_list[OSM_TYPE_MAX];
+  struct osm_id_hash_table *id_hash[OSM_TYPE_MAX];
+  uint obj_cnt[OSM_TYPE_MAX];
+};
+
+extern struct osm *osm_this;
 
-extern clist osm_obj_list[OSM_TYPE_MAX];
+struct osm *osm_init(void);
+void osm_dump(void);
+void osm_stats(void);
 
 osm_id_t osm_parse_id(const char *str);
 struct osm_object *osm_obj_find_by_id(enum osm_object_type type, osm_id_t id);
 void osm_obj_add_tag(struct osm_object *o, const char *key, const char *val);
 void osm_obj_add_tag_raw(struct osm_object *o, osm_key_t key, osm_val_t val);
+void osm_obj_set_tag(struct osm_object *o, const char *key, const char *val);
+void osm_obj_set_tag_raw(struct osm_object *o, osm_key_t key, osm_val_t val);
 osm_val_t osm_obj_find_tag(struct osm_object *o, osm_val_t key);
 void osm_obj_dump(struct osm_object *o);
 void osm_obj_warn(struct osm_object *o, const char *msg, ...);
@@ -96,6 +107,18 @@ void osm_ref_add(struct osm_object *parent, clist *list, struct osm_object *son,
 #define OSM_FOR_EACH_BEGIN(_type, _var, _list) CLIST_FOR_EACH(struct osm_ref *, _ref, _list) { _type _var = (_type) _ref->o;
 #define OSM_FOR_EACH_END }
 
+static inline struct osm_object *osm_ref_head(clist *list)
+{
+  struct osm_ref *r = clist_head(list);
+  return r ? r->o : NULL;
+}
+
+static inline struct osm_object *osm_ref_tail(clist *list)
+{
+  struct osm_ref *r = clist_tail(list);
+  return r ? r->o : NULL;
+}
+
 struct osm_node *osm_node_new(osm_id_t id);
 void osm_node_dump(struct osm_node *n);
 void osm_node_dump_all(void);
@@ -161,4 +184,8 @@ enum value_names {
 #undef P
 };
 
+/* xml.c */
+
+void osm_xml_parse(const char *name);
+
 #endif