[libchamplainmm] Point: Make Point inherit from Object



commit adda1dd8d600ed5ad16e29d0310675f40c725478
Author: Juan R. GarcĂ­a Blanco <juanrgar gmail com>
Date:   Tue Feb 25 20:29:54 2014 +0100

    Point: Make Point inherit from Object
    
        * Point is no longer a boxed type but a class
        inheriting from Glib::Object.

 libchamplain/src/point.ccg |   39 ++-------------------------------------
 libchamplain/src/point.hg  |   22 ++++++++--------------
 2 files changed, 10 insertions(+), 51 deletions(-)
---
diff --git a/libchamplain/src/point.ccg b/libchamplain/src/point.ccg
index 33f6ad1..c096e9b 100644
--- a/libchamplain/src/point.ccg
+++ b/libchamplain/src/point.ccg
@@ -16,43 +16,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-namespace Champlain
-{
-
-Point::Point()
-{
-    ChamplainPoint point = {0, 0};
-    gobject_ = champlain_point_copy(&point);
-}
-
-Point::Point(double latitude, double longitude)
-{
-    ChamplainPoint point = {latitude, longitude};
-    gobject_ = champlain_point_copy(&point);
-}
-
-double
-Point::get_latitude() const
-{
-  return gobject_->lat;
-}
-
-double
-Point::get_longitude() const
-{
-  return gobject_->lon;
-}
+#include <champlain/champlain.h>
 
-void
-Point::set_latitude(double latitude)
-{
-  gobject_->lat = latitude;
-}
-
-void
-Point::set_longitude(double longitude)
+namespace Champlain
 {
-  gobject_->lon = longitude;
-}
-
 } // namespace Champlain
diff --git a/libchamplain/src/point.hg b/libchamplain/src/point.hg
index 5a2663f..5b9f9b8 100644
--- a/libchamplain/src/point.hg
+++ b/libchamplain/src/point.hg
@@ -16,28 +16,22 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <libchamplainmm/marker.h>
 _DEFS(libchamplainmm,libchamplain)
-
-_CC_INCLUDE(champlain/champlain.h)
+_PINCLUDE(libchamplainmm/private/marker_p.h)
 
 namespace Champlain
 {
 
-class Point
+class Point : public Marker
 {
-  _CLASS_BOXEDTYPE(Point, ChamplainPoint, NONE,
-                   champlain_point_copy,
-                   champlain_point_free)
+  _CLASS_GOBJECT(Point, ChamplainPoint, CHAMPLAIN_POINT, Champlain::Marker, ChamplainMarker)
 
 public:
-  _CUSTOM_DEFAULT_CTOR
-  Point();
-  Point(double latitude, double longitude);
-
-  double get_latitude() const;
-  double get_longitude() const;
-  void set_latitude(double latitude);
-  void set_longitude(double longitude);
+  _WRAP_METHOD(double get_latitude() const, champlain_point_get_latitude)
+  _WRAP_METHOD(double get_longitude() const, champlain_point_get_longitude)
+  _WRAP_METHOD(void set_latitude(double latitude), champlain_point_set_latitude)
+  _WRAP_METHOD(void set_longitude(double longitude), champlain_point_set_longitude)
 };
 
 } // namespace Champlain


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]