static void create_marker (EogImage *image, EogMapPlugin *plugin) { gdouble lon, lat; if (!image) return; if (!eog_image_has_data (image, EOG_IMAGE_DATA_EXIF) && !eog_image_load (image, EOG_IMAGE_DATA_EXIF, NULL, NULL)) return; if (get_coordinates (image, &lat, &lon)) { ChamplainLabel *marker; marker = CHAMPLAIN_LABEL (champlain_label_new ()); champlain_label_set_draw_background (CHAMPLAIN_LABEL (marker), FALSE); update_marker_image (marker, GTK_ICON_SIZE_MENU); g_object_set_data_full (G_OBJECT (image), "marker", marker, (GDestroyNotify) clutter_actor_destroy); g_object_set_data (G_OBJECT (marker), "image", image); champlain_location_set_location (CHAMPLAIN_LOCATION (marker), lat, lon); champlain_marker_layer_add_marker (plugin->layer, CHAMPLAIN_MARKER (marker)); g_signal_connect (marker, "button-release-event", G_CALLBACK (change_image), plugin); } }
void gth_map_view_real_set_file (GthPropertyView *base, GthFileData *file_data) { GthMapView *self = GTH_MAP_VIEW (base); int coordinates_available; double latitude; double longitude; coordinates_available = 0; if (file_data != NULL) { GthMetadata *metadata; metadata = (GthMetadata *) g_file_info_get_attribute_object (file_data->info, "Exif::GPSInfo::GPSLatitude"); if (metadata != NULL) { latitude = exif_coordinate_to_decimal (gth_metadata_get_raw (metadata)); metadata = (GthMetadata *) g_file_info_get_attribute_object (file_data->info, "Exif::GPSInfo::GPSLatitudeRef"); if (metadata != NULL) { if (g_strcmp0 (gth_metadata_get_raw (metadata), "S") == 0) latitude = - latitude; } coordinates_available++; } metadata = (GthMetadata *) g_file_info_get_attribute_object (file_data->info, "Exif::GPSInfo::GPSLongitude"); if (metadata != NULL) { longitude = exif_coordinate_to_decimal (gth_metadata_get_raw (metadata)); metadata = (GthMetadata *) g_file_info_get_attribute_object (file_data->info, "Exif::GPSInfo::GPSLongitudeRef"); if (metadata != NULL) { if (g_strcmp0 (gth_metadata_get_raw (metadata), "W") == 0) longitude = - longitude; } coordinates_available++; } } if (coordinates_available == 2) { char *position; gtk_widget_hide (self->priv->no_gps_label); gtk_widget_show (self->priv->embed); position = decimal_coordinates_to_string (latitude, longitude); champlain_label_set_text (CHAMPLAIN_LABEL (self->priv->marker), position); g_free (position); champlain_location_set_location (CHAMPLAIN_LOCATION (self->priv->marker), latitude, longitude); champlain_view_center_on (CHAMPLAIN_VIEW (self->priv->map_view), latitude, longitude); } else { gtk_widget_hide (self->priv->embed); gtk_widget_show (self->priv->no_gps_label); } }
static ChamplainMarker * add_marker(PlacemarksPlugin *plugin, const gchar *name, gdouble lat, gdouble lon) { PlacemarksPluginPrivate *priv; priv = PLACEMARKS_PLUGIN (plugin)->priv; ChamplainMarker *marker; ClutterColor orange = { 0xf3, 0x94, 0x07, 0xbb }; marker = CHAMPLAIN_MARKER ( champlain_label_new_with_text (name, "Serif 14", NULL, NULL)); champlain_label_set_use_markup (CHAMPLAIN_LABEL (marker), TRUE); champlain_label_set_alignment (CHAMPLAIN_LABEL (marker), PANGO_ALIGN_RIGHT); champlain_label_set_color (CHAMPLAIN_LABEL (marker), &orange); champlain_location_set_location (CHAMPLAIN_LOCATION(marker), lat, lon); champlain_marker_layer_add_marker (priv->markers_layer, CHAMPLAIN_MARKER (marker)); return marker; }
static void show_text_markers (ClutterActor *actor, ClutterEvent *event, PhidiasItemsGeo *item) { GList *markers; GList *iter; ChamplainLabel *m; if (item->priv->show_text == TRUE) return; markers = g_hash_table_get_values (item->priv->markers); for (iter = markers; iter; iter = g_list_next (iter)) { m = CHAMPLAIN_LABEL (iter->data); champlain_label_set_image (m, NULL); champlain_label_set_font_name (m, "Serif 9"); } g_list_free (markers); item->priv->show_text = TRUE; }
static void show_point_markers (ClutterActor *actor, ClutterEvent *event, PhidiasItemsGeo *item) { GList *markers; GList *iter; ClutterActor *icon; ChamplainLabel *m; if (item->priv->show_text == FALSE) return; markers = g_hash_table_get_values (item->priv->markers); for (iter = markers; iter; iter = g_list_next (iter)) { m = CHAMPLAIN_LABEL (iter->data); icon = g_object_get_data (G_OBJECT (m), "icon"); champlain_label_set_image (m, icon); champlain_label_set_font_name (m, "Serif 0"); } g_list_free (markers); item->priv->show_text = FALSE; }
static gboolean add_marker (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { int latitude_offset; int longitude_offset; double lat; double lon; gchar *title; gchar *latitude_str; gchar *longitude_str; gchar *check; ClutterActor *marker; ClutterActor *icon; PhidiasItemsGeo *item; item = data; latitude_offset = phidias_extra_column_get_index ((PhidiasExtraColumn*) g_ptr_array_index (item->priv->extras, 0)); longitude_offset = phidias_extra_column_get_index ((PhidiasExtraColumn*) g_ptr_array_index (item->priv->extras, 1)); gtk_tree_model_get (model, iter, ITEM_INFO_TITLE, &title, latitude_offset, &latitude_str, longitude_offset, &longitude_str, -1); if (latitude_str == NULL || longitude_str == NULL) goto end; check = NULL; lat = strtod (latitude_str, &check); if (*check != '\0') goto end; check = NULL; lon = strtod (longitude_str, &check); if (*check != '\0') goto end; check = g_markup_escape_text (title, -1); g_free (title); title = check; /* TODO Provide a proper ChamplainMarker implementation, able to store the icon, the title, the description, and able to react to clicks */ icon = do_marker_icon ("go-jump", 22); if (item->priv->show_text) { marker = champlain_label_new_with_text (title, "Serif 9", NULL, NULL); } else { marker = champlain_label_new_with_text (title, "Serif 0", NULL, NULL); champlain_label_set_image (CHAMPLAIN_LABEL (marker), icon); } g_object_set_data (G_OBJECT (marker), "icon", icon); champlain_location_set_location (CHAMPLAIN_LOCATION (marker), lat, lon); champlain_marker_layer_add_marker (item->priv->current_layer, CHAMPLAIN_MARKER (marker)); g_hash_table_insert (item->priv->markers, gtk_tree_path_to_string (path), marker); end: if (title != NULL) g_free (title); if (latitude_str != NULL) g_free (latitude_str); if (longitude_str != NULL) g_free (longitude_str); return FALSE; }