ChamplainTile

## ChamplainTile ChamplainTile — An object that represent map tiles |

## Synopsis

    enum                ChamplainState;
    struct              ChamplainTile;
    ChamplainTile *     champlain_tile_new                  (void);
    ChamplainTile *     champlain_tile_new_full             (guint x,
                                                             guint y,
                                                             guint size,
                                                             guint zoom_level);
    guint               champlain_tile_get_x                (ChamplainTile *self);
    guint               champlain_tile_get_y                (ChamplainTile *self);
    guint               champlain_tile_get_zoom_level       (ChamplainTile *self);
    guint               champlain_tile_get_size             (ChamplainTile *self);
    ChamplainState      champlain_tile_get_state            (ChamplainTile *self);
    gboolean            champlain_tile_get_fade_in          (ChamplainTile *self);
    void                champlain_tile_set_x                (ChamplainTile *self,
                                                             guint x);
    void                champlain_tile_set_y                (ChamplainTile *self,
                                                             guint y);
    void                champlain_tile_set_zoom_level       (ChamplainTile *self,
                                                             guint zoom_level);
    void                champlain_tile_set_size             (ChamplainTile *self,
                                                             guint size);
    void                champlain_tile_set_state            (ChamplainTile *self,
                                                             ChamplainState state);
    void                champlain_tile_set_fade_in          (ChamplainTile *self,
                                                             gboolean fade_in);
    ClutterActor *      champlain_tile_get_content          (ChamplainTile *self);
    const gchar *       champlain_tile_get_etag             (ChamplainTile *self);
    const GTimeVal *    champlain_tile_get_modified_time    (ChamplainTile *self);
    void                champlain_tile_set_content          (ChamplainTile *self,
                                                             ClutterActor *actor);
    void                champlain_tile_set_etag             (ChamplainTile *self,
                                                             const gchar *etag);
    void                champlain_tile_set_modified_time    (ChamplainTile *self,
                                                             const GTimeVal *time);
    void                champlain_tile_display_content      (ChamplainTile *self);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----ClutterActor
                   +----ChamplainTile

## Implemented Interfaces

ChamplainTile implements ClutterContainer, ClutterScriptable, ClutterAnimatable and AtkImplementorIface.

## Properties

      "content"                  ClutterActor*         : Read / Write
      "etag"                     gchar*                : Read / Write
      "fade-in"                  gboolean              : Read / Write
      "size"                     guint                 : Read / Write
      "state"                    ChamplainState        : Read / Write
      "x"                        guint                 : Read / Write
      "y"                        guint                 : Read / Write
      "zoom-level"               guint                 : Read / Write

## Signals

      "render-complete"                                : Run Last

## Description

This object represents map tiles. Tiles are loaded by ChamplainMapSource.

## Details

### enum ChamplainState

    typedef enum {
      CHAMPLAIN_STATE_NONE,
      CHAMPLAIN_STATE_LOADING,
      CHAMPLAIN_STATE_LOADED,
      CHAMPLAIN_STATE_DONE
    } ChamplainState;

Tile loading state.

`CHAMPLAIN_STATE_NONE` | Initial or undefined state
`CHAMPLAIN_STATE_LOADING` | Tile is loading
`CHAMPLAIN_STATE_LOADED` | Tile is loaded but not yet displayed
`CHAMPLAIN_STATE_DONE` | Tile loading finished. Also used to inform map sources that tile loading has been cancelled.

### struct ChamplainTile

    struct ChamplainTile;

The ChamplainTile structure contains only private data and should be accessed using the provided API

Since 0.4

### champlain_tile_new ()

    ChamplainTile *     champlain_tile_new                  (void);

Creates an instance of ChamplainTile.

Returns : | a new ChamplainTile

Since 0.4

### champlain_tile_new_full ()

    ChamplainTile *     champlain_tile_new_full             (guint x,
                                                             guint y,
                                                             guint size,
                                                             guint zoom_level);

Creates an instance of ChamplainTile.

`x` : | the x position
`y` : | the y position
`size` : | the size in pixels
`zoom_level` : | the zoom level
Returns : | a ChamplainTile

Since 0.4

### champlain_tile_get_x ()

    guint               champlain_tile_get_x                (ChamplainTile *self);

Gets the tile's x position.

`self` : | the ChamplainTile
Returns : | the tile's x position

Since 0.4

### champlain_tile_get_y ()

    guint               champlain_tile_get_y                (ChamplainTile *self);

Gets the tile's y position.

`self` : | the ChamplainTile
Returns : | the tile's y position

Since 0.4

### champlain_tile_get_zoom_level ()

    guint               champlain_tile_get_zoom_level       (ChamplainTile *self);

Gets the tile's zoom level.

`self` : | the ChamplainTile
Returns : | the tile's zoom level

Since 0.4

### champlain_tile_get_size ()

    guint               champlain_tile_get_size             (ChamplainTile *self);

Gets the tile's size.

`self` : | the ChamplainTile
Returns : | the tile's size in pixels

Since 0.4

### champlain_tile_get_state ()

    ChamplainState      champlain_tile_get_state            (ChamplainTile *self);

Gets the current state of tile loading.

`self` : | the ChamplainTile
Returns : | the tile's ChamplainState

Since 0.4

### champlain_tile_get_fade_in ()

    gboolean            champlain_tile_get_fade_in          (ChamplainTile *self);

Checks whether the tile should fade in.

