MCPcopy Create free account
hub / github.com/MapServer/MapServer / addResult

Function addResult

mapquery.c:141–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141static int addResult(resultCacheObj *cache, shapeObj *shape)
142{
143 int i;
144
145 if(cache->numresults == cache->cachesize) { /* just add it to the end */
146 if(cache->cachesize == 0)
147 cache->results = (resultObj *) malloc(sizeof(resultObj)*MS_RESULTCACHEINCREMENT);
148 else
149 cache->results = (resultObj *) realloc(cache->results, sizeof(resultObj)*(cache->cachesize+MS_RESULTCACHEINCREMENT));
150 if(!cache->results) {
151 msSetError(MS_MEMERR, "Realloc() error.", "addResult()");
152 return(MS_FAILURE);
153 }
154 cache->cachesize += MS_RESULTCACHEINCREMENT;
155 }
156
157 i = cache->numresults;
158
159 cache->results[i].classindex = shape->classindex;
160 cache->results[i].tileindex = shape->tileindex;
161 cache->results[i].shapeindex = shape->index;
162 cache->results[i].resultindex = shape->resultindex;
163 cache->numresults++;
164
165 if(cache->numresults == 1)
166 cache->bounds = shape->bounds;
167 else
168 msMergeRect(&(cache->bounds), &(shape->bounds));
169
170 return(MS_SUCCESS);
171}
172
173/*
174** Serialize a query result set to disk.

Callers 7

msQueryByIndexFunction · 0.70
msQueryByAttributesFunction · 0.70
msQueryByFilterFunction · 0.70
msQueryByRectFunction · 0.70
msQueryByFeaturesFunction · 0.70
msQueryByPointFunction · 0.70
msQueryByShapeFunction · 0.70

Calls 2

msSetErrorFunction · 0.85
msMergeRectFunction · 0.85

Tested by

no test coverage detected