PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ assvg_point_buf()

static size_t assvg_point_buf ( const LWPOINT point,
char *  output,
int  circle,
int  precision 
)
static

Definition at line 105 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().

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