PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ BOX3D_out()

Datum BOX3D_out ( PG_FUNCTION_ARGS  )

Definition at line 121 of file lwgeom_box3d.c.

122 {
123  BOX3D *bbox = (BOX3D *)PG_GETARG_POINTER(0);
124  int size;
125  char *result;
126 
127  if (bbox == NULL)
128  {
129  result = palloc(5);
130  strcat(result, "NULL");
131  PG_RETURN_CSTRING(result);
132  }
133 
134  /* double digits + "BOX3D"+ "()" + commas + null */
135  size = MAX_DIGS_DOUBLE * 6 + 5 + 2 + 4 + 5 + 1;
136 
137  result = (char *)palloc(size);
138 
139  sprintf(result,
140  "BOX3D(%.15g %.15g %.15g,%.15g %.15g %.15g)",
141  bbox->xmin,
142  bbox->ymin,
143  bbox->zmin,
144  bbox->xmax,
145  bbox->ymax,
146  bbox->zmax);
147 
148  PG_RETURN_CSTRING(result);
149 }
#define MAX_DIGS_DOUBLE
Definition: lwgeom_box3d.c:44
double xmax
Definition: liblwgeom.h:281
double zmin
Definition: liblwgeom.h:280
double ymax
Definition: liblwgeom.h:281
double ymin
Definition: liblwgeom.h:280
double zmax
Definition: liblwgeom.h:281
double xmin
Definition: liblwgeom.h:280

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