PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ getPoint4d_p()

int getPoint4d_p ( const POINTARRAY pa,
uint32_t  n,
POINT4D point 
)

Definition at line 125 of file lwgeom_api.c.

126 {
127  uint8_t *ptr;
128  int zmflag;
129 
130  if ( ! pa )
131  {
132  lwerror("%s [%d] NULL POINTARRAY input", __FILE__, __LINE__);
133  return 0;
134  }
135 
136  if ( n>=pa->npoints )
137  {
138  lwnotice("%s [%d] called with n=%d and npoints=%d", __FILE__, __LINE__, n, pa->npoints);
139  return 0;
140  }
141 
142  LWDEBUG(4, "getPoint4d_p called.");
143 
144  /* Get a pointer to nth point offset and zmflag */
145  ptr=getPoint_internal(pa, n);
146  zmflag=FLAGS_GET_ZM(pa->flags);
147 
148  LWDEBUGF(4, "ptr %p, zmflag %d", ptr, zmflag);
149 
150  switch (zmflag)
151  {
152  case 0: /* 2d */
153  memcpy(op, ptr, sizeof(POINT2D));
154  op->m=NO_M_VALUE;
155  op->z=NO_Z_VALUE;
156  break;
157 
158  case 3: /* ZM */
159  memcpy(op, ptr, sizeof(POINT4D));
160  break;
161 
162  case 2: /* Z */
163  memcpy(op, ptr, sizeof(POINT3DZ));
164  op->m=NO_M_VALUE;
165  break;
166 
167  case 1: /* M */
168  memcpy(op, ptr, sizeof(POINT3DM));
169  op->m=op->z; /* we use Z as temporary storage */
170  op->z=NO_Z_VALUE;
171  break;
172 
173  default:
174  lwerror("Unknown ZM flag ??");
175  return 0;
176  }
177  return 1;
178 
179 }
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:194
#define NO_Z_VALUE
#define NO_M_VALUE
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:177
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: lwinline.h:67
lwflags_t flags
Definition: liblwgeom.h:417
uint32_t npoints
Definition: liblwgeom.h:413

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

Referenced by _lwt_AddLineEdge(), _lwt_AddPoint(), analyze_pa(), circstring_from_pa(), encode_coords(), encode_mpoint(), getPoint4d(), linestring_from_pa(), lwarc_linearize(), lwcircstring_calculate_gbox_cartesian(), lwcircstring_linearize(), lwcompound_add_lwgeom(), lwcompound_linearize(), LWGEOM_dumppoints(), LWGEOM_setpoint_linestring(), LWGEOM_snaptogrid_pointoff(), lwgeom_wrapx(), lwline_add_lwpoint(), lwline_clip_to_ordinate_range(), lwline_from_lwmpoint(), lwline_interpolate_point_3d(), lwline_interpolate_points(), lwline_split_by_point_to(), lwmpoint_construct(), lwmpoint_extract_points_4d(), lwpoint_get_m(), lwpoint_get_x(), lwpoint_get_y(), lwpoint_get_z(), lwpoint_getPoint4d_p(), lwpointiterator_peek(), lwpoly_from_twkb_state(), lwpoly_pt_outside_hack(), lwpsurface_is_closed(), lwtin_is_closed(), lwtriangle_clip_to_ordinate_range(), parse_kml_polygon(), printPA(), pta_unstroke(), ptarray_affine(), ptarray_append_point(), ptarray_clamp_to_ordinate_range(), ptarray_collect_mvals(), ptarray_flip_coordinates(), ptarray_force_dims(), ptarray_force_geodetic(), 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_startpoint(), ptarray_substring(), ptarray_swap_ordinates(), ptarray_to_kml2_sb(), ptarray_to_x3d3_sb(), ptarray_transform(), RTreeCreateLeafNode(), test_raster_convex_hull(), and test_raster_envelope_geom().

Here is the call graph for this function: