[libchamplain] Revert "clutter_actor_set_position can now happen in ChamplainTile"
- From: Pierre-Luc Beaudoin <plbeaudoin src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libchamplain] Revert "clutter_actor_set_position can now happen in ChamplainTile"
- Date: Fri, 11 Sep 2009 21:47:04 +0000 (UTC)
commit 04a025af5bfa83f0b6e73a4341e88286f88a028a
Author: Pierre-Luc Beaudoin <pierre-luc pierlux com>
Date: Fri Sep 11 16:52:37 2009 -0400
Revert "clutter_actor_set_position can now happen in ChamplainTile"
This reverts commit 8b697b0bc069be83989548fe86c8ee3eb94569af.
champlain/champlain-tile.c | 26 +++-----------------------
champlain/champlain-view.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 23 deletions(-)
---
diff --git a/champlain/champlain-tile.c b/champlain/champlain-tile.c
index b7d0f1a..b9a731a 100644
--- a/champlain/champlain-tile.c
+++ b/champlain/champlain-tile.c
@@ -555,14 +555,7 @@ champlain_tile_set_x (ChamplainTile *self,
{
g_return_if_fail (CHAMPLAIN_TILE (self));
- ChamplainTilePrivate *priv = self->priv;
-
- priv->x = x;
-
- if (priv->actor != NULL)
- clutter_actor_set_position (priv->actor,
- priv->x * priv->size,
- priv->y * priv->size);
+ self->priv->x = x;
g_object_notify (G_OBJECT (self), "x");
}
@@ -582,13 +575,7 @@ champlain_tile_set_y (ChamplainTile *self,
{
g_return_if_fail (CHAMPLAIN_TILE (self));
- ChamplainTilePrivate *priv = self->priv;
-
- priv->y = y;
- if (priv->actor != NULL)
- clutter_actor_set_position (priv->actor,
- priv->x * priv->size,
- priv->y * priv->size);
+ self->priv->y = y;
g_object_notify (G_OBJECT (self), "y");
}
@@ -628,14 +615,7 @@ champlain_tile_set_size (ChamplainTile *self,
{
g_return_if_fail (CHAMPLAIN_TILE (self));
- ChamplainTilePrivate *priv = self->priv;
-
- priv->size = size;
-
- if (priv->actor != NULL)
- clutter_actor_set_position (priv->actor,
- priv->x * priv->size,
- priv->y * priv->size);
+ self->priv->size = size;
g_object_notify (G_OBJECT (self), "size");
}
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index ffb4b6a..db092dc 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -197,6 +197,8 @@ static gboolean finger_scroll_button_press_cb (ClutterActor *actor,
static void update_license (ChamplainView *view);
static void license_set_position (ChamplainView *view);
static void view_load_visible_tiles (ChamplainView *view);
+static void view_position_tile (ChamplainView* view, ChamplainTile* tile);
+static void view_tiles_reposition (ChamplainView* view);
static void view_update_state (ChamplainView *view);
static gboolean view_set_zoom_level_at (ChamplainView *view,
gint zoom_level,
@@ -346,6 +348,7 @@ create_initial_map (ChamplainView *view)
clutter_container_add_actor (CLUTTER_CONTAINER (priv->map_layer), group);
g_idle_add (marker_reposition, view);
+ view_tiles_reposition (view);
update_license (view);
g_object_notify (G_OBJECT (view), "zoom-level");
@@ -1049,6 +1052,7 @@ viewport_pos_changed_cb (GObject *gobject,
priv->viewport_size.y = rect.y;
view_load_visible_tiles (view);
+ view_tiles_reposition (view);
marker_reposition (view);
view_update_polygons (view);
@@ -1303,6 +1307,7 @@ champlain_view_center_on (ChamplainView *view,
g_object_notify (G_OBJECT (view), "latitude");
view_load_visible_tiles (view);
+ view_tiles_reposition (view);
view_update_polygons (view);
marker_reposition (view);
}
@@ -1816,10 +1821,47 @@ view_load_visible_tiles (ChamplainView *view)
}
static void
+view_position_tile (ChamplainView* view,
+ ChamplainTile* tile)
+{
+ ClutterActor *actor;
+ gint x;
+ gint y;
+ guint size;
+
+ actor = champlain_tile_get_actor (tile);
+ x = champlain_tile_get_x (tile);
+ y = champlain_tile_get_y (tile);
+ size = champlain_tile_get_size (tile);
+
+ clutter_actor_set_position (actor, (x * size), (y * size));
+}
+
+static void
+view_tiles_reposition (ChamplainView* view)
+{
+ ChamplainViewPrivate *priv = view->priv;
+ gint i;
+ return;
+
+ for (i = 0; i < champlain_zoom_level_tile_count (priv->map->current_level); i++)
+ {
+ ChamplainTile *tile = champlain_zoom_level_get_nth_tile (priv->map->current_level, i);
+
+ if (tile == NULL)
+ continue;
+
+ if (champlain_tile_get_state (tile) == CHAMPLAIN_STATE_DONE)
+ view_position_tile (view, tile);
+ }
+}
+
+static void
tile_state_notify (GObject *gobject,
GParamSpec *pspec,
gpointer data)
{
+ view_position_tile (CHAMPLAIN_VIEW (data), CHAMPLAIN_TILE (gobject));
view_update_state (CHAMPLAIN_VIEW (data));
}
@@ -1907,6 +1949,7 @@ champlain_view_set_map_source (ChamplainView *view,
update_license (view);
g_idle_add (marker_reposition, view);
+ view_tiles_reposition (view);
champlain_view_center_on (view, priv->latitude, priv->longitude);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]