PostGIS  2.3.7dev-r@@SVN_REVISION@@
static size_t pointArray_svg_abs ( POINTARRAY pa,
char *  output,
int  close_ring,
int  precision 
)
static

Returns maximum size of rendered pointarray in bytes.

Definition at line 646 of file lwout_svg.c.

References getPoint2d_p(), POINTARRAY::npoints, OUT_MAX_DIGS_DOUBLE, OUT_MAX_DOUBLE, OUT_MAX_DOUBLE_PRECISION, trim_trailing_zeros(), pixval::x, POINT2D::x, pixval::y, and POINT2D::y.

Referenced by assvg_line_buf(), and assvg_polygon_buf().

647 {
648  int i, end;
649  char *ptr;
652  POINT2D pt;
653 
654  ptr = output;
655 
656  if (close_ring) end = pa->npoints;
657  else end = pa->npoints - 1;
658 
659  for (i=0 ; i < end ; i++)
660  {
661  getPoint2d_p(pa, i, &pt);
662 
663  if (fabs(pt.x) < OUT_MAX_DOUBLE)
664  sprintf(x, "%.*f", precision, pt.x);
665  else
666  sprintf(x, "%g", pt.x);
668 
669  /* SVG Y axis is reversed, an no need to transform 0 into -0 */
670  if (fabs(pt.y) < OUT_MAX_DOUBLE)
671  sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1:pt.y);
672  else
673  sprintf(y, "%g", fabs(pt.y) ? pt.y * -1:pt.y);
675 
676  if (i == 1) ptr += sprintf(ptr, " L ");
677  else if (i) ptr += sprintf(ptr, " ");
678  ptr += sprintf(ptr,"%s %s", x, y);
679  }
680 
681  return (ptr-output);
682 }
int npoints
Definition: liblwgeom.h:370
#define OUT_MAX_DOUBLE_PRECISION
void trim_trailing_zeros(char *num)
Definition: lwutil.c:252
double x
Definition: liblwgeom.h:327
uint8_t precision
Definition: cu_in_twkb.c:25
double y
Definition: liblwgeom.h:327
int getPoint2d_p(const POINTARRAY *pa, int n, POINT2D *point)
Definition: lwgeom_api.c:461
tuple x
Definition: pixval.py:53
#define OUT_MAX_DOUBLE
#define OUT_MAX_DIGS_DOUBLE
tuple y
Definition: pixval.py:54

Here is the call graph for this function:

Here is the caller graph for this function: