From: drh Date: Sat, 12 May 2018 21:09:31 +0000 (+0000) Subject: Add the geopoly_svg() SQL function. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e65b394d6b92e119125f5f987a903085b6e2fe03;p=thirdparty%2Fsqlite.git Add the geopoly_svg() SQL function. FossilOrigin-Name: 318ba5f0c52596fc5ceed23a2b7b1ca18644449809890bfed47ab4ee01075060 --- diff --git a/ext/misc/geopoly.c b/ext/misc/geopoly.c index daa9f449b0..2c403c0cb4 100644 --- a/ext/misc/geopoly.c +++ b/ext/misc/geopoly.c @@ -345,6 +345,40 @@ static void geopolyJsonFunc( } } +/* +** SQL function: geopoly_svg(X, ....) +** +** Interpret X as a polygon and render it as a SVG . +** Additional arguments are added as attributes to the . +*/ +static void geopolySvgFunc( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + GeoPoly *p = geopolyFuncParam(context, argv[0]); + if( p ){ + sqlite3 *db = sqlite3_context_db_handle(context); + sqlite3_str *x = sqlite3_str_new(db); + int i; + char cSep = '\''; + sqlite3_str_appendf(x, "a[i*2], p->a[i*2+1]); + cSep = ' '; + } + sqlite3_str_appendf(x, " %g,%g'", p->a[0], p->a[1]); + for(i=1; i"); + sqlite3_result_text(context, sqlite3_str_finish(x), -1, sqlite3_free); + sqlite3_free(p); + } +} /* ** Implementation of the geopoly_area(X) function. @@ -811,6 +845,7 @@ int sqlite3_geopoly_init( { geopolyAreaFunc, 1, "geopoly_area" }, { geopolyBlobFunc, 1, "geopoly_blob" }, { geopolyJsonFunc, 1, "geopoly_json" }, + { geopolySvgFunc, -1, "geopoly_svg" }, { geopolyWithinFunc, 3, "geopoly_within" }, { geopolyOverlapFunc, 2, "geopoly_overlap" }, { geopolyDebugFunc, 1, "geopoly_debug" }, diff --git a/manifest b/manifest index f923ef59d9..687b3339f6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Preliminary\stests\sshow\sgeopoly_overlap()\sis\sworking. -D 2018-05-12T20:28:51.628 +C Add\sthe\sgeopoly_svg()\sSQL\sfunction. +D 2018-05-12T21:09:31.743 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -279,7 +279,7 @@ F ext/misc/dbdump.c 69ef1be5b210538f77dfcc6fcb55b4b5f5e98b1e0bcfd67d818711e10761 F ext/misc/eval.c 6ea9b22a5fa0dd973b67ca4e53555be177bc0b7b263aadf1024429457c82c0e3 F ext/misc/fileio.c 48c7751c78fc4cdd29d8c862fd2f3f98bbfefa2a3cf1ca1496df4bf02eb8cded F ext/misc/fuzzer.c 7c64b8197bb77b7d64eff7cac7848870235d4c25 -F ext/misc/geopoly.c 2d3478b322fde9d31d7d02bfe4e3c0cbc43f901991936a7511ecefd0f1770a9b +F ext/misc/geopoly.c 0ff8defd4c14f696c6f7ae22f5b35684bb5e97d704b1fbcd83a52397ef1d748f F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c F ext/misc/json1.c dbe086615b9546c156bf32b9378fc09383b58bd17513b866cfd24c1e15281984 F ext/misc/memvfs.c ab36f49e02ebcdf85a1e08dc4d8599ea8f343e073ac9e0bca18a98b7e1ec9567 @@ -1729,7 +1729,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c857976efba79bd24befec1bd1597cc967dd2f0a39e66087cc9b1663154a05a8 -R f0e2b517cfea19580d6d720b8d793968 +P 77bb7b7d7278725e4e02935d485c3540bb41f4fc29ca8da679b2a380ebc38d7d +R 45a8a2641f4ccb20c343642fef078d5a U drh -Z a98a635ee795f5a445da6c92e9105b9c +Z 51ab8a1c4e9dc75f7d7508c91ab6edda diff --git a/manifest.uuid b/manifest.uuid index ae3995d753..26f2d72709 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -77bb7b7d7278725e4e02935d485c3540bb41f4fc29ca8da679b2a380ebc38d7d \ No newline at end of file +318ba5f0c52596fc5ceed23a2b7b1ca18644449809890bfed47ab4ee01075060 \ No newline at end of file