PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ getPoint_internal()

uint8_t* getPoint_internal ( const POINTARRAY pa,
int  n 
)

Definition at line 1753 of file ptarray.c.

References POINTARRAY::flags, FLAGS_NDIMS, LWDEBUGF, lwerror(), POINTARRAY::maxpoints, POINTARRAY::npoints, ptarray_point_size(), and POINTARRAY::serialized_pointlist.

Referenced by circ_node_leaf_new(), circ_node_leaf_point_new(), getPoint2d_cp(), getPoint2d_p(), getPoint2d_p_ro(), getPoint3dm_p(), getPoint3dz_cp(), getPoint3dz_p(), getPoint4d_cp(), getPoint4d_p(), gserialized_from_lwcircstring(), gserialized_from_lwline(), gserialized_from_lwpoint(), gserialized_from_lwpoly(), gserialized_from_lwtriangle(), lwcircstring_addpoint(), lwcircstring_from_lwmpoint(), lwcircstring_from_lwpointarray(), lwcompound_is_closed(), LWGEOM2GEOS(), lwline_make_geos_friendly(), parse_gml_curve(), ptarray_addPoint(), ptarray_append_ptarray(), ptarray_calc_areas(), ptarray_close2d(), ptarray_copy_point(), ptarray_insert_point(), ptarray_is_closed(), ptarray_is_closed_2d(), ptarray_is_closed_3d(), ptarray_longitude_shift(), ptarray_merge(), ptarray_remove_point(), ptarray_removePoint(), ptarray_reverse(), ptarray_same(), ptarray_set_point4d(), ptarray_to_twkb_buf(), ptarray_to_wkb_buf(), ptarray_to_wkt_sb(), rect_node_leaf_new(), ring_make_geos_friendly(), and tune_areas().

1754 {
1755  size_t size;
1756  uint8_t *ptr;
1757 
1758 #if PARANOIA_LEVEL > 0
1759  if ( pa == NULL )
1760  {
1761  lwerror("%s [%d] got NULL pointarray", __FILE__, __LINE__);
1762  return NULL;
1763  }
1764 
1765  LWDEBUGF(5, "(n=%d, pa.npoints=%d, pa.maxpoints=%d)",n,pa->npoints,pa->maxpoints);
1766 
1767  if ( ( n < 0 ) ||
1768  ( n > pa->npoints ) ||
1769  ( n >= pa->maxpoints ) )
1770  {
1771  lwerror("%s [%d] called outside of ptarray range (n=%d, pa.npoints=%d, pa.maxpoints=%d)", __FILE__, __LINE__, n, pa->npoints, pa->maxpoints);
1772  return NULL; /*error */
1773  }
1774 #endif
1775 
1776  size = ptarray_point_size(pa);
1777 
1778  ptr = pa->serialized_pointlist + size * n;
1779  if ( FLAGS_NDIMS(pa->flags) == 2)
1780  {
1781  LWDEBUGF(5, "point = %g %g", *((double*)(ptr)), *((double*)(ptr+8)));
1782  }
1783  else if ( FLAGS_NDIMS(pa->flags) == 3)
1784  {
1785  LWDEBUGF(5, "point = %g %g %g", *((double*)(ptr)), *((double*)(ptr+8)), *((double*)(ptr+16)));
1786  }
1787  else if ( FLAGS_NDIMS(pa->flags) == 4)
1788  {
1789  LWDEBUGF(5, "point = %g %g %g %g", *((double*)(ptr)), *((double*)(ptr+8)), *((double*)(ptr+16)), *((double*)(ptr+24)));
1790  }
1791 
1792  return ptr;
1793 }
uint8_t * serialized_pointlist
Definition: liblwgeom.h:366
int ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:54
int npoints
Definition: liblwgeom.h:371
uint8_t flags
Definition: liblwgeom.h:369
int maxpoints
Definition: liblwgeom.h:372
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:152
unsigned char uint8_t
Definition: uthash.h:79
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
Here is the call graph for this function:
Here is the caller graph for this function: