1 /*
2  * Copyright (C) 2008-2009 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
3  * Copyright (C) 2010-2013 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 #include <champlain/champlain-exportable.h>
25 
26 #include <glib.h>
27 #include <clutter/clutter.h>
28 
29 G_BEGIN_DECLS
30 
31 #define CHAMPLAIN_TYPE_TILE champlain_tile_get_type ()
32 
33 #define CHAMPLAIN_TILE(obj) \
34   (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_TILE, ChamplainTile))
35 
36 #define CHAMPLAIN_TILE_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_TILE, ChamplainTileClass))
38 
39 #define CHAMPLAIN_IS_TILE(obj) \
40   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_TILE))
41 
42 #define CHAMPLAIN_IS_TILE_CLASS(klass) \
43   (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_TILE))
44 
45 #define CHAMPLAIN_TILE_GET_CLASS(obj) \
46   (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_TILE, ChamplainTileClass))
47 
48 typedef struct _ChamplainTilePrivate ChamplainTilePrivate;
49 
50 typedef struct _ChamplainTile ChamplainTile;
51 typedef struct _ChamplainTileClass ChamplainTileClass;
52 
53 /**
54  * ChamplainState:
55  * @CHAMPLAIN_STATE_NONE: Initial or undefined state
56  * @CHAMPLAIN_STATE_LOADING: Tile is loading
57  * @CHAMPLAIN_STATE_LOADED: Tile is loaded but not yet displayed
58  * @CHAMPLAIN_STATE_DONE: Tile loading finished. Also used to inform map sources
59  *     that tile loading has been cancelled.
60  *
61  * Tile loading state.
62  */
63 typedef enum
64 {
65   CHAMPLAIN_STATE_NONE,
66   CHAMPLAIN_STATE_LOADING,
67   CHAMPLAIN_STATE_LOADED,
68   CHAMPLAIN_STATE_DONE
69 } ChamplainState;
70 
71 
72 /**
73  * ChamplainTile:
74  *
75  * The #ChamplainTile structure contains only private data
76  * and should be accessed using the provided API
77  *
78  * Since: 0.4
79  */
80 struct _ChamplainTile
81 {
82   ClutterActor parent;
83 
84   ChamplainTilePrivate *priv;
85 };
86 
87 struct _ChamplainTileClass
88 {
89   ClutterActorClass parent_class;
90 };
91 
92 
93 GType champlain_tile_get_type (void);
94 
95 ChamplainTile *champlain_tile_new (void);
96 ChamplainTile *champlain_tile_new_full (guint x,
97     guint y,
98     guint size,
99     guint zoom_level);
100 
101 guint champlain_tile_get_x (ChamplainTile *self);
102 guint champlain_tile_get_y (ChamplainTile *self);
103 guint champlain_tile_get_zoom_level (ChamplainTile *self);
104 guint champlain_tile_get_size (ChamplainTile *self);
105 ChamplainState champlain_tile_get_state (ChamplainTile *self);
106 ClutterActor *champlain_tile_get_content (ChamplainTile *self);
107 const GTimeVal *champlain_tile_get_modified_time (ChamplainTile *self);
108 const gchar *champlain_tile_get_etag (ChamplainTile *self);
109 gboolean champlain_tile_get_fade_in (ChamplainTile *self);
110 
111 void champlain_tile_set_x (ChamplainTile *self,
112     guint x);
113 void champlain_tile_set_y (ChamplainTile *self,
114     guint y);
115 void champlain_tile_set_zoom_level (ChamplainTile *self,
116     guint zoom_level);
117 void champlain_tile_set_size (ChamplainTile *self,
118     guint size);
119 void champlain_tile_set_state (ChamplainTile *self,
120     ChamplainState state);
121 void champlain_tile_set_content (ChamplainTile *self,
122     ClutterActor *actor);
123 void champlain_tile_set_etag (ChamplainTile *self,
124     const gchar *etag);
125 void champlain_tile_set_modified_time (ChamplainTile *self,
126     const GTimeVal *time);
127 void champlain_tile_set_fade_in (ChamplainTile *self,
128     gboolean fade_in);
129 
130 void champlain_tile_display_content (ChamplainTile *self);
131 
132 G_END_DECLS
133 
134 #endif /* CHAMPLAIN_MAP_TILE_H */
135