MemphisRenderer: libmemphis Reference Manual

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

## Functions

MemphisRenderer * | memphis_renderer_new ()
MemphisRenderer * | memphis_renderer_new_full ()
void | memphis_renderer_free ()
void | memphis_renderer_set_resolution ()
void | memphis_renderer_set_map ()
void | memphis_renderer_set_rule_set ()
guint | memphis_renderer_get_resolution ()
MemphisMap * | memphis_renderer_get_map ()
MemphisRuleSet * | memphis_renderer_get_rule_set ()
void | memphis_renderer_draw_tile ()
gint | memphis_renderer_get_row_count ()
gint | memphis_renderer_get_column_count ()
gint | memphis_renderer_get_min_x_tile ()
gint | memphis_renderer_get_max_x_tile ()
gint | memphis_renderer_get_min_y_tile ()
gint | memphis_renderer_get_max_y_tile ()
gboolean | memphis_renderer_tile_has_data ()

## Properties

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

## Types and Values

struct | MemphisRenderer

## Object Hierarchy

        GObject
        ╰── MemphisRenderer

## 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.

## Functions

### 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);

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

renderer | a MemphisRenderer |
rules | a MemphisRuleSet |

Since: 0.2

### memphis_renderer_get_resolution ()

    guint
    memphis_renderer_get_resolution (MemphisRenderer *renderer);

#### Parameters

renderer | a MemphisRenderer |

#### Returns

the resoltion of a tile.

Since: 0.1

### memphis_renderer_get_map ()

    MemphisMap *
    memphis_renderer_get_map (MemphisRenderer *renderer);

#### Parameters

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);

#### Parameters

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.

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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

## Types and Values

### struct MemphisRenderer

    struct MemphisRenderer;

## Property Details

### The `“map”` property

      “map”                      MemphisMap *

A MemphisMap.

Owner: MemphisRenderer

Flags: Read / Write

Since: 0.1

### The `“resolution”` property

      “resolution”               guint

The tile resolution in pixels.

Owner: MemphisRenderer

Flags: Read / Write

Allowed values: [8,2048]

Default value: 256

Since: 0.1

### The `“rule-set”` property

      “rule-set”                 MemphisRuleSet *

A MemphisRuleSet.

Owner: MemphisRenderer

Flags: Read / Write

Since: 0.1