git-svn-id: svn+ssh://garage/var/lib/gforge/svnroot/maemo-mapper/trunk@234
6c538b50-5814-0410-93ad-
8bdf4c0149d1
NSEW_DDPDDDDD,
NSEW_DD_MMPMMM,
NSEW_DD_MM_SSPS,
NSEW_DDPDDDDD,
NSEW_DD_MMPMMM,
NSEW_DD_MM_SSPS,
+ UK_NGR, // 8 char grid ref
+ UK_NGR6,// 6 char grid ref
+ IARU_LOC,
DEG_FORMAT_ENUM_COUNT
} DegFormat;
DEG_FORMAT_ENUM_COUNT
} DegFormat;
#include "gpx.h"
#include "util.h"
#include "gpx.h"
#include "util.h"
+gboolean convert_iaru_loc_to_lat_lon(const gchar* txt_lon, gdouble* lat, gdouble* lon);
/**
* Pop up a modal dialog box with simple error information in it.
/**
* Pop up a modal dialog box with simple error information in it.
case IARU_LOC:
case UK_OSGB:
case UK_NGR:
case IARU_LOC:
case UK_OSGB:
case UK_NGR:
// These formats should not be formatted in the same way
// - they need to be converted first, therefore if we reach
// this bit of code use the first available format - drop through.
// These formats should not be formatted in the same way
// - they need to be converted first, therefore if we reach
// this bit of code use the first available format - drop through.
{
case UK_OSGB:
case UK_NGR:
{
case UK_OSGB:
case UK_NGR:
valid = os_grid_check_lat_lon(lat, lon);
if(fallback_deg_format != NULL) *fallback_deg_format = DDPDDDDD;
break;
valid = os_grid_check_lat_lon(lat, lon);
if(fallback_deg_format != NULL) *fallback_deg_format = DDPDDDDD;
break;
snprintf(eing, 12, "%u", easting);
snprintf(ning, 12, "%u", northing);
snprintf(eing, 12, "%u", easting);
snprintf(ning, 12, "%u", northing);
- snprintf(eing, 5, "%s", eing+1);
- snprintf(ning, 5, "%s", ning+1);
+ snprintf(eing, (_degformat == UK_NGR ? 5 : 4), "%s", eing+1);
+ snprintf(ning, (_degformat == UK_NGR ? 5 : 4), "%s", ning+1);
sprintf(bng, "%c%c%s%s",
(char)(tmp + 65),
sprintf(bng, "%c%c%s%s",
(char)(tmp + 65),
gboolean valid = FALSE;
// UK_NGR starts with two letters, and then all numbers - it may contain spaces - no lon will be entered
gboolean valid = FALSE;
// UK_NGR starts with two letters, and then all numbers - it may contain spaces - no lon will be entered
- if( _degformat == UK_NGR)
+ if( _degformat == UK_NGR || _degformat == UK_NGR6 )
{
valid = convert_os_ngr_to_latlon(txt_lat, lat, lon);
{
valid = convert_os_ngr_to_latlon(txt_lat, lat, lon);
if(convert_lat_lon_to_bng(d_lat, d_lon, lat))
{
if(convert_lat_lon_to_bng(d_lat, d_lon, lat))
{