122 switch (sfcgal_geometry_type_id(geom))
124 case SFCGAL_TYPE_POINT:
127 point.
x = sfcgal_point_x(geom);
128 point.
y = sfcgal_point_y(geom);
130 if (sfcgal_geometry_is_3d(geom))
131 point.
z = sfcgal_point_z(geom);
139 case SFCGAL_TYPE_LINESTRING:
141 npoints = sfcgal_linestring_num_points(geom);
144 for (i = 0; i < npoints; i++)
146 const sfcgal_geometry_t *pt = sfcgal_linestring_point_n(geom, i);
147 point.
x = sfcgal_point_x(pt);
148 point.
y = sfcgal_point_y(pt);
150 if (sfcgal_geometry_is_3d(geom))
151 point.
z = sfcgal_point_z(pt);
160 case SFCGAL_TYPE_TRIANGLE:
164 for (i = 0; i < 4; i++)
166 const sfcgal_geometry_t *pt = sfcgal_triangle_vertex(geom, (i % 3));
167 point.
x = sfcgal_point_x(pt);
168 point.
y = sfcgal_point_y(pt);
170 if (sfcgal_geometry_is_3d(geom))
171 point.
z = sfcgal_point_z(pt);
182 lwerror(
"ptarray_from_SFCGAL: Unknown Type");
POINTARRAY * ptarray_construct(char hasz, char hasm, uint32_t npoints)
Construct an empty pointarray, allocating storage and setting the npoints, but not filling in any inf...
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.