[libchamplain] Add champlain_bounding_box_get_center
- From: Pierre-Luc Beaudoin <plbeaudoin src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libchamplain] Add champlain_bounding_box_get_center
- Date: Sun, 24 Jan 2010 20:11:41 +0000 (UTC)
commit 3f13c52247d57a6cec09fee5411ac03c174be813
Author: Simon Wenner <simon wenner ch>
Date: Sun Jul 26 23:30:20 2009 +0200
Add champlain_bounding_box_get_center
champlain/champlain-bounding-box.c | 19 +++++++++++++++++++
champlain/champlain-bounding-box.h | 4 ++++
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlain-bounding-box.c b/champlain/champlain-bounding-box.c
index 495837b..4cb0d9c 100644
--- a/champlain/champlain-bounding-box.c
+++ b/champlain/champlain-bounding-box.c
@@ -93,3 +93,22 @@ champlain_bounding_box_new ()
{
return g_slice_new (ChamplainBoundingBox);
}
+
+/**
+ * champlain_bounding_box_get_center:
+ * @bbox: a #ChamplainBoundingBox
+ * @lat: the latitude of the box center
+ * @lon: the longitude of the box center
+ *
+ * Since: 0.6
+ */
+void
+champlain_bounding_box_get_center (ChamplainBoundingBox *bbox,
+ gdouble *lat,
+ gdouble *lon)
+{
+ g_return_if_fail (CHAMPLAIN_BOUNDING_BOX (bbox));
+
+ *lat = (bbox->right + bbox->left) / 2.0;
+ *lon = (bbox->top + bbox->bottom) / 2.0;
+}
diff --git a/champlain/champlain-bounding-box.h b/champlain/champlain-bounding-box.h
index 38480da..0d7969c 100644
--- a/champlain/champlain-bounding-box.h
+++ b/champlain/champlain-bounding-box.h
@@ -54,6 +54,10 @@ void champlain_bounding_box_free (ChamplainBoundingBox *bbox);
ChamplainBoundingBox * champlain_bounding_box_new (void);
+void champlain_bounding_box_get_center (ChamplainBoundingBox *bbox,
+ gdouble *lat,
+ gdouble *lon);
+
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]