diff --git a/examples/GoogleMaps/GoogleMaps.cpp b/examples/GoogleMaps/GoogleMaps.cpp index 5173fa9bf..ac892003c 100644 --- a/examples/GoogleMaps/GoogleMaps.cpp +++ b/examples/GoogleMaps/GoogleMaps.cpp @@ -1,9 +1,5 @@ #include "GoogleMaps.h" -#include -#include -#include - using namespace Upp; #define LLOG(x) // LOG(x) @@ -98,6 +94,28 @@ Pointf ScanGPS(const char *s) return r; } +String FormatDegree(double d, int decimals) +{ + if(IsNull(d)) + return Null; + d = modulo(d + 180, 360) - 180; + char sign = (d < 0 ? '-' : '+'); + if(d < 0) d = -d; + int deg = ffloor(d); + String cd = ToCharset(CHARSET_DEFAULT, "%c%d°", CHARSET_UTF8); + if(decimals <= -2) + return NFormat(cd, sign, deg); + d = (d - deg) * 60; + int min = ffloor(d); + if(decimals <= -1) + return NFormat(cd + " %02d\'", sign, deg, min); + d = (d - min) * 60; + String sec = FormatDoubleFix(d, decimals); + if(!IsDigit(sec[1])) + sec.Insert(0, '0'); + return NFormat(cd + " %02d\' %s\"", sign, deg, min, sec); +} + String FormatGPSX(double x) { return IsNull(x) ? String() : FormatDegree(x, 2) + (x < 0 ? "W" : "E"); diff --git a/examples/GoogleMaps/GoogleMaps.h b/examples/GoogleMaps/GoogleMaps.h index 4b3168591..202474d9d 100644 --- a/examples/GoogleMaps/GoogleMaps.h +++ b/examples/GoogleMaps/GoogleMaps.h @@ -2,6 +2,8 @@ #define _GoogleMaps_GoogleMaps_h #include +#include + using namespace Upp; diff --git a/examples/GoogleMaps/GoogleMaps.upp b/examples/GoogleMaps/GoogleMaps.upp index 98ccffb8a..d769a55e2 100644 --- a/examples/GoogleMaps/GoogleMaps.upp +++ b/examples/GoogleMaps/GoogleMaps.upp @@ -1,6 +1,8 @@ +description "Example using GoogleMaps static API to display the map of given location\377"; + uses - Geom\Coords, - CtrlLib; + CtrlLib, + Web; file GoogleMaps.h, diff --git a/examples/GoogleMaps/init b/examples/GoogleMaps/init index 727abc36b..08a8a31b1 100644 --- a/examples/GoogleMaps/init +++ b/examples/GoogleMaps/init @@ -1,5 +1,5 @@ #ifndef _GoogleMaps_icpp_init_stub #define _GoogleMaps_icpp_init_stub -#include "Geom\Coords/init" #include "CtrlLib/init" +#include "Web/init" #endif