]> mj.ucw.cz Git - leo.git/blobdiff - style.c
TODO
[leo.git] / style.c
diff --git a/style.c b/style.c
index d82c71213edb10571bdf9454a85937862cb77f59..96f2c2220c990f4c1794b1b00f5dc3caefa5ccfb 100644 (file)
--- a/style.c
+++ b/style.c
@@ -4,15 +4,14 @@
  *     (c) 2014 Martin Mares <mj@ucw.cz>
  */
 
-#include <ucw/lib.h>
-#include <ucw/mempool.h>
-
-#include <stdio.h>
-
 #include "leo.h"
 #include "osm.h"
 #include "style.h"
 
+#include <ucw/mempool.h>
+
+#include <stdio.h>
+
 struct dict style_prop_dict, style_layer_dict;
 
 static const char * const style_wk_props[] = {
@@ -64,6 +63,11 @@ void style_init(struct style_results *r)
   r->active_layers = mp_alloc_zero(r->pool, r->num_layers * sizeof(layer_t));
 }
 
+void style_cleanup(struct style_results *r)
+{
+  mp_delete(r->pool);
+}
+
 void style_begin(struct style_results *r, struct osm_object *o)
 {
   ASSERT(!r->num_active_layers);
@@ -120,6 +124,11 @@ static struct style_info *style_get_info(struct style_results *r, layer_t layer)
   return r->layers[layer];
 }
 
+void style_enable_default_layer(struct style_results *r)
+{
+  style_get_info(r, STYLE_LAYER_DEFAULT);
+}
+
 void style_set_by_layer(struct style_results *r, layer_t layer, struct style_prop *p)
 {
   if (layer == STYLE_LAYER_ALL)
@@ -134,6 +143,12 @@ void style_set_by_layer(struct style_results *r, layer_t layer, struct style_pro
   style_assign(style_prop_lookup(si->hash, p->key), p);
 }
 
+struct style_prop *style_get_by_layer(struct style_results *r, layer_t layer, prop_t key)
+{
+  struct style_info *si = style_get_info(r, layer);
+  return style_get(si, key);
+}
+
 void style_set(struct style_info *si, struct style_prop *p)
 {
   style_assign(style_prop_lookup(si->hash, p->key), p);