PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwgeom_filter_m()

LWGEOM* lwgeom_filter_m ( LWGEOM geom,
double  min,
double  max,
int  returnm 
)

Definition at line 221 of file lwmval.c.

222 {
223  LWDEBUGF(2, "Entered %s",__func__);
224 
225  LWGEOM *ngeom = lwgeom_filter_m_ignore_null(geom,min, max,returnm);
226 
227  if(ngeom)
228  return ngeom;
229  else
230  {
231  switch ( geom->type )
232  {
233  case POINTTYPE:
234  {
235  return (LWGEOM*) lwpoint_construct_empty(geom->srid, FLAGS_GET_Z(geom->flags), returnm * FLAGS_GET_M(geom->flags));
236  break;
237  }
238  case LINETYPE:
239  {
240  return (LWGEOM*) lwline_construct_empty(geom->srid, FLAGS_GET_Z(geom->flags), returnm * FLAGS_GET_M(geom->flags));
241  break;
242  }
243  /* Polygon has 'nrings' and 'rings' elements */
244  case POLYGONTYPE:
245  {
246  return (LWGEOM*) lwpoly_construct_empty(geom->srid, FLAGS_GET_Z(geom->flags), returnm * FLAGS_GET_M(geom->flags));
247  break;
248  }
249 
250  /* All these Collection types have 'ngeoms' and 'geoms' elements */
251  case MULTIPOINTTYPE:
252  case MULTILINETYPE:
253  case MULTIPOLYGONTYPE:
254  case COLLECTIONTYPE:
255  {
256  return (LWGEOM*) lwcollection_construct_empty(geom->type, geom->srid, FLAGS_GET_Z(geom->flags), returnm * FLAGS_GET_M(geom->flags));
257  break;
258  }
259  /* Unknown type! */
260  default:
261  lwerror("%s: Unsupported geometry type: %s", __func__, lwtype_name(geom->type));
262  }
263  }
264  /*Shouldn't be possible*/
265  return NULL;
266 }
LWPOINT * lwpoint_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwpoint.c:151
#define COLLECTIONTYPE
Definition: liblwgeom.h:122
#define MULTILINETYPE
Definition: liblwgeom.h:120
#define LINETYPE
Definition: liblwgeom.h:117
#define MULTIPOINTTYPE
Definition: liblwgeom.h:119
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:116
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:179
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:121
#define POLYGONTYPE
Definition: liblwgeom.h:118
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
Definition: lwcollection.c:92
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:180
LWPOLY * lwpoly_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwpoly.c:161
LWLINE * lwline_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwline.c:55
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static LWGEOM * lwgeom_filter_m_ignore_null(LWGEOM *geom, double min, double max, int returnm)
Definition: lwmval.c:173
uint8_t type
Definition: liblwgeom.h:448
int32_t srid
Definition: liblwgeom.h:446
lwflags_t flags
Definition: liblwgeom.h:447

References COLLECTIONTYPE, LWGEOM::flags, FLAGS_GET_M, FLAGS_GET_Z, LINETYPE, lwcollection_construct_empty(), LWDEBUGF, lwerror(), lwgeom_filter_m_ignore_null(), lwline_construct_empty(), lwpoint_construct_empty(), lwpoly_construct_empty(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, POINTTYPE, POLYGONTYPE, LWGEOM::srid, and LWGEOM::type.

Referenced by do_test_filterm(), and LWGEOM_FilterByM().

Here is the call graph for this function:
Here is the caller graph for this function: