PostGIS  2.1.10dev-r@@SVN_REVISION@@
static size_t assvg_point_buf ( const LWPOINT point,
char *  output,
int  circle,
int  precision 
)
static

Definition at line 106 of file lwout_svg.c.

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

Referenced by assvg_geom_buf(), assvg_multipoint_buf(), and assvg_point().

107 {
108  char *ptr=output;
111  POINT2D pt;
112 
113  getPoint2d_p(point->point, 0, &pt);
114 
115  if (fabs(pt.x) < OUT_MAX_DOUBLE)
116  sprintf(x, "%.*f", precision, pt.x);
117  else
118  sprintf(x, "%g", pt.x);
120 
121  /* SVG Y axis is reversed, an no need to transform 0 into -0 */
122  if (fabs(pt.y) < OUT_MAX_DOUBLE)
123  sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1 : pt.y);
124  else
125  sprintf(y, "%g", fabs(pt.y) ? pt.y * -1 : pt.y);
127 
128  if (circle) ptr += sprintf(ptr, "x=\"%s\" y=\"%s\"", x, y);
129  else ptr += sprintf(ptr, "cx=\"%s\" cy=\"%s\"", x, y);
130 
131  return (ptr-output);
132 }
#define OUT_MAX_DOUBLE_PRECISION
void trim_trailing_zeros(char *num)
Definition: lwutil.c:200
POINTARRAY * point
Definition: liblwgeom.h:367
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: