PostGIS  2.2.7dev-r@@SVN_REVISION@@
LWPOLY* lwpoly_construct ( int  srid,
GBOX bbox,
uint32_t  nrings,
POINTARRAY **  points 
)

Definition at line 29 of file lwpoly.c.

References LWPOLY::bbox, LWPOLY::flags, FLAGS_GET_M, FLAGS_GET_Z, FLAGS_GET_ZM, FLAGS_SET_BBOX, gflags(), lwalloc(), lwerror(), LWPOLY::maxrings, LWPOLY::nrings, POLYGONTYPE, LWPOLY::rings, LWPOLY::srid, and LWPOLY::type.

Referenced by _lwt_AddFaceSplit(), _lwt_EdgeMotionArea(), BOX2D_to_LWGEOM(), BOX3D_to_LWGEOM(), GEOS2LWGEOM(), lwcurvepoly_stroke(), LWGEOM_dump_rings(), LWGEOM_envelope(), LWGEOM_expand(), lwmsurface_stroke(), lwpoly_force_dims(), lwpoly_from_lwlines(), lwpoly_remove_repeated_points(), lwpoly_segmentize2d(), parse_geojson_polygon(), 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(), SFCGAL2LWGEOM(), and ST_MakeEnvelope().

30 {
31  LWPOLY *result;
32  int hasz, hasm;
33 #ifdef CHECK_POLY_RINGS_ZM
34  char zm;
35  uint32_t i;
36 #endif
37 
38  if ( nrings < 1 ) lwerror("lwpoly_construct: need at least 1 ring");
39 
40  hasz = FLAGS_GET_Z(points[0]->flags);
41  hasm = FLAGS_GET_M(points[0]->flags);
42 
43 #ifdef CHECK_POLY_RINGS_ZM
44  zm = FLAGS_GET_ZM(points[0]->flags);
45  for (i=1; i<nrings; i++)
46  {
47  if ( zm != FLAGS_GET_ZM(points[i]->flags) )
48  lwerror("lwpoly_construct: mixed dimensioned rings");
49  }
50 #endif
51 
52  result = (LWPOLY*) lwalloc(sizeof(LWPOLY));
53  result->type = POLYGONTYPE;
54  result->flags = gflags(hasz, hasm, 0);
55  FLAGS_SET_BBOX(result->flags, bbox?1:0);
56  result->srid = srid;
57  result->nrings = nrings;
58  result->maxrings = nrings;
59  result->rings = points;
60  result->bbox = bbox;
61 
62  return result;
63 }
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:137
GBOX * bbox
Definition: liblwgeom.h:437
uint8_t type
Definition: liblwgeom.h:435
POINTARRAY ** rings
Definition: liblwgeom.h:441
int nrings
Definition: liblwgeom.h:439
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:130
#define FLAGS_SET_BBOX(flags, value)
Definition: liblwgeom.h:132
int maxrings
Definition: liblwgeom.h:440
int32_t srid
Definition: liblwgeom.h:438
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:125
uint8_t flags
Definition: liblwgeom.h:436
void * lwalloc(size_t size)
Definition: lwutil.c:199
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74

Here is the call graph for this function:

Here is the caller graph for this function: