[libchamplain/libchamplain-0-4] Add an option to highligh points in Polygons
- From: Pierre-Luc Beaudoin <plbeaudoin src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libchamplain/libchamplain-0-4] Add an option to highligh points in Polygons
- Date: Tue, 5 Jan 2010 19:03:11 +0000 (UTC)
commit 9f34e21af32322814364ad8d36ebaf86d43869c6
Author: Andreas Henriksson <andreas fatal se>
Date: Tue Jan 5 12:41:08 2010 -0500
Add an option to highligh points in Polygons
AUTHORS | 1 +
champlain/champlain-polygon.c | 60 +++++++++++++++++++++++++++++++++++++++++
champlain/champlain-polygon.h | 3 ++
champlain/champlain-private.h | 1 +
champlain/champlain-view.c | 4 +++
5 files changed, 69 insertions(+), 0 deletions(-)
---
diff --git a/AUTHORS b/AUTHORS
index 24a1843..f2bdaa5 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -29,3 +29,4 @@ Bruce Cowan <bcowan fastmail co uk>
Koop Mast <kwm freebsd org>
Laurent Bigonville <bigon debian org>
Tollef Fog Heen <tfheen err no>
+Andreas Henriksson <andreas fatal se>
diff --git a/champlain/champlain-polygon.c b/champlain/champlain-polygon.c
index 3355cff..43ba16b 100644
--- a/champlain/champlain-polygon.c
+++ b/champlain/champlain-polygon.c
@@ -51,6 +51,7 @@ enum
PROP_FILL_COLOR,
PROP_STROKE,
PROP_VISIBLE,
+ PROP_MARK_POINTS,
};
static void
@@ -84,6 +85,9 @@ champlain_polygon_get_property (GObject *object,
case PROP_VISIBLE:
g_value_set_boolean (value, priv->visible);
break;
+ case PROP_MARK_POINTS:
+ g_value_set_boolean (value, priv->mark_points);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -128,6 +132,10 @@ champlain_polygon_set_property (GObject *object,
else
champlain_polygon_hide (CHAMPLAIN_POLYGON (object));
break;
+ case PROP_MARK_POINTS:
+ champlain_polygon_set_mark_points (CHAMPLAIN_POLYGON (object),
+ g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -256,6 +264,21 @@ champlain_polygon_class_init (ChamplainPolygonClass *klass)
CHAMPLAIN_PARAM_READWRITE));
/**
+ * ChamplainPolygon:mark-points:
+ *
+ * Wether the polygons points should be marked for extra visibility.
+ *
+ * Since: 0.X
+ */
+ g_object_class_install_property (object_class,
+ PROP_MARK_POINTS,
+ g_param_spec_boolean ("mark-points",
+ "Mark Points",
+ "The polygon's points are marked for visibility",
+ FALSE,
+ CHAMPLAIN_PARAM_READWRITE));
+
+ /**
* ChamplainPolygon:visible:
*
* Wether the polygon is visible
@@ -281,6 +304,7 @@ champlain_polygon_init (ChamplainPolygon *polygon)
polygon->priv->fill = FALSE;
polygon->priv->stroke = TRUE;
polygon->priv->stroke_width = 2.0;
+ polygon->priv->mark_points = FALSE;
polygon->priv->fill_color = clutter_color_copy (&DEFAULT_FILL_COLOR);
polygon->priv->stroke_color = clutter_color_copy (&DEFAULT_STROKE_COLOR);
@@ -606,6 +630,42 @@ champlain_polygon_get_stroke_width (ChamplainPolygon *polygon)
}
/**
+ * champlain_polygon_set_mark_points:
+ * @polygon: The polygon
+ * @value: mark points when drawing the polygon.
+ *
+ * Sets the property determining if the points in the polygon
+ * should get marked for extra visibility when drawing the polygon.
+ *
+ * Since: 0.X
+ */
+void
+champlain_polygon_set_mark_points (ChamplainPolygon *polygon,
+ gboolean value)
+{
+ g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
+
+ polygon->priv->mark_points = value;
+ g_object_notify (G_OBJECT (polygon), "mark-points");
+}
+
+/**
+ * champlain_polygon_get_mark_points:
+ * @polygon: The polygon
+ *
+ * Returns: wether points in polygon gets marked for extra visibility.
+ *
+ * Since: 0.X
+ */
+gboolean
+champlain_polygon_get_mark_points (ChamplainPolygon *polygon)
+{
+ g_return_val_if_fail (CHAMPLAIN_IS_POLYGON (polygon), FALSE);
+
+ return polygon->priv->mark_points;
+}
+
+/**
* champlain_polygon_show:
* @polygon: The polygon
*
diff --git a/champlain/champlain-polygon.h b/champlain/champlain-polygon.h
index 7654e07..f0eea35 100644
--- a/champlain/champlain-polygon.h
+++ b/champlain/champlain-polygon.h
@@ -93,6 +93,9 @@ void champlain_polygon_set_stroke (ChamplainPolygon *polygon,
void champlain_polygon_set_stroke_width (ChamplainPolygon *polygon,
gdouble value);
gdouble champlain_polygon_get_stroke_width (ChamplainPolygon *polygon);
+void champlain_polygon_set_mark_points (ChamplainPolygon *polygon,
+ gboolean value);
+gboolean champlain_polygon_get_mark_points (ChamplainPolygon *polygon);
void champlain_polygon_show (ChamplainPolygon *polygon);
void champlain_polygon_hide (ChamplainPolygon *polygon);
diff --git a/champlain/champlain-private.h b/champlain/champlain-private.h
index fef2f80..7455fe7 100644
--- a/champlain/champlain-private.h
+++ b/champlain/champlain-private.h
@@ -48,6 +48,7 @@ struct _ChamplainPolygonPrivate {
gdouble stroke_width;
ClutterActor *actor;
gboolean visible;
+ gboolean mark_points;
};
typedef struct
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index a3bb1e4..fc3e036 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -427,6 +427,10 @@ draw_polygon (ChamplainView *view, ChamplainPolygon *polygon)
y -= priv->viewport_size.y + priv->anchor.y;
cairo_line_to (cr, x, y);
+
+ if (polygon->priv->mark_points)
+ cairo_arc (cr, x, y, polygon->priv->stroke_width, 0, 2 * M_PI);
+
list = list->next;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]