162 double *xpts, *ypts, *zpts, *mpts;
164 int *shpparts, shppointtotal = 0, shppoint = 0;
170 for (i = 0; i < lwpolygon->
nrings; i++)
174 xpts =
malloc(
sizeof(
double) * shppointtotal);
175 ypts =
malloc(
sizeof(
double) * shppointtotal);
176 zpts =
malloc(
sizeof(
double) * shppointtotal);
177 mpts =
malloc(
sizeof(
double) * shppointtotal);
179 LWDEBUGF(4,
"Total number of points: %d", shppointtotal);
182 for (i = 0; i < lwpolygon->
nrings; i++)
185 shpparts[i] = shppoint;
191 xpts[shppoint] = p4d.
x;
192 ypts[shppoint] = p4d.
y;
193 zpts[shppoint] = p4d.
z;
194 mpts[shppoint] = p4d.
m;
196 LWDEBUGF(4,
"Polygon Ring %d - Point: %g %g %g %g", i, xpts[shppoint], ypts[shppoint], zpts[shppoint], mpts[shppoint]);
209 &xpts[shpparts[i]], &ypts[shpparts[i]], NULL) )
211 LWDEBUG(4,
"Outer ring not clockwise, forcing clockwise\n");
214 &xpts[shpparts[i]], &ypts[shpparts[i]],
215 &zpts[shpparts[i]], &mpts[shpparts[i]]);
221 &xpts[shpparts[i]], &ypts[shpparts[i]], NULL) )
223 LWDEBUGF(4,
"Inner ring %d not counter-clockwise, forcing counter-clockwise\n", i);
226 &xpts[shpparts[i]], &ypts[shpparts[i]],
227 &zpts[shpparts[i]], &mpts[shpparts[i]]);
POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
static int reverse_points(int num_points, double *x, double *y, double *z, double *m)
static int is_clockwise(int num_points, double *x, double *y, double *z)
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