PostGIS  3.4.0dev-r@@SVN_REVISION@@
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages

◆ assvg_compound()

static void assvg_compound ( stringbuffer_t sb,
const LWCOMPOUND icompound,
int  relative,
int  precision 
)
static

if the compound curve does not start with a line, we need to skip the first point since it is the same as previous point of previous curve

in theory this should never happen

Definition at line 261 of file lwout_svg.c.

262 {
263  uint32_t i;
264  LWGEOM *geom;
265  LWCIRCSTRING *tmpc = NULL;
266  LWLINE *tmpl = NULL;
267  /* Start path with SVG MoveTo */
268  stringbuffer_append(sb, "M ");
269 
270  for (i = 0; i < icompound->ngeoms; i++)
271  {
272  if (i) stringbuffer_append(sb, " "); /* SVG whitespace Separator */
273  geom = icompound->geoms[i];
274 
275  switch (geom->type)
276  {
277  case CIRCSTRINGTYPE:
278  tmpc = (LWCIRCSTRING *)geom;
279  pointArray_svg_arc(sb, tmpc->points, 1, relative, precision);
280  break;
281 
282  case LINETYPE:
283  tmpl = (LWLINE *)geom;
284 
285  if (i){
289  if (relative)
290  pointArray_svg_rel(sb, tmpl->points, 1, precision, 1);
291  else
292  pointArray_svg_abs(sb, tmpl->points, 1, precision, 1);
293  }
294  else {
295  if (relative)
296  pointArray_svg_rel(sb, tmpl->points, 1, precision, 0);
297  else
298  pointArray_svg_abs(sb, tmpl->points, 1, precision, 0);
299  }
300  break;
301 
302  default:
303  break;
304  }
305  }
306 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define LINETYPE
Definition: liblwgeom.h:103
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:109
static void pointArray_svg_rel(stringbuffer_t *sb, const POINTARRAY *pa, int close_ring, int precision, int start_at_index)
Definition: lwout_svg.c:44
static void pointArray_svg_arc(stringbuffer_t *sb, const POINTARRAY *pa, int close_ring, int relative, int precision)
Definition: lwout_svg.c:162
static void pointArray_svg_abs(stringbuffer_t *sb, const POINTARRAY *pa, int close_ring, int precision, int start_at_index)
Returns maximum size of rendered pointarray in bytes.
Definition: lwout_svg.c:102
static void stringbuffer_append(stringbuffer_t *s, const char *a)
Append the specified string to the stringbuffer_t.
Definition: stringbuffer.h:105
POINTARRAY * points
Definition: liblwgeom.h:507
uint32_t ngeoms
Definition: liblwgeom.h:594
LWGEOM ** geoms
Definition: liblwgeom.h:589
uint8_t type
Definition: liblwgeom.h:462
POINTARRAY * points
Definition: liblwgeom.h:483

References CIRCSTRINGTYPE, LWCOMPOUND::geoms, LINETYPE, LWCOMPOUND::ngeoms, pointArray_svg_abs(), pointArray_svg_arc(), pointArray_svg_rel(), LWLINE::points, LWCIRCSTRING::points, precision, stringbuffer_append(), and LWGEOM::type.

Referenced by assvg_curvepoly(), assvg_geom(), and lwgeom_to_svg().

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