]> err.no Git - libchamplain/commitdiff
Revert "clutter_actor_set_position can now happen in ChamplainTile"
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Fri, 11 Sep 2009 20:52:37 +0000 (16:52 -0400)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Fri, 11 Sep 2009 20:52:37 +0000 (16:52 -0400)
This reverts commit 8b697b0bc069be83989548fe86c8ee3eb94569af.

champlain/champlain-tile.c
champlain/champlain-view.c

index b7d0f1ab9db4019da4e9bedda5e7270cd716c7a7..b9a731a68ca63198226f06f2d35239ade2935bb9 100644 (file)
@@ -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");
 }
index ffb4b6abdf8e6b3da280cc53002ef62127881a00..db092dc409870244e13ff6fe89be2d117acfd4b6 100644 (file)
@@ -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);
 }
@@ -1815,11 +1820,48 @@ view_load_visible_tiles (ChamplainView *view)
   view_update_state (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);
 }