MemphisRenderer

## MemphisRenderer MemphisRenderer — Renders OSM map data on a cairo surface. |

## Synopsis

                        MemphisRenderer;
    MemphisRenderer*    memphis_renderer_new                ();
    MemphisRenderer*    memphis_renderer_new_full           (MemphisRuleSet *rules,
                                                             MemphisMap *map);
    void                memphis_renderer_free               (MemphisRenderer *renderer);
    void                memphis_renderer_set_resolution     (MemphisRenderer *renderer,
                                                             guint resolution);
    void                memphis_renderer_set_map            (MemphisRenderer *renderer,
                                                             MemphisMap *map);
    void                memphis_renderer_set_rule_set       (MemphisRenderer *renderer,
                                                             MemphisRuleSet *rules);
    guint               memphis_renderer_get_resolution     (MemphisRenderer *renderer);
    MemphisMap*         memphis_renderer_get_map            (MemphisRenderer *renderer);
    MemphisRuleSet*     memphis_renderer_get_rule_set       (MemphisRenderer *renderer);
    void                memphis_renderer_draw_tile          (MemphisRenderer *renderer,
                                                             cairo_t *cr,
                                                             guint x,
                                                             guint y,
                                                             guint zoom_level);
    gint                memphis_renderer_get_row_count      (MemphisRenderer *renderer,
                                                             guint zoom_level);
    gint                memphis_renderer_get_column_count   (MemphisRenderer *renderer,
                                                             guint zoom_level);
    gint                memphis_renderer_get_min_x_tile     (MemphisRenderer *renderer,
                                                             guint zoom_level);
    gint                memphis_renderer_get_max_x_tile     (MemphisRenderer *renderer,
                                                             guint zoom_level);
    gint                memphis_renderer_get_min_y_tile     (MemphisRenderer *renderer,
                                                             guint zoom_level);
    gint                memphis_renderer_get_max_y_tile     (MemphisRenderer *renderer,
                                                             guint zoom_level);
    gboolean            memphis_renderer_tile_has_data      (MemphisRenderer *renderer,
                                                             guint x,
                                                             guint y,
                                                             guint zoom_level);

## Object Hierarchy

      GObject
       +----MemphisRenderer

## Properties

      "map"                      MemphisMap*           : Read / Write
      "resolution"               guint                 : Read / Write
      "rule-set"                 MemphisRuleSet*       : Read / Write

## Description

The Memphis tile renderer implements the 'Slippy Map Tilename' specification, like Mapnik and Osmarender. It supports zoom level 12 to 18, projected with the Mercator projection.

Every level has 2^(zoom level) images in x and y direction (enumarated from 0 to 2^(zoom level)-1). Tiles without data are rendered filled with the background color of the map.

## Details

### MemphisRenderer

    typedef struct _MemphisRenderer MemphisRenderer;

### memphis_renderer_new ()

    MemphisRenderer*    memphis_renderer_new                ();

Returns : | a fresh MemphisRenderer.

Since 0.1

### memphis_renderer_new_full ()

    MemphisRenderer*    memphis_renderer_new_full           (MemphisRuleSet *rules,
                                                             MemphisMap *map);

`rules` : | a MemphisRuleSet. [allow-none]
`map` : | a MemphisMap. [allow-none]
Returns : | a fresh MemphisRenderer with the given rules and map.

Since 0.1

### memphis_renderer_free ()

    void                memphis_renderer_free               (MemphisRenderer *renderer);

Frees the memory of MemphisRenderer.

`renderer` : | a MemphisRenderer

Since 0.1

### memphis_renderer_set_resolution ()

    void                memphis_renderer_set_resolution     (MemphisRenderer *renderer,
                                                             guint resolution);

Set the resoltion of a tile.

`renderer` : | a MemphisRenderer
`resolution` : | the resolution of a tile

Since 0.1

### memphis_renderer_set_map ()

    void                memphis_renderer_set_map            (MemphisRenderer *renderer,
                                                             MemphisMap *map);

Assigns a MemphisMap to the renderer.

`renderer` : | a MemphisRenderer
`map` : | a MemphisMap

Since 0.1

### memphis_renderer_set_rule_set ()

    void                memphis_renderer_set_rule_set       (MemphisRenderer *renderer,
                                                             MemphisRuleSet *rules);

