PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwgeom_filter_m()

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

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}
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition lwutil.c:216
#define COLLECTIONTYPE
Definition liblwgeom.h:108
#define MULTILINETYPE
Definition liblwgeom.h:106
#define LINETYPE
Definition liblwgeom.h:103
#define MULTIPOINTTYPE
Definition liblwgeom.h:105
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:102
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
#define MULTIPOLYGONTYPE
Definition liblwgeom.h:107
#define POLYGONTYPE
Definition liblwgeom.h:104
LWPOINT * lwpoint_construct_empty(int32_t srid, char hasz, char hasm)
Definition lwpoint.c:151
#define FLAGS_GET_M(flags)
Definition liblwgeom.h:166
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
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:106
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
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:462
int32_t srid
Definition liblwgeom.h:460
lwflags_t flags
Definition liblwgeom.h:461

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: