1
/*
2
 * Copyright (C) 2008-2009 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
3
 * Copyright (C) 2010-2012 Jiri Techet <techet@gmail.com>
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Lesser General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2.1 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public
16
 * License along with this library; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
20
#ifndef CHAMPLAIN_MAP_TILE_H
21
#define CHAMPLAIN_MAP_TILE_H
22
23
#include <champlain/champlain-defines.h>
24
25
#include <glib.h>
26
#include <clutter/clutter.h>
27
28
G_BEGIN_DECLS
29
30
#define CHAMPLAIN_TYPE_TILE champlain_tile_get_type ()
31
32
#define CHAMPLAIN_TILE(obj) \
33
  (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_TILE, ChamplainTile))
34
35
#define CHAMPLAIN_TILE_CLASS(klass) \
36
  (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_TILE, ChamplainTileClass))
37
38
#define CHAMPLAIN_IS_TILE(obj) \
39
  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_TILE))
40
41
#define CHAMPLAIN_IS_TILE_CLASS(klass) \
42
  (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_TILE))
43
44
#define CHAMPLAIN_TILE_GET_CLASS(obj) \
45
  (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_TILE, ChamplainTileClass))
46
47
typedef struct _ChamplainTilePrivate ChamplainTilePrivate;
48
49
typedef struct _ChamplainTile ChamplainTile;
50
typedef struct _ChamplainTileClass ChamplainTileClass;
51
52
/**
53
 * ChamplainState:
54
 * @CHAMPLAIN_STATE_NONE: Initial or undefined state
55
 * @CHAMPLAIN_STATE_LOADING: Tile is loading
56
 * @CHAMPLAIN_STATE_LOADED: Tile is loaded but not yet displayed
57
 * @CHAMPLAIN_STATE_DONE: Tile loading finished. Also used to inform map sources
58
 *     that tile loading has been cancelled.
59
 *
60
 * Tile loading state.
61
 */
62
typedef enum
63
{
64
  CHAMPLAIN_STATE_NONE,
65
  CHAMPLAIN_STATE_LOADING,
66
  CHAMPLAIN_STATE_LOADED,
67
  CHAMPLAIN_STATE_DONE
68
} ChamplainState;
69
70
71
/**
72
 * ChamplainTile:
73
 *
74
 * The #ChamplainTile structure contains only private data
75
 * and should be accessed using the provided API
76
 *
77
 * Since: 0.4
78
 */
79
struct _ChamplainTile
80
{
81
  ClutterActor parent;
82
83
  ChamplainTilePrivate *priv;
84
};
85
86
struct _ChamplainTileClass
87
{
88
  ClutterActorClass parent_class;
89
};
90
91
92
GType champlain_tile_get_type (void);
93
94
ChamplainTile *champlain_tile_new (void);
95
ChamplainTile *champlain_tile_new_full (guint x,
96
    guint y,
97
    guint size,
98
    guint zoom_level);
99
100
guint champlain_tile_get_x (ChamplainTile *self);
101
guint champlain_tile_get_y (ChamplainTile *self);
102
guint champlain_tile_get_zoom_level (ChamplainTile *self);
103
guint champlain_tile_get_size (ChamplainTile *self);
104
ChamplainState champlain_tile_get_state (ChamplainTile *self);
105
ClutterActor *champlain_tile_get_content (ChamplainTile *self);
106
const GTimeVal *champlain_tile_get_modified_time (ChamplainTile *self);
107
const gchar *champlain_tile_get_etag (ChamplainTile *self);
108
gboolean champlain_tile_get_fade_in (ChamplainTile *self);
109
110
void champlain_tile_set_x (ChamplainTile *self,
111
    guint x);
112
void champlain_tile_set_y (ChamplainTile *self,
113
    guint y);
114
void champlain_tile_set_zoom_level (ChamplainTile *self,
115
    guint zoom_level);
116
void champlain_tile_set_size (ChamplainTile *self,
117
    guint size);
118
void champlain_tile_set_state (ChamplainTile *self,
119
    ChamplainState state);
120
void champlain_tile_set_content (ChamplainTile *self,
121
    ClutterActor *actor);
122
void champlain_tile_set_etag (ChamplainTile *self,
123
    const gchar *etag);
124
void champlain_tile_set_modified_time (ChamplainTile *self,
125
    const GTimeVal *time);
126
void champlain_tile_set_fade_in (ChamplainTile *self,
127
    gboolean fade_in);
128
129
void champlain_tile_display_content (ChamplainTile *self);
130
131
G_END_DECLS
132
133
#endif /* CHAMPLAIN_MAP_TILE_H */