Changeset 156


Ignore:
Timestamp:
Oct 17, 2009, 3:34:56 PM (5 years ago)
Author:
simon
Message:

Introduce MemphisRuleType?

More work is needed to replace the old rule type in the whole library.
It is only used for the public API at the moment.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/memphis-rule-set.c

    r151 r156  
    235235  rule->keys = g_strdupv (curr->key); 
    236236  rule->values = g_strdupv (curr->value); 
    237   rule->type = curr->type; 
     237  switch (curr->type) 
     238    { 
     239      case (WAY): 
     240        rule->type = MEMPHIS_RULE_TYPE_WAY; 
     241        break; 
     242      case (NODE): 
     243        rule->type = MEMPHIS_RULE_TYPE_NODE; 
     244        break; 
     245      case (RELATION): 
     246        rule->type = MEMPHIS_RULE_TYPE_RELATION; 
     247        break; 
     248      default: 
     249        rule->type = MEMPHIS_RULE_TYPE_UNKNOWN; 
     250    } 
    238251 
    239252  cfgDraw *drw = curr->draw; 
     
    359372  cfgRule *new = g_new (cfgRule, 1); 
    360373 
    361   new->type = rule->type; 
     374  switch (rule->type) 
     375    { 
     376      case (MEMPHIS_RULE_TYPE_WAY): 
     377        new->type = WAY; 
     378        break; 
     379      case (MEMPHIS_RULE_TYPE_NODE): 
     380        new->type = NODE; 
     381        break; 
     382      case (MEMPHIS_RULE_TYPE_RELATION): 
     383        new->type = RELATION; 
     384        break; 
     385      default: 
     386        new->type = 0; 
     387    } 
     388 
    362389  new->value = g_strdupv (rule->values); 
    363390  len = g_strv_length (new->value); 
  • trunk/src/memphis-rule.c

    r142 r156  
    8989  self->keys = NULL; 
    9090  self->values = NULL; 
    91   self->type = 0; 
     91  self->type = MEMPHIS_RULE_TYPE_UNKNOWN; 
    9292 
    9393  self->polygon_color[0] = -1; 
  • trunk/src/memphis-rule.h

    r142 r156  
    4242  (G_TYPE_INSTANCE_GET_CLASS ((obj), MEMPHIS_TYPE_RULE, MemphisRuleClass)) 
    4343 
     44typedef enum 
     45{ 
     46  MEMPHIS_RULE_TYPE_UNKNOWN, 
     47  MEMPHIS_RULE_TYPE_WAY, 
     48  MEMPHIS_RULE_TYPE_NODE, 
     49  MEMPHIS_RULE_TYPE_RELATION 
     50} MemphisRuleType; 
     51 
    4452typedef struct { 
    4553  GObject parent; 
     
    4755  gchar **keys; 
    4856  gchar **values; 
    49   gint16 type; /* Node, way or relation */ 
     57  MemphisRuleType type; 
    5058 
    5159  gint16 polygon_color[3]; 
  • trunk/tests/unit-tests.c

    r150 r156  
    366366  g_test_add_func ("/renderer/draw_empty_map_and_rules", 
    367367      renderer_draw_empty_map_and_rules); 
     368  // TODO: huge drawing test, performance tests 
    368369 
    369370  return g_test_run (); 
Note: See TracChangeset for help on using the changeset viewer.