PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ create_point()

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

Definition at line 83 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().

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