[libchamplain] clutter_actor_set_position can now happen in ChamplainTile



commit 8b697b0bc069be83989548fe86c8ee3eb94569af
Author: Pierre-Luc Beaudoin <pierre-luc pierlux com>
Date:   Mon May 18 21:26:44 2009 -0400

    clutter_actor_set_position can now happen in ChamplainTile
    
    Since anchor (which was in ChamplainView) has disapeared

 champlain/champlain-tile.c |   12 ++++++++++++
 champlain/champlain-view.c |   43 -------------------------------------------
 2 files changed, 12 insertions(+), 43 deletions(-)
---
diff --git a/champlain/champlain-tile.c b/champlain/champlain-tile.c
index b666b7e..07ff07b 100644
--- a/champlain/champlain-tile.c
+++ b/champlain/champlain-tile.c
@@ -565,6 +565,11 @@ champlain_tile_set_x (ChamplainTile *self,
   ChamplainTilePrivate *priv = GET_PRIVATE (self);
 
   priv->x = x;
+
+  if (priv->actor != NULL)
+    clutter_actor_set_position (priv->actor, priv->x * priv->size,
+        priv->y * priv->size);
+
   g_object_notify (G_OBJECT (self), "x");
 }
 
@@ -586,6 +591,9 @@ champlain_tile_set_y (ChamplainTile *self,
   ChamplainTilePrivate *priv = GET_PRIVATE (self);
 
   priv->y = y;
+  if (priv->actor != NULL)
+    clutter_actor_set_position (priv->actor, priv->x * priv->size,
+        priv->y * priv->size);
   g_object_notify (G_OBJECT (self), "y");
 }
 
@@ -628,6 +636,10 @@ champlain_tile_set_size (ChamplainTile *self,
   ChamplainTilePrivate *priv = GET_PRIVATE (self);
 
   priv->size = size;
+
+  if (priv->actor != NULL)
+    clutter_actor_set_position (priv->actor, priv->x * priv->size,
+        priv->y * priv->size);
   g_object_notify (G_OBJECT (self), "size");
 }
 
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 2714e1e..36d1ce1 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -198,8 +198,6 @@ 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,
@@ -342,7 +340,6 @@ 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");
@@ -1040,7 +1037,6 @@ viewport_x_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);
 
@@ -1166,7 +1162,6 @@ 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);
 }
@@ -1662,47 +1657,10 @@ 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));
 }
 
@@ -1790,7 +1748,6 @@ 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]