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);
172 ptr += sprintf(ptr,
"M ");
205 for (i=0; i<poly->
nrings; i++)
207 size +=
sizeof(
"M Z") * poly->
nrings;
218 for (i=0; i<poly->
nrings; i++)
220 if (i) ptr += sprintf(ptr,
" ");
221 ptr += sprintf(ptr,
"M ");
226 ptr += sprintf(ptr,
" z");
231 ptr += sprintf(ptr,
" Z");
263 for (i=0 ; i<mpoint->
ngeoms ; i++)
265 point = mpoint->
geoms[i];
268 size +=
sizeof(
",") * --i;
280 for (i=0 ; i<mpoint->
ngeoms ; i++)
282 if (i) ptr += sprintf(ptr,
",");
283 point = mpoint->
geoms[i];
315 for (i=0 ; i<mline->
ngeoms ; i++)
317 line = mline->
geoms[i];
320 size +=
sizeof(
" ") * --i;
332 for (i=0 ; i<mline->
ngeoms ; i++)
334 if (i) ptr += sprintf(ptr,
" ");
335 line = mline->
geoms[i];
367 for (i=0 ; i<mpoly->
ngeoms ; i++)
369 poly = mpoly->
geoms[i];
372 size +=
sizeof(
" ") * --i;
384 for (i=0 ; i<mpoly->
ngeoms ; i++)
386 if (i) ptr += sprintf(ptr,
" ");
387 poly = mpoly->
geoms[i];
419 for (i=0; i<col->
ngeoms; i++)
421 subgeom = col->
geoms[i];
426 size +=
sizeof(
";") * --i;
428 if (size == 0) size++;
441 if (col->
ngeoms == 0) *ptr =
'\0';
443 for (i=0; i<col->
ngeoms; i++)
445 if (i) ptr += sprintf(ptr,
";");
446 subgeom = col->
geoms[i];
450 return (ptr - output);
500 lwerror(
"assvg_geom_buf: '%s' geometry type not supported.",
541 lwerror(
"assvg_geom_size: '%s' geometry type not supported.",
559 double dx, dy,
x,
y, accum_x, accum_y;
568 if (close_ring) end = pa->
npoints;
574 x = round(pt->
x*f)/f;
575 y = round(pt->
y*f)/f;
579 ptr += sprintf(ptr,
"%s %s l", sx, sy);
586 for (i=1 ; i < end ; i++)
592 x = round(pt->
x*f)/f;
593 y = round(pt->
y*f)/f;
603 ptr += sprintf(ptr,
" %s %s", sx, sy);
624 if (close_ring) end = pa->
npoints;
627 for (i=0 ; i < end ; i++)
634 if (i == 1) ptr += sprintf(ptr,
" L ");
635 else if (i) ptr += sprintf(ptr,
" ");
636 ptr += sprintf(ptr,
"%s %s",
x,
y);
650 * 2 * pa->
npoints +
sizeof(
" L ");
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.
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
void * lwalloc(size_t size)
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
#define OUT_MAX_DIGS_DOUBLE
#define OUT_DOUBLE_BUFFER_SIZE
int lwprint_double(double d, int maxdd, char *buf, size_t bufsize)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
char * lwgeom_to_svg(const LWGEOM *geom, int precision, int relative)
Takes a GEOMETRY and returns a SVG representation.
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)
static char * assvg_multiline(const LWMLINE *mline, int relative, int precision)
static char * assvg_multipoint(const LWMPOINT *mpoint, int relative, int precision)
static size_t assvg_collection_size(const LWCOLLECTION *col, int relative, int precision)
Collection Geometry.
static size_t assvg_line_size(const LWLINE *line, __attribute__((__unused__)) int relative, int precision)
Line Geometry.
static char * assvg_point(const LWPOINT *point, int relative, int precision)
static size_t assvg_multipolygon_size(const LWMPOLY *mpoly, int relative, int precision)
static char * assvg_collection(const LWCOLLECTION *col, int relative, int precision)
static size_t pointArray_svg_rel(POINTARRAY *pa, char *output, int close_ring, int precision)
static size_t assvg_point_buf(const LWPOINT *point, char *output, int circle, int precision)
static char * 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 char * assvg_multipolygon(const LWMPOLY *mpoly, 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 char * assvg_polygon(const LWPOLY *poly, int relative, int precision)
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)