PostGIS  2.3.7dev-r@@SVN_REVISION@@
Datum BOX3D_out ( PG_FUNCTION_ARGS  )

Definition at line 135 of file lwgeom_box3d.c.

References MAX_DIGS_DOUBLE, BOX3D::xmax, BOX3D::xmin, BOX3D::ymax, BOX3D::ymin, BOX3D::zmax, and BOX3D::zmin.

136 {
137  BOX3D *bbox = (BOX3D *) PG_GETARG_POINTER(0);
138  int size;
139  char *result;
140 
141  if (bbox == NULL)
142  {
143  result = palloc(5);
144  strcat(result,"NULL");
145  PG_RETURN_CSTRING(result);
146  }
147 
148 
149  /*double digits+ "BOX3D"+ "()" + commas +null */
150  size = MAX_DIGS_DOUBLE*6+5+2+4+5+1;
151 
152  result = (char *) palloc(size);
153 
154  sprintf(result, "BOX3D(%.15g %.15g %.15g,%.15g %.15g %.15g)",
155  bbox->xmin, bbox->ymin, bbox->zmin,
156  bbox->xmax,bbox->ymax,bbox->zmax);
157 
158  PG_RETURN_CSTRING(result);
159 }
double ymin
Definition: liblwgeom.h:276
double xmin
Definition: liblwgeom.h:276
#define MAX_DIGS_DOUBLE
Definition: lwgeom_box3d.c:42
double xmax
Definition: liblwgeom.h:277
double ymax
Definition: liblwgeom.h:277
double zmax
Definition: liblwgeom.h:277
double zmin
Definition: liblwgeom.h:276