PostGIS  2.1.10dev-r@@SVN_REVISION@@
int getPoint4d_p ( const POINTARRAY pa,
int  n,
POINT4D point 
)

Definition at line 217 of file lwgeom_api.c.

References POINTARRAY::flags, FLAGS_GET_ZM, getPoint_internal(), LWDEBUG, LWDEBUGF, lwerror(), POINT4D::m, NO_M_VALUE, NO_Z_VALUE, POINTARRAY::npoints, and POINT4D::z.

Referenced by circstring_from_pa(), getPoint4d(), gml_reproject_pa(), linestring_from_pa(), lwcircstring_calculate_gbox_cartesian(), lwcircstring_segmentize(), lwcompound_add_lwgeom(), lwcompound_segmentize(), LWGEOM_dumppoints(), LWGEOM_line_interpolate_point(), LWGEOM_setpoint_linestring(), LWGEOM_snaptogrid_pointoff(), lwline_add_lwpoint(), lwline_clip_to_ordinate_range(), lwline_from_lwmpoint(), lwline_split_by_point_to(), lwmpoint_construct(), lwpoint_get_m(), lwpoint_get_x(), lwpoint_get_y(), lwpoint_get_z(), lwpoint_getPoint4d_p(), lwpsurface_is_closed(), lwtin_is_closed(), pointArray_toX3D3(), printPA(), pta_desegmentize(), ptarray_affine(), ptarray_append_point(), ptarray_calculate_gbox_cartesian(), ptarray_flip_coordinates(), ptarray_force_dims(), ptarray_force_geodetic(), ptarray_grid(), ptarray_length_spheroid(), ptarray_locate_along(), ptarray_locate_between_m(), ptarray_locate_point(), ptarray_nudge_geodetic(), ptarray_segmentize2d(), ptarray_segmentize_sphere(), ptarray_simplify(), ptarray_startpoint(), ptarray_substring(), ptarray_to_kml2_sb(), ptarray_transform(), RTreeCreateLeafNode(), and test_raster_convex_hull().

218 {
219  uint8_t *ptr;
220  int zmflag;
221 
222 #if PARANOIA_LEVEL > 0
223  if ( ! pa ) lwerror("getPoint4d_p: NULL pointarray");
224 
225  if ( (n<0) || (n>=pa->npoints))
226  {
227  lwerror("getPoint4d_p: point offset out of range");
228  }
229 #endif
230 
231  LWDEBUG(4, "getPoint4d_p called.");
232 
233  /* Get a pointer to nth point offset and zmflag */
234  ptr=getPoint_internal(pa, n);
235  zmflag=FLAGS_GET_ZM(pa->flags);
236 
237  LWDEBUGF(4, "ptr %p, zmflag %d", ptr, zmflag);
238 
239  switch (zmflag)
240  {
241  case 0: /* 2d */
242  memcpy(op, ptr, sizeof(POINT2D));
243  op->m=NO_M_VALUE;
244  op->z=NO_Z_VALUE;
245  break;
246 
247  case 3: /* ZM */
248  memcpy(op, ptr, sizeof(POINT4D));
249  break;
250 
251  case 2: /* Z */
252  memcpy(op, ptr, sizeof(POINT3DZ));
253  op->m=NO_M_VALUE;
254  break;
255 
256  case 1: /* M */
257  memcpy(op, ptr, sizeof(POINT3DM));
258  op->m=op->z; /* we use Z as temporary storage */
259  op->z=NO_Z_VALUE;
260  break;
261 
262  default:
263  lwerror("Unknown ZM flag ??");
264  }
265  return 1;
266 
267 }
int npoints
Definition: liblwgeom.h:327
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:119
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
uint8_t flags
Definition: liblwgeom.h:325
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1645
#define NO_Z_VALUE
#define NO_M_VALUE
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55

Here is the call graph for this function:

Here is the caller graph for this function: