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

◆ lwpoly_construct()

LWPOLY * lwpoly_construct ( int32_t  srid,
GBOX bbox,
uint32_t  nrings,
POINTARRAY **  points 
)
extern

Definition at line 43 of file lwpoly.c.

44{
46 int hasz, hasm;
47#ifdef CHECK_POLY_RINGS_ZM
48 char zm;
49 uint32_t i;
50#endif
51
52 if ( nrings < 1 ) lwerror("lwpoly_construct: need at least 1 ring");
53
54 hasz = FLAGS_GET_Z(points[0]->flags);
55 hasm = FLAGS_GET_M(points[0]->flags);
56
57#ifdef CHECK_POLY_RINGS_ZM
58 zm = FLAGS_GET_ZM(points[0]->flags);
59 for (i=1; i<nrings; i++)
60 {
61 if ( zm != FLAGS_GET_ZM(points[i]->flags) )
62 lwerror("lwpoly_construct: mixed dimensioned rings");
63 }
64#endif
65
66 result = (LWPOLY*) lwalloc(sizeof(LWPOLY));
67 result->type = POLYGONTYPE;
68 result->flags = lwflags(hasz, hasm, 0);
69 FLAGS_SET_BBOX(result->flags, bbox?1:0);
70 result->srid = srid;
71 result->nrings = nrings;
72 result->maxrings = nrings;
73 result->rings = points;
74 result->bbox = bbox;
75
76 return result;
77}
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition cu_print.c:267
#define FLAGS_SET_BBOX(flags, value)
Definition liblwgeom.h:174
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
void * lwalloc(size_t size)
Definition lwutil.c:227
#define POLYGONTYPE
Definition liblwgeom.h:104
#define FLAGS_GET_M(flags)
Definition liblwgeom.h:166
#define FLAGS_GET_ZM(flags)
Definition liblwgeom.h:180
lwflags_t lwflags(int hasz, int hasm, int geodetic)
Construct a new flags bitmask.
Definition lwutil.c:477
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.

References FLAGS_GET_M, FLAGS_GET_Z, FLAGS_GET_ZM, FLAGS_SET_BBOX, lwalloc(), lwerror(), lwflags(), POLYGONTYPE, and result.

Referenced by _lwt_MakeRingShell(), GEOS2LWGEOM(), hexagon(), lwcurvepoly_linearize(), LWGEOM_dump_rings(), LWGEOM_envelope(), lwmsurface_linearize(), lwpoly_force_dims(), lwpoly_from_lwlines(), lwpoly_segmentize2d(), parse_geojson_poly_rings(), parse_gml_linearring(), parse_gml_patch(), parse_gml_polygon(), parse_kml_polygon(), polygon_to_geometry(), rt_raster_get_convex_hull(), rt_raster_get_envelope_geom(), rt_raster_get_perimeter(), rt_raster_pixel_as_polygon(), rt_util_envelope_to_lwpoly(), and SFCGAL2LWGEOM().

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