[mapserver-commits] r8740 - sandbox/single-pass/mapserver
svn at osgeo.org
svn at osgeo.org
Mon Mar 9 17:03:31 EDT 2009
Author: sdlime
Date: 2009-03-09 17:03:31 -0400 (Mon, 09 Mar 2009)
New Revision: 8740
Modified:
sandbox/single-pass/mapserver/maplayer.c
sandbox/single-pass/mapserver/mapquery.c
sandbox/single-pass/mapserver/mapserver.h
sandbox/single-pass/mapserver/mapshape.c
sandbox/single-pass/mapserver/maptemplate.c
Log:
stuff...
Modified: sandbox/single-pass/mapserver/maplayer.c
===================================================================
--- sandbox/single-pass/mapserver/maplayer.c 2009-03-09 20:59:26 UTC (rev 8739)
+++ sandbox/single-pass/mapserver/maplayer.c 2009-03-09 21:03:31 UTC (rev 8740)
@@ -182,20 +182,6 @@
}
/*
-** Returns the shape in its feature staff offset by a number of features (offset 0 is the first feature)
-*/
-int msLayerSeekShape(layerObj *layer, shapeObj *shape, long offset)
-{
- if ( ! layer->vtable) {
- int rv = msInitializeVirtualTable(layer);
- if (rv != MS_SUCCESS)
- return rv;
- }
-
- return layer->vtable->LayerSeekShape(layer, shape, offset);
-}
-
-/*
** Closes resources used by a particular layer.
*/
void msLayerClose(layerObj *layer)
@@ -1279,11 +1265,6 @@
return MS_SUCCESS;
}
-int LayerDefaultSeekShape(layerObj *layer, shapeObj *shape, long offset)
-{
- return MS_SUCCESS;
-}
-
/*
* msConnectLayer
*
@@ -1342,7 +1323,6 @@
vtable->LayerGetNumFeatures = LayerDefaultGetNumFeatures;
vtable->LayerRewind = LayerDefaultRewind;
- vtable->LayerSeekShape = LayerDefaultSeekShape;
return MS_SUCCESS;
}
Modified: sandbox/single-pass/mapserver/mapquery.c
===================================================================
--- sandbox/single-pass/mapserver/mapquery.c 2009-03-09 20:59:26 UTC (rev 8739)
+++ sandbox/single-pass/mapserver/mapquery.c 2009-03-09 21:03:31 UTC (rev 8740)
@@ -48,7 +48,7 @@
}
layer->resultcache->results = NULL;
- layer->resultcache->numresults = layer->resultcache->cachesize = layer->resultcache->maxcachesize = 0;
+ layer->resultcache->numresults = layer->resultcache->cachesize = 0;
layer->resultcache->bounds.minx = layer->resultcache->bounds.miny = layer->resultcache->bounds.maxx = layer->resultcache->bounds.maxy = -1;
return MS_SUCCESS;
@@ -74,7 +74,7 @@
return MS_FALSE;
}
-static int addResult(resultCacheObj *cache, shapeObj *shape, int status)
+static int addResult(resultCacheObj *cache, shapeObj *shape)
{
int i;
@@ -83,33 +83,29 @@
return(MS_FAILURE);
}
- if(cache->cachesize == cache->maxcachesize) { /* expand the cache */
- if(cache->maxcachesize == 0)
+ if(cache->numresults == cache->cachesize) { /* expand the cache */
+ if(cache->cachesize == 0)
cache->results = (resultCacheMemberObj *) malloc(sizeof(resultCacheMemberObj)*MS_RESULTCACHEINCREMENT);
else
- cache->results = (resultCacheMemberObj *) realloc(cache->results, sizeof(resultCacheMemberObj)*(cache->cachesize+MS_RESULTCACHEINCREMENT));
+ cache->results = (resultCacheMemberObj *) realloc(cache->results, sizeof(resultCacheMemberObj)*(cache->numresults+MS_RESULTCACHEINCREMENT));
if(!cache->results) {
msSetError(MS_MEMERR, "Realloc() error.", "addResult()");
return(MS_FAILURE);
}
- cache->maxcachesize += MS_RESULTCACHEINCREMENT;
+ cache->cachesize += MS_RESULTCACHEINCREMENT;
}
- i = cache->cachesize;
- cache->cachesize++;
+ i = cache->numresults;
- cache->results[i].status = status;
cache->results[i].classindex = shape->classindex;
cache->results[i].tileindex = shape->tileindex;
cache->results[i].shapeindex = shape->index;
- if(cache->results[i].status == MS_TRUE) {
- cache->numresults++;
- if(cache->numresults == 1)
- cache->bounds = shape->bounds;
- else
- msMergeRect(&(cache->bounds), &shape->bounds);
- }
+ cache->numresults++;
+ if(cache->numresults == 1)
+ cache->bounds = shape->bounds;
+ else
+ msMergeRect(&(cache->bounds), &shape->bounds);
return(MS_SUCCESS);
}
@@ -250,7 +246,7 @@
return(MS_FAILURE);
}
- addResult(lp->resultcache, &shape, MS_TRUE);
+ addResult(lp->resultcache, &shape);
if(lp->resultcache->numresults == 1)
lp->resultcache->bounds = shape.bounds;
else
@@ -391,7 +387,7 @@
lp->project = MS_FALSE;
#endif
- addResult(lp->resultcache, &shape, MS_TRUE);
+ addResult(lp->resultcache, &shape);
msFreeShape(&shape);
if(mode == MS_SINGLE) { /* no need to look any further */
@@ -436,7 +432,7 @@
int msQueryByRect(mapObj *map, int qlayer, rectObj rect)
{
- int l; /* counters */
+ int i, l; /* counters */
int start, stop=0;
layerObj *lp;
@@ -520,17 +516,17 @@
if (lp->classgroup && lp->numclasses > 0)
classgroup = msAllocateValidClassGroups(lp, &nclasses);
+ i = 0;
while((status = msLayerNextShape(lp, &shape)) == MS_SUCCESS) { /* step through the shapes */
+ i++;
shape.classindex = msShapeGetClass(lp, &shape, map->scaledenom, classgroup, nclasses);
- if(!(lp->template) && ((shape.classindex == -1) || (lp->class[shape.classindex]->status == MS_OFF))) { /* not a valid shape */
- addResult(lp->resultcache, &shape, MS_FALSE);
+ if(!(lp->template) && ((shape.classindex == -1) || (lp->class[shape.classindex]->status == MS_OFF))) { /* not a valid shape */
msFreeShape(&shape);
continue;
}
if(!(lp->template) && !(lp->class[shape.classindex]->template)) { /* no valid template */
- addResult(lp->resultcache, &shape, MS_FALSE);
msFreeShape(&shape);
continue;
}
@@ -560,8 +556,8 @@
}
}
- // if(status == MS_TRUE)
- addResult(lp->resultcache, &shape, status);
+ if(status == MS_TRUE)
+ addResult(lp->resultcache, &shape);
msFreeShape(&shape);
} /* next shape */
@@ -836,7 +832,7 @@
}
if(status == MS_TRUE)
- addResult(lp->resultcache, &shape, MS_TRUE);
+ addResult(lp->resultcache, &shape);
msFreeShape(&shape);
} /* next shape */
@@ -1014,11 +1010,11 @@
if( d <= t ) { /* found one */
if(mode == MS_SINGLE) {
lp->resultcache->numresults = 0;
- addResult(lp->resultcache, &shape, MS_TRUE);
+ addResult(lp->resultcache, &shape);
lp->resultcache->bounds = shape.bounds;
t = d; /* next one must be closer */
} else {
- addResult(lp->resultcache, &shape, MS_TRUE);
+ addResult(lp->resultcache, &shape);
}
}
@@ -1222,7 +1218,7 @@
}
if(status == MS_TRUE)
- addResult(lp->resultcache, &shape, MS_TRUE);
+ addResult(lp->resultcache, &shape);
msFreeShape(&shape);
} /* next shape */
@@ -1453,7 +1449,7 @@
}
if(status == MS_TRUE)
- addResult(lp->resultcache, &shape, MS_TRUE);
+ addResult(lp->resultcache, &shape);
msFreeShape(&shape);
} /* next shape */
Modified: sandbox/single-pass/mapserver/mapserver.h
===================================================================
--- sandbox/single-pass/mapserver/mapserver.h 2009-03-09 20:59:26 UTC (rev 8739)
+++ sandbox/single-pass/mapserver/mapserver.h 2009-03-09 21:03:31 UTC (rev 8740)
@@ -885,7 +885,7 @@
/* resultCacheMemberObj */
/************************************************************************/
typedef struct {
- int status; /* TRUE/FALSE */
+ long offset;
long shapeindex;
int tileindex;
int classindex;
@@ -902,7 +902,7 @@
#ifndef SWIG
resultCacheMemberObj *results;
- int cachesize, maxcachesize;
+ int cachesize;
#endif /* not SWIG */
#ifdef SWIG
@@ -1442,7 +1442,6 @@
int (*LayerCreateItems)(layerObj *layer, int nt);
int (*LayerGetNumFeatures)(layerObj *layer);
int (*LayerRewind)(layerObj *layer);
- int (*LayerSeekShape)(layerObj *layer, shapeObj *shape, long offset);
};
#endif /*SWIG*/
@@ -1787,7 +1786,6 @@
MS_DLL_EXPORT int msLayerIsOpen(layerObj *layer);
MS_DLL_EXPORT void msLayerClose(layerObj *layer);
MS_DLL_EXPORT int msLayerRewind(layerObj *layer);
-MS_DLL_EXPORT int msLayerSeekShape(layerObj *layer, shapeObj *shape, long offset);
MS_DLL_EXPORT int msLayerWhichShapes(layerObj *layer, rectObj rect);
MS_DLL_EXPORT int msLayerWhichItems(layerObj *layer, int classify, int annotate, char *metadata);
MS_DLL_EXPORT int msLayerWhichItemsNew(layerObj *layer, int classify, int annotate, int all, char *metadata);
Modified: sandbox/single-pass/mapserver/mapshape.c
===================================================================
--- sandbox/single-pass/mapserver/mapshape.c 2009-03-09 20:59:26 UTC (rev 8739)
+++ sandbox/single-pass/mapserver/mapshape.c 2009-03-09 21:03:31 UTC (rev 8740)
@@ -2502,7 +2502,6 @@
{
shapefileObj *shpfile = layer->layerinfo;
shpfile->lastshape = 0;
- printf("msShapeFileLayerRewind()\n");
return MS_SUCCESS;
}
@@ -2632,6 +2631,6 @@
/* layer->vtable->LayerCreateItems, use default */
/* layer->vtable->LayerGetNumFeatures, use default */
layer->vtable->LayerRewind = msShapeFileLayerRewind;
-
+
return MS_SUCCESS;
}
Modified: sandbox/single-pass/mapserver/maptemplate.c
===================================================================
--- sandbox/single-pass/mapserver/maptemplate.c 2009-03-09 20:59:26 UTC (rev 8739)
+++ sandbox/single-pass/mapserver/maptemplate.c 2009-03-09 21:03:31 UTC (rev 8740)
@@ -860,12 +860,11 @@
else
limit = MS_MIN(limit, layer->resultcache->numresults);
- i=0;
msLayerRewind(layer);
- while(((status = msLayerNextShape(layer, &(mapserv->resultshape))) == MS_SUCCESS) && (i <= limit)) {
+ for(i=0; i<limit; i++) {
+ status = msLayerGetShape(layer, &(mapserv->resultshape), layer->resultcache->results[i].tileindex, layer->resultcache->results[i].shapeindex);
+ if(status != MS_SUCCESS) return status;
- if(layer->resultcache->results[i].status != MS_TRUE) continue; /* don't present */
-
/* prepare any necessary JOINs here (one-to-one only) */
if(layer->numjoins > 0) {
for(j=0; j<layer->numjoins; j++) {
More information about the mapserver-commits
mailing list