PostGIS  2.5.0dev-r@@SVN_REVISION@@
static SHPObject * create_point ( SHPDUMPERSTATE state,
LWPOINT lwpoint 
)
static

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

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

Referenced by ShpLoaderGenerateShapeRow().

73 {
74  SHPObject *obj;
75  POINT4D p4d;
76 
77  double *xpts, *ypts, *zpts, *mpts;
78 
79  /* Allocate storage for points */
80  xpts = malloc(sizeof(double));
81  ypts = malloc(sizeof(double));
82  zpts = malloc(sizeof(double));
83  mpts = malloc(sizeof(double));
84 
85  /* Grab the point: note getPoint4d will correctly handle
86  the case where the POINTs don't contain Z or M coordinates */
87  p4d = getPoint4d(lwpoint->point, 0);
88 
89  xpts[0] = p4d.x;
90  ypts[0] = p4d.y;
91  zpts[0] = p4d.z;
92  mpts[0] = p4d.m;
93 
94  LWDEBUGF(4, "Point: %g %g %g %g", xpts[0], ypts[0], zpts[0], mpts[0]);
95 
96  obj = SHPCreateObject(state->outshptype, -1, 0, NULL, NULL, 1, xpts, ypts, zpts, mpts);
97 
98  free(xpts);
99  free(ypts);
100  free(zpts);
101  free(mpts);
102 
103  return obj;
104 }
double x
Definition: liblwgeom.h:351
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
double m
Definition: liblwgeom.h:351
POINTARRAY * point
Definition: liblwgeom.h:410
POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n)
Definition: lwgeom_api.c:96
double z
Definition: liblwgeom.h:351
void free(void *)
void * malloc(YYSIZE_T)
double y
Definition: liblwgeom.h:351
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88

Here is the call graph for this function:

Here is the caller graph for this function: