MemphisRule

## MemphisRule MemphisRule — Describes a drawing rule. |

## Synopsis

                        MemphisRule;
    #define             MEMPHIS_RULE                        (obj)
    GType               memphis_rule_get_type               (void);
    #define             MEMPHIS_TYPE_RULE
    MemphisRule *       memphis_rule_new                    (void);
    MemphisRule *       memphis_rule_copy                   (const MemphisRule *rule);
    void                memphis_rule_free                   (MemphisRule *rule);
    enum                MemphisRuleType;
    #define             MEMPHIS_TYPE_RULE_TYPE
                        MemphisRuleAttr;
    #define             MEMPHIS_RULE_ATTR                   (obj)
    #define             MEMPHIS_TYPE_RULE_ATTR
    MemphisRuleAttr *   memphis_rule_attr_new               (void);
    MemphisRuleAttr *   memphis_rule_attr_copy              (const MemphisRuleAttr *attr);
    void                memphis_rule_attr_free              (MemphisRuleAttr *attr);

## Description

A boxed struct to describe a drawing rule for the MemphisRuleSet.

## Details

### MemphisRule

    typedef struct {
      gchar **keys;
      gchar **values;
      MemphisRuleType type;
      MemphisRuleAttr *polygon;
      MemphisRuleAttr *line;
      MemphisRuleAttr *border;
      MemphisRuleAttr *text;
    } MemphisRule;

Defines a drawing rule for the MemphisRuleSet.

gchar **`keys`; | an array of key strings
gchar **`values`; | an array of value strings
MemphisRuleType `type`; | the type of the rule
MemphisRuleAttr *`polygon`; | a pointer to the polygon or NULL
MemphisRuleAttr *`line`; | a pointer to the line or NULL
MemphisRuleAttr *`border`; | a pointer to the border or NULL
MemphisRuleAttr *`text`; | a pointer to the text or NULL

Since 0.1

### MEMPHIS_RULE()

    #define MEMPHIS_RULE(obj)     ((MemphisRule *) (obj))

`obj` : |

### memphis_rule_get_type ()

    GType               memphis_rule_get_type               (void);

Returns : |

### MEMPHIS_TYPE_RULE

    #define MEMPHIS_TYPE_RULE (memphis_rule_get_type ())

### memphis_rule_new ()

    MemphisRule *       memphis_rule_new                    (void);

Creates a newly allocated MemphisRule to be freed with `memphis_rule_free()`.

Returns : | a MemphisRule.

Since 0.1

### memphis_rule_copy ()

    MemphisRule *       memphis_rule_copy                   (const MemphisRule *rule);

Makes a copy of the memphis rule structure. The result must be freed using `memphis_rule_free()`.

`rule` : | a MemphisRule
Returns : | an allocated copy of `rule`.

Since 0.1

### memphis_rule_free ()

    void                memphis_rule_free                   (MemphisRule *rule);

Frees a memphis rule structure created with `memphis_rule_new()` or `memphis_rule_copy()`.

`rule` : | a MemphisRule

Since 0.1

### enum MemphisRuleType

    typedef enum {
      MEMPHIS_RULE_TYPE_UNKNOWN,
      MEMPHIS_RULE_TYPE_NODE,
      MEMPHIS_RULE_TYPE_WAY,
      MEMPHIS_RULE_TYPE_RELATION
    } MemphisRuleType;

Defines a the data type of the rule. Only ways are supported in Memphis 0.1.x.

`MEMPHIS_RULE_TYPE_UNKNOWN` | unknown
`MEMPHIS_RULE_TYPE_NODE` | a node
`MEMPHIS_RULE_TYPE_WAY` | a way
`MEMPHIS_RULE_TYPE_RELATION` | a realtion

Since 0.1

### MEMPHIS_TYPE_RULE_TYPE

    #define MEMPHIS_TYPE_RULE_TYPE memphis_rule_type_get_type()

### MemphisRuleAttr

    typedef struct {
      guint8 z_min;
      guint8 z_max;
      guint8 color_red;
      guint8 color_green;
      guint8 color_blue;
      guint8 color_alpha;
      gchar *style;
      gdouble size;
    } MemphisRuleAttr;

Defines the drawing attributes for a MemphisRule.

guint8 `z_min`; | minimum visible zoom level
guint8 `z_max`; | maximum visible zoom level
guint8 `color_red`; | red component, between 0 and 255
guint8 `color_green`; | green component, between 0 and 255
guint8 `color_blue`; | blue component, between 0 and 255
guint8 `color_alpha`; | transparency component, between 0 and 255
gchar *`style`; | field for future use (line style, polygon pattern...)
gdouble `size`; | the size

Since 0.1

### MEMPHIS_RULE_ATTR()

    #define MEMPHIS_RULE_ATTR(obj) ((MemphisRuleAttr *) (obj))

`obj` : |

### MEMPHIS_TYPE_RULE_ATTR

    #define MEMPHIS_TYPE_RULE_ATTR (memphis_rule_attr_get_type ())

### memphis_rule_attr_new ()

    MemphisRuleAttr *   memphis_rule_attr_new               (void);

Returns : | a new MemphisRuleAttr.

Since 0.2.2

### memphis_rule_attr_copy ()

    MemphisRuleAttr *   memphis_rule_attr_copy              (const MemphisRuleAttr *attr);

`attr` : | a MemphisRuleAttr
Returns : | a copy of the rule attribute.

Since 0.2.2

### memphis_rule_attr_free ()

    void                memphis_rule_attr_free              (MemphisRuleAttr *attr);

Frees the memory of a MemphisRuleAttr.

`attr` : | a MemphisRuleAttr

Since 0.2.2