PostGIS  2.5.7dev-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("Unsupported geometry type: %s [%d] in function %s", lwtype_name((geom)->type), (geom)->type, __func__);
262  }
263  }
264  /*Shouldn't be possible*/
265  return NULL;
266 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:94
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define LINETYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
LWLINE * lwline_construct_empty(int srid, char hasz, char hasm)
Definition: lwline.c:64
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POLYGONTYPE
Definition: liblwgeom.h:87
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
LWPOINT * lwpoint_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoint.c:151
LWPOLY * lwpoly_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoly.c:161
#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
type
Definition: ovdump.py:41
uint8_t type
Definition: liblwgeom.h:399
uint8_t flags
Definition: liblwgeom.h:400
int32_t srid
Definition: liblwgeom.h:402

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, LWGEOM::type, and ovdump::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: