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");
static POINTARRAY * ptarray_from_SFCGAL(const sfcgal_geometry_t *geom, int force3D)
static int SFCGAL_type_to_lwgeom_type(sfcgal_geometry_type_t type)
LWGEOM * SFCGAL2LWGEOM(const sfcgal_geometry_t *geom, int force3D, int srid)
LWLINE * lwline_construct_empty(int srid, char hasz, char hasm)
void * lwrealloc(void *mem, size_t size)
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
#define POLYHEDRALSURFACETYPE
#define FLAGS_GET_SOLID(flags)
LWPOLY * lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
LWTRIANGLE * lwtriangle_construct(int srid, GBOX *bbox, POINTARRAY *points)
void * lwalloc(size_t size)
LWPOINT * lwpoint_construct_empty(int srid, char hasz, char hasm)
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
#define FLAGS_SET_SOLID(flags, value)
LWPOLY * lwpoly_construct_empty(int srid, char hasz, char hasm)
LWTRIANGLE * lwtriangle_construct_empty(int srid, char hasz, char hasm)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.