196{
198 int is_3d;
199 uint32_t i;
200
201 assert(pa);
202
204
205 switch (type)
206 {
208 {
210 if (is_3d)
211 return sfcgal_point_create_from_xyz(point.
x, point.
y, point.
z);
212 else
213 return sfcgal_point_create_from_xy(point.
x, point.
y);
214 }
215 break;
216
218 {
219 sfcgal_geometry_t *line = sfcgal_linestring_create();
220
221 for (i = 0; i < pa->
npoints; i++)
222 {
224 if (is_3d)
225 {
226 sfcgal_linestring_add_point(line,
227 sfcgal_point_create_from_xyz(point.
x, point.
y, point.
z));
228 }
229 else
230 {
231 sfcgal_linestring_add_point(line, sfcgal_point_create_from_xy(point.
x, point.
y));
232 }
233 }
234
235 return line;
236 }
237 break;
238
240 {
241 sfcgal_geometry_t *triangle = sfcgal_triangle_create();
242
244 if (is_3d)
245 sfcgal_triangle_set_vertex_from_xyz(triangle, 0, point.
x, point.
y, point.
z);
246 else
247 sfcgal_triangle_set_vertex_from_xy(triangle, 0, point.
x, point.
y);
248
250 if (is_3d)
251 sfcgal_triangle_set_vertex_from_xyz(triangle, 1, point.
x, point.
y, point.
z);
252 else
253 sfcgal_triangle_set_vertex_from_xy(triangle, 1, point.
x, point.
y);
254
256 if (is_3d)
257 sfcgal_triangle_set_vertex_from_xyz(triangle, 2, point.
x, point.
y, point.
z);
258 else
259 sfcgal_triangle_set_vertex_from_xy(triangle, 2, point.
x, point.
y);
260
261 return triangle;
262 }
263 break;
264
265
266 default:
267 lwerror(
"ptarray_from_SFCGAL: Unknown Type");
268 return NULL;
269 }
270}
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
#define FLAGS_GET_Z(flags)
int getPoint3dz_p(const POINTARRAY *pa, uint32_t n, POINT3DZ *point)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.