MapWidget

MapWidget — Provides a way of showing and interacting with maps. It is able to render maps from OpenStreetMap and supports zooming and markers.

Functions

Properties

gboolean draw-path Read / Write
gboolean markers-visible Read / Write
GObject * model Read / Write

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── ClutterActor
            ╰── LightwoodMapBase
                ╰── MapWidget

Description

MapWidget allows interacting with maps. It extends from LightwoodMapBase and is customized accordingly based on the Mildenhall variant requirements.

Freeing the widget

Call g_object_unref() to free the widget.

Sample C Code

How to create MapWidget

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
ThornburyModel *model = NULL;

map = p_map_widget_new ();
g_signal_connect (map, "marker-selected", G_CALLBACK (map_mark_selected), NULL);
g_object_set (map, "map-width", 728, "map-height", 480, "current-zoom-level",
		  15, NULL);

model = (ThornburyModel*) thornbury_list_model_new (COLUMN_LAST, G_TYPE_INT,
                                                   NULL, G_TYPE_FLOAT, NULL,
                                                   G_TYPE_FLOAT, NULL,
                                                   G_TYPE_STRING, NULL,
                                                   G_TYPE_STRING, NULL,
                                                   G_TYPE_STRING, NULL,
                                                   G_TYPE_BOOLEAN, NULL, -1);
g_object_set (map, "latitude", 52.522710, "longitude", 13.409951, NULL);

thornbury_model_append (model, COLUMN_VIEW_POINT_TYPE, 2, COLUMN_LATITUDE,
                       52.517664, COLUMN_LONGITUDE, 13.397060,
                       COLUMN_MARKER_NAME, "one", COLUMN_HIGHLIGHT_MARKER,
                       TRUE, -1);

thornbury_model_append (model, COLUMN_VIEW_POINT_TYPE, 3, COLUMN_LATITUDE,
                       52.516667, COLUMN_LONGITUDE, 13.400000,
                       COLUMN_NORMAL_IMAGE, "/var/lib/MILDENHALL_extensions/themes/blau/current.png",
                       COLUMN_SELECTED_IMAGE, "/var/lib/MILDENHALL_extensions/themes/blau/current_ac.png", -1);
thornbury_model_append (model, COLUMN_VIEW_POINT_TYPE, 3, COLUMN_LATITUDE,
                       52.522710, COLUMN_LONGITUDE, 13.409951, -1);
thornbury_model_append (model, COLUMN_VIEW_POINT_TYPE, 3, COLUMN_LATITUDE,
                       52.523755, COLUMN_LONGITUDE, 13.402038, -1);
thornbury_model_append (model, COLUMN_VIEW_POINT_TYPE, 3, COLUMN_LATITUDE,
                       52.522070, COLUMN_LONGITUDE, 13.397999, -1);

g_object_set (map, "model", model, NULL);
g_object_set (map, "draw-path", TRUE, NULL);

clutter_actor_add_child (stage, CLUTTER_ACTOR (map));

Example signal callback function for MapWidget::marker-selected

1
2
3
4
5
6
static gboolean
map_mark_selected (MapWidget *map, gchar *name, gpointer data)
{
  g_debug ("map_mark_selected: %s", name);
  return FALSE;
}

Functions

p_map_widget_new ()

MapWidget *
p_map_widget_new (void);

Creates a new Map view widget

Returns

a newly created MapWidget.

[transfer full]


map_widget_thumbnail_map_init ()

MapWidget *
map_widget_thumbnail_map_init ();

Creates a hidden map for thumbnails

Returns

Pointer to hidden map


map_widget_get_thumbnail_map ()

void
map_widget_get_thumbnail_map (gint width,
                              gint height,
                              gfloat latitude,
                              gfloat longitude);

width : width of the thumbnail height : height of thumbnail latitude : location of thumbnail longitude : location of thumbnail

Generates a thumbnail for the given location

Types and Values

Property Details

The “draw-path” property

  “draw-path”                gboolean

path handlingof the map widget.

Flags: Read / Write

Default value: FALSE


The “markers-visible” property

  “markers-visible”          gboolean

To ensure all markers and layers are visible.

Flags: Read / Write

Default value: FALSE


The “model” property

  “model”                    GObject *

model information of the map widget.

Flags: Read / Write

See Also

ThornburyItemFactory, LightwoodMapBase