`self` : | the ChamplainTile
Returns : | the return value determines whether the tile should fade in when loading.

Since 0.6

### champlain_tile_set_x ()

    void                champlain_tile_set_x                (ChamplainTile *self,
                                                             guint x);

Sets the tile's x position

`self` : | the ChamplainTile
`x` : | the position

Since 0.4

### champlain_tile_set_y ()

    void                champlain_tile_set_y                (ChamplainTile *self,
                                                             guint y);

Sets the tile's y position

`self` : | the ChamplainTile
`y` : | the position

Since 0.4

### champlain_tile_set_zoom_level ()

    void                champlain_tile_set_zoom_level       (ChamplainTile *self,
                                                             guint zoom_level);

Sets the tile's zoom level

`self` : | the ChamplainTile
`zoom_level` : | the zoom level

Since 0.4

### champlain_tile_set_size ()

    void                champlain_tile_set_size             (ChamplainTile *self,
                                                             guint size);

Sets the tile's size

`self` : | the ChamplainTile
`size` : | the size in pixels

Since 0.4

### champlain_tile_set_state ()

    void                champlain_tile_set_state            (ChamplainTile *self,
                                                             ChamplainState state);

Sets the tile's ChamplainState

`self` : | the ChamplainTile
`state` : | a ChamplainState

Since 0.4

### champlain_tile_set_fade_in ()

    void                champlain_tile_set_fade_in          (ChamplainTile *self,
                                                             gboolean fade_in);

Sets the flag determining whether the tile should fade in when loading

`self` : | the ChamplainTile
`fade_in` : | determines whether the tile should fade in when loading

Since 0.6

### champlain_tile_get_content ()

    ClutterActor *      champlain_tile_get_content          (ChamplainTile *self);

Gets the tile's content actor.

`self` : | the ChamplainTile
Returns : | the tile's content, this actor will change each time the tile's content changes. You should not unref this content, it is owned by the tile. [transfer none]

Since 0.4

### champlain_tile_get_etag ()

    const gchar *       champlain_tile_get_etag             (ChamplainTile *self);

Gets the tile's ETag.

`self` : | the ChamplainTile
Returns : | the tile's ETag

Since 0.4

### champlain_tile_get_modified_time ()

    const GTimeVal *    champlain_tile_get_modified_time    (ChamplainTile *self);

Gets the tile's last modified time.

`self` : | the ChamplainTile
Returns : | the tile's last modified time

Since 0.4

### champlain_tile_set_content ()

    void                champlain_tile_set_content          (ChamplainTile *self,
                                                             ClutterActor *actor);

Sets the tile's content. To also disppay the tile, you have to call `champlain_tile_display_content()` in addition.

`self` : | the ChamplainTile
`actor` : | the new content

Since 0.4

### champlain_tile_set_etag ()

    void                champlain_tile_set_etag             (ChamplainTile *self,
                                                             const gchar *etag);

Sets the tile's ETag

`self` : | the ChamplainTile
`etag` : | the tile's ETag as sent by the server

Since 0.4

### champlain_tile_set_modified_time ()

    void                champlain_tile_set_modified_time    (ChamplainTile *self,
                                                             const GTimeVal *time);

Sets the tile's modified time

`self` : | the ChamplainTile
`time` : | a GTimeVal, the value will be copied

Since 0.4

### champlain_tile_display_content ()

    void                champlain_tile_display_content      (ChamplainTile *self);

Displays the tile's content.

`self` : | the ChamplainTile

Since 0.8

## Property Details

### The `"content"` property

      "content"                  ClutterActor*         : Read / Write

The ClutterActor with the specific image content. When changing this property, the new actor will be faded in.

Since 0.4

### The `"etag"` property

      "etag"                     gchar*                : Read / Write

The tile's ETag. This information is sent by some web servers as a mean to identify if a tile has changed. This information is saved in the cache and sent in GET queries.

Default value: NULL

Since 0.4

### The `"fade-in"` property

      "fade-in"                  gboolean              : Read / Write

Specifies whether the tile should fade in when loading

Default value: FALSE

Since 0.6

### The `"size"` property

      "size"                     guint                 : Read / Write

The size of the tile in pixels

Allowed values: <= G_MAXINT

Default value: 256

Since 0.4

### The `"state"` property

      "state"                    ChamplainState        : Read / Write

The state of the tile

Default value: CHAMPLAIN_STATE_NONE

Since 0.4

### The `"x"` property

      "x"                        guint                 : Read / Write

The x position of the tile

Allowed values: <= G_MAXINT

Default value: 0

Since 0.4

### The `"y"` property

      "y"                        guint                 : Read / Write

The y position of the tile

Allowed values: <= G_MAXINT

Default value: 0

Since 0.4

### The `"zoom-level"` property

      "zoom-level"               guint                 : Read / Write

The zoom level of the tile

Allowed values: <= G_MAXINT

Default value: 0

Since 0.4

## Signal Details

### The `"render-complete"` signal

    void                user_function                      (ChamplainTile *self,
                                                            gpointer       data,
                                                            guint          size,
                                                            gboolean       error,
                                                            gpointer       user_data)      : Run Last

The "render-complete" signal is emitted when rendering of the tile is completed by the renderer.

`self` : | a ChamplainTile
`data` : | the result of the rendering
`size` : | size of data
`error` : | TRUE if there was an error during rendering
`user_data` : | user data set when the signal handler was connected.

Since 0.10