Sets the drawing rules for the renderer.

`renderer` : | a MemphisRenderer
`rules` : | a MemphisRuleSet

Since 0.2

### memphis_renderer_get_resolution ()

    guint               memphis_renderer_get_resolution     (MemphisRenderer *renderer);

`renderer` : | a MemphisRenderer
Returns : | the resoltion of a tile.

Since 0.1

### memphis_renderer_get_map ()

    MemphisMap*         memphis_renderer_get_map            (MemphisRenderer *renderer);

`renderer` : | a MemphisRenderer
Returns : | the MemphisMap of this renderer. [allow-none]

Since 0.1

### memphis_renderer_get_rule_set ()

    MemphisRuleSet*     memphis_renderer_get_rule_set       (MemphisRenderer *renderer);

`renderer` : | a MemphisRenderer
Returns : | the MemphisRuleSet of the renderer. [allow-none]

Since 0.1

### memphis_renderer_draw_tile ()

    void                memphis_renderer_draw_tile          (MemphisRenderer *renderer,
                                                             cairo_t *cr,
                                                             guint x,
                                                             guint y,
                                                             guint zoom_level);

Renders a tile.

`renderer` : | a MemphisRenderer
`cr` : | a Cairo context. [inout]
`x` : | x coordinates
`y` : | y coordinates
`zoom_level` : | the zoom level

Since 0.1

### memphis_renderer_get_row_count ()

    gint                memphis_renderer_get_row_count      (MemphisRenderer *renderer,
                                                             guint zoom_level);

`renderer` : | a MemphisRenderer
`zoom_level` : | the zoom level
Returns : | the total number of tile rows for this zoom level.

Since 0.1

### memphis_renderer_get_column_count ()

    gint                memphis_renderer_get_column_count   (MemphisRenderer *renderer,
                                                             guint zoom_level);

`renderer` : | a MemphisRenderer
`zoom_level` : | the zoom level
Returns : | the total number of tile columns for this zoom level.

Since 0.1

### memphis_renderer_get_min_x_tile ()

    gint                memphis_renderer_get_min_x_tile     (MemphisRenderer *renderer,
                                                             guint zoom_level);

`renderer` : | a MemphisRenderer
`zoom_level` : | the zoom level
Returns : | the smallest tile x coordinate with data for this zoom level.

Since 0.1

### memphis_renderer_get_max_x_tile ()

    gint                memphis_renderer_get_max_x_tile     (MemphisRenderer *renderer,
                                                             guint zoom_level);

`renderer` : | a MemphisRenderer
`zoom_level` : | the zoom level
Returns : | the biggest tile x coordinate with data for this zoom level.

Since 0.1

### memphis_renderer_get_min_y_tile ()

    gint                memphis_renderer_get_min_y_tile     (MemphisRenderer *renderer,
                                                             guint zoom_level);

`renderer` : | a MemphisRenderer
`zoom_level` : | the zoom level
Returns : | the smallest tile y coordinate with data for this zoom level.

Since 0.1

### memphis_renderer_get_max_y_tile ()

    gint                memphis_renderer_get_max_y_tile     (MemphisRenderer *renderer,
                                                             guint zoom_level);

`renderer` : | a MemphisRenderer
`zoom_level` : | the zoom level
Returns : | the biggest tile y coordinate with data for this zoom level.

Since 0.1

### memphis_renderer_tile_has_data ()

    gboolean            memphis_renderer_tile_has_data      (MemphisRenderer *renderer,
                                                             guint x,
                                                             guint y,
                                                             guint zoom_level);

`renderer` : | a MemphisRenderer
`x` : | x coordinates
`y` : | y coordinates
`zoom_level` : | the zoom level
Returns : | true if the renderer has map data for this zoom level and tile number. If no data is available an empty tile with background color will be rendered.

Since 0.1

## Property Details

### The `"map"` property

      "map"                      MemphisMap*           : Read / Write

A MemphisMap.

Since 0.1

### The `"resolution"` property

      "resolution"               guint                 : Read / Write

The tile resolution in pixels.

Allowed values: [8,2048]

Default value: 256

Since 0.1

### The `"rule-set"` property

      "rule-set"                 MemphisRuleSet*       : Read / Write

A MemphisRuleSet.

Since 0.1