[libchamplain] Add champlain_bounding_box_compose() method
- From: Jiří Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] Add champlain_bounding_box_compose() method
- Date: Wed, 9 Feb 2011 08:40:45 +0000 (UTC)
commit 60b9b40fdf413e9922f304de915aec877d7b4a37
Author: JiÅ?Ã Techet <techet gmail com>
Date: Tue Feb 8 22:18:20 2011 +0100
Add champlain_bounding_box_compose() method
champlain/champlain-bounding-box.c | 30 ++++++++++++++++++++++++++++++
champlain/champlain-bounding-box.h | 3 +++
docs/reference/libchamplain-sections.txt | 1 +
3 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlain-bounding-box.c b/champlain/champlain-bounding-box.c
index 43302e3..7915893 100644
--- a/champlain/champlain-bounding-box.c
+++ b/champlain/champlain-bounding-box.c
@@ -123,3 +123,33 @@ champlain_bounding_box_get_center (ChamplainBoundingBox *bbox,
*longitude = (bbox->right + bbox->left) / 2.0;
*latitude = (bbox->top + bbox->bottom) / 2.0;
}
+
+
+/**
+ * champlain_bounding_box_compose:
+ * @bbox: a #ChamplainBoundingBox
+ * @other: a #ChamplainBoundingBox
+ *
+ * Sets bbox equal to the bounding box containing both @bbox and @other.
+ *
+ * Since: 0.10
+ */
+void
+champlain_bounding_box_compose (ChamplainBoundingBox *bbox,
+ ChamplainBoundingBox *other)
+{
+ g_return_if_fail (CHAMPLAIN_BOUNDING_BOX (bbox));
+
+ if (other->left < bbox->left)
+ bbox->left = other->left;
+
+ if (other->right > bbox->right)
+ bbox->right = other->right;
+
+ if (other->top > bbox->top)
+ bbox->top = other->top;
+
+ if (other->bottom < bbox->bottom)
+ bbox->bottom = other->bottom;
+}
+
diff --git a/champlain/champlain-bounding-box.h b/champlain/champlain-bounding-box.h
index f79bf48..12fbe60 100644
--- a/champlain/champlain-bounding-box.h
+++ b/champlain/champlain-bounding-box.h
@@ -63,6 +63,9 @@ void champlain_bounding_box_get_center (ChamplainBoundingBox *bbox,
gdouble *latitude,
gdouble *longitude);
+void champlain_bounding_box_compose (ChamplainBoundingBox *bbox,
+ ChamplainBoundingBox *other);
+
G_END_DECLS
#endif
diff --git a/docs/reference/libchamplain-sections.txt b/docs/reference/libchamplain-sections.txt
index 4b71b32..4833266 100644
--- a/docs/reference/libchamplain-sections.txt
+++ b/docs/reference/libchamplain-sections.txt
@@ -476,6 +476,7 @@ champlain_bounding_box_new
champlain_bounding_box_copy
champlain_bounding_box_free
champlain_bounding_box_get_center
+champlain_bounding_box_compose
<SUBSECTION Standard>
CHAMPLAIN_BOUNDING_BOX
CHAMPLAIN_TYPE_BOUNDING_BOX
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]