PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwcircstring_construct()

LWCIRCSTRING* lwcircstring_construct ( int  srid,
GBOX bbox,
POINTARRAY points 
)

Definition at line 51 of file lwcircstring.c.

References LWCIRCSTRING::bbox, CIRCSTRINGTYPE, POINTARRAY::flags, LWCIRCSTRING::flags, FLAGS_SET_BBOX, lwalloc(), lwnotice(), POINTARRAY::npoints, LWCIRCSTRING::points, LWCIRCSTRING::srid, and LWCIRCSTRING::type.

Referenced by circstring_from_pa(), lwcircstring_addpoint(), lwcircstring_from_lwmpoint(), lwcircstring_from_lwpointarray(), lwcircstring_from_wkb_state(), lwcircstring_grid(), lwcircstring_removepoint(), and wkt_parser_circularstring_new().

52 {
53  LWCIRCSTRING *result;
54 
55  /*
56  * The first arc requires three points. Each additional
57  * arc requires two more points. Thus the minimum point count
58  * is three, and the count must be odd.
59  */
60  if (points->npoints % 2 != 1 || points->npoints < 3)
61  {
62  lwnotice("lwcircstring_construct: invalid point count %d", points->npoints);
63  }
64 
65  result = (LWCIRCSTRING*) lwalloc(sizeof(LWCIRCSTRING));
66 
67  result->type = CIRCSTRINGTYPE;
68 
69  result->flags = points->flags;
70  FLAGS_SET_BBOX(result->flags, bbox?1:0);
71 
72  result->srid = srid;
73  result->points = points;
74  result->bbox = bbox;
75 
76  return result;
77 }
uint8_t flags
Definition: liblwgeom.h:440
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:89
int npoints
Definition: liblwgeom.h:370
int32_t srid
Definition: liblwgeom.h:442
uint8_t flags
Definition: liblwgeom.h:368
uint8_t type
Definition: liblwgeom.h:439
GBOX * bbox
Definition: liblwgeom.h:441
#define FLAGS_SET_BBOX(flags, value)
Definition: liblwgeom.h:147
POINTARRAY * points
Definition: liblwgeom.h:443
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
void * lwalloc(size_t size)
Definition: lwutil.c:227
Here is the call graph for this function:
Here is the caller graph for this function: