PostGIS  2.1.10dev-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 633 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().

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