286 want3d = force3D || sfcgal_geometry_is_3d(geom);
288 switch (sfcgal_geometry_type_id(geom))
290 case SFCGAL_TYPE_POINT:
292 if (sfcgal_geometry_is_empty(geom))
299 case SFCGAL_TYPE_LINESTRING:
301 if (sfcgal_geometry_is_empty(geom))
308 case SFCGAL_TYPE_TRIANGLE:
310 if (sfcgal_geometry_is_empty(geom))
317 case SFCGAL_TYPE_POLYGON:
319 if (sfcgal_geometry_is_empty(geom))
322 uint32_t nrings = sfcgal_polygon_num_interior_rings(geom) + 1;
326 for (i = 1; i < nrings; i++)
332 case SFCGAL_TYPE_MULTIPOINT:
333 case SFCGAL_TYPE_MULTILINESTRING:
334 case SFCGAL_TYPE_MULTIPOLYGON:
335 case SFCGAL_TYPE_MULTISOLID:
336 case SFCGAL_TYPE_GEOMETRYCOLLECTION:
338 ngeoms = sfcgal_geometry_collection_num_geometries(geom);
344 for (i = 0; i < ngeoms; i++)
346 const sfcgal_geometry_t* g = sfcgal_geometry_collection_geometry_n(geom, i);
353 sfcgal_geometry_type_id(geom)), srid, NULL, ngeoms, geoms);
357 else if ( nsolids )
lwnotice(
"SFCGAL2LWGEOM: SOLID in heterogeneous collection will be treated as a POLYHEDRALSURFACETYPE");
363 case SFCGAL_TYPE_CIRCULARSTRING:
364 case SFCGAL_TYPE_COMPOUNDCURVE:
365 case SFCGAL_TYPE_CURVEPOLYGON:
366 case SFCGAL_TYPE_MULTICURVE:
367 case SFCGAL_TYPE_MULTISURFACE:
368 case SFCGAL_TYPE_CURVE:
369 case SFCGAL_TYPE_SURFACE:
374 case SFCGAL_TYPE_POLYHEDRALSURFACE:
376 ngeoms = sfcgal_polyhedral_surface_num_polygons(geom);
382 for (i = 0; i < ngeoms; i++)
384 const sfcgal_geometry_t* g = sfcgal_polyhedral_surface_polygon_n( geom, i );
392 case SFCGAL_TYPE_SOLID:
394 nshells = sfcgal_solid_num_shells(geom);
396 for (ngeoms = 0, i = 0; i < nshells; i++)
397 ngeoms += sfcgal_polyhedral_surface_num_polygons(sfcgal_solid_shell_n(geom, i));
403 for (i = 0, k =0 ; i < nshells; i++)
405 const sfcgal_geometry_t* shell = sfcgal_solid_shell_n(geom, i);
406 ngeoms = sfcgal_polyhedral_surface_num_polygons(shell);
408 for (j = 0; j < ngeoms; j++)
410 const sfcgal_geometry_t* g = sfcgal_polyhedral_surface_polygon_n(shell, j);
421 case SFCGAL_TYPE_TRIANGULATEDSURFACE:
423 ngeoms = sfcgal_triangulated_surface_num_triangles(geom);
428 for (i = 0; i < ngeoms; i++)
430 const sfcgal_geometry_t* g = sfcgal_triangulated_surface_triangle_n(geom, i);
438 lwerror(
"SFCGAL2LWGEOM: Unknown Type");
#define FLAGS_SET_SOLID(flags, value)
LWLINE * lwline_construct_empty(int srid, char hasz, char hasm)
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
LWTRIANGLE * lwtriangle_construct_empty(int srid, char hasz, char hasm)
#define POLYHEDRALSURFACETYPE
#define FLAGS_GET_SOLID(flags)
LWPOINT * lwpoint_construct_empty(int srid, char hasz, char hasm)
static int SFCGAL_type_to_lwgeom_type(sfcgal_geometry_type_t type)
LWPOLY * lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
LWTRIANGLE * lwtriangle_construct(int srid, GBOX *bbox, POINTARRAY *points)
static POINTARRAY * ptarray_from_SFCGAL(const sfcgal_geometry_t *geom, int force3D)
void * lwrealloc(void *mem, size_t size)
LWPOLY * lwpoly_construct_empty(int srid, char hasz, char hasm)
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
void * lwalloc(size_t size)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
LWGEOM * SFCGAL2LWGEOM(const sfcgal_geometry_t *geom, int force3D, int srid)