Commit 46b99dfa2bb68987eedc6a15e1aca8850feb5af0
- Diff rendering mode:
- inline
- side by side
champlain/champlainview.c
(11 / 11)
|   | |||
| 162 | 162 | resize_viewport(view); | |
| 163 | 163 | clutter_container_remove_actor (CLUTTER_CONTAINER (priv->map_layer), group); | |
| 164 | 164 | 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); | ||
| 166 | 166 | ||
| 167 | 167 | g_object_notify(G_OBJECT(view), "zoom-level"); | |
| 168 | 168 | } | |
| … | … | ||
| 288 | 288 | ||
| 289 | 289 | if (center) | |
| 290 | 290 | { | |
| 291 | champlain_view_center_on(view, priv->longitude, priv->latitude); | ||
| 291 | champlain_view_center_on(view, priv->latitude, priv->longitude); | ||
| 292 | 292 | } | |
| 293 | 293 | } | |
| 294 | 294 | ||
| … | … | ||
| 348 | 348 | { | |
| 349 | 349 | gdouble lon = g_value_get_double(value); | |
| 350 | 350 | gdouble lat = viewport_get_current_latitude(priv); | |
| 351 | champlain_view_center_on(view, lon, lat); | ||
| 351 | champlain_view_center_on(view, lat, lon); | ||
| 352 | 352 | break; | |
| 353 | 353 | } | |
| 354 | 354 | case PROP_LATITUDE: | |
| 355 | 355 | { | |
| 356 | 356 | gdouble lon = viewport_get_current_longitude(priv); | |
| 357 | 357 | gdouble lat = g_value_get_double(value); | |
| 358 | champlain_view_center_on(view, lon, lat); | ||
| 358 | champlain_view_center_on(view, lat, lon); | ||
| 359 | 359 | break; | |
| 360 | 360 | } | |
| 361 | 361 | case PROP_ZOOM_LEVEL: | |
| … | … | ||
| 366 | 366 | if (level != priv->map->current_level->level) | |
| 367 | 367 | { | |
| 368 | 368 | ClutterActor *group = priv->map->current_level->group; | |
| 369 | gdouble lon = viewport_get_current_longitude(priv); | ||
| 370 | 369 | gdouble lat = viewport_get_current_latitude(priv); | |
| 370 | gdouble lon = viewport_get_current_longitude(priv); | ||
| 371 | 371 | if (map_zoom_to(priv->map, level)) | |
| 372 | 372 | { | |
| 373 | 373 | resize_viewport(view); | |
| 374 | 374 | clutter_container_remove_actor (CLUTTER_CONTAINER (priv->map_layer), group); | |
| 375 | 375 | 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); | ||
| 377 | 377 | } | |
| 378 | 378 | } | |
| 379 | 379 | } | |
| … | … | ||
| 654 | 654 | /** | |
| 655 | 655 | * champlain_view_center_on: | |
| 656 | 656 | * @view: a #ChamplainView | |
| 657 | * @longitude: the longitude to center the map at | ||
| 658 | 657 | * @latitude: the longitude to center the map at | |
| 658 | * @longitude: the longitude to center the map at | ||
| 659 | 659 | * | |
| 660 | 660 | * Centers the map on these coordinates. | |
| 661 | 661 | * | |
| … | … | ||
| 663 | 663 | */ | |
| 664 | 664 | // FIXME: Animate this. Can be done in Tidy-Adjustment (like for elastic effect) | |
| 665 | 665 | void | |
| 666 | champlain_view_center_on (ChamplainView *view, gdouble longitude, gdouble latitude) | ||
| 666 | champlain_view_center_on (ChamplainView *view, gdouble latitude, gdouble longitude) | ||
| 667 | 667 | { | |
| 668 | 668 | ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (view); | |
| 669 | 669 | ||
| … | … | ||
| 743 | 743 | resize_viewport(view); | |
| 744 | 744 | clutter_container_remove_actor (CLUTTER_CONTAINER (priv->map_layer), group); | |
| 745 | 745 | 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); | ||
| 747 | 747 | ||
| 748 | 748 | g_object_notify(G_OBJECT(view), "zoom-level"); | |
| 749 | 749 | } | |
| … | … | ||
| 770 | 770 | resize_viewport(view); | |
| 771 | 771 | clutter_container_remove_actor (CLUTTER_CONTAINER (priv->map_layer), group); | |
| 772 | 772 | 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); | ||
| 774 | 774 | ||
| 775 | 775 | g_object_notify(G_OBJECT(view), "zoom-level"); | |
| 776 | 776 | } | |
| … | … | ||
| 795 | 795 | if(priv->map) | |
| 796 | 796 | marker_reposition(view); | |
| 797 | 797 | ||
| 798 | g_signal_connect (layer, | ||
| 798 | g_signal_connect_after (layer, | ||
| 799 | 799 | "add", | |
| 800 | 800 | G_CALLBACK (layer_add_marker_cb), | |
| 801 | 801 | view); |
champlain/champlainview.h
(1 / 1)
|   | |||
| 81 | 81 | ||
| 82 | 82 | ClutterActor *champlain_view_new (ChamplainViewMode mode); | |
| 83 | 83 | ||
| 84 | void champlain_view_center_on (ChamplainView *view, gdouble longitude, gdouble latitude); | ||
| 84 | void champlain_view_center_on (ChamplainView *view, gdouble latitude, gdouble longitude); | ||
| 85 | 85 | ||
| 86 | 86 | void champlain_view_zoom_in (ChamplainView *champlainView); | |
| 87 | 87 |
champlain/launcher.c
(4 / 4)
|   | |||
| 31 | 31 | ClutterColor orange = { 0xf3, 0x94, 0x07, 0xbb }; | |
| 32 | 32 | ClutterColor white = { 0xff, 0xff, 0xff, 0xff }; | |
| 33 | 33 | 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); | ||
| 35 | 35 | clutter_container_add(CLUTTER_CONTAINER(layer), marker, NULL); | |
| 36 | 36 | ||
| 37 | 37 | 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); | ||
| 39 | 39 | clutter_container_add(CLUTTER_CONTAINER(layer), marker, NULL); | |
| 40 | 40 | ||
| 41 | 41 | 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); | ||
| 43 | 43 | clutter_container_add(CLUTTER_CONTAINER(layer), marker, NULL); | |
| 44 | 44 | ||
| 45 | 45 | clutter_actor_hide(layer); | |
| … | … | ||
| 66 | 66 | champlain_view_add_layer(actor, layer); | |
| 67 | 67 | ||
| 68 | 68 | 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); | ||
| 70 | 70 | ||
| 71 | 71 | clutter_actor_show (stage); | |
| 72 | 72 | clutter_main (); |

