** Build possible paths we might find the tile file at: ** map dir + shape path + filename? ** tile dir + shape path + filename? ** map dir + filename? ** ** Returns ** MS_SUCCESS - found a file ** MS_FAILURE - no file, and map is configured to fail on missing ** MS_DONE - no file, and map is configured to continue on missing */
| 1830 | ** MS_DONE - no file, and map is configured to continue on missing |
| 1831 | */ |
| 1832 | int msTiledSHPTryOpen(shapefileObj *shpfile, layerObj *layer, char *tiFileAbsDir, char *filename) { |
| 1833 | char szPath[MS_MAXPATHLEN]; |
| 1834 | int ignore_missing = msMapIgnoreMissingData(layer->map); |
| 1835 | int log_failures = MS_TRUE; |
| 1836 | |
| 1837 | if( ignore_missing == MS_MISSING_DATA_IGNORE ) |
| 1838 | log_failures = MS_FALSE; |
| 1839 | |
| 1840 | if(msShapefileOpen(shpfile, "rb", msBuildPath3(szPath, layer->map->mappath, layer->map->shapepath, filename), log_failures) == -1) { |
| 1841 | if(msShapefileOpen(shpfile, "rb", msBuildPath3(szPath, tiFileAbsDir, layer->map->shapepath, filename), log_failures) == -1) { |
| 1842 | if(msShapefileOpen(shpfile, "rb", msBuildPath(szPath, layer->map->mappath, filename), log_failures) == -1) { |
| 1843 | if(ignore_missing == MS_MISSING_DATA_FAIL) { |
| 1844 | msSetError(MS_IOERR, "Unable to open shapefile '%s' for layer '%s' ... fatal error.", "msTiledSHPTryOpen()", filename, layer->name); |
| 1845 | return(MS_FAILURE); |
| 1846 | } |
| 1847 | else if( ignore_missing == MS_MISSING_DATA_LOG ) { |
| 1848 | if( layer->debug || layer->map->debug ) { |
| 1849 | msDebug( "Unable to open shapefile '%s' for layer '%s' ... ignoring this missing data.\n", szPath, layer->name ); |
| 1850 | } |
| 1851 | return(MS_DONE); |
| 1852 | } |
| 1853 | else if( ignore_missing == MS_MISSING_DATA_IGNORE ) { |
| 1854 | return(MS_DONE); |
| 1855 | } |
| 1856 | else { |
| 1857 | /* never get here */ |
| 1858 | msSetError(MS_IOERR, "msIgnoreMissingData returned unexpected value.", "msTiledSHPTryOpen()"); |
| 1859 | return(MS_FAILURE); |
| 1860 | } |
| 1861 | } |
| 1862 | } |
| 1863 | } |
| 1864 | return(MS_SUCCESS); |
| 1865 | } |
| 1866 | |
| 1867 | int msTiledSHPOpenFile(layerObj *layer) |
| 1868 | { |
no test coverage detected