Exemple #1
0
int mapObj_queryByRect(mapObj* self, rectObj rect) {
    msInitQuery(&(self->query));

    self->query.type = MS_QUERY_BY_RECT;
    self->query.mode = MS_QUERY_MULTIPLE;
    self->query.rect = rect;

    return msQueryByRect(self);
  }
Exemple #2
0
int mapObj_queryByPoint(mapObj* self, pointObj *point, int mode, double buffer) {
    msInitQuery(&(self->query));

    self->query.type = MS_QUERY_BY_POINT;
    self->query.mode = mode;
    self->query.point = *point;
    self->query.buffer = buffer;

    return msQueryByPoint(self);
  }
Exemple #3
0
int mapObj_queryByShape(mapObj *self, shapeObj *shape) {
    msInitQuery(&(self->query));

    self->query.type = MS_QUERY_BY_SHAPE;
    self->query.mode = MS_QUERY_MULTIPLE;
    self->query.shape = (shapeObj *) malloc(sizeof(shapeObj));
    msInitShape(self->query.shape);
    msCopyShape(shape, self->query.shape);

    return msQueryByShape(self);
  }
Exemple #4
0
int mapObj_queryByIndex(mapObj *self, int qlayer, int tileindex, int shapeindex, int bAddToQuery) {
    msInitQuery(&(self->query));

    self->query.type = MS_QUERY_BY_INDEX;
    self->query.mode = MS_QUERY_SINGLE;
    self->query.tileindex = tileindex;
    self->query.shapeindex = shapeindex;
    self->query.clear_resultcache = !bAddToQuery;
    self->query.layer = qlayer;

    return msQueryByIndex(self);
}
Exemple #5
0
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;
}