PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ getPoint4d_p()

int getPoint4d_p ( const POINTARRAY pa,
int  n,
POINT4D op 
)

Definition at line 231 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 _lwt_AddLineEdge(), _lwt_EdgeMotionArea(), circstring_from_pa(), getPoint4d(), linestring_from_pa(), lwcircstring_calculate_gbox_cartesian(), lwcircstring_stroke(), lwcompound_add_lwgeom(), lwcompound_stroke(), LWGEOM_dumppoints(), LWGEOM_line_interpolate_point(), LWGEOM_setpoint_linestring(), LWGEOM_snaptogrid_pointoff(), lwline_add_lwpoint(), lwline_clip_to_ordinate_range(), lwline_from_lwmpoint(), lwline_simplify(), lwline_split_by_point_to(), lwmpoint_construct(), lwpoint_get_m(), lwpoint_get_x(), lwpoint_get_y(), lwpoint_get_z(), lwpoint_getPoint4d_p(), lwpoly_from_twkb_state(), lwpsurface_is_closed(), lwt_AddPoint(), lwtin_is_closed(), parse_kml_polygon(), pointArray_toX3D3(), printPA(), pta_unstroke(), ptarray_affine(), ptarray_append_point(), ptarray_calculate_gbox_cartesian(), ptarray_collect_mvals(), ptarray_flip_coordinates(), ptarray_force_dims(), ptarray_force_geodetic(), ptarray_grid(), ptarray_length_spheroid(), ptarray_locate_along(), ptarray_locate_along_linear(), ptarray_locate_between_m(), ptarray_locate_point(), ptarray_nudge_geodetic(), ptarray_scale(), ptarray_segmentize2d(), ptarray_segmentize_sphere(), ptarray_simplify(), ptarray_startpoint(), ptarray_substring(), ptarray_swap_ordinates(), ptarray_to_kml2_sb(), ptarray_transform(), RTreeCreateLeafNode(), ST_Scale(), test_raster_convex_hull(), and test_raster_envelope_geom().

232 {
233  uint8_t *ptr;
234  int zmflag;
235 
236 #if PARANOIA_LEVEL > 0
237  if ( ! pa ) lwerror("getPoint4d_p: NULL pointarray");
238 
239  if ( (n<0) || (n>=pa->npoints))
240  {
241  lwerror("getPoint4d_p: point offset out of range");
242  }
243 #endif
244 
245  LWDEBUG(4, "getPoint4d_p called.");
246 
247  /* Get a pointer to nth point offset and zmflag */
248  ptr=getPoint_internal(pa, n);
249  zmflag=FLAGS_GET_ZM(pa->flags);
250 
251  LWDEBUGF(4, "ptr %p, zmflag %d", ptr, zmflag);
252 
253  switch (zmflag)
254  {
255  case 0: /* 2d */
256  memcpy(op, ptr, sizeof(POINT2D));
257  op->m=NO_M_VALUE;
258  op->z=NO_Z_VALUE;
259  break;
260 
261  case 3: /* ZM */
262  memcpy(op, ptr, sizeof(POINT4D));
263  break;
264 
265  case 2: /* Z */
266  memcpy(op, ptr, sizeof(POINT3DZ));
267  op->m=NO_M_VALUE;
268  break;
269 
270  case 1: /* M */
271  memcpy(op, ptr, sizeof(POINT3DM));
272  op->m=op->z; /* we use Z as temporary storage */
273  op->z=NO_Z_VALUE;
274  break;
275 
276  default:
277  lwerror("Unknown ZM flag ??");
278  }
279  return 1;
280 
281 }
double m
Definition: liblwgeom.h:336
int npoints
Definition: liblwgeom.h:355
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:137
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
uint8_t flags
Definition: liblwgeom.h:353
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1706
double z
Definition: liblwgeom.h:336
#define NO_Z_VALUE
#define NO_M_VALUE
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
Here is the call graph for this function: