{
return g_object_new (CHAMPLAIN_TYPE_LAYER, NULL);
}
+
+/**
+ * champlain_layer_add_marker:
+ * @layer: a #ChamplainLayer
+ * @marker: a #ChamplainBaseMarker
+ *
+ * Adds the marker to the layer.
+ *
+ * Since: 0.4
+ */
+void
+champlain_layer_add_marker (ChamplainLayer *layer,
+ ChamplainBaseMarker *marker)
+{
+ g_return_if_fail (CHAMPLAIN_IS_LAYER (layer));
+ g_return_if_fail (CHAMPLAIN_IS_BASE_MARKER (marker));
+
+ clutter_container_add (CLUTTER_CONTAINER (layer), CLUTTER_ACTOR (marker), NULL);
+}
+
+/**
+ * champlain_layer_remove_marker:
+ * @layer: a #ChamplainLayer
+ * @marker: a #ChamplainBaseMarker
+ *
+ * Removes the marker from the layer.
+ *
+ * Since: 0.4
+ */
+void
+champlain_layer_remove_marker (ChamplainLayer *layer,
+ ChamplainBaseMarker *marker)
+{
+ g_return_if_fail (CHAMPLAIN_IS_LAYER (layer));
+ g_return_if_fail (CHAMPLAIN_IS_BASE_MARKER (marker));
+
+ clutter_container_remove (CLUTTER_CONTAINER (layer), CLUTTER_ACTOR (marker), NULL);
+}
+
+/**
+ * champlain_layer_show:
+ * @layer: a #ChamplainLayer
+ *
+ * Makes the layer and its markers visible.
+ *
+ * Since: 0.4
+ */
+void
+champlain_layer_show (ChamplainLayer *layer)
+{
+ g_return_if_fail (CHAMPLAIN_IS_LAYER (layer));
+
+ clutter_actor_show (CLUTTER_ACTOR (layer));
+}
+
+/**
+ * champlain_layer_hide:
+ * @layer: a #ChamplainLayer
+ *
+ * Makes the layer and its markers invisible.
+ *
+ * Since: 0.4
+ */
+void
+champlain_layer_hide (ChamplainLayer *layer)
+{
+ g_return_if_fail (CHAMPLAIN_IS_LAYER (layer));
+
+ clutter_actor_hide (CLUTTER_ACTOR (layer));
+}
#define CHAMPLAIN_LAYER_H
#include <champlain/champlain-defines.h>
+#include <champlain/champlain-base-marker.h>
#include <glib-object.h>
#include <clutter/clutter.h>
ChamplainLayer* champlain_layer_new (void);
+void champlain_layer_show (ChamplainLayer *layer);
+void champlain_layer_hide (ChamplainLayer *layer);
+
+void champlain_layer_add_marker (ChamplainLayer *layer,
+ ChamplainBaseMarker *marker);
+void champlain_layer_remove_marker (ChamplainLayer *layer,
+ ChamplainBaseMarker *marker);
+
G_END_DECLS
#endif
champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker),
45.528178, -73.563788);
- clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
+ champlain_layer_add_marker (layer, CHAMPLAIN_BASE_MARKER (marker));
clutter_actor_set_reactive (marker, TRUE);
g_signal_connect_after (marker, "button-release-event",
G_CALLBACK (marker_button_release_cb), view);
marker = champlain_marker_new_from_file ("/usr/share/icons/gnome/24x24/emblems/emblem-generic.png", NULL);
champlain_marker_set_text (CHAMPLAIN_MARKER (marker), "New York");
champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), 40.77, -73.98);
- clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
+ champlain_layer_add_marker (layer, CHAMPLAIN_BASE_MARKER (marker));
marker = champlain_marker_new_from_file ("/usr/share/icons/gnome/24x24/emblems/emblem-important.png", NULL);
champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), 47.130885,
-70.764141);
- clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
+ champlain_layer_add_marker (layer, CHAMPLAIN_BASE_MARKER (marker));
marker = champlain_marker_new_from_file ("/usr/share/icons/gnome/24x24/emblems/emblem-favorite.png", NULL);
champlain_marker_set_draw_background (CHAMPLAIN_MARKER (marker), FALSE);
champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), 45.41484,
-71.918907);
- clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
+ champlain_layer_add_marker (layer, CHAMPLAIN_BASE_MARKER (marker));
- clutter_actor_show (CLUTTER_ACTOR (layer));
+ champlain_layer_show (layer);
return layer;
}