From bb680f70f18f1200bdc25b45031e26ac07c71979 Mon Sep 17 00:00:00 2001 From: lains Date: Sun, 22 Sep 2019 17:33:56 +0200 Subject: Add/Android: Provide geo coordinates for clicked position in contextual menu (#794) * Adding unescape string utility and unescaping alls values in textfile attributes * Moving coordinates_geo out of internal use in gui_internal_command.c (to coord.c) * Moving gui_internal_escape() into generic str_escape() function in util.c * Moving strncpy_unescape() into generic function in util.c * Using geo coords as item name in Android contextual menu "Route Here" * Using string escaping (for double quotes) when writing former destinations to file * Adding new type DEGREES_MINUTES_SECONDS_BRIEF to factorize coordinates_geo() And fixing the example strings to match what is actually output by the function * Adding support for DEGREES_MINUTES_SECONDS_BRIEF format into coord_format And add internal coord_format_with_sep() to specify the separator * Fixing doxygen doc for coord_format_with_sep() * Making coord_format() inline * Using new factorized generic function coord_geo_format_short() instead of coordinates_geo() * Changing single contextual window title with GPS coords on Android * Adding string bytes length for each coord to string format, using short format in pcoord_format_short() and coord_geo_format_short() * Using pcoord_format_short() in android --- navit/coord.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'navit/coord.h') diff --git a/navit/coord.h b/navit/coord.h index 8387462a2..753da5e8c 100644 --- a/navit/coord.h +++ b/navit/coord.h @@ -65,7 +65,7 @@ struct coord_rect { /** * On platforms where we are trying to avoid floats, sometimes we can't. * It is better on these platforms to use single precision floating points - * over double percision ones since performance is much better. + * over double precision ones since performance is much better. */ typedef float navit_float; #define navit_sin(x) sinf(x) @@ -114,20 +114,25 @@ enum coord_format { /** * Degrees with decimal places. - * Ie 20.5000 N 110.5000 E + * ie 20.500000°N 110.500000°E */ DEGREES_DECIMAL, /** * Degrees and minutes. - * ie 20 30.00 N 110 30.00 E + * ie 20°30.0000' N 110°30.0000' E */ DEGREES_MINUTES, /** * Degrees, minutes and seconds. - * ie 20 30 30.00 N 110 30 30 E + * ie 20°30'30.00" N 110°30'30.00" E */ - DEGREES_MINUTES_SECONDS + DEGREES_MINUTES_SECONDS, + /** + * Degrees, minutes and seconds, brief + * ie 20°30'30"N 110°30'30"E + */ + DEGREES_MINUTES_SECONDS_BRIEF }; enum projection; @@ -145,7 +150,11 @@ void coord_rect_destroy(struct coord_rect *r); int coord_rect_overlap(struct coord_rect *r1, struct coord_rect *r2); int coord_rect_contains(struct coord_rect *r, struct coord *c); void coord_rect_extend(struct coord_rect *r, struct coord *c); -void coord_format(float lat,float lng, enum coord_format, char * buffer, int size); +void coord_format_with_sep(float lat,float lng, enum coord_format fmt, char *buffer, int size, const char *sep); +void coord_format(float lat,float lng, enum coord_format fmt, char *buffer, int size); +void coord_geo_format_short(const struct coord_geo *gc, char *buffer, int size, char *sep); +void pcoord_format_short(const struct pcoord *pc, char *buffer, int size, char *sep); +char *coordinates_geo(const struct coord_geo *gc, char sep); /* prototypes */ enum coord_format; -- cgit v1.2.1