PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ pointArray_svg_rel()

static void pointArray_svg_rel ( stringbuffer_t sb,
const POINTARRAY pa,
int  close_ring,
int  precision,
int  start_at_index 
)
static

Definition at line 44 of file lwout_svg.c.

45{
46 int i, end;
47 const POINT2D *pt;
48
49 double f = 1.0;
50 double dx, dy, x, y, accum_x, accum_y;
51
54
55 if (precision >= 0)
56 {
57 f = pow(10, precision);
58 }
59
60 end = close_ring ? pa->npoints : pa->npoints - 1;
61
62 /* Starting point */
63 pt = getPoint2d_cp(pa, start_at_index);
64
65 x = round(pt->x*f)/f;
66 y = round(pt->y*f)/f;
67
70
71 stringbuffer_aprintf(sb, "%s %s l", sx, sy);
72
73 /* accum */
74 accum_x = x;
75 accum_y = y;
76
77 /* All the following ones */
78 for (i = (start_at_index + 1); i < end; i++)
79 {
80 pt = getPoint2d_cp(pa, i);
81
82 x = round(pt->x*f)/f;
83 y = round(pt->y*f)/f;
84
85 dx = x - accum_x;
86 dy = y - accum_y;
87
88 accum_x += dx;
89 accum_y += dy;
90
92 lwprint_double(-dy, precision, sy);
93 stringbuffer_aprintf(sb, " %s %s", sx, sy);
94 }
95}
static uint8_t precision
Definition cu_in_twkb.c:25
#define OUT_DOUBLE_BUFFER_SIZE
int lwprint_double(double d, int maxdd, char *buf)
Definition lwprint.c:463
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
Definition lwinline.h:97
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.
double y
Definition liblwgeom.h:390
double x
Definition liblwgeom.h:390
uint32_t npoints
Definition liblwgeom.h:427

References getPoint2d_cp(), lwprint_double(), POINTARRAY::npoints, OUT_DOUBLE_BUFFER_SIZE, precision, stringbuffer_aprintf(), POINT2D::x, and POINT2D::y.

Referenced by assvg_compound(), assvg_line(), and assvg_polygon().

Here is the call graph for this function:
Here is the caller graph for this function: