examples: GoogleMaps removed dependency on Geom

git-svn-id: svn://ultimatepp.org/upp/trunk@2040 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-02-09 17:45:26 +00:00
parent 22096f6f7f
commit 6d14ed40bf
4 changed files with 29 additions and 7 deletions

View file

@ -1,9 +1,5 @@
#include "GoogleMaps.h"
#include <CtrlLib/CtrlLib.h>
#include <Web/Web.h>
#include <Geom/Coords/GeomCoords.h>
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");

View file

@ -2,6 +2,8 @@
#define _GoogleMaps_GoogleMaps_h
#include <CtrlLib/CtrlLib.h>
#include <Web/Web.h>
using namespace Upp;

View file

@ -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,

View file

@ -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