Verified Commit 8908d636 authored by James Westman's avatar James Westman
Browse files

Use doubles for zoom level

parent 5ddb3717
......@@ -207,7 +207,7 @@ shumate_map_source_get_projection (ShumateMapSource *map_source)
*/
double
shumate_map_source_get_x (ShumateMapSource *map_source,
guint zoom_level,
double zoom_level,
double longitude)
{
g_return_val_if_fail (SHUMATE_IS_MAP_SOURCE (map_source), 0.0);
......@@ -232,7 +232,7 @@ shumate_map_source_get_x (ShumateMapSource *map_source,
*/
double
shumate_map_source_get_y (ShumateMapSource *map_source,
guint zoom_level,
double zoom_level,
double latitude)
{
double sin_latitude;
......@@ -259,7 +259,7 @@ shumate_map_source_get_y (ShumateMapSource *map_source,
*/
double
shumate_map_source_get_longitude (ShumateMapSource *map_source,
guint zoom_level,
double zoom_level,
double x)
{
double longitude;
......@@ -286,7 +286,7 @@ shumate_map_source_get_longitude (ShumateMapSource *map_source,
*/
double
shumate_map_source_get_latitude (ShumateMapSource *map_source,
guint zoom_level,
double zoom_level,
double y)
{
double latitude, map_size, dy;
......@@ -355,7 +355,7 @@ shumate_map_source_get_column_count (ShumateMapSource *map_source,
*/
double
shumate_map_source_get_meters_per_pixel (ShumateMapSource *map_source,
guint zoom_level,
double zoom_level,
double latitude,
G_GNUC_UNUSED double longitude)
{
......
......@@ -79,23 +79,23 @@ guint shumate_map_source_get_tile_size (ShumateMapSource *map_source);
ShumateMapProjection shumate_map_source_get_projection (ShumateMapSource *map_source);
double shumate_map_source_get_x (ShumateMapSource *map_source,
guint zoom_level,
double zoom_level,
double longitude);
double shumate_map_source_get_y (ShumateMapSource *map_source,
guint zoom_level,
double zoom_level,
double latitude);
double shumate_map_source_get_longitude (ShumateMapSource *map_source,
guint zoom_level,
double zoom_level,
double x);
double shumate_map_source_get_latitude (ShumateMapSource *map_source,
guint zoom_level,
double zoom_level,
double y);
guint shumate_map_source_get_row_count (ShumateMapSource *map_source,
guint zoom_level);
guint shumate_map_source_get_column_count (ShumateMapSource *map_source,
guint zoom_level);
double shumate_map_source_get_meters_per_pixel (ShumateMapSource *map_source,
guint zoom_level,
double zoom_level,
double latitude,
double longitude);
......
......@@ -40,7 +40,7 @@ struct _ShumateViewport
double lon;
double lat;
guint zoom_level;
double zoom_level;
guint min_zoom_level;
guint max_zoom_level;
......@@ -112,7 +112,7 @@ shumate_viewport_get_property (GObject *object,
switch (prop_id)
{
case PROP_ZOOM_LEVEL:
g_value_set_uint (value, self->zoom_level);
g_value_set_double (value, self->zoom_level);
break;
case PROP_MIN_ZOOM_LEVEL:
......@@ -152,7 +152,7 @@ shumate_viewport_set_property (GObject *object,
switch (prop_id)
{
case PROP_ZOOM_LEVEL:
shumate_viewport_set_zoom_level (self, g_value_get_uint (value));
shumate_viewport_set_zoom_level (self, g_value_get_double (value));
break;
case PROP_MIN_ZOOM_LEVEL:
......@@ -208,11 +208,11 @@ shumate_viewport_class_init (ShumateViewportClass *klass)
* The level of zoom of the content.
*/
obj_properties[PROP_ZOOM_LEVEL] =
g_param_spec_uint ("zoom-level",
"Zoom level",
"The level of zoom of the map",
0, 20, 3,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_param_spec_double ("zoom-level",
"Zoom level",
"The level of zoom of the map",
0, 20, 3,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
/**
* ShumateViewport:min-zoom-level:
......@@ -298,7 +298,7 @@ shumate_viewport_new (void)
*/
void
shumate_viewport_set_zoom_level (ShumateViewport *self,
guint zoom_level)
double zoom_level)
{
g_return_if_fail (SHUMATE_IS_VIEWPORT (self));
......@@ -319,7 +319,7 @@ shumate_viewport_set_zoom_level (ShumateViewport *self,
*
* Returns: the current zoom level
*/
guint
double
shumate_viewport_get_zoom_level (ShumateViewport *self)
{
g_return_val_if_fail (SHUMATE_IS_VIEWPORT (self), 0U);
......
......@@ -38,8 +38,8 @@ G_DECLARE_FINAL_TYPE (ShumateViewport, shumate_viewport, SHUMATE, VIEWPORT, GObj
ShumateViewport *shumate_viewport_new (void);
void shumate_viewport_set_zoom_level (ShumateViewport *self,
guint zoom_level);
guint shumate_viewport_get_zoom_level (ShumateViewport *self);
double zoom_level);
double shumate_viewport_get_zoom_level (ShumateViewport *self);
void shumate_viewport_set_max_zoom_level (ShumateViewport *self,
guint max_zoom_level);
......
......@@ -10,7 +10,7 @@ test_coordinate_convert (void)
ShumateMapSource *source;
double latitude = -73.75f;
double longitude = 45.466f;
guint zoom_level;
double zoom_level;
factory = shumate_map_source_factory_dup_default ();
......@@ -22,7 +22,7 @@ test_coordinate_convert (void)
for (zoom_level = shumate_map_source_get_min_zoom_level (source);
zoom_level <= shumate_map_source_get_max_zoom_level (source);
zoom_level++)
zoom_level += 0.5)
{
double x;
double y;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment