From: Debarshi Ray Date: Wed, 1 Apr 2009 21:11:44 +0000 (+0300) Subject: Fix Bug 577592 for ChamplainMapSource X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02d54aed5154e238ec3c910709339800edc156f1;p=libchamplain Fix Bug 577592 for ChamplainMapSource --- diff --git a/champlain/champlain-map-source.c b/champlain/champlain-map-source.c index 4bb4230..852cb0a 100644 --- a/champlain/champlain-map-source.c +++ b/champlain/champlain-map-source.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Pierre-Luc Beaudoin + * Copyright (C) 2008, 2009 Pierre-Luc Beaudoin * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -79,7 +79,7 @@ champlain_map_source_get_property (GObject *object, GParamSpec *pspec) { ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE(object); - ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source); + ChamplainMapSourcePrivate *priv = map_source->priv; switch(prop_id) { @@ -116,7 +116,7 @@ champlain_map_source_set_property (GObject *object, GParamSpec *pspec) { ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE(object); - ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source); + ChamplainMapSourcePrivate *priv = map_source->priv; switch(prop_id) { @@ -151,7 +151,7 @@ static void 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); @@ -282,27 +282,28 @@ champlain_map_source_class_init (ChamplainMapSourceClass *klass) 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; } @@ -311,7 +312,7 @@ champlain_map_source_get_x (ChamplainMapSource *map_source, 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; } @@ -321,7 +322,7 @@ champlain_map_source_get_y (ChamplainMapSource *map_source, 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)) / @@ -332,7 +333,7 @@ guint 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); } @@ -341,7 +342,7 @@ guint 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); } @@ -371,7 +372,7 @@ champlain_map_source_get_longitude (ChamplainMapSource *map_source, 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; @@ -382,7 +383,7 @@ champlain_map_source_get_latitude (ChamplainMapSource *map_source, 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); @@ -392,7 +393,7 @@ champlain_map_source_get_latitude (ChamplainMapSource *map_source, const gchar * champlain_map_source_get_name (ChamplainMapSource *map_source) { - ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source); + ChamplainMapSourcePrivate *priv = map_source->priv; return priv->name; } @@ -400,7 +401,7 @@ void 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); } @@ -408,7 +409,7 @@ champlain_map_source_set_name (ChamplainMapSource *map_source, const gchar * champlain_map_source_get_license (ChamplainMapSource *map_source) { - ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source); + ChamplainMapSourcePrivate *priv = map_source->priv; return priv->license; } @@ -416,7 +417,7 @@ void 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); }