int mapObj_queryByFilter(mapObj* self, char *string) { msInitQuery(&(self->query)); self->query.type = MS_QUERY_BY_FILTER; self->query.filter = (expressionObj *) malloc(sizeof(expressionObj)); self->query.filter->string = strdup(string); self->query.filter->type = 2000; /* MS_EXPRESSION: lot's of conflicts in mapfile.h */ self->query.rect = self->extent; return msQueryByFilter(self); }
int mapObj_queryByFilter(mapObj* self, char *string) { msInitQuery(&(self->query)); self->query.type = MS_QUERY_BY_FILTER; self->query.mode = MS_QUERY_MULTIPLE; self->query.filter.string = strdup(string); self->query.filter.type = MS_EXPRESSION; self->query.rect = self->extent; return msQueryByFilter(self); }
/* rect must be in map->projection */ int FLTApplyFilterToLayerCommonExpressionWithRect(mapObj *map, int iLayerIndex, const char *pszExpression, rectObj rect) { int retval; int save_startindex; int save_maxfeatures; int save_only_cache_result_count; int save_cache_shapes; int save_max_cached_shape_count; int save_max_cached_shape_ram_amount; save_startindex = map->query.startindex; save_maxfeatures = map->query.maxfeatures; save_only_cache_result_count = map->query.only_cache_result_count; save_cache_shapes = map->query.cache_shapes; save_max_cached_shape_count = map->query.max_cached_shape_count; save_max_cached_shape_ram_amount = map->query.max_cached_shape_ram_amount; msInitQuery(&(map->query)); map->query.startindex = save_startindex; map->query.maxfeatures = save_maxfeatures; map->query.only_cache_result_count = save_only_cache_result_count; map->query.cache_shapes = save_cache_shapes; map->query.max_cached_shape_count = save_max_cached_shape_count; map->query.max_cached_shape_ram_amount = save_max_cached_shape_ram_amount; map->query.mode = MS_QUERY_MULTIPLE; map->query.layer = iLayerIndex; map->query.rect = rect; if( pszExpression ) { map->query.type = MS_QUERY_BY_FILTER; msInitExpression(&map->query.filter); map->query.filter.string = msStrdup(pszExpression); map->query.filter.type = MS_EXPRESSION; /* a logical expression */ retval = msQueryByFilter(map); } else { map->query.type = MS_QUERY_BY_RECT; retval = msQueryByRect(map); } return retval; }
int FLTApplyFilterToLayerCommonExpression(mapObj *map, int iLayerIndex, char *pszExpression) { int retval; msInitQuery(&(map->query)); map->query.type = MS_QUERY_BY_FILTER; map->query.filter = (expressionObj *) msSmallMalloc(sizeof(expressionObj)); initExpression( map->query.filter); map->query.filter->string = msStrdup(pszExpression); map->query.filter->type = 2000; map->query.layer = iLayerIndex; /*TODO: if there is a bbox in the node, get it and set the map extent*/ map->query.rect = map->extent; retval = msQueryByFilter(map); return retval; }