50 double dx, dy,
x,
y, accum_x, accum_y;
78 for (i = (start_at_index + 1); i < end; i++)
111 for (i = start_at_index; i < end; i++)
117 if (start_at_index > 0 ){
145 circle ?
"x=\"%s\" y=\"%s\"" :
"cx=\"%s\" cy=\"%s\"",
168 LWDEBUG(2,
"pointArray_svg_arc called.");
170 for (i = 2; i < pa->
npoints; i+=2)
172 LWDEBUGF(3,
"assvg_circstring: arc ending at point %d", i);
173 int largeArcFlag, sweepFlag, clockwise;
187 if ( t1->
x == t3->
x && t1->
y == t3->
y ){
196 a1 = atan2(t1->
y - center.
y, t1->
x - center.
x)*180/M_PI;
198 a3 = atan2(t3->
y - center.
y, t3->
x - center.
x)*180/M_PI;
200 LWDEBUGF(2,
" center is POINT(%.15g %.15g) - radius:%g", center.
x, center.
y, radius);
202 total_angle = clockwise ? a1 - a3 : a3 - a1;
203 if (total_angle < 0 ){
210 largeArcFlag = (total_angle <= 180)? 0 : 1;
213 sweepFlag = (p2_side == -1) ? 1 : 0;
214 if ( (i == 2) && !is_circle ){
221 if ( (i == 2) && is_circle){
270 for (i = 0; i < icompound->
ngeoms; i++)
273 geom = icompound->
geoms[i];
313 for (i = 0; i<poly->
nrings; i++)
337 for (i = 0; i<mpoint->
ngeoms; i++)
340 point = mpoint->
geoms[i];
352 for (i = 0; i<mline->
ngeoms; i++)
355 line = mline->
geoms[i];
366 for (i = 0; i<mpoly->
ngeoms; i++)
369 poly = mpoly->
geoms[i];
380 const LWLINE *tmpl = NULL;
382 for (i = 0; i < mcurve->
ngeoms; i++)
385 geom = mcurve->
geoms[i];
411 for (i = 0; i < curvepoly->
nrings; i++)
414 tmp = curvepoly->
rings[i];
451 for (i = 0; i < msurface->
ngeoms; i++)
454 geom = msurface->
geoms[i];
474 uint32_t i; uint32_t j = 0;
478 if (col->
ngeoms == 0)
return;
480 for (i = 0; i<col->
ngeoms; i++)
482 subgeom = col->
geoms[i];
549 lwerror(
"assvg_geom_buf: '%s' geometry type not supported.",
#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 LW_TRUE
Return types for functions with status returns.
double lw_arc_center(const POINT2D *p1, const POINT2D *p2, const POINT2D *p3, POINT2D *result)
Determines the center of the circle defined by the three given points.
#define OUT_DOUBLE_BUFFER_SIZE
int lw_segment_side(const POINT2D *p1, const POINT2D *p2, const POINT2D *q)
lw_segment_side()
int lwprint_double(double d, int maxdd, char *buf)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
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 void assvg_compound(stringbuffer_t *sb, const LWCOMPOUND *icompound, int relative, int precision)
static void assvg_multipoint(stringbuffer_t *sb, const LWMPOINT *mpoint, 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 void pointArray_svg_rel(stringbuffer_t *sb, const POINTARRAY *pa, int close_ring, int precision, int start_at_index)
static void assvg_curvepoly(stringbuffer_t *sb, const LWCURVEPOLY *curvepoly, int relative, int precision)
static void assvg_multiline(stringbuffer_t *sb, const LWMLINE *mline, int relative, int precision)
static void assvg_multipolygon(stringbuffer_t *sb, const LWMPOLY *mpoly, int relative, int precision)
static void pointArray_svg_arc(stringbuffer_t *sb, const POINTARRAY *pa, int close_ring, int relative, int precision)
static void assvg_line(stringbuffer_t *sb, const LWLINE *line, int relative, int precision)
static void assvg_polygon(stringbuffer_t *sb, const LWPOLY *poly, int relative, int precision)
static void assvg_circstring(stringbuffer_t *sb, const LWCIRCSTRING *icurve, int relative, int precision)
static void assvg_multicurve(stringbuffer_t *sb, const LWMCURVE *mcurve, int relative, int precision)
static void assvg_point(stringbuffer_t *sb, const LWPOINT *point, int circle, int precision)
static void pointArray_svg_abs(stringbuffer_t *sb, const POINTARRAY *pa, int close_ring, int precision, int start_at_index)
Returns maximum size of rendered pointarray in bytes.
static void assvg_geom(stringbuffer_t *sb, const LWGEOM *geom, int relative, int precision)
static void assvg_multisurface(stringbuffer_t *sb, const LWMSURFACE *msurface, int relative, int precision)
static void assvg_collection(stringbuffer_t *sb, const LWCOLLECTION *col, int relative, int precision)
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.
lwvarlena_t * stringbuffer_getvarlena(stringbuffer_t *s)
void stringbuffer_init_varlena(stringbuffer_t *s)
static void stringbuffer_append(stringbuffer_t *s, const char *a)
Append the specified string to the stringbuffer_t.