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

◆ wkt_parser_ptarray_add_coord()

POINTARRAY * wkt_parser_ptarray_add_coord ( POINTARRAY pa,
POINT  p 
)

Definition at line 265 of file lwin_wkt.c.

266{
267 POINT4D pt;
268 LWDEBUG(4,"entered");
269
270 /* Error on trouble */
271 if( ! pa )
272 {
274 return NULL;
275 }
276
277 /* Check that the coordinate has the same dimensionality as the array */
278 if( FLAGS_NDIMS(p.flags) != FLAGS_NDIMS(pa->flags) )
279 {
280 ptarray_free(pa);
282 return NULL;
283 }
284
285 /* While parsing the point arrays, XYM and XMZ points are both treated as XYZ */
286 pt.x = p.x;
287 pt.y = p.y;
288 if( FLAGS_GET_Z(pa->flags) )
289 pt.z = p.z;
290 if( FLAGS_GET_M(pa->flags) )
291 pt.m = p.m;
292 /* If the destination is XYM, we'll write the third coordinate to m */
293 if( FLAGS_GET_M(pa->flags) && ! FLAGS_GET_Z(pa->flags) )
294 pt.m = p.z;
295
296 ptarray_append_point(pa, &pt, LW_TRUE); /* Allow duplicate points in array */
297 return pa;
298}
#define PARSER_ERROR_MIXDIMS
Definition liblwgeom.h:2175
#define PARSER_ERROR_OTHER
Definition liblwgeom.h:2181
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
#define FLAGS_NDIMS(flags)
Definition liblwgeom.h:179
#define FLAGS_GET_M(flags)
Definition liblwgeom.h:166
void ptarray_free(POINTARRAY *pa)
Definition ptarray.c:327
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
Definition ptarray.c:147
#define LW_TRUE
Return types for functions with status returns.
Definition liblwgeom.h:93
#define LWDEBUG(level, msg)
Definition lwgeom_log.h:101
#define SET_PARSER_ERROR(errno)
Definition lwin_wkt.c:52
double m
Definition liblwgeom.h:414
double x
Definition liblwgeom.h:414
double z
Definition liblwgeom.h:414
double y
Definition liblwgeom.h:414
lwflags_t flags
Definition liblwgeom.h:431
double y
Definition lwin_wkt.h:36
double m
Definition lwin_wkt.h:38
lwflags_t flags
Definition lwin_wkt.h:34
double z
Definition lwin_wkt.h:37
double x
Definition lwin_wkt.h:35

References POINTARRAY::flags, POINT::flags, FLAGS_GET_M, FLAGS_GET_Z, FLAGS_NDIMS, LW_TRUE, LWDEBUG, POINT4D::m, POINT::m, PARSER_ERROR_MIXDIMS, PARSER_ERROR_OTHER, ptarray_append_point(), ptarray_free(), SET_PARSER_ERROR, POINT4D::x, POINT::x, POINT4D::y, POINT::y, POINT4D::z, and POINT::z.

Referenced by wkt_parser_ptarray_new().

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