Changeset 159


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

Fix border size calculation regression, reorder rule struct

Location:
trunk/src
Files:
2 edited

Legend:

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

    r158 r159  
    268268        { 
    269269          if (line_seen) { 
     270            /* line with border */ 
     271            rule->border = g_slice_new0 (MemphisRuleAttr); 
     272            rule->border->color_red = rule->line->color_red; 
     273            rule->border->color_green = rule->line->color_green; 
     274            rule->border->color_blue = rule->line->color_blue; 
     275            rule->border->color_alpha = rule->line->color_alpha; 
     276            rule->border->size = (rule->line->size - drw->width) * 0.5; 
     277            rule->border->z_min = rule->line->z_min; 
     278            rule->border->z_max = rule->line->z_max; 
     279 
     280            rule->line->color_red = drw->color[0]; 
     281            rule->line->color_green = drw->color[1]; 
     282            rule->line->color_blue = drw->color[2]; 
     283            rule->line->color_alpha = 255; 
     284            rule->line->size = drw->width; 
     285            rule->line->z_min = drw->minzoom; 
     286            rule->line->z_max = drw->maxzoom; 
     287          } else { 
     288            /* only a single line */ 
    270289            rule->line = g_slice_new0 (MemphisRuleAttr); 
    271290            rule->line->color_red = drw->color[0]; 
     
    276295            rule->line->z_min = drw->minzoom; 
    277296            rule->line->z_max = drw->maxzoom; 
    278           } else { 
    279             rule->border = g_slice_new0 (MemphisRuleAttr); 
    280             rule->border->color_red = drw->color[0]; 
    281             rule->border->color_green = drw->color[1]; 
    282             rule->border->color_blue = drw->color[2]; 
    283             rule->border->color_alpha = 255; 
    284             rule->border->size = drw->width; 
    285             rule->border->z_min = drw->minzoom; 
    286             rule->border->z_max = drw->maxzoom; 
    287297            line_seen = TRUE; 
    288298          } 
     
    354364      tmp->color[1] = rule->border->color_green; 
    355365      tmp->color[2] = rule->border->color_blue; 
    356       tmp->width = rule->border->size; 
     366      if (rule->line != NULL) 
     367        tmp->width = 2.0 * rule->border->size + rule->line->size; 
     368      else 
     369        tmp->width = rule->border->size; /* polygon border */ 
    357370      drw = tmp; 
    358371    } 
  • trunk/src/memphis-rule.h

    r158 r159  
    3333 * @z_min: minimum visible zoom level 
    3434 * @z_max: maximum visible zoom level 
    35  * @style: field for future use (line style, polygon pattern...) 
    36  * @size: the size 
    3735 * @color_red: red component, between 0 and 255 
    3836 * @color_green: green component, between 0 and 255 
    3937 * @color_blue: blue component, between 0 and 255 
    4038 * @color_alpha: transparency component, between 0 and 255 
     39 * @style: field for future use (line style, polygon pattern...) 
     40 * @size: the size 
    4141 * 
    4242 * Defines the drawing attributes for a #MemphisRule. 
     
    4545 */ 
    4646struct _MemphisRuleAttr { 
    47   gint8 z_min; 
    48   gint8 z_max; 
    49   gchar *style; 
    50   gdouble size; 
     47  guint8 z_min; 
     48  guint8 z_max; 
    5149  guint8 color_red; 
    5250  guint8 color_green; 
    5351  guint8 color_blue; 
    5452  guint8 color_alpha; 
     53  gchar *style; 
     54  gdouble size; 
    5555}; 
    5656 
Note: See TracChangeset for help on using the changeset viewer.