PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ create_multipoint()

static SHPObject * create_multipoint ( SHPDUMPERSTATE state,
LWMPOINT lwmultipoint 
)
static

Definition at line 132 of file pgsql2shp-core.c.

133 {
134  SHPObject *obj;
135  POINT4D p4d;
136  uint32_t i;
137 
138  double *xpts, *ypts, *zpts, *mpts;
139 
140  /* Allocate storage for points */
141  xpts = malloc(sizeof(double) * lwmultipoint->ngeoms);
142  ypts = malloc(sizeof(double) * lwmultipoint->ngeoms);
143  zpts = malloc(sizeof(double) * lwmultipoint->ngeoms);
144  mpts = malloc(sizeof(double) * lwmultipoint->ngeoms);
145 
146  /* Grab the points: note getPoint4d will correctly handle
147  the case where the POINTs don't contain Z or M coordinates */
148  for (i = 0; i < lwmultipoint->ngeoms; i++)
149  {
150  p4d = getPoint4d(lwmultipoint->geoms[i]->point, 0);
151 
152  xpts[i] = p4d.x;
153  ypts[i] = p4d.y;
154  zpts[i] = p4d.z;
155  mpts[i] = p4d.m;
156 
157  LWDEBUGF(4, "MultiPoint %d - Point: %g %g %g %g", i, xpts[i], ypts[i], zpts[i], mpts[i]);
158  }
159 
160  obj = SHPCreateObject(state->outshptype, -1, 0, NULL, NULL, lwmultipoint->ngeoms, xpts, ypts, zpts, mpts);
161 
162  free(xpts);
163  free(ypts);
164  free(zpts);
165  free(mpts);
166 
167  return obj;
168 }
POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n)
Definition: lwgeom_api.c:108
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void * malloc(YYSIZE_T)
void free(void *)
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
uint32_t ngeoms
Definition: liblwgeom.h:553
LWPOINT ** geoms
Definition: liblwgeom.h:548
POINTARRAY * point
Definition: liblwgeom.h:486
double m
Definition: liblwgeom.h:429
double x
Definition: liblwgeom.h:429
double z
Definition: liblwgeom.h:429
double y
Definition: liblwgeom.h:429

References free(), LWMPOINT::geoms, getPoint4d(), LWDEBUGF, POINT4D::m, malloc(), LWMPOINT::ngeoms, shp_dumper_state::outshptype, LWPOINT::point, SHPCreateObject(), POINT4D::x, POINT4D::y, and POINT4D::z.

Referenced by ShpLoaderGenerateShapeRow().

Here is the call graph for this function:
Here is the caller graph for this function: