PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ create_point()

static SHPObject * create_point ( SHPDUMPERSTATE state,
LWPOINT lwpoint 
)
static

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

83{
84 SHPObject *obj;
85 POINT4D p4d;
86
87 double *xpts, *ypts, *zpts, *mpts;
88
89 /* Allocate storage for points */
90 xpts = malloc(sizeof(double));
91 ypts = malloc(sizeof(double));
92 zpts = malloc(sizeof(double));
93 mpts = malloc(sizeof(double));
94
95 /* Grab the point: note getPoint4d will correctly handle
96 the case where the POINTs don't contain Z or M coordinates */
97 p4d = getPoint4d(lwpoint->point, 0);
98
99 xpts[0] = p4d.x;
100 ypts[0] = p4d.y;
101 zpts[0] = p4d.z;
102 mpts[0] = p4d.m;
103
104 LWDEBUGF(4, "Point: %g %g %g %g", xpts[0], ypts[0], zpts[0], mpts[0]);
105
106 obj = SHPCreateObject(state->outshptype, -1, 0, NULL, NULL, 1, xpts, ypts, zpts, mpts);
107
108 free(xpts);
109 free(ypts);
110 free(zpts);
111 free(mpts);
112
113 return obj;
114}
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
POINTARRAY * point
Definition liblwgeom.h:457
double m
Definition liblwgeom.h:400
double x
Definition liblwgeom.h:400
double z
Definition liblwgeom.h:400
double y
Definition liblwgeom.h:400

References free(), getPoint4d(), LWDEBUGF, POINT4D::m, malloc(), 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: