PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ create_point()

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

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

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