94 lwerror(
"lwgeom_to_svg: '%s' geometry type not supported",
112 if (circle) size +=
sizeof(
"cx='' cy=''");
113 else size +=
sizeof(
"x='' y=''");
131 if (circle) ptr += sprintf(ptr,
"x=\"%s\" y=\"%s\"",
x,
y);
132 else ptr += sprintf(ptr,
"cx=\"%s\" cy=\"%s\"",
x,
y);
169 ptr += sprintf(ptr,
"M ");
199 for (i=0; i<poly->
nrings; i++)
201 size +=
sizeof(
"M Z") * poly->
nrings;
212 for (i=0; i<poly->
nrings; i++)
214 if (i) ptr += sprintf(ptr,
" ");
215 ptr += sprintf(ptr,
"M ");
220 ptr += sprintf(ptr,
" z");
225 ptr += sprintf(ptr,
" Z");
254 for (i=0 ; i<mpoint->
ngeoms ; i++)
256 point = mpoint->
geoms[i];
259 size +=
sizeof(
",") * --i;
271 for (i=0 ; i<mpoint->
ngeoms ; i++)
273 if (i) ptr += sprintf(ptr,
",");
274 point = mpoint->
geoms[i];
303 for (i=0 ; i<mline->
ngeoms ; i++)
305 line = mline->
geoms[i];
308 size +=
sizeof(
" ") * --i;
320 for (i=0 ; i<mline->
ngeoms ; i++)
322 if (i) ptr += sprintf(ptr,
" ");
323 line = mline->
geoms[i];
352 for (i=0 ; i<mpoly->
ngeoms ; i++)
354 poly = mpoly->
geoms[i];
357 size +=
sizeof(
" ") * --i;
369 for (i=0 ; i<mpoly->
ngeoms ; i++)
371 if (i) ptr += sprintf(ptr,
" ");
372 poly = mpoly->
geoms[i];
401 for (i=0; i<col->
ngeoms; i++)
403 subgeom = col->
geoms[i];
408 size +=
sizeof(
";") * --i;
410 if (size == 0) size++;
423 if (col->
ngeoms == 0) *ptr =
'\0';
425 for (i=0; i<col->
ngeoms; i++)
427 if (i) ptr += sprintf(ptr,
";");
428 subgeom = col->
geoms[i];
432 return (ptr - output);
479 lwerror(
"assvg_geom_buf: '%s' geometry type not supported.",
520 lwerror(
"assvg_geom_size: '%s' geometry type not supported.",
538 double dx, dy,
x,
y, accum_x, accum_y;
547 if (close_ring) end = pa->
npoints;
553 x = round(pt->
x*f)/f;
554 y = round(pt->
y*f)/f;
558 ptr += sprintf(ptr,
"%s %s l", sx, sy);
565 for (i=1 ; i < end ; i++)
571 x = round(pt->
x*f)/f;
572 y = round(pt->
y*f)/f;
582 ptr += sprintf(ptr,
" %s %s", sx, sy);
603 if (close_ring) end = pa->
npoints;
606 for (i=0 ; i < end ; i++)
613 if (i == 1) ptr += sprintf(ptr,
" L ");
614 else if (i) ptr += sprintf(ptr,
" ");
615 ptr += sprintf(ptr,
"%s %s",
x,
y);
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
#define LWSIZE_SET(varsize, len)
void * lwalloc(size_t size)
#define OUT_MAX_BYTES_DOUBLE
#define OUT_DOUBLE_BUFFER_SIZE
int lwprint_double(double d, int maxdd, char *buf)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
static lwvarlena_t * assvg_multipolygon(const LWMPOLY *mpoly, int relative, int precision)
static size_t assvg_multipoint_buf(const LWMPOINT *mpoint, char *output, int relative, int precision)
static size_t assvg_geom_buf(const LWGEOM *geom, char *output, int relative, int precision)
static size_t assvg_multipoint_size(const LWMPOINT *mpoint, int relative, int precision)
Multipoint Geometry.
static size_t assvg_collection_buf(const LWCOLLECTION *col, char *output, int relative, int precision)
static size_t assvg_multiline_buf(const LWMLINE *mline, char *output, int relative, int precision)
static size_t assvg_line_buf(const LWLINE *line, char *output, int relative, int precision)
lwvarlena_t * lwgeom_to_svg(const LWGEOM *geom, int precision, int relative)
Takes a GEOMETRY and returns a SVG representation.
static size_t assvg_collection_size(const LWCOLLECTION *col, int relative, int precision)
Collection Geometry.
static lwvarlena_t * assvg_multipoint(const LWMPOINT *mpoint, int relative, int precision)
static size_t assvg_line_size(const LWLINE *line, __attribute__((__unused__)) int relative, int precision)
Line Geometry.
static size_t assvg_multipolygon_size(const LWMPOLY *mpoly, int relative, int precision)
static size_t pointArray_svg_rel(POINTARRAY *pa, char *output, int close_ring, int precision)
static lwvarlena_t * assvg_multiline(const LWMLINE *mline, int relative, int precision)
static size_t assvg_point_buf(const LWPOINT *point, char *output, int circle, int precision)
static lwvarlena_t * assvg_point(const LWPOINT *point, int relative, int precision)
static lwvarlena_t * assvg_polygon(const LWPOLY *poly, int relative, int precision)
static lwvarlena_t * assvg_line(const LWLINE *line, int relative, int precision)
static size_t assvg_multiline_size(const LWMLINE *mline, int relative, int precision)
Multiline Geometry.
static size_t assvg_point_size(__attribute__((__unused__)) const LWPOINT *point, int circle, int precision)
Point Geometry.
static lwvarlena_t * assvg_collection(const LWCOLLECTION *col, int relative, int precision)
static size_t pointArray_svg_abs(POINTARRAY *pa, char *output, int close_ring, int precision)
Returns maximum size of rendered pointarray in bytes.
static size_t assvg_geom_size(const LWGEOM *geom, int relative, int precision)
static size_t assvg_polygon_size(const LWPOLY *poly, __attribute__((__unused__)) int relative, int precision)
Polygon Geometry.
static size_t pointArray_svg_size(POINTARRAY *pa, int precision)
Returns maximum size of rendered pointarray in bytes.
static size_t assvg_multipolygon_buf(const LWMPOLY *mpoly, char *output, int relative, int precision)
static size_t assvg_polygon_buf(const LWPOLY *poly, char *output, int relative, int precision)