[libchamplainmm] BoundingBox: Add ChamplainBoundingBox wrapper
- From: Juan R. Garcia Blanco <juanrgar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplainmm] BoundingBox: Add ChamplainBoundingBox wrapper
- Date: Fri, 7 Mar 2014 20:18:19 +0000 (UTC)
commit 2c3007f803460a8711a8a0bb7a92e60d6f72a8c0
Author: Juan R. García Blanco <juanrgar gmail com>
Date: Fri Mar 7 21:14:41 2014 +0100
BoundingBox: Add ChamplainBoundingBox wrapper
* bounding-box.{hg,ccg}: Wrap BoundingBox symbols.
* generate_extra_defs_libchamplain.cc: Add
CHAMPLAIN_TYPE_BOUNDING_BOX.
* convert_libchamplain.m4: Add BoundingBox& to
ChamplainBoundingBox* conversion.
champlain/champlainmm/.gitignore | 1 +
champlain/src/bounding-box.ccg | 23 +++++++++
champlain/src/bounding-box.hg | 52 ++++++++++++++++++++
champlain/src/filelist.am | 1 +
.../extradefs/generate_extra_defs_libchamplain.cc | 3 +-
tools/m4/convert_libchamplain.m4 | 3 +
6 files changed, 82 insertions(+), 1 deletions(-)
---
diff --git a/champlain/champlainmm/.gitignore b/champlain/champlainmm/.gitignore
index aa66446..c27cf5c 100644
--- a/champlain/champlainmm/.gitignore
+++ b/champlain/champlainmm/.gitignore
@@ -1,3 +1,4 @@
+bounding-box.*
defines.*
label.*
layer.*
diff --git a/champlain/src/bounding-box.ccg b/champlain/src/bounding-box.ccg
new file mode 100644
index 0000000..98e7f82
--- /dev/null
+++ b/champlain/src/bounding-box.ccg
@@ -0,0 +1,23 @@
+/* Copyright (c) 2014 Juan R. García Blanco <juanrgar gmail com>
+ *
+ * This file is part of libchamplainmm.
+ *
+ * libchamplainmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libchamplainmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <champlain/champlain.h>
+
+namespace Champlain
+{
+} // namespace Champlain
diff --git a/champlain/src/bounding-box.hg b/champlain/src/bounding-box.hg
new file mode 100644
index 0000000..b44651b
--- /dev/null
+++ b/champlain/src/bounding-box.hg
@@ -0,0 +1,52 @@
+/* Copyright (c) 2014 Juan R. García Blanco <juanrgar gmail com>
+ *
+ * This file is part of libchamplainmm.
+ *
+ * libchamplainmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libchamplainmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+_DEFS(champlainmm,champlain)
+
+namespace Champlain
+{
+
+/** A basic struct to describe a bounding box.
+ *
+ * Defines the area of a MapDataSource that contains data.
+ *
+ * @newin{0,6}
+ */
+class BoundingBox
+{
+ _CLASS_BOXEDTYPE(BoundingBox, ChamplainBoundingBox, champlain_bounding_box_new,
champlain_bounding_box_copy, champlain_bounding_box_free)
+ _IGNORE(champlain_bounding_box_copy, champlain_bounding_box_free)
+
+public:
+ _WRAP_METHOD(void get_center(double& latitude, double& longitude) const, champlain_bounding_box_get_center)
+
+ _WRAP_METHOD(void compose(BoundingBox& other), champlain_bounding_box_compose)
+
+ _WRAP_METHOD(void extend(double latitude, double longitude), champlain_bounding_box_extend)
+
+ _WRAP_METHOD(bool is_valid() const, champlain_bounding_box_is_valid)
+
+ _WRAP_METHOD(bool covers(double latitude, double longitude) const, champlain_bounding_box_covers)
+
+ _MEMBER_GET(left, left, double, gdouble)
+ _MEMBER_GET(top, top, double, gdouble)
+ _MEMBER_GET(right, right, double, gdouble)
+ _MEMBER_GET(bottom, bottom, double, gdouble)
+};
+
+} // namespace Champlain
diff --git a/champlain/src/filelist.am b/champlain/src/filelist.am
index b3ae8f1..affc4cc 100644
--- a/champlain/src/filelist.am
+++ b/champlain/src/filelist.am
@@ -10,6 +10,7 @@ files_defs = \
champlain_docs_override.xml
files_hg = \
+ bounding-box.hg \
marker.hg \
defines.hg \
layer.hg \
diff --git a/tools/extradefs/generate_extra_defs_libchamplain.cc
b/tools/extradefs/generate_extra_defs_libchamplain.cc
index 8ad2cc9..ae83ae1 100644
--- a/tools/extradefs/generate_extra_defs_libchamplain.cc
+++ b/tools/extradefs/generate_extra_defs_libchamplain.cc
@@ -26,7 +26,8 @@ main(int argc, char *argv[])
{
clutter_init(&argc, &argv);
- std::cout << get_defs(CHAMPLAIN_TYPE_LABEL)
+ std::cout << get_defs(CHAMPLAIN_TYPE_BOUNDING_BOX)
+ << get_defs(CHAMPLAIN_TYPE_LABEL)
<< get_defs(CHAMPLAIN_TYPE_LAYER)
<< get_defs(CHAMPLAIN_TYPE_LOCATION)
<< get_defs(CHAMPLAIN_TYPE_MAP_SOURCE)
diff --git a/tools/m4/convert_libchamplain.m4 b/tools/m4/convert_libchamplain.m4
index ce8b6db..b712c7d 100644
--- a/tools/m4/convert_libchamplain.m4
+++ b/tools/m4/convert_libchamplain.m4
@@ -26,6 +26,9 @@ _CONVERSION(`const Glib::RefPtr<BaseMarker>&',`ChamplainBaseMarker*',__CONVERT_R
_CONVERSION(`const Glib::ArrayHandle<Glib::RefPtr<BaseMarker>
&',`ChamplainBaseMarker*[]',`const_cast<ChamplainBaseMarker**>(($3).data())')
_CONVERSION(`const GList*',`Glib::ListHandle<Glib::RefPtr<BaseMarker>
',`$2(const_cast<GList*>($3),Glib::OWNERSHIP_NONE)')
+# BoundingBox
+_CONVERSION(`BoundingBox&',`ChamplainBoundingBox*',`($3).gobj()')
+
# Cache
_CONVERSION(`ChamplainCache*',`Glib::RefPtr<Cache>',`Glib::wrap($3)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]