[postgis-tickets] r14952 - Style only change: remove trailing spaces
Sandro Santilli
strk at kbt.io
Wed Jun 15 09:28:28 PDT 2016
Author: strk
Date: 2016-06-15 09:28:28 -0700 (Wed, 15 Jun 2016)
New Revision: 14952
Modified:
trunk/liblwgeom/ptarray.c
Log:
Style only change: remove trailing spaces
Modified: trunk/liblwgeom/ptarray.c
===================================================================
--- trunk/liblwgeom/ptarray.c 2016-06-15 16:01:40 UTC (rev 14951)
+++ trunk/liblwgeom/ptarray.c 2016-06-15 16:28:28 UTC (rev 14952)
@@ -71,14 +71,14 @@
{
POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
pa->serialized_pointlist = NULL;
-
+
/* Set our dimsionality info on the bitmap */
pa->flags = gflags(hasz, hasm, 0);
-
+
/* We will be allocating a bit of room */
pa->npoints = 0;
pa->maxpoints = maxpoints;
-
+
/* Allocate the coordinate array */
if ( maxpoints > 0 )
pa->serialized_pointlist = lwalloc(maxpoints * ptarray_point_size(pa));
@@ -98,20 +98,20 @@
size_t point_size = ptarray_point_size(pa);
LWDEBUGF(5,"pa = %p; p = %p; where = %d", pa, p, where);
LWDEBUGF(5,"pa->npoints = %d; pa->maxpoints = %d", pa->npoints, pa->maxpoints);
-
+
if ( FLAGS_GET_READONLY(pa->flags) )
{
lwerror("ptarray_insert_point: called on read-only point array");
return LW_FAILURE;
}
-
+
/* Error on invalid offset value */
if ( where > pa->npoints || where < 0)
{
lwerror("ptarray_insert_point: offset out of range (%d)", where);
return LW_FAILURE;
}
-
+
/* If we have no storage, let's allocate some */
if( pa->maxpoints == 0 || ! pa->serialized_pointlist )
{
@@ -126,14 +126,14 @@
lwerror("npoints (%d) is greated than maxpoints (%d)", pa->npoints, pa->maxpoints);
return LW_FAILURE;
}
-
+
/* Check if we have enough storage, add more if necessary */
if( pa->npoints == pa->maxpoints )
{
pa->maxpoints *= 2;
pa->serialized_pointlist = lwrealloc(pa->serialized_pointlist, ptarray_point_size(pa) * pa->maxpoints);
}
-
+
/* Make space to insert the new point */
if( where < pa->npoints )
{
@@ -141,14 +141,14 @@
memmove(getPoint_internal(pa, where+1), getPoint_internal(pa, where), copy_size);
LWDEBUGF(5,"copying %d bytes to start vertex %d from start vertex %d", copy_size, where+1, where);
}
-
+
/* We have one more point */
++pa->npoints;
-
+
/* Copy the new point into the gap */
ptarray_set_point4d(pa, where, p);
LWDEBUGF(5,"copying new point to start vertex %d", point_size, where);
-
+
return LW_SUCCESS;
}
@@ -199,7 +199,7 @@
}
npoints = pa2->npoints;
-
+
if ( ! npoints ) return LW_SUCCESS; /* nothing more to do */
if( FLAGS_GET_READONLY(pa1->flags) )
@@ -268,23 +268,23 @@
lwerror("ptarray_remove_point: null input");
return LW_FAILURE;
}
-
+
/* Error on invalid offset value */
if ( where >= pa->npoints || where < 0)
{
lwerror("ptarray_remove_point: offset out of range (%d)", where);
return LW_FAILURE;
}
-
+
/* If the point is any but the last, we need to copy the data back one point */
if( where < pa->npoints - 1 )
{
memmove(getPoint_internal(pa, where), getPoint_internal(pa, where+1), ptsize * (pa->npoints - where - 1));
}
-
+
/* We have one less point */
pa->npoints--;
-
+
return LW_SUCCESS;
}
@@ -332,7 +332,7 @@
if(pa)
{
if(pa->serialized_pointlist && ( ! FLAGS_GET_READONLY(pa->flags) ) )
- lwfree(pa->serialized_pointlist);
+ lwfree(pa->serialized_pointlist);
lwfree(pa);
LWDEBUG(5,"Freeing a PointArray");
}
@@ -431,7 +431,7 @@
/* Initial storage */
opa = ptarray_construct_empty(hasz, hasm, ipa->npoints);
-
+
/* Add first point */
getPoint4d_p(ipa, ipoff, &p1);
ptarray_append_point(opa, &p1, LW_FALSE);
@@ -488,7 +488,7 @@
if ( FLAGS_GET_ZM(pa1->flags) != FLAGS_GET_ZM(pa2->flags) ) return LW_FALSE;
LWDEBUG(5,"dimensions are the same");
-
+
if ( pa1->npoints != pa2->npoints ) return LW_FALSE;
LWDEBUG(5,"npoints are the same");
@@ -728,21 +728,21 @@
seg2 = getPoint2d_cp(pa, pa->npoints-1);
if ( check_closed && ! p2d_same(seg1, seg2) )
lwerror("ptarray_contains_point called on unclosed ring");
-
+
for ( i=1; i < pa->npoints; i++ )
{
seg2 = getPoint2d_cp(pa, i);
-
+
/* Zero length segments are ignored. */
if ( seg1->x == seg2->x && seg1->y == seg2->y )
{
seg1 = seg2;
continue;
}
-
+
ymin = FP_MIN(seg1->y, seg2->y);
ymax = FP_MAX(seg1->y, seg2->y);
-
+
/* Only test segments in our vertical range */
if ( pt->y > ymax || pt->y < ymin )
{
@@ -770,7 +770,7 @@
{
wn++;
}
-
+
/*
* If the point is to the right of the line, and it's falling,
* then the line is to the right of the point and circling
@@ -780,7 +780,7 @@
{
wn--;
}
-
+
seg1 = seg2;
}
@@ -793,7 +793,7 @@
{
return LW_OUTSIDE;
}
-
+
/* Inside */
return LW_INSIDE;
}
@@ -851,11 +851,11 @@
double radius, d;
POINT2D c;
seg2 = getPoint2d_cp(pa, 1);
-
+
/* Wait, it's just a point, so it can't contain anything */
if ( lw_arc_is_pt(seg1, seg2, seg3) )
return LW_OUTSIDE;
-
+
/* See if the point is within the circle radius */
radius = lw_arc_center(seg1, seg2, seg3, &c);
d = distance2d_pt_pt(pt, &c);
@@ -877,18 +877,18 @@
{
seg2 = getPoint2d_cp(pa, i);
seg3 = getPoint2d_cp(pa, i+1);
-
+
/* Catch an easy boundary case */
if( p2d_same(seg3, pt) )
return LW_BOUNDARY;
-
+
/* Skip arcs that have no size */
if ( lw_arc_is_pt(seg1, seg2, seg3) )
{
seg1 = seg3;
continue;
}
-
+
/* Only test segments in our vertical range */
lw_arc_calculate_gbox_cartesian_2d(seg1, seg2, seg3, &gbox);
if ( pt->y > gbox.ymax || pt->y < gbox.ymin )
@@ -903,16 +903,16 @@
{
seg1 = seg3;
continue;
- }
-
+ }
+
side = lw_arc_side(seg1, seg2, seg3, pt);
-
+
/* On the boundary */
if ( (side == 0) && lw_pt_in_arc(pt, seg1, seg2, seg3) )
{
return LW_BOUNDARY;
}
-
+
/* Going "up"! Point to left of arc. */
if ( side < 0 && (seg1->y <= pt->y) && (pt->y < seg3->y) )
{
@@ -924,7 +924,7 @@
{
wn--;
}
-
+
/* Inside the arc! */
if ( pt->x <= gbox.xmax && pt->x >= gbox.xmin )
{
@@ -935,7 +935,7 @@
/* On the boundary! */
if ( d == radius )
return LW_BOUNDARY;
-
+
/* Within the arc! */
if ( d < radius )
{
@@ -960,7 +960,7 @@
{
return LW_OUTSIDE;
}
-
+
/* Inside */
return LW_INSIDE;
}
@@ -979,10 +979,10 @@
double sum = 0.0;
double x0, x, y1, y2;
int i;
-
+
if (! pa || pa->npoints < 3 )
return 0.0;
-
+
P1 = getPoint2d_cp(pa, 0);
P2 = getPoint2d_cp(pa, 1);
x0 = P1->x;
@@ -993,12 +993,12 @@
y1 = P3->y;
y2 = P1->y;
sum += x * (y2-y1);
-
+
/* Move forwards! */
P1 = P2;
P2 = P3;
}
- return sum / 2.0;
+ return sum / 2.0;
}
int
@@ -1019,7 +1019,7 @@
int in_hasm = FLAGS_GET_M(pa->flags);
POINT4D pt;
POINTARRAY *pa_out = ptarray_construct_empty(hasz, hasm, pa->npoints);
-
+
for( i = 0; i < pa->npoints; i++ )
{
getPoint4d_p(pa, i, &pt);
@@ -1291,11 +1291,11 @@
/* Initialize our 2D copy of the input parameter */
p.x = p4d->x;
p.y = p4d->y;
-
+
if ( ! proj4d ) proj4d = &projtmp;
-
+
start = getPoint2d_cp(pa, 0);
-
+
/* If the pointarray has only one point, the nearest point is */
/* just that point */
if ( pa->npoints == 1 )
@@ -1305,7 +1305,7 @@
*mindistout = distance2d_pt_pt(&p, start);
return 0.0;
}
-
+
/* Loop through pointarray looking for nearest segment */
for (t=1; t<pa->npoints; t++)
{
@@ -1340,7 +1340,7 @@
getPoint4d_p(pa, seg, &start4d);
getPoint4d_p(pa, seg+1, &end4d);
closest_point_on_segment(p4d, &start4d, &end4d, proj4d);
-
+
/* Copy 4D values into 2D holder */
proj.x = proj4d->x;
proj.y = proj4d->y;
@@ -1574,7 +1574,7 @@
getPoint4d_p(inpts, stack[sp], &pt);
LWDEBUGF(4, "npoints , minpoints %d %d", outpts->npoints, minpts);
ptarray_append_point(outpts, &pt, LW_FALSE);
-
+
LWDEBUGF(4, "Added P%d to simplified point array (size: %d)", stack[sp], outpts->npoints);
p1 = stack[sp--];
@@ -1606,7 +1606,7 @@
lwerror("arc point array with even number of points");
a1 = getPoint2d_cp(pts, 0);
-
+
for ( i=2; i < pts->npoints; i += 2 )
{
a2 = getPoint2d_cp(pts, i-1);
@@ -1631,14 +1631,14 @@
if ( pts->npoints < 2 ) return 0.0;
frm = getPoint2d_cp(pts, 0);
-
+
for ( i=1; i < pts->npoints; i++ )
{
to = getPoint2d_cp(pts, i);
dist += sqrt( ((frm->x - to->x)*(frm->x - to->x)) +
((frm->y - to->y)*(frm->y - to->y)) );
-
+
frm = to;
}
return dist;
@@ -1693,7 +1693,7 @@
lwerror("getPoint got NULL pointarray");
return NULL;
}
-
+
LWDEBUGF(5, "(n=%d, pa.npoints=%d, pa.maxpoints=%d)",n,pa->npoints,pa->maxpoints);
if ( ( n < 0 ) ||
@@ -1706,7 +1706,7 @@
#endif
size = ptarray_point_size(pa);
-
+
ptr = pa->serialized_pointlist + size * n;
if ( FLAGS_NDIMS(pa->flags) == 2)
{
More information about the postgis-tickets
mailing list