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

Definition at line 115 of file lwgeom_box3d.c.

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

116 {
117  BOX3D *bbox = (BOX3D *) PG_GETARG_POINTER(0);
118  int size;
119  char *result;
120 
121  if (bbox == NULL)
122  {
123  result = palloc(5);
124  strcat(result,"NULL");
125  PG_RETURN_CSTRING(result);
126  }
127 
128 
129  /*double digits+ "BOX3D"+ "()" + commas +null */
130  size = MAX_DIGS_DOUBLE*6+5+2+4+5+1;
131 
132  result = (char *) palloc(size);
133 
134  sprintf(result, "BOX3D(%.15g %.15g %.15g,%.15g %.15g %.15g)",
135  bbox->xmin, bbox->ymin, bbox->zmin,
136  bbox->xmax,bbox->ymax,bbox->zmax);
137 
138  PG_RETURN_CSTRING(result);
139 }
double ymin
Definition: liblwgeom.h:261
double xmin
Definition: liblwgeom.h:261
#define MAX_DIGS_DOUBLE
Definition: lwgeom_box3d.c:23
double xmax
Definition: liblwgeom.h:262
double ymax
Definition: liblwgeom.h:262
double zmax
Definition: liblwgeom.h:262
double zmin
Definition: liblwgeom.h:261