/*
- * Copyright (C) 2008 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
+ * Copyright (C) 2008, 2009 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
GParamSpec *pspec)
{
ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE(object);
- ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
switch(prop_id)
{
GParamSpec *pspec)
{
ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE(object);
- ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
switch(prop_id)
{
champlain_map_source_finalize (GObject *object)
{
ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE (object);
- ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
g_free (priv->name);
g_free (priv->license);
static void
champlain_map_source_init (ChamplainMapSource *champlainMapSource)
{
- //ChamplainMapSourcePrivate *priv = GET_PRIVATE (champlainMapSource);
+ ChamplainMapSourcePrivate *priv = GET_PRIVATE (champlainMapSource);
+ champlainMapSource->priv = priv;
}
gint
champlain_map_source_get_max_zoom_level (ChamplainMapSource *map_source)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
return priv->max_zoom_level;
}
gint
champlain_map_source_get_min_zoom_level (ChamplainMapSource *map_source)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
return priv->min_zoom_level;
}
guint
champlain_map_source_get_tile_size (ChamplainMapSource *map_source)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
return priv->tile_size;
}
gint zoom_level,
gdouble longitude)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
// FIXME: support other projections
return ((longitude + 180.0) / 360.0 * pow(2.0, zoom_level)) * priv->tile_size;
}
gint zoom_level,
gdouble latitude)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
// FIXME: support other projections
return ((1.0 - log (tan (latitude * M_PI / 180.0) + 1.0 /
cos (latitude * M_PI / 180.0)) /
champlain_map_source_get_row_count (ChamplainMapSource *map_source,
gint zoom_level)
{
- //ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ //ChamplainMapSourcePrivate *priv = map_source->priv;
// FIXME: support other projections
return pow (2, zoom_level);
}
champlain_map_source_get_column_count (ChamplainMapSource *map_source,
gint zoom_level)
{
- //ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ //ChamplainMapSourcePrivate *priv = map_source->priv;
// FIXME: support other projections
return pow (2, zoom_level);
}
gint zoom_level,
guint x)
{
- //ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ //ChamplainMapSourcePrivate *priv = map_source->priv;
// FIXME: support other projections
gdouble dx = (float)x / champlain_map_source_get_tile_size (map_source);
return dx / pow (2.0, zoom_level) * 360.0 - 180;
gint zoom_level,
guint y)
{
- //ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ //ChamplainMapSourcePrivate *priv = map_source->priv;
// FIXME: support other projections
gdouble dy = (float)y / champlain_map_source_get_tile_size (map_source);
double n = M_PI - 2.0 * M_PI * dy / pow (2.0, zoom_level);
const gchar *
champlain_map_source_get_name (ChamplainMapSource *map_source)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
return priv->name;
}
champlain_map_source_set_name (ChamplainMapSource *map_source,
const gchar *name)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
priv->name = g_strdup (name);
}
const gchar *
champlain_map_source_get_license (ChamplainMapSource *map_source)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
return priv->license;
}
champlain_map_source_set_license (ChamplainMapSource *map_source,
const gchar *license)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
priv->license = g_strdup (license);
}