int msContourLayerClose(layerObj *layer) { contourLayerInfo *clinfo = (contourLayerInfo *) layer->layerinfo; if (layer->debug) msDebug("Entering msContourLayerClose().\n"); if (clinfo) { if (clinfo->hOGRDS) msConnPoolRelease(&clinfo->ogrLayer, clinfo->hOGRDS); msLayerClose(&clinfo->ogrLayer); if (clinfo->hDS) { GDALClose(clinfo->hDS); clinfo->hDS = NULL; free(clinfo->buffer); } if (clinfo->hOrigDS) { GDALClose(clinfo->hOrigDS); clinfo->hOrigDS = NULL; } msContourLayerInfoFree(layer); } return MS_SUCCESS; }
int msContourLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) { rectObj newRect; contourLayerInfo *clinfo = (contourLayerInfo *) layer->layerinfo; if (layer->debug) msDebug("Entering msContourLayerWhichShapes().\n"); if (clinfo == NULL) { msSetError(MS_MISCERR, "Assertion failed: Contour layer not opened!!!", "msContourLayerWhichShapes()"); return MS_FAILURE; } newRect = rect; #ifdef USE_PROJ /* if necessary, project the searchrect to source coords */ if (msProjectionsDiffer( &(layer->map->projection), &(layer->projection))) { if (msProjectRect(&layer->projection, &layer->map->projection, &newRect) != MS_SUCCESS ) { msDebug("msContourLayerWhichShapes(%s): unable to reproject map request rectangle into layer projection, canceling.\n", layer->name); return MS_FAILURE; } } #endif /* regenerate the raster io */ msConnPoolRelease(&clinfo->ogrLayer, clinfo->hOGRDS); msLayerClose(&clinfo->ogrLayer); /* Open the raster source */ if (msContourLayerReadRaster(layer, newRect) != MS_SUCCESS) return MS_FAILURE; /* Generate Contour Dataset */ if (msContourLayerGenerateContour(layer) != MS_SUCCESS) return MS_FAILURE; GDALClose(clinfo->hDS); clinfo->hDS = NULL; free(clinfo->buffer); /* Open our virtual ogr layer */ if (msLayerOpen(&clinfo->ogrLayer) != MS_SUCCESS) return MS_FAILURE; clinfo->ogrLayer.numitems = layer->numitems; clinfo->ogrLayer.items = CSLDuplicate(layer->items); return msLayerWhichShapes(&clinfo->ogrLayer, rect, isQuery); }