PostGIS  2.2.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 632 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().

633 {
634  int i, end;
635  char *ptr;
638  POINT2D pt;
639 
640  ptr = output;
641 
642  if (close_ring) end = pa->npoints;
643  else end = pa->npoints - 1;
644 
645  for (i=0 ; i < end ; i++)
646  {
647  getPoint2d_p(pa, i, &pt);
648 
649  if (fabs(pt.x) < OUT_MAX_DOUBLE)
650  sprintf(x, "%.*f", precision, pt.x);
651  else
652  sprintf(x, "%g", pt.x);
654 
655  /* SVG Y axis is reversed, an no need to transform 0 into -0 */
656  if (fabs(pt.y) < OUT_MAX_DOUBLE)
657  sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1:pt.y);
658  else
659  sprintf(y, "%g", fabs(pt.y) ? pt.y * -1:pt.y);
661 
662  if (i == 1) ptr += sprintf(ptr, " L ");
663  else if (i) ptr += sprintf(ptr, " ");
664  ptr += sprintf(ptr,"%s %s", x, y);
665  }
666 
667  return (ptr-output);
668 }
int npoints
Definition: liblwgeom.h:355
#define OUT_MAX_DOUBLE_PRECISION
void trim_trailing_zeros(char *num)
Definition: lwutil.c:224
double x
Definition: liblwgeom.h:312
uint8_t precision
Definition: cu_in_twkb.c:25
double y
Definition: liblwgeom.h:312
int getPoint2d_p(const POINTARRAY *pa, int n, POINT2D *point)
Definition: lwgeom_api.c:448
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: