127 switch (sfcgal_geometry_type_id(geom))
129 case SFCGAL_TYPE_POINT:
132 point.
x = sfcgal_point_x(geom);
133 point.
y = sfcgal_point_y(geom);
135 if (sfcgal_geometry_is_3d(geom))
136 point.
z = sfcgal_point_z(geom);
144 case SFCGAL_TYPE_LINESTRING:
146 npoints = sfcgal_linestring_num_points(geom);
149 for (i = 0; i < npoints; i++)
151 const sfcgal_geometry_t* pt = sfcgal_linestring_point_n(geom, i);
152 point.
x = sfcgal_point_x(pt);
153 point.
y = sfcgal_point_y(pt);
155 if (sfcgal_geometry_is_3d(geom))
156 point.
z = sfcgal_point_z(pt);
165 case SFCGAL_TYPE_TRIANGLE:
169 for (i = 0; i < 4; i++)
171 const sfcgal_geometry_t* pt = sfcgal_triangle_vertex(geom, (i%3));
172 point.
x = sfcgal_point_x(pt);
173 point.
y = sfcgal_point_y(pt);
175 if ( sfcgal_geometry_is_3d(geom))
176 point.
z = sfcgal_point_z(pt);
187 lwerror(
"ptarray_from_SFCGAL: Unknown Type");
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
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 lwerror(const char *fmt,...)
Write a notice out to the error handler.