Commit 537d540c authored by Jiří Techet's avatar Jiří Techet

Add null tile source and error tile renderer

Replace the error tile source with a null tile source
(a tile source with no data input) and error tile renderer
(always renders error tile, no mater what is on the input)
Signed-off-by: 's avatarJiří Techet <techet@gmail.com>
parent 5dad0e02
......@@ -35,7 +35,6 @@ libchamplain_headers = \
champlain-tile-source.h \
champlain-tile-cache.h \
champlain-network-tile-source.h \
champlain-error-tile-source.h \
champlain-file-cache.h \
champlain-map-source-factory.h \
champlain-map-source-desc.h \
......@@ -44,7 +43,9 @@ libchamplain_headers = \
champlain-features.h \
champlain-renderer.h \
champlain-image-renderer.h \
champlain-error-tile-renderer.h \
champlain-file-tile-source.h \
champlain-null-tile-source.h \
champlain-network-bbox-tile-source.h \
champlain-bounding-box.h
......@@ -70,7 +71,6 @@ libchamplain_@CHAMPLAIN_API_VERSION@_la_SOURCES = \
champlain-tile-source.c \
champlain-tile-cache.c \
champlain-network-tile-source.c \
champlain-error-tile-source.c \
champlain-file-cache.c \
champlain-map-source-factory.c \
champlain-map-source-desc.c \
......@@ -78,7 +78,9 @@ libchamplain_@CHAMPLAIN_API_VERSION@_la_SOURCES = \
champlain-polygon.c \
champlain-renderer.c \
champlain-image-renderer.c \
champlain-error-tile-renderer.c \
champlain-file-tile-source.c \
champlain-null-tile-source.c \
champlain-network-bbox-tile-source.c \
champlain-bounding-box.c
......@@ -100,7 +102,6 @@ libchamplain_include_HEADERS = \
champlain-tile-source.h \
champlain-tile-cache.h \
champlain-network-tile-source.h \
champlain-error-tile-source.h \
champlain-file-cache.h \
champlain-map-source-factory.h \
champlain-map-source-desc.h \
......@@ -112,7 +113,9 @@ libchamplain_include_HEADERS = \
champlain-features.h \
champlain-renderer.h \
champlain-image-renderer.h \
champlain-error-tile-renderer.h \
champlain-file-tile-source.h \
champlain-null-tile-source.h \
champlain-network-bbox-tile-source.h \
champlain-bounding-box.h
......
/*
* Copyright (C) 2008-2009 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
* Copyright (C) 2010 Jiri Techet <techet@gmail.com>
*
* This library is free software; you can redistribute it and/or
......@@ -17,33 +16,77 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* SECTION:champlain-error-tile-source
* @short_description: A map source displaying error tiles
*
* #ChamplainErrorTileSource always fills a tile with error tile image.
* Applications can create their own error tile sources to change the look
* of the error tile.
*/
#include "champlain-error-tile-renderer.h"
#include <gdk/gdk.h>
#include "champlain-error-tile-source.h"
G_DEFINE_TYPE (ChamplainErrorTileRenderer, champlain_error_tile_renderer, CHAMPLAIN_TYPE_RENDERER)
G_DEFINE_TYPE (ChamplainErrorTileSource, champlain_error_tile_source, CHAMPLAIN_TYPE_TILE_SOURCE);
#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_ERROR_TILE_RENDERER, ChamplainErrorTileRendererPrivate))
#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_ERROR_TILE_SOURCE, ChamplainErrorTileSourcePrivate))
struct _ChamplainErrorTileSourcePrivate
struct _ChamplainErrorTileRendererPrivate
{
CoglHandle error_tex;
guint tile_size;
};
enum
{
PROP_0,
PROP_TILE_SIZE
};
static void fill_tile (ChamplainMapSource *map_source,
static void set_data (ChamplainRenderer *renderer,
const gchar *data,
guint size);
static void render (ChamplainRenderer *renderer,
ChamplainTile *tile);
static void
champlain_error_tile_source_dispose (GObject *object)
champlain_error_tile_renderer_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
ChamplainErrorTileSourcePrivate *priv = CHAMPLAIN_ERROR_TILE_SOURCE (object)->priv;
ChamplainErrorTileRenderer *renderer = CHAMPLAIN_ERROR_TILE_RENDERER (object);
switch (property_id)
{
case PROP_TILE_SIZE:
g_value_set_uint (value, champlain_error_tile_renderer_get_tile_size (renderer));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
champlain_error_tile_renderer_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
ChamplainErrorTileRenderer *renderer = CHAMPLAIN_ERROR_TILE_RENDERER (object);
switch (property_id)
{
case PROP_TILE_SIZE:
champlain_error_tile_renderer_set_tile_size (renderer, g_value_get_uint (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
champlain_error_tile_renderer_dispose (GObject *object)
{
ChamplainErrorTileRendererPrivate *priv = CHAMPLAIN_ERROR_TILE_RENDERER (object)->priv;
if (priv->error_tex)
{
......@@ -51,74 +94,93 @@ champlain_error_tile_source_dispose (GObject *object)
priv->error_tex = NULL;
}
G_OBJECT_CLASS (champlain_error_tile_source_parent_class)->dispose (object);
G_OBJECT_CLASS (champlain_error_tile_renderer_parent_class)->dispose (object);
}
static void
champlain_error_tile_source_finalize (GObject *object)
champlain_error_tile_renderer_finalize (GObject *object)
{
G_OBJECT_CLASS (champlain_error_tile_source_parent_class)->finalize (object);
G_OBJECT_CLASS (champlain_error_tile_renderer_parent_class)->finalize (object);
}
static void
champlain_error_tile_source_class_init (ChamplainErrorTileSourceClass *klass)
champlain_error_tile_renderer_class_init (ChamplainErrorTileRendererClass *klass)
{
ChamplainMapSourceClass *map_source_class = CHAMPLAIN_MAP_SOURCE_CLASS (klass);
GObjectClass* object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (ChamplainErrorTileSourcePrivate));
object_class->finalize = champlain_error_tile_source_finalize;
object_class->dispose = champlain_error_tile_source_dispose;
map_source_class->fill_tile = fill_tile;
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ChamplainRendererClass *renderer_class = CHAMPLAIN_RENDERER_CLASS (klass);
g_type_class_add_private (klass, sizeof (ChamplainErrorTileRendererPrivate));
object_class->get_property = champlain_error_tile_renderer_get_property;
object_class->set_property = champlain_error_tile_renderer_set_property;
object_class->finalize = champlain_error_tile_renderer_finalize;
object_class->dispose = champlain_error_tile_renderer_dispose;
g_object_class_install_property (object_class,
PROP_TILE_SIZE,
g_param_spec_uint ("tile-size",
"Tile Size",
"The size of the rendered tile",
0,
G_MAXINT,
256,
G_PARAM_READWRITE));
renderer_class->set_data = set_data;
renderer_class->render = render;
}
static void
champlain_error_tile_source_init (ChamplainErrorTileSource *error_source)
champlain_error_tile_renderer_init (ChamplainErrorTileRenderer *self)
{
ChamplainErrorTileSourcePrivate *priv = GET_PRIVATE(error_source);
ChamplainErrorTileRendererPrivate *priv = GET_PRIVATE (self);
error_source->priv = priv;
self->priv = priv;
priv->error_tex = NULL;
}
/**
* champlain_error_tile_source_new_full:
* @tile_size: size of the error tile
*
* Constructor of #ChamplainErrorTileSource.
*
* Returns: a constructed #ChamplainErrorTileSource
*
* Since: 0.6
*/
ChamplainErrorTileSource* champlain_error_tile_source_new_full (guint tile_size)
ChamplainErrorTileRenderer *
champlain_error_tile_renderer_new (guint tile_size)
{
return g_object_new (CHAMPLAIN_TYPE_ERROR_TILE_SOURCE, "tile-size", tile_size, NULL);
return g_object_new (CHAMPLAIN_TYPE_ERROR_TILE_RENDERER, "tile-size", tile_size, NULL);
}
static void
set_data (ChamplainRenderer *renderer, const gchar *data, guint size)
{
}
static void
fill_tile (ChamplainMapSource *map_source,
ChamplainTile *tile)
render (ChamplainRenderer *renderer, ChamplainTile *tile)
{
g_return_if_fail (CHAMPLAIN_IS_ERROR_TILE_SOURCE (map_source));
g_return_if_fail (CHAMPLAIN_IS_ERROR_TILE_RENDERER (renderer));
g_return_if_fail (CHAMPLAIN_IS_TILE (tile));
ChamplainErrorTileSourcePrivate *priv = CHAMPLAIN_ERROR_TILE_SOURCE (map_source)->priv;
ChamplainErrorTileRenderer *error_renderer = CHAMPLAIN_ERROR_TILE_RENDERER (renderer);
ChamplainErrorTileRendererPrivate *priv = error_renderer->priv;
ClutterActor *clone;
guint size;
ChamplainRenderCallbackData callback_data;
callback_data.data = NULL;
callback_data.size = 0;
callback_data.error = FALSE;
if (champlain_tile_get_state (tile) == CHAMPLAIN_STATE_LOADED)
{
/* cache is just validating tile - don't generate error tile in this case - instead use what we have */
champlain_tile_set_state (tile, CHAMPLAIN_STATE_DONE);
champlain_tile_display_content (tile);
return;
}
{
/* cache is just validating tile - don't generate error tile in this case - instead use what we have */
g_signal_emit_by_name (tile, "render-complete", &callback_data);
return;
}
size = champlain_map_source_get_tile_size (map_source);
size = champlain_error_tile_renderer_get_tile_size (error_renderer);
if (!priv->error_tex)
{
......@@ -130,7 +192,7 @@ fill_tile (ChamplainMapSource *map_source,
cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (tmp_actor));
/* draw a linear gray to white pattern */
pat = cairo_pattern_create_linear (size / 2.0, 0.0, size, size / 2.0);
pat = cairo_pattern_create_linear (size / 2.0, 0.0, size, size / 2.0);
cairo_pattern_add_color_stop_rgb (pat, 0, 0.686, 0.686, 0.686);
cairo_pattern_add_color_stop_rgb (pat, 1, 0.925, 0.925, 0.925);
cairo_set_source (cr, pat);
......@@ -161,6 +223,26 @@ fill_tile (ChamplainMapSource *map_source,
clone = clutter_texture_new ();
clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (clone), priv->error_tex);
champlain_tile_set_content (tile, clone);
champlain_tile_set_state (tile, CHAMPLAIN_STATE_DONE);
champlain_tile_display_content (tile);
g_signal_emit_by_name (tile, "render-complete", &callback_data);
}
void
champlain_error_tile_renderer_set_tile_size (ChamplainErrorTileRenderer *renderer,
guint size)
{
g_return_if_fail (CHAMPLAIN_IS_ERROR_TILE_RENDERER (renderer));
renderer->priv->tile_size = size;
g_object_notify (G_OBJECT (renderer), "tile-size");
}
guint
champlain_error_tile_renderer_get_tile_size (ChamplainErrorTileRenderer *renderer)
{
g_return_val_if_fail (CHAMPLAIN_IS_ERROR_TILE_RENDERER (renderer), 0);
return renderer->priv->tile_size;
}
/*
* Copyright (C) 2010 Jiri Techet <techet@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined (__CHAMPLAIN_CHAMPLAIN_H_INSIDE__) && !defined (CHAMPLAIN_COMPILATION)
#error "Only <champlain/champlain.h> can be included directly."
#endif
#ifndef __CHAMPLAIN_ERROR_TILE_RENDERER_H__
#define __CHAMPLAIN_ERROR_TILE_RENDERER_H__
#include <champlain/champlain-tile.h>
#include <champlain/champlain-renderer.h>
G_BEGIN_DECLS
#define CHAMPLAIN_TYPE_ERROR_TILE_RENDERER (champlain_error_tile_renderer_get_type ())
#define CHAMPLAIN_ERROR_TILE_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_ERROR_TILE_RENDERER, ChamplainErrorTileRenderer))
#define CHAMPLAIN_ERROR_TILE_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_ERROR_TILE_RENDERER, ChamplainErrorTileRendererClass))
#define CHAMPLAIN_IS_ERROR_TILE_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_ERROR_TILE_RENDERER))
#define CHAMPLAIN_IS_ERROR_TILE_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_ERROR_TILE_RENDERER))
#define CHAMPLAIN_ERROR_TILE_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_ERROR_TILE_RENDERER, ChamplainErrorTileRendererClass))
typedef struct _ChamplainErrorTileRendererPrivate ChamplainErrorTileRendererPrivate;
typedef struct _ChamplainErrorTileRenderer ChamplainErrorTileRenderer;
typedef struct _ChamplainErrorTileRendererClass ChamplainErrorTileRendererClass;
struct _ChamplainErrorTileRenderer
{
ChamplainRenderer parent;
ChamplainErrorTileRendererPrivate *priv;
};
struct _ChamplainErrorTileRendererClass
{
ChamplainRendererClass parent_class;
};
GType champlain_error_tile_renderer_get_type (void);
ChamplainErrorTileRenderer *champlain_error_tile_renderer_new (guint tile_size);
void champlain_error_tile_renderer_set_tile_size (ChamplainErrorTileRenderer *renderer,
guint size);
guint champlain_error_tile_renderer_get_tile_size (ChamplainErrorTileRenderer *renderer);
G_END_DECLS
#endif /* __CHAMPLAIN_ERROR_TILE_RENDERER_H__ */
......@@ -138,7 +138,7 @@ tile_rendered_cb (ChamplainTile *tile,
if (!data->error)
{
if (tile_cache)
if (tile_cache && data->data)
champlain_tile_cache_store_tile (tile_cache, tile, data->data, data->size);
champlain_tile_set_fade_in (tile, TRUE);
......
......@@ -50,7 +50,7 @@
#include "champlain-private.h"
#include "champlain-network-tile-source.h"
#include "champlain-map-source-chain.h"
#include "champlain-error-tile-source.h"
#include "champlain-error-tile-renderer.h"
#include "champlain-image-renderer.h"
#include "champlain-file-tile-source.h"
......@@ -400,7 +400,8 @@ champlain_map_source_factory_create (ChamplainMapSourceFactory *factory,
*
* Since: 0.6
*/
ChamplainMapSource * champlain_map_source_factory_create_cached_source (ChamplainMapSourceFactory *factory,
ChamplainMapSource *
champlain_map_source_factory_create_cached_source (ChamplainMapSourceFactory *factory,
const gchar *id)
{
ChamplainMapSourceChain *source_chain;
......@@ -412,7 +413,7 @@ ChamplainMapSource * champlain_map_source_factory_create_cached_source (Champlai
tile_source = champlain_map_source_factory_create (factory, id);
tile_size = champlain_map_source_get_tile_size (tile_source);
error_source = CHAMPLAIN_MAP_SOURCE(champlain_error_tile_source_new_full (tile_size));
error_source = champlain_map_source_factory_create_error_source (factory, tile_size);
file_cache = CHAMPLAIN_MAP_SOURCE(champlain_file_cache_new ());
......@@ -424,6 +425,22 @@ ChamplainMapSource * champlain_map_source_factory_create_cached_source (Champlai
return CHAMPLAIN_MAP_SOURCE(source_chain);
}
ChamplainMapSource *
champlain_map_source_factory_create_error_source (ChamplainMapSourceFactory *factory,
guint tile_size)
{
ChamplainMapSource *null_source;
ChamplainRenderer *renderer;
null_source = CHAMPLAIN_MAP_SOURCE (champlain_null_tile_source_new ());
renderer = CHAMPLAIN_RENDERER (champlain_error_tile_renderer_new (tile_size));
champlain_map_source_set_renderer (null_source, renderer);
return null_source;
}
/**
* champlain_map_source_factory_register:
* @factory: A #ChamplainMapSourceFactory
......
......@@ -64,6 +64,8 @@ ChamplainMapSource * champlain_map_source_factory_create (ChamplainMapSourceFact
const gchar *id);
ChamplainMapSource * champlain_map_source_factory_create_cached_source (ChamplainMapSourceFactory *factory,
const gchar *id);
ChamplainMapSource * champlain_map_source_factory_create_error_source (ChamplainMapSourceFactory *factory,
guint tile_size);
gboolean
champlain_map_source_factory_register (ChamplainMapSourceFactory *factory,
......
......@@ -342,7 +342,7 @@ tile_rendered_cb (ChamplainTile *tile,
if (!data->error)
{
if (tile_cache)
if (tile_cache && data->data)
champlain_tile_cache_store_tile (tile_cache, tile, data->data, data->size);
champlain_tile_set_fade_in (tile, TRUE);
......
......@@ -533,7 +533,7 @@ tile_rendered_cb (ChamplainTile *tile, ChamplainRenderCallbackData *data, TileRe
if (etag != NULL)
champlain_tile_set_etag (tile, etag);
if (tile_cache)
if (tile_cache && data->data)
champlain_tile_cache_store_tile (tile_cache, tile, data->data, data->size);
champlain_tile_set_fade_in (tile, TRUE);
......
/*
* Copyright (C) 2010 Jiri Techet <techet@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "champlain-null-tile-source.h"
#include "champlain-debug.h"
#include "champlain-bounding-box.h"
#include "champlain-enum-types.h"
#include "champlain-tile.h"
G_DEFINE_TYPE (ChamplainNullTileSource, champlain_null_tile_source, CHAMPLAIN_TYPE_TILE_SOURCE)
static void fill_tile (ChamplainMapSource *map_source,
ChamplainTile *tile);
static void
champlain_null_tile_source_dispose (GObject *object)
{
G_OBJECT_CLASS (champlain_null_tile_source_parent_class)->dispose (object);
}
static void
champlain_null_tile_source_finalize (GObject *object)
{
G_OBJECT_CLASS (champlain_null_tile_source_parent_class)->finalize (object);
}
static void
champlain_null_tile_source_class_init (ChamplainNullTileSourceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ChamplainMapSourceClass *map_source_class = CHAMPLAIN_MAP_SOURCE_CLASS (klass);
object_class->dispose = champlain_null_tile_source_dispose;
object_class->finalize = champlain_null_tile_source_finalize;
map_source_class->fill_tile = fill_tile;
}
static void
champlain_null_tile_source_init (ChamplainNullTileSource *self)
{
g_return_if_fail (CHAMPLAIN_IS_NULL_TILE_SOURCE (self));
}
/*
* champlain_null_tile_source_new:
*
* Creates a new instance of #ChamplainNullTileSource.
*
* Returns: a new #ChamplainNullTileSource.
*
* Since: 0.8
*/
ChamplainNullTileSource *
champlain_null_tile_source_new (void)
{
ChamplainNullTileSource *source;
source = g_object_new (CHAMPLAIN_TYPE_NULL_TILE_SOURCE, NULL);
return source;
}
static void
tile_rendered_cb (ChamplainTile *tile,
ChamplainRenderCallbackData *data,
ChamplainMapSource *map_source)
{
ChamplainTileSource *tile_source = CHAMPLAIN_TILE_SOURCE (map_source);
ChamplainTileCache *tile_cache = champlain_tile_source_get_cache (tile_source);
ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
if (!data->error)
{
if (tile_cache && data->data)
champlain_tile_cache_store_tile (tile_cache, tile, data->data, data->size);
champlain_tile_set_fade_in (tile, TRUE);
champlain_tile_set_state (tile, CHAMPLAIN_STATE_DONE);
champlain_tile_display_content (tile);
}
else if (next_source)
champlain_map_source_fill_tile (next_source, tile);
g_object_unref (map_source);
g_signal_handlers_disconnect_by_func (tile, tile_rendered_cb, data);
}
static void
fill_tile (ChamplainMapSource *map_source,
ChamplainTile *tile)
{
g_return_if_fail (CHAMPLAIN_IS_NULL_TILE_SOURCE (map_source));
g_return_if_fail (CHAMPLAIN_IS_TILE (tile));
ChamplainRenderer *renderer;
renderer = champlain_map_source_get_renderer (map_source);
g_return_if_fail (CHAMPLAIN_IS_RENDERER (renderer));
g_object_ref (map_source);
g_signal_connect (tile, "render-complete", G_CALLBACK (tile_rendered_cb), map_source);
champlain_renderer_render (renderer, tile);
}
/*
* Copyright (C) 2008-2009 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
* Copyright (C) 2010 Jiri Techet <techet@gmail.com>
*
* This library is free software; you can redistribute it and/or
......@@ -21,41 +20,49 @@
#error "Only <champlain/champlain.h> can be included directly."
#endif
#ifndef _CHAMPLAIN_ERROR_TILE_SOURCE_H_
#define _CHAMPLAIN_ERROR_TILE_SOURCE_H_
#ifndef _CHAMPLAIN_NULL_TILE_SOURCE
#define _CHAMPLAIN_NULL_TILE_SOURCE
#include <glib-object.h>
#include <champlain/champlain-tile-source.h>
G_BEGIN_DECLS
#define CHAMPLAIN_TYPE_ERROR_TILE_SOURCE (champlain_error_tile_source_get_type ())
#define CHAMPLAIN_ERROR_TILE_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_ERROR_TILE_SOURCE, ChamplainErrorTileSource))
#define CHAMPLAIN_ERROR_TILE_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_ERROR_TILE_SOURCE, ChamplainErrorTileSourceClass))
#define CHAMPLAIN_IS_ERROR_TILE_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_ERROR_TILE_SOURCE))
#define CHAMPLAIN_IS_ERROR_TILE_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_ERROR_TILE_SOURCE))
#define CHAMPLAIN_ERROR_TILE_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_ERROR_TILE_SOURCE, ChamplainErrorTileSourceClass))
#define CHAMPLAIN_TYPE_NULL_TILE_SOURCE champlain_null_tile_source_get_type ()
typedef struct _ChamplainErrorTileSourcePrivate ChamplainErrorTileSourcePrivate;
#define CHAMPLAIN_NULL_TILE_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_NULL_TILE_SOURCE, ChamplainNullTileSource))
typedef struct _ChamplainErrorTileSource ChamplainErrorTileSource;
typedef struct _ChamplainErrorTileSourceClass ChamplainErrorTileSourceClass;
#define CHAMPLAIN_NULL_TILE_SOURCE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_NULL_TILE_SOURCE, ChamplainNullTileSourceClass))
struct _ChamplainErrorTileSource
{
ChamplainTileSource parent_instance;
#define CHAMPLAIN_IS_NULL_TILE_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_NULL_TILE_SOURCE))
#define CHAMPLAIN_IS_NULL_TILE_SOURCE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_NULL_TILE_SOURCE))
#define CHAMPLAIN_NULL_TILE_SOURCE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_NULL_TILE_SOURCE, ChamplainNullTileSourceClass))
ChamplainErrorTileSourcePrivate *priv;
};
typedef struct _ChamplainNullTileSourcePrivate ChamplainNullTileSourcePrivate;
struct _ChamplainErrorTileSourceClass
typedef struct
{
ChamplainTileSource parent;
} ChamplainNullTileSource;
typedef struct
{
ChamplainTileSourceClass parent_class;
};
} ChamplainNullTileSourceClass;
GType champlain_null_tile_source_get_type (void);
GType champlain_error_tile_source_get_type (void);
ChamplainNullTileSource *champlain_null_tile_source_new (void);
ChamplainErrorTileSource* champlain_error_tile_source_new_full (guint tile_size);
G_END_DECLS
#endif /* _CHAMPLAIN_ERROR_TILE_SOURCE_H_ */
#endif /* _CHAMPLAIN_NULL_TILE_SOURCE */
......@@ -39,7 +39,7 @@
#include "champlain/champlain-tile-cache.h"
#include "champlain/champlain-network-tile-source.h"
#include "champlain/champlain-file-cache.h"
#include "champlain/champlain-error-tile-source.h"
#include "champlain/champlain-null-tile-source.h"
#include "champlain/champlain-map-source-factory.h"
#include "champlain/champlain-version.h"
#include "champlain/champlain-bounding-box.h"
......@@ -47,6 +47,7 @@
#include "champlain/champlain-network-bbox-tile-source.h"
#include "champlain/champlain-renderer.h"
#include "champlain/champlain-image-renderer.h"
#include "champlain/champlain-error-tile-renderer.h"
#undef __CHAMPLAIN_CHAMPLAIN_H_INSIDE__
......
......@@ -439,7 +439,7 @@ map_source_changed (GtkWidget *widget, ChamplainView *view)
source_chain = champlain_map_source_chain_new ();
tile_size = champlain_map_source_get_tile_size (tile_source);
src = CHAMPLAIN_MAP_SOURCE(champlain_error_tile_source_new_full (tile_size));
src = champlain_map_source_factory_create_error_source (factory, tile_size);
champlain_map_source_chain_push (source_chain, src);
champlain_map_source_chain_push (source_chain, tile_source);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment