163 double *xpts, *ypts, *zpts, *mpts;
165 int *shpparts, shppointtotal = 0, shppoint = 0;
171 for (i = 0; i < lwpolygon->
nrings; i++)
175 xpts =
malloc(
sizeof(
double) * shppointtotal);
176 ypts =
malloc(
sizeof(
double) * shppointtotal);
177 zpts =
malloc(
sizeof(
double) * shppointtotal);
178 mpts =
malloc(
sizeof(
double) * shppointtotal);
180 LWDEBUGF(4,
"Total number of points: %d", shppointtotal);
183 for (i = 0; i < lwpolygon->
nrings; i++)
186 shpparts[i] = shppoint;
192 xpts[shppoint] = p4d.
x;
193 ypts[shppoint] = p4d.
y;
194 zpts[shppoint] = p4d.
z;
195 mpts[shppoint] = p4d.
m;
197 LWDEBUGF(4,
"Polygon Ring %d - Point: %g %g %g %g", i, xpts[shppoint], ypts[shppoint], zpts[shppoint], mpts[shppoint]);
210 &xpts[shpparts[i]], &ypts[shpparts[i]], NULL) )
212 LWDEBUG(4,
"Outer ring not clockwise, forcing clockwise\n");
215 &xpts[shpparts[i]], &ypts[shpparts[i]],
216 &zpts[shpparts[i]], &mpts[shpparts[i]]);
222 &xpts[shpparts[i]], &ypts[shpparts[i]], NULL) )
224 LWDEBUGF(4,
"Inner ring %d not counter-clockwise, forcing counter-clockwise\n", i);
227 &xpts[shpparts[i]], &ypts[shpparts[i]],
228 &zpts[shpparts[i]], &mpts[shpparts[i]]);
SHPObject SHPAPI_CALL1 * SHPCreateObject(int nSHPType, int nShapeId, int nParts, const int *panPartStart, const int *panPartType, int nVertices, const double *padfX, const double *padfY, const double *padfZ, const double *padfM);SHPObject SHPAPI_CALL1(*) SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ
#define LWDEBUG(level, msg)
static int reverse_points(int num_points, double *x, double *y, double *z, double *m)
POINT4D getPoint4d(const POINTARRAY *pa, int n)
static int is_clockwise(int num_points, double *x, double *y, double *z)
#define LWDEBUGF(level, msg,...)