int
lwpoint_getPoint2d_p(const LWPOINT *point, POINT2D *out)
{
- return getPoint2d_p(point->point, 0, out);
+ return lwpoint_is_empty(point) ? 0 : getPoint2d_p(point->point, 0, out);
}
/* convenience functions to hide the POINTARRAY */
int
lwpoint_getPoint3dz_p(const LWPOINT *point, POINT3DZ *out)
{
- return getPoint3dz_p(point->point,0,out);
+ return lwpoint_is_empty(point) ? 0 : getPoint3dz_p(point->point,0,out);
}
int
lwpoint_getPoint3dm_p(const LWPOINT *point, POINT3DM *out)
{
- return getPoint3dm_p(point->point,0,out);
+ return lwpoint_is_empty(point) ? 0 : getPoint3dm_p(point->point,0,out);
}
int
lwpoint_getPoint4d_p(const LWPOINT *point, POINT4D *out)
{
- return getPoint4d_p(point->point,0,out);
+ return lwpoint_is_empty(point) ? 0 : getPoint4d_p(point->point,0,out);
}
double
{
POINT4D pt;
if ( lwpoint_is_empty(point) )
+ {
lwerror("lwpoint_get_x called with empty geometry");
+ return 0;
+ }
getPoint4d_p(point->point, 0, &pt);
return pt.x;
}
{
POINT4D pt;
if ( lwpoint_is_empty(point) )
+ {
lwerror("lwpoint_get_y called with empty geometry");
+ return 0;
+ }
getPoint4d_p(point->point, 0, &pt);
return pt.y;
}
{
POINT4D pt;
if ( lwpoint_is_empty(point) )
+ {
lwerror("lwpoint_get_z called with empty geometry");
+ return 0;
+ }
if ( ! FLAGS_GET_Z(point->flags) )
+ {
lwerror("lwpoint_get_z called without z dimension");
+ return 0;
+ }
getPoint4d_p(point->point, 0, &pt);
return pt.z;
}
{
POINT4D pt;
if ( lwpoint_is_empty(point) )
+ {
lwerror("lwpoint_get_m called with empty geometry");
+ return 0;
+ }
if ( ! FLAGS_GET_M(point->flags) )
+ {
lwerror("lwpoint_get_m called without m dimension");
+ return 0;
+ }
getPoint4d_p(point->point, 0, &pt);
return pt.m;
}