Append a POINTARRAY, pa2 to the end of an existing POINTARRAY, pa1.
If gap_tolerance is >= 0 then the end point of pa1 will be checked for being within gap_tolerance 2d distance from start point of pa2 or an error will be raised and LW_FAILURE returned. A gap_tolerance < 0 disables the check.
If end point of pa1 and start point of pa2 are 2d-equal, then pa2 first point will not be appended.
Definition at line 177 of file ptarray.c.
178{
179 unsigned int poff = 0;
180 unsigned int npoints;
181 unsigned int ncap;
182 unsigned int ptsize;
183
184
185 if( ! pa1 || ! pa2 )
186 {
187 lwerror(
"%s: null input", __func__);
189 }
190
192
194
196 {
197 lwerror(
"%s: target pointarray is read-only", __func__);
199 }
200
202 {
203 lwerror(
"%s: appending mixed dimensionality is not allowed", __func__);
205 }
206
208
209
211 {
215
216
218 poff = 1;
219 --npoints;
220 }
221 else if ((gap_tolerance == 0) ||
223 {
224 lwerror(
"Second line start point too far from first line end point");
226 }
227 }
228
229
232 {
234 {
238 }
239 else
240 {
243 }
244 }
245
248
250
252}
void * lwrealloc(void *mem, size_t size)
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
#define FLAGS_GET_READONLY(flags)
void * lwalloc(size_t size)
#define FLAGS_GET_ZM(flags)
int p2d_same(const POINT2D *p1, const POINT2D *p2)
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
static size_t ptarray_point_size(const POINTARRAY *pa)
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
uint8_t * serialized_pointlist
References distance2d_pt_pt(), POINTARRAY::flags, FLAGS_GET_READONLY, FLAGS_GET_ZM, getPoint2d_cp(), getPoint_internal(), LW_FAILURE, LW_SUCCESS, lwalloc(), lwerror(), lwrealloc(), POINTARRAY::maxpoints, POINTARRAY::npoints, p2d_same(), ptarray_point_size(), and POINTARRAY::serialized_pointlist.
Referenced by _lwt_HealEdges(), _lwt_MakeRingShell(), _lwt_SnapEdge_checkMotion(), lwline_extend(), lwline_from_lwgeom_array(), and test_ptarray_append_ptarray().