xs/ChamplainMapSourceFactory.xs
xs/ChamplainMarker.xs
xs/ChamplainNetworkMapSource.xs
+xs/ChamplainPoint.xs
xs/ChamplainTile.xs
xs/ChamplainView.xs
xs/ChamplainZoomLevel.xs
t/ChamplainMapSourceFactory.t
t/ChamplainMarker.t
t/ChamplainNetworkMapSource.t
+t/ChamplainPoint.t
t/ChamplainTile.t
t/ChamplainView.t
t/ChamplainZoomLevel.t
CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY ChamplainMapSourceFactory GObject Champlain::MapSourceFactory
CHAMPLAIN_TYPE_CACHE ChamplainCache GObject Champlain::Cache
CHAMPLAIN_TYPE_MAP_SOURCE_DESC ChamplainMapSourceDesc GBoxed Champlain::MapSourceDesc
+CHAMPLAIN_TYPE_POINT ChamplainPoint GBoxed Champlain::Point
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Clutter::TestHelper tests => 10;
+use Test::Exception;
+
+use Champlain ':maps';
+
+exit tests();
+
+sub tests {
+ test_generic();
+ return 0;
+}
+
+
+sub test_generic {
+ my $point = Champlain::Point->new(10.2, 34.5);
+ isa_ok($point, 'Champlain::Point');
+
+ is($point->lat, 10.2, "point->lat()");
+ is($point->lon, 34.5, "point->lon()");
+
+
+ # Copy the point
+ my $copy = $point->copy;
+ isa_ok($copy, 'Champlain::Point');
+ is($copy->lat, $point->lat, "lat of copy is identical to the original");
+ is($copy->lon, $point->lon, "lon of copy is identical to the original");
+
+
+ # Modify the copy
+ $copy->lat(-45.03);
+ is($copy->lat, -45.03, "point->lat(x)");
+ is($point->lat, 10.2, "point->lat()");
+
+ $copy->lon(74.364);
+ is($copy->lon, 74.364, "point->lon(y)");
+ is($point->lon, 34.5, "point->lon()");
+}
--- /dev/null
+#include "champlain-perl.h"
+
+
+MODULE = Champlain::Point PACKAGE = Champlain::Point PREFIX = champlain_point_
+
+
+ChamplainPoint*
+champlain_point_new (class, gdouble lat, gdouble lon)
+ C_ARGS: lat, lon
+
+
+ChamplainPoint*
+champlain_point_copy (const ChamplainPoint* point)
+
+
+void
+champlain_point_free (ChamplainPoint* point)
+
+
+#
+# Provide nice accessors to the data members of the struct.
+#
+gdouble
+lat (ChamplainPoint *point, gdouble newval = 0)
+ ALIAS:
+ lon = 1
+
+ CODE:
+ switch (ix) {
+ case 0:
+ RETVAL = point->lat;
+ if (items > 1) point->lat = newval;
+ break;
+
+ case 1:
+ RETVAL = point->lon;
+ if (items > 1) point->lon = newval;
+ break;
+
+ default:
+ RETVAL = 0.0;
+ g_assert_not_reached();
+ break;
+ }
+
+ OUTPUT:
+ RETVAL