Commit 46b99dfa2bb68987eedc6a15e1aca8850feb5af0

  • avatar
  • Pierre-Luc Beaudoin <pierre-luc @squ…dy.info>
  • Tue Sep 16 15:06:14 GMT 2008
Use (lat, lon) instead of (lon, lat)
champlain/champlainview.c
(11 / 11)
  
162162 resize_viewport(view);
163163 clutter_container_remove_actor (CLUTTER_CONTAINER (priv->map_layer), group);
164164 clutter_container_add_actor (CLUTTER_CONTAINER (priv->map_layer), priv->map->current_level->group);
165 champlain_view_center_on(view, lon2, lat2);
165 champlain_view_center_on(view, lat2, lon2);
166166
167167 g_object_notify(G_OBJECT(view), "zoom-level");
168168 }
288288
289289 if (center)
290290 {
291 champlain_view_center_on(view, priv->longitude, priv->latitude);
291 champlain_view_center_on(view, priv->latitude, priv->longitude);
292292 }
293293}
294294
348348 {
349349 gdouble lon = g_value_get_double(value);
350350 gdouble lat = viewport_get_current_latitude(priv);
351 champlain_view_center_on(view, lon, lat);
351 champlain_view_center_on(view, lat, lon);
352352 break;
353353 }
354354 case PROP_LATITUDE:
355355 {
356356 gdouble lon = viewport_get_current_longitude(priv);
357357 gdouble lat = g_value_get_double(value);
358 champlain_view_center_on(view, lon, lat);
358 champlain_view_center_on(view, lat, lon);
359359 break;
360360 }
361361 case PROP_ZOOM_LEVEL:
366366 if (level != priv->map->current_level->level)
367367 {
368368 ClutterActor *group = priv->map->current_level->group;
369 gdouble lon = viewport_get_current_longitude(priv);
370369 gdouble lat = viewport_get_current_latitude(priv);
370 gdouble lon = viewport_get_current_longitude(priv);
371371 if (map_zoom_to(priv->map, level))
372372 {
373373 resize_viewport(view);
374374 clutter_container_remove_actor (CLUTTER_CONTAINER (priv->map_layer), group);
375375 clutter_container_add_actor (CLUTTER_CONTAINER (priv->map_layer), priv->map->current_level->group);
376 champlain_view_center_on(view, lon, lat);
376 champlain_view_center_on(view, lat, lon);
377377 }
378378 }
379379 }
654654/**
655655 * champlain_view_center_on:
656656 * @view: a #ChamplainView
657 * @longitude: the longitude to center the map at
658657 * @latitude: the longitude to center the map at
658 * @longitude: the longitude to center the map at
659659 *
660660 * Centers the map on these coordinates.
661661 *
663663 */
664664// FIXME: Animate this. Can be done in Tidy-Adjustment (like for elastic effect)
665665void
666champlain_view_center_on (ChamplainView *view, gdouble longitude, gdouble latitude)
666champlain_view_center_on (ChamplainView *view, gdouble latitude, gdouble longitude)
667667{
668668 ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (view);
669669
743743 resize_viewport(view);
744744 clutter_container_remove_actor (CLUTTER_CONTAINER (priv->map_layer), group);
745745 clutter_container_add_actor (CLUTTER_CONTAINER (priv->map_layer), priv->map->current_level->group);
746 champlain_view_center_on(view, lon, lat);
746 champlain_view_center_on(view, lat, lon);
747747
748748 g_object_notify(G_OBJECT(view), "zoom-level");
749749 }
770770 resize_viewport(view);
771771 clutter_container_remove_actor (CLUTTER_CONTAINER (priv->map_layer), group);
772772 clutter_container_add_actor (CLUTTER_CONTAINER (priv->map_layer), priv->map->current_level->group);
773 champlain_view_center_on(view, lon, lat);
773 champlain_view_center_on(view, lat, lon);
774774
775775 g_object_notify(G_OBJECT(view), "zoom-level");
776776 }
795795 if(priv->map)
796796 marker_reposition(view);
797797
798 g_signal_connect (layer,
798 g_signal_connect_after (layer,
799799 "add",
800800 G_CALLBACK (layer_add_marker_cb),
801801 view);
champlain/champlainview.h
(1 / 1)
  
8181
8282ClutterActor *champlain_view_new (ChamplainViewMode mode);
8383
84void champlain_view_center_on (ChamplainView *view, gdouble longitude, gdouble latitude);
84void champlain_view_center_on (ChamplainView *view, gdouble latitude, gdouble longitude);
8585
8686void champlain_view_zoom_in (ChamplainView *champlainView);
8787
champlain/launcher.c
(4 / 4)
  
3131 ClutterColor orange = { 0xf3, 0x94, 0x07, 0xbb };
3232 ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
3333 marker = champlain_marker_new_with_label("Montréal", "Airmole 14", NULL, NULL);
34 champlain_marker_set_position(CHAMPLAIN_MARKER(marker), -73.563788, 45.528178);
34 champlain_marker_set_position(CHAMPLAIN_MARKER(marker), 45.528178, -73.563788);
3535 clutter_container_add(CLUTTER_CONTAINER(layer), marker, NULL);
3636
3737 marker = champlain_marker_new_with_label("New York", "Sans 25", &white, NULL);
38 champlain_marker_set_position(CHAMPLAIN_MARKER(marker), -73.98, 40.77);
38 champlain_marker_set_position(CHAMPLAIN_MARKER(marker), 40.77, -73.98);
3939 clutter_container_add(CLUTTER_CONTAINER(layer), marker, NULL);
4040
4141 marker = champlain_marker_new_with_label("Saint-Tite-des-Caps", "Serif 12", NULL, &orange);
42 champlain_marker_set_position(CHAMPLAIN_MARKER(marker), -70.764141, 47.130885);
42 champlain_marker_set_position(CHAMPLAIN_MARKER(marker), 47.130885, -70.764141);
4343 clutter_container_add(CLUTTER_CONTAINER(layer), marker, NULL);
4444
4545 clutter_actor_hide(layer);
6666 champlain_view_add_layer(actor, layer);
6767
6868 clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
69 champlain_view_center_on(CHAMPLAIN_VIEW(actor), -73.75, 45.466);
69 champlain_view_center_on(CHAMPLAIN_VIEW(actor), 45.466, -73.75);
7070
7171 clutter_actor_show (stage);
7272 clutter_main ();

Comments

Add a new comment:

Login or create an account to post a comment

Add your comment