| 47 | |
| 48 | /***********************************************************************/ |
| 49 | int process_shapefiles(char *metaFileNameP, char *tileFileNameP, |
| 50 | int tile_path_only) |
| 51 | { |
| 52 | SHPHandle hSHP, tileSHP; |
| 53 | rectObj extentRect; |
| 54 | lineObj line; |
| 55 | shapeObj shapeRect; |
| 56 | DBFHandle tileDBF; |
| 57 | DBFHandle shpDBF; |
| 58 | |
| 59 | typedef struct DBFFieldDef_struct { |
| 60 | DBFFieldType type; |
| 61 | char name[12]; |
| 62 | int width; |
| 63 | int decimals; |
| 64 | } DBFFieldDef; |
| 65 | |
| 66 | DBFFieldDef *theFields = NULL; |
| 67 | char fldname[256]; |
| 68 | int width; |
| 69 | int decimals; |
| 70 | int fieldCnt; |
| 71 | int i; |
| 72 | |
| 73 | FILE *metaFP = NULL; |
| 74 | char *p; |
| 75 | char tileshapeName[256]; |
| 76 | char tiledbfName[256]; |
| 77 | char shapeFileName[256]; |
| 78 | int entityNum; |
| 79 | |
| 80 | int tilesFound = 0; |
| 81 | int tilesProcessed = 0; |
| 82 | |
| 83 | msInitShape(&shapeRect); |
| 84 | line.point = (pointObj *)msSmallMalloc(sizeof(pointObj)*5); |
| 85 | line.numpoints = 5; |
| 86 | |
| 87 | /* open metafile */ |
| 88 | /* ------------- */ |
| 89 | if (NULL==(metaFP=fopen(metaFileNameP, "r"))) { |
| 90 | printf( "Unable to open:%s\n", metaFileNameP); |
| 91 | return(1); |
| 92 | } |
| 93 | |
| 94 | |
| 95 | /* create new tileindex shapefiles and create a header */ |
| 96 | /* -------------------------------------------------- */ |
| 97 | snprintf(tileshapeName, sizeof(tileshapeName), "%s.shp", tileFileNameP); |
| 98 | |
| 99 | if(NULL==(tileSHP=msSHPCreate(tileFileNameP, SHP_POLYGON))) { |
| 100 | fclose(metaFP); |
| 101 | printf("Unable to create %s.shp (.shx)\n", tileFileNameP); |
| 102 | return(1); |
| 103 | } |
| 104 | |
| 105 | |
| 106 | /* create new tileindex dbf-file */ |
no test coverage detected