PostGIS  2.4.9dev-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 119 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().

120 {
121  char *ptr=output;
124  POINT2D pt;
125 
126  getPoint2d_p(point->point, 0, &pt);
127 
128  if (fabs(pt.x) < OUT_MAX_DOUBLE)
129  sprintf(x, "%.*f", precision, pt.x);
130  else
131  sprintf(x, "%g", pt.x);
133 
134  /* SVG Y axis is reversed, an no need to transform 0 into -0 */
135  if (fabs(pt.y) < OUT_MAX_DOUBLE)
136  sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1 : pt.y);
137  else
138  sprintf(y, "%g", fabs(pt.y) ? pt.y * -1 : pt.y);
140 
141  if (circle) ptr += sprintf(ptr, "x=\"%s\" y=\"%s\"", x, y);
142  else ptr += sprintf(ptr, "cx=\"%s\" cy=\"%s\"", x, y);
143 
144  return (ptr-output);
145 }
#define OUT_MAX_DOUBLE_PRECISION
void trim_trailing_zeros(char *num)
Definition: lwutil.c:254
POINTARRAY * point
Definition: liblwgeom.h:411
double x
Definition: liblwgeom.h:328
uint8_t precision
Definition: cu_in_twkb.c:25
double y
Definition: liblwgeom.h:328
int getPoint2d_p(const POINTARRAY *pa, int n, POINT2D *point)
Definition: lwgeom_api.c:347
#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: