You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(92) |
Dec
(141) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(126) |
Feb
(72) |
Mar
(31) |
Apr
(200) |
May
(81) |
Jun
(130) |
Jul
(112) |
Aug
(134) |
Sep
(76) |
Oct
(89) |
Nov
(153) |
Dec
(9) |
2007 |
Jan
(59) |
Feb
(82) |
Mar
(50) |
Apr
(20) |
May
(9) |
Jun
(81) |
Jul
(41) |
Aug
(109) |
Sep
(91) |
Oct
(87) |
Nov
(33) |
Dec
(60) |
2008 |
Jan
(21) |
Feb
(15) |
Mar
(38) |
Apr
(75) |
May
(59) |
Jun
(46) |
Jul
(30) |
Aug
(20) |
Sep
(35) |
Oct
(32) |
Nov
(34) |
Dec
(19) |
2009 |
Jan
(29) |
Feb
(71) |
Mar
(54) |
Apr
(17) |
May
(4) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(58) |
Sep
(7) |
Oct
(7) |
Nov
(12) |
Dec
(18) |
2011 |
Jan
(17) |
Feb
(29) |
Mar
(11) |
Apr
(5) |
May
(1) |
Jun
|
Jul
|
Aug
(11) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(87) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(44) |
Jun
(79) |
Jul
(16) |
Aug
(31) |
Sep
|
Oct
(51) |
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Pascal F M. <pas...@us...> - 2006-02-05 23:20:00
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14406 Modified Files: roadmap_line.c Log Message: Remove hard-coded layers Index: roadmap_line.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_line.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** roadmap_line.c 14 Nov 2005 07:13:17 -0000 1.6 --- roadmap_line.c 5 Feb 2006 23:19:52 -0000 1.7 *************** *** 23,28 **** * SYNOPSYS: * ! * int roadmap_line_in_square (int square, int cfcc, int *first, int *last); ! * int roadmap_line_in_square2 (int square, int cfcc, int *first, int *last); * int roadmap_line_get_from_index2 (int index); * void roadmap_line_from (int line, RoadMapPosition *position); --- 23,30 ---- * SYNOPSYS: * ! * int roadmap_line_in_square ! * (int square, int layer, int *first, int *last); ! * int roadmap_line_in_square2 ! * (int square, int layer, int *first, int *last); * int roadmap_line_get_from_index2 (int index); * void roadmap_line_from (int line, RoadMapPosition *position); *************** *** 62,71 **** int LineBySquare1Count; ! int *LineIndex2; ! int LineIndex2Count; RoadMapLineBySquare *LineBySquare2; int LineBySquare2Count; } RoadMapLineContext; --- 64,79 ---- int LineBySquare1Count; ! int *LineByLayer1; ! int LineByLayer1Count; RoadMapLineBySquare *LineBySquare2; int LineBySquare2Count; + int *LineByLayer2; + int LineByLayer2Count; + + int *LineIndex2; + int LineIndex2Count; + } RoadMapLineContext; *************** *** 81,84 **** --- 89,94 ---- roadmap_db *square1_table; roadmap_db *square2_table; + roadmap_db *layer1_table; + roadmap_db *layer2_table; *************** *** 92,96 **** --- 102,108 ---- line_table = roadmap_db_get_subsection (root, "data"); square1_table = roadmap_db_get_subsection (root, "bysquare1"); + layer1_table = roadmap_db_get_subsection (root, "bylayer1"); square2_table = roadmap_db_get_subsection (root, "bysquare2"); + layer2_table = roadmap_db_get_subsection (root, "bylayer2"); index2_table = roadmap_db_get_subsection (root, "index2"); *************** *** 114,117 **** --- 126,138 ---- } + context->LineByLayer1 = (int *) roadmap_db_get_data (layer1_table); + context->LineByLayer1Count = roadmap_db_get_count (layer1_table); + + if (roadmap_db_get_size (layer1_table) != + context->LineByLayer1Count * sizeof(int)) { + roadmap_log (ROADMAP_ERROR, "invalid line/bylayer1 structure"); + goto roadmap_line_map_abort; + } + context->LineIndex2 = (int *) roadmap_db_get_data (index2_table); context->LineIndex2Count = roadmap_db_get_count (index2_table); *************** *** 123,126 **** --- 144,156 ---- } + context->LineByLayer2 = (int *) roadmap_db_get_data (layer2_table); + context->LineByLayer2Count = roadmap_db_get_count (layer2_table); + + if (roadmap_db_get_size (layer2_table) != + context->LineByLayer2Count * sizeof(int)) { + roadmap_log (ROADMAP_ERROR, "invalid line/bylayer2 structure"); + goto roadmap_line_map_abort; + } + context->LineBySquare2 = (RoadMapLineBySquare *) roadmap_db_get_data (square2_table); *************** *** 170,183 **** ! int roadmap_line_in_square (int square, int cfcc, int *first, int *last) { - int next; int *index; if (RoadMapLineActive == NULL) return 0; /* No line. */ - if (cfcc <= 0 || cfcc > ROADMAP_CATEGORY_RANGE) { - roadmap_log (ROADMAP_FATAL, "illegal cfcc %d", cfcc); - } square = roadmap_square_index(square); if (square < 0) { --- 200,209 ---- ! int roadmap_line_in_square (int square, int layer, int *first, int *last) { int *index; if (RoadMapLineActive == NULL) return 0; /* No line. */ square = roadmap_square_index(square); if (square < 0) { *************** *** 185,219 **** } ! index = RoadMapLineActive->LineBySquare1[square].first; ! ! if (index[cfcc-1] < 0) { ! return 0; ! } ! *first = index[cfcc-1]; ! ! for (next = -1; next < 0 && cfcc < ROADMAP_CATEGORY_RANGE; cfcc++) { ! next = index[cfcc]; } ! if (next > 0) { ! *last = next - 1; ! } else { ! *last = RoadMapLineActive->LineBySquare1[square].last; ! } ! return 1; } ! int roadmap_line_in_square2 (int square, int cfcc, int *first, int *last) { ! int next; int *index; if (RoadMapLineActive == NULL) return 0; /* No line. */ - if (cfcc <= 0 || cfcc > ROADMAP_CATEGORY_RANGE) { - roadmap_log (ROADMAP_FATAL, "illegal cfcc %d", cfcc); - } square = roadmap_square_index(square); if (square < 0) { --- 211,234 ---- } ! if (layer <= 0 || layer > RoadMapLineActive->LineBySquare1[square].count) { ! return 0; } + index = RoadMapLineActive->LineByLayer1 + + RoadMapLineActive->LineBySquare1[square].first; ! *first = index[layer-1]; ! *last = index[layer] - 1; ! return (*first <= *last); } ! int roadmap_line_in_square2 (int square, int layer, int *first, int *last) { ! int layer_first; int *index; if (RoadMapLineActive == NULL) return 0; /* No line. */ square = roadmap_square_index(square); if (square < 0) { *************** *** 221,258 **** } ! index = RoadMapLineActive->LineBySquare2[square].first; ! ! if (index[cfcc-1] < 0 || ! index[cfcc-1] >= RoadMapLineActive->LineIndex2Count) { ! return 0; ! } ! *first = index[cfcc-1]; ! ! /* The last line for this category is the line before the first line ! * for the next category that has lines, otherwise it is the last ! * square's line. ! */ ! for (next = -1; next < 0 && cfcc < ROADMAP_CATEGORY_RANGE; cfcc++) { ! next = index[cfcc]; } ! if (next >= 0) { ! ! if (next <= *first) { ! ! /* Due to a bug in buildmap, the value 0 may show up. */ ! if (next != 0) { ! roadmap_log (ROADMAP_ERROR, ! "invalid LineBySquare2 index for square %d", square); ! } ! return 0; ! } ! *last = next - 1; ! ! } else { ! *last = RoadMapLineActive->LineBySquare2[square].last; } ! return 1; } --- 236,253 ---- } ! if (layer <= 0 || layer > RoadMapLineActive->LineBySquare2[square].count) { ! return 0; } + index = RoadMapLineActive->LineByLayer2 + + RoadMapLineActive->LineBySquare2[square].first; ! layer_first = index[layer-1]; ! if (layer_first < 0 || layer_first >= RoadMapLineActive->LineIndex2Count) { ! return 0; } + *first = layer_first; + *last = index[layer] - 1; ! return (*first <= *last); } |
From: Pascal F M. <pas...@us...> - 2006-02-05 23:19:30
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14139 Modified Files: roadmap_db_place.h Log Message: Remove hard-coded layers Index: roadmap_db_place.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_db_place.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_db_place.h 8 Nov 2004 07:53:42 -0000 1.1 --- roadmap_db_place.h 5 Feb 2006 23:19:21 -0000 1.2 *************** *** 1,3 **** ! /* roadmap_db_line.h - the format of the address line table used by RoadMap. * * LICENSE: --- 1,3 ---- ! /* roadmap_db_place.h - the format of the address line table used by RoadMap. * * LICENSE: *************** *** 23,45 **** * SYNOPSYS: * ! * The RoadMap lines are described by the following table: * ! * line the ID of the line and its from and to points. */ ! #ifndef _ROADMAP_DB_PLACE__H_ ! #define _ROADMAP_DB_PLACE__H_ #include "roadmap_types.h" ! typedef int RoadMapPlace; /* table place */ ! ! typedef struct { /* tables bysquare */ ! int first[ROADMAP_CATEGORY_RANGE]; ! int last; } RoadMapPlaceBySquare; ! #endif // _ROADMAP_DB_PLACE__H_ --- 23,49 ---- * SYNOPSYS: * ! * The RoadMap places are described by the following tables: * ! * place/bysquare an index by square, links to place/bylayer. ! * place/bylayer a subindex by square, links to place/data. ! * place/data the link to the place's point. */ ! #ifndef INCLUDED__ROADMAP_DB_PLACE__H ! #define INCLUDED__ROADMAP_DB_PLACE__H #include "roadmap_types.h" ! typedef struct { /* table place/bysquare */ ! int first; ! int count; } RoadMapPlaceBySquare; ! /* Table place/bylayer is an array of int. */ ! ! /* Table place/data is an array of int. */ ! ! #endif // INCLUDED__ROADMAP_DB_PLACE__H |
From: Pascal F M. <pas...@us...> - 2006-02-05 23:19:13
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14020 Modified Files: roadmap_db_line.h Log Message: Remove hard-coded layers Index: roadmap_db_line.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_db_line.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** roadmap_db_line.h 9 Jan 2006 07:38:59 -0000 1.3 --- roadmap_db_line.h 5 Feb 2006 23:19:04 -0000 1.4 *************** *** 27,35 **** * line/data The ID of the line and its from and to points. * The lines are sorted by square. ! * line/bysquare1 An index of lines per square. ! * line/index2 This index table points to line/data and is pointed ! * to from line/bysquare2. This is used to build lists. * line/bysquare2 A given line may have one end in a different square: ! * this other index covers this very case. */ --- 27,46 ---- * line/data The ID of the line and its from and to points. * The lines are sorted by square. ! * line/bysquare1 An index of layers per square (points to line/bylayer1). ! * line/bylayer1 An indirect index, from layers to lines. * line/bysquare2 A given line may have one end in a different square: ! * this 2nd index covers this (points to line/bylayer2). ! * line/bylayer2 An indirect index, from layers to lines. ! * line/index2 This index table points to line/data and is pointed ! * to from line/layer2. This is used to build lists. ! * ! * The logic here is that line/bysquare1 points to a sublist of layers in ! * line/bylayer1. each item in this sublist points to a sublist of lines. ! * ! * The line/bysquare2 logic is slightly different, as there is one ! * additional indirection: items in line/bylayer2 point to sublists in ! * line/index2, and an item in line/index2 point to a line. This is done ! * so because the lines are not sorted according to this 2nd index, only ! * according to the first one. */ *************** *** 48,56 **** typedef struct { /* tables line/bysquare1 and line/bysquare2 */ ! int first[ROADMAP_CATEGORY_RANGE]; ! int last; } RoadMapLineBySquare; /* Table line/index2 is an array of int. */ --- 59,71 ---- typedef struct { /* tables line/bysquare1 and line/bysquare2 */ ! int first; /* First layer item in line/layer. */ ! int count; /* Number of layers + 1, the additional layer defines the end. */ } RoadMapLineBySquare; + /* Table line/bylayer1 is an array of int. */ + + /* Table line/bylayer2 is an array of int. */ + /* Table line/index2 is an array of int. */ |
From: Pascal F M. <pas...@us...> - 2006-02-05 23:18:36
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13806 Modified Files: Makefile Log Message: Remove hard-coded layers Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/Makefile,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** Makefile 4 Feb 2006 09:19:14 -0000 1.74 --- Makefile 5 Feb 2006 23:18:27 -0000 1.75 *************** *** 199,202 **** --- 199,203 ---- buildmap_range.c \ buildmap_zip.c \ + buildmap_layer.c \ buildmap_tiger.c \ buildmap_shapefile.c \ *************** *** 255,259 **** SCRIPTS=rdmdownload rdmgetall rdmgenmaps rdmgendcwmaps rdmcompare RUNTIME=rdmindex $(RDMLIBS) libguiroadgps.a libguiroadmap.a ! DRIVERS=rdmkismet rdmghost rdmfriends rdmtrace TOOLS=sunrise $(SQLTOOLS) --- 256,260 ---- SCRIPTS=rdmdownload rdmgetall rdmgenmaps rdmgendcwmaps rdmcompare RUNTIME=rdmindex $(RDMLIBS) libguiroadgps.a libguiroadmap.a ! DRIVERS=rdmkismet rdmghost rdmfriends rdmtrace rdmxchange TOOLS=sunrise $(SQLTOOLS) |
From: Pascal F M. <pas...@us...> - 2006-02-05 23:18:14
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13447 Modified Files: buildmap_tiger.h Log Message: Remove hard-coded layers Index: buildmap_tiger.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_tiger.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** buildmap_tiger.h 14 Nov 2005 07:04:18 -0000 1.3 --- buildmap_tiger.h 5 Feb 2006 23:18:06 -0000 1.4 *************** *** 29,35 **** void buildmap_tiger_process (const char *source, const char *county, ! int verbose, ! int canals, ! int rivers); #endif // INCLUDED__BUILDMAP_TIGER__H --- 29,33 ---- void buildmap_tiger_process (const char *source, const char *county, ! int verbose); #endif // INCLUDED__BUILDMAP_TIGER__H |
From: Pascal F M. <pas...@us...> - 2006-02-05 23:17:59
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13168 Modified Files: buildmap_tiger.c Log Message: Remove hard-coded layers Index: buildmap_tiger.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_tiger.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** buildmap_tiger.c 2 Jan 2006 09:14:54 -0000 1.7 --- buildmap_tiger.c 5 Feb 2006 23:17:51 -0000 1.8 *************** *** 59,62 **** --- 59,64 ---- #include "buildmap_metadata.h" + #include "buildmap_layer.h" + static BuildMapDictionary DictionaryPrefix; *************** *** 67,75 **** static BuildMapDictionary DictionaryLandmark; - static int BuildMapCanals = ROADMAP_WATER_RIVER; - static int BuildMapRivers = ROADMAP_WATER_RIVER; - static int BuildMapFormat = 2000; static void tigerAdjust (char *line, int *start, int *end) { --- 69,142 ---- static BuildMapDictionary DictionaryLandmark; static int BuildMapFormat = 2000; + /* Road layers. */ + + static int BuildMapLayerFreeway = 0; + static int BuildMapLayerRamp = 0; + static int BuildMapLayerMain = 0; + static int BuildMapLayerStreet = 0; + static int BuildMapLayerTrail = 0; + + /* Area layers. */ + + static int BuildMapLayerParc = 0; + static int BuildMapLayerHospital = 0; + static int BuildMapLayerAirport = 0; + static int BuildMapLayerStation = 0; + static int BuildMapLayerMall = 0; + + /* Water layers. */ + + static int BuildMapLayerShoreline = 0; + static int BuildMapLayerRiver = 0; + static int BuildMapLayerCanal = 0; + static int BuildMapLayerLake = 0; + static int BuildMapLayerSea = 0; + + static struct { + const char *name; + int line_count; + int landmark_count; + } BuildMapTigerLayerStatistics[256]; + + static void buildmap_tiger_set_one_layer (int verbose, + int *layer, const char *name) { + + *layer = buildmap_layer_get (name); + + if (*layer > 0) { + if (verbose) fprintf (stderr, " %3d %s\n", *layer, name); + if (*layer < 256) { + BuildMapTigerLayerStatistics[*layer].name = name; + BuildMapTigerLayerStatistics[*layer].line_count = 0; + BuildMapTigerLayerStatistics[*layer].landmark_count = 0; + } + } + } + + static void buildmap_tiger_set_layers (int verbose) { + + if (verbose) fprintf (stderr, "Enabled TIGER layers:\n"); + + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerFreeway, "freeways"); + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerRamp, "ramps"); + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerMain, "highways"); + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerStreet, "streets"); + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerTrail, "trails"); + + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerParc, "parks"); + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerHospital, "hospitals"); + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerAirport, "airports"); + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerStation, "stations"); + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerMall, "malls"); + + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerShoreline, "shore"); + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerRiver, "rivers"); + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerCanal, "canals"); + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerLake, "lakes"); + buildmap_tiger_set_one_layer (verbose, &BuildMapLayerSea, "sea"); + } + static void tigerAdjust (char *line, int *start, int *end) { *************** *** 157,178 **** static char tiger2area (char *line, int start, int end) { ! start -= 1; /* Adjust: tiger start from 1, C starts from 0. */ ! ! switch (line[start]) { case 'D': /* Area. */ ! if (line[start+1] == '8') { ! return ROADMAP_AREA_PARC; ! } else if (strncmp (line+start, "D31", 3) == 0) { ! return ROADMAP_AREA_HOSPITAL; ! } else if (strncmp (line+start, "D51", 3) == 0) { ! return ROADMAP_AREA_AIRPORT; ! } else if (strncmp (line+start, "D52", 3) == 0) { ! return ROADMAP_AREA_STATION; ! } else if (strncmp (line+start, "D53", 3) == 0) { ! return ROADMAP_AREA_STATION; ! } else if (strncmp (line+start, "D61", 3) == 0) { ! return ROADMAP_AREA_MALL; } break; --- 224,254 ---- static char tiger2area (char *line, int start, int end) { ! switch (line[start-1]) { /* Adjust: tiger start from 1, C starts from 0. */ case 'D': /* Area. */ ! switch (line[start]) { ! ! case '8': return BuildMapLayerParc; ! ! case '3': ! if (line[start+1] == '1') { ! return BuildMapLayerHospital; ! } ! break; ! ! case '5': ! switch (line[start+1]) { ! case '1': return BuildMapLayerAirport; ! case '2': return BuildMapLayerStation; ! case '3': return BuildMapLayerStation; ! } ! break; ! ! case '6': ! if (line[start+1] == '1') { ! return BuildMapLayerMall; ! } ! break; } break; *************** *** 180,188 **** case 'H': /* Rivers, lakes and sea. */ ! switch (line[start+1]) { ! case '3': return ROADMAP_WATER_LAKE; ! case '4': return ROADMAP_WATER_LAKE; /* Reservoir. */ ! case '6': return ROADMAP_WATER_LAKE; /* Quarry. */ } break; --- 256,264 ---- case 'H': /* Rivers, lakes and sea. */ ! switch (line[start]) { ! case '3': return BuildMapLayerLake; ! case '4': return BuildMapLayerLake; /* Reservoir. */ ! case '6': return BuildMapLayerLake; /* Quarry. */ } break; *************** *** 200,221 **** static char tiger2type (char *line, int start, int end) { ! start -= 1; /* Adjust: tiger start from 1, C starts from 0. */ ! ! switch (line[start]) { case 'A': /* Roads. */ ! switch (line[start+1]) { ! case '1': return ROADMAP_ROAD_FREEWAY; ! case '2': return ROADMAP_ROAD_MAIN; ! case '3': return ROADMAP_ROAD_MAIN; ! case '4': return ROADMAP_ROAD_STREET; case '6': ! if (line[start+2] == '3') { ! return ROADMAP_ROAD_RAMP; } ! return 0; ! default: return ROADMAP_ROAD_TRAIL; } break; --- 276,295 ---- static char tiger2type (char *line, int start, int end) { ! switch (line[start-1]) { /* Adjust: tiger start from 1, C starts from 0. */ case 'A': /* Roads. */ ! switch (line[start]) { ! case '1': return BuildMapLayerFreeway; ! case '2': return BuildMapLayerMain; ! case '3': return BuildMapLayerMain; ! case '4': return BuildMapLayerStreet; case '6': ! if (line[start+1] == '3') { ! return BuildMapLayerRamp; } ! break; ! default: return BuildMapLayerTrail; } break; *************** *** 223,237 **** case 'H': /* Rivers, lakes and sea. */ ! switch (line[start+1]) { ! case '0': return ROADMAP_WATER_SHORELINE; ! case '1': return BuildMapRivers; ! case '2': return BuildMapCanals; ! case '5': return ROADMAP_WATER_SEA; } break; } ! return tiger2area (line, start+1, end); } --- 297,316 ---- case 'H': /* Rivers, lakes and sea. */ ! switch (line[start]) { ! case '0': return BuildMapLayerShoreline; ! case '1': return BuildMapLayerRiver; ! case '2': return BuildMapLayerCanal; ! case '5': return BuildMapLayerSea; ! default: return tiger2area (line, start, end); } break; + + default: + + return tiger2area (line, start, end); } ! return 0; } *************** *** 291,294 **** --- 370,375 ---- + /* Table 1: lines. */ + static void buildmap_tiger_read_rt1 (const char *source, int verbose) { *************** *** 357,363 **** if (cfcc == 0) { ! if (buildmap_polygon_use_line (tlid)) { ! cfcc = ROADMAP_AREA_PARC; /* to force loading this line. */ ! } } --- 438,446 ---- if (cfcc == 0) { ! /* Even if filtered out, a line should be still recorded if ! * it is part of a polygon we recorded: we need the line to ! * draw the polygon. ! */ ! cfcc = buildmap_polygon_use_line (tlid); } *************** *** 388,395 **** to_point = buildmap_point_add (tolong, tolat); line = buildmap_line_add (tlid, cfcc, from_point, to_point); ! if (cfcc >= ROADMAP_ROAD_FIRST && ! cfcc <= ROADMAP_ROAD_LAST) { street = buildmap_street_add --- 471,479 ---- to_point = buildmap_point_add (tolong, tolat); + BuildMapTigerLayerStatistics[(int)cfcc].line_count += 1; + line = buildmap_line_add (tlid, cfcc, from_point, to_point); ! if (cursor[55] == 'A') { /* Roads. */ street = buildmap_street_add *************** *** 495,500 **** } ! } else if (cfcc >= ROADMAP_AREA_FIRST && ! cfcc <= ROADMAP_AREA_LAST) { buildmap_area_add (cfcc, fedirp, fename, fetype, fedirs, tlid); --- 579,583 ---- } ! } else if (cursor[55] == 'D') { /* Areas. */ buildmap_area_add (cfcc, fedirp, fename, fetype, fedirs, tlid); *************** *** 527,530 **** --- 610,615 ---- + /* Table 2: shapes. */ + static void buildmap_tiger_read_rt2 (const char *source, int verbose) { *************** *** 618,621 **** --- 703,708 ---- + /* Table C: cities. */ + static void buildmap_tiger_read_rtc (const char *source, int verbose) { *************** *** 705,708 **** --- 792,797 ---- + /* Table 7: landmarks. */ + static void buildmap_tiger_read_rt7 (const char *source, int verbose) { *************** *** 746,749 **** --- 835,840 ---- if (cfcc > 0) { + BuildMapTigerLayerStatistics[(int)cfcc].landmark_count += 1; + landid = tiger2int (cursor, 11, 20); landname = tiger2string (DictionaryLandmark, cursor, 25, 54); *************** *** 774,777 **** --- 865,870 ---- + /* Table 8: polygons. */ + static void buildmap_tiger_read_rt8 (const char *source, int verbose) { *************** *** 841,844 **** --- 934,939 ---- + /* Table I: polygon lines. */ + static void buildmap_tiger_read_rti (const char *source, int verbose) { *************** *** 951,986 **** void buildmap_tiger_process (const char *source, const char *county, ! int verbose, ! int canals, ! int rivers) { char *base = roadmap_path_remove_extension (source); ! if (! canals) { ! BuildMapCanals = 0; ! } ! if (! rivers) { ! BuildMapRivers = 0; ! } ! buildmap_tiger_read_rtc (base, verbose); ! buildmap_tiger_read_rt7 (base, verbose); ! buildmap_tiger_read_rt8 (base, verbose); ! buildmap_tiger_read_rti (base, verbose); ! buildmap_tiger_read_rt1 (base, verbose); - buildmap_tiger_read_rt2 (base, verbose); buildmap_metadata_add_attribute ("Territory", "Id", county); buildmap_metadata_add_attribute ("Territory", "Parent", "us"); /* for now. */ ! buildmap_metadata_add_attribute ("Class", "Name", "All"); ! buildmap_metadata_add_attribute ("Map", "Source", "USCB"); free(base); --- 1046,1092 ---- void buildmap_tiger_process (const char *source, const char *county, ! int verbose) { + int i; char *base = roadmap_path_remove_extension (source); ! buildmap_tiger_set_layers (verbose); ! buildmap_tiger_read_rtc (base, verbose); /* Cities. */ ! buildmap_tiger_read_rt7 (base, verbose); /* landmarks. */ ! buildmap_tiger_read_rt8 (base, verbose); /* Polygons. */ ! buildmap_tiger_read_rti (base, verbose); /* Polygon lines. */ ! buildmap_tiger_read_rt1 (base, verbose); /* Lines. */ ! buildmap_tiger_read_rt2 (base, verbose); /* Shapes. */ buildmap_metadata_add_attribute ("Territory", "Id", county); buildmap_metadata_add_attribute ("Territory", "Parent", "us"); /* for now. */ ! buildmap_metadata_add_attribute ("Class", "Name", "All"); ! buildmap_metadata_add_attribute ("Data", "Source", "USCB"); ! ! if (verbose) { ! fprintf (stderr, ! "-- %s: layer statistics:\n", ! roadmap_path_skip_directories(source)); ! ! for (i = 0; i < 256; ++i) { ! if (BuildMapTigerLayerStatistics[i].name != NULL) { ! fprintf (stderr, ! "-- %s: %s: %d lines, %d landmarks\n", ! roadmap_path_skip_directories(source), ! BuildMapTigerLayerStatistics[i].name, ! BuildMapTigerLayerStatistics[i].line_count, ! BuildMapTigerLayerStatistics[i].landmark_count); ! } ! } ! } free(base); |
From: Pascal F M. <pas...@us...> - 2006-02-05 23:17:19
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12918 Modified Files: buildmap_shapefile.h Log Message: Remove hard-coded layers Index: buildmap_shapefile.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_shapefile.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** buildmap_shapefile.h 14 Nov 2005 07:03:12 -0000 1.3 --- buildmap_shapefile.h 5 Feb 2006 23:17:11 -0000 1.4 *************** *** 27,35 **** void buildmap_shapefile_process (const char *source, const char *county, ! int verbose, int canals, int rivers); void buildmap_shapefile_dcw_process (const char *source, const char *county, ! int verbose, int canals, int rivers); #endif // INCLUDED__BUILDMAP_SHAPEFILE__H --- 27,35 ---- void buildmap_shapefile_process (const char *source, const char *county, ! int verbose); void buildmap_shapefile_dcw_process (const char *source, const char *county, ! int verbose); #endif // INCLUDED__BUILDMAP_SHAPEFILE__H |
From: Pascal F M. <pas...@us...> - 2006-02-05 23:17:01
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12659 Modified Files: buildmap_shapefile.c Log Message: Remove hard-coded layers Index: buildmap_shapefile.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_shapefile.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** buildmap_shapefile.c 14 Nov 2005 07:03:04 -0000 1.4 --- buildmap_shapefile.c 5 Feb 2006 23:16:52 -0000 1.5 *************** *** 59,62 **** --- 59,64 ---- #include "buildmap_polygon.h" + #include "buildmap_layer.h" + // shapfile column names for DMTI *************** *** 95,104 **** static BuildMapDictionary DictionaryFSA; - static int BuildMapCanals = ROADMAP_WATER_RIVER; - static int BuildMapRivers = ROADMAP_WATER_RIVER; ! static RoadMapString ! str2dict (BuildMapDictionary d, const char *string) { if (!strlen(string)) { --- 97,135 ---- static BuildMapDictionary DictionaryFSA; + /* Road layers. */ ! static int BuildMapLayerFreeway = 0; ! static int BuildMapLayerRamp = 0; ! static int BuildMapLayerMain = 0; ! static int BuildMapLayerStreet = 0; ! static int BuildMapLayerTrail = 0; ! ! /* Water layers. */ ! ! static int BuildMapLayerShoreline = 0; ! static int BuildMapLayerRiver = 0; ! static int BuildMapLayerCanal = 0; ! static int BuildMapLayerLake = 0; ! static int BuildMapLayerSea = 0; ! ! ! static void buildmap_shapefile_find_layers (void) { ! ! BuildMapLayerFreeway = buildmap_layer_get ("freeways"); ! BuildMapLayerRamp = buildmap_layer_get ("ramps"); ! BuildMapLayerMain = buildmap_layer_get ("highways"); ! BuildMapLayerStreet = buildmap_layer_get ("streets"); ! BuildMapLayerTrail = buildmap_layer_get ("trails"); ! ! BuildMapLayerShoreline = buildmap_layer_get ("shore"); ! BuildMapLayerRiver = buildmap_layer_get ("rivers"); ! BuildMapLayerCanal = buildmap_layer_get ("canals"); ! BuildMapLayerLake = buildmap_layer_get ("lakes"); ! BuildMapLayerSea = buildmap_layer_get ("sea"); ! } ! ! ! static RoadMapString str2dict (BuildMapDictionary d, const char *string) { if (!strlen(string)) { *************** *** 121,131 **** switch (carto) { ! case 1: return ROADMAP_ROAD_FREEWAY; ! case 2: return ROADMAP_ROAD_MAIN; ! case 3: return ROADMAP_ROAD_MAIN; ! case 4: return ROADMAP_ROAD_MAIN; ! case 5: return ROADMAP_ROAD_STREET; ! case 6: return ROADMAP_ROAD_TRAIL; ! default: return ROADMAP_ROAD_RAMP; } break; --- 152,162 ---- switch (carto) { ! case 1: return BuildMapLayerFreeway; ! case 2: return BuildMapLayerMain; ! case 3: return BuildMapLayerMain; ! case 4: return BuildMapLayerMain; ! case 5: return BuildMapLayerStreet; ! case 6: return BuildMapLayerTrail; ! default: return BuildMapLayerRamp; } break; *************** *** 135,142 **** switch (carto) { ! case 0: return ROADMAP_ROAD_STREET; ! case 14: return ROADMAP_ROAD_FREEWAY; ! case 15: return ROADMAP_ROAD_MAIN; ! default: return ROADMAP_ROAD_TRAIL; } break; --- 166,173 ---- switch (carto) { ! case 0: return BuildMapLayerStreet; ! case 14: return BuildMapLayerFreeway; ! case 15: return BuildMapLayerMain; ! default: return BuildMapLayerTrail; } break; *************** *** 146,153 **** switch (carto) { ! case '0': return ROADMAP_WATER_SHORELINE; ! case '1': return BuildMapRivers; ! case '2': return BuildMapCanals; ! case '5': return ROADMAP_WATER_SEA; } break; --- 177,184 ---- switch (carto) { ! case '0': return BuildMapLayerShoreline; ! case '1': return BuildMapLayerRiver; ! case '2': return BuildMapLayerCanal; ! case '5': return BuildMapLayerSea; } break; *************** *** 709,713 **** void buildmap_shapefile_process (const char *source, const char *county, ! int verbose, int canals, int rivers) { #if ROADMAP_USE_SHAPEFILES --- 740,744 ---- void buildmap_shapefile_process (const char *source, const char *county, ! int verbose) { #if ROADMAP_USE_SHAPEFILES *************** *** 719,729 **** if (strlen(basename) > 2) basename[2] = 0; ! if (! canals) { ! BuildMapCanals = 0; ! } ! ! if (! rivers) { ! BuildMapRivers = 0; ! } buildmap_shapefile_read_rte(base, verbose); --- 750,754 ---- if (strlen(basename) > 2) basename[2] = 0; ! buildmap_shapefile_find_layers (); buildmap_shapefile_read_rte(base, verbose); *************** *** 745,749 **** void buildmap_shapefile_dcw_process (const char *source, const char *county, ! int verbose, int canals, int rivers) { #if ROADMAP_USE_SHAPEFILES --- 770,774 ---- void buildmap_shapefile_dcw_process (const char *source, const char *county, ! int verbose) { #if ROADMAP_USE_SHAPEFILES *************** *** 751,761 **** char *base = roadmap_path_remove_extension (source); ! if (! canals) { ! BuildMapCanals = 0; ! } ! ! if (! rivers) { ! BuildMapRivers = 0; ! } buildmap_shapefile_read_dcw_roads(base, verbose); --- 776,780 ---- char *base = roadmap_path_remove_extension (source); ! buildmap_shapefile_find_layers (); buildmap_shapefile_read_dcw_roads(base, verbose); |
From: Pascal F M. <pas...@us...> - 2006-02-05 23:16:23
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12507 Modified Files: buildmap_polygon.c Log Message: Remove hard-coded layers Index: buildmap_polygon.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_polygon.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** buildmap_polygon.c 16 Jan 2006 20:48:50 -0000 1.5 --- buildmap_polygon.c 5 Feb 2006 23:16:13 -0000 1.6 *************** *** 67,71 **** * * The function buildmap_polygon_use_line() tells the line loading logic ! * if it must load the line anyway. * * The other functions are generic functions, same as for the other table --- 67,72 ---- * * The function buildmap_polygon_use_line() tells the line loading logic ! * the layer to use for this line (which is used only if the line was not ! * going to be loaded according to its own native layer). * * The other functions are generic functions, same as for the other table *************** *** 694,698 **** if (this_line->tlid == tlid) { ! return 1; } } --- 695,699 ---- if (this_line->tlid == tlid) { ! return this_line->polygon->cfcc; } } |
From: Pascal F M. <pas...@us...> - 2006-02-05 23:15:40
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12209 Modified Files: buildmap_place.c Log Message: Remove hard-coded layers Index: buildmap_place.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_place.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** buildmap_place.c 16 Jan 2006 20:47:20 -0000 1.4 --- buildmap_place.c 5 Feb 2006 23:15:31 -0000 1.5 *************** *** 23,27 **** * SYNOPSYS: * ! * int buildmap_place_add (int name, int cfcc, int point); * * int buildmap_place_get_sorted (int place); --- 23,27 ---- * SYNOPSYS: * ! * int buildmap_place_add (int name, int layer, int point); * * int buildmap_place_get_sorted (int place); *************** *** 63,68 **** int name; int sorted; ! int cfcc; int point; } BuildMapPlace; --- 63,69 ---- int name; int sorted; ! int layer; int point; + int square; } BuildMapPlace; *************** *** 94,98 **** ! int buildmap_place_add (int name, int cfcc, int point) { int block; --- 95,99 ---- ! int buildmap_place_add (int name, int layer, int point) { int block; *************** *** 125,129 **** } this_place->name = name; ! this_place->cfcc = cfcc; this_place->point = point; --- 126,130 ---- } this_place->name = name; ! this_place->layer = layer; this_place->point = point; *************** *** 252,256 **** /* The Places are first sorted by square. * Within a square, Places are sorted by category. ! * Within a category, Places are sorted by point. */ --- 253,257 ---- /* The Places are first sorted by square. * Within a square, Places are sorted by category. ! * Within a layer, Places are sorted by point. */ *************** *** 262,267 **** } ! if (record1->cfcc != record2->cfcc) { ! return record1->cfcc - record2->cfcc; } --- 263,268 ---- } ! if (record1->layer != record2->layer) { ! return record1->layer - record2->layer; } *************** *** 321,333 **** int i; int j; - int k; int square; int square_current; ! int cfcc_current; int square_count; BuildMapPlace *one_place; ! RoadMapPlace *db_places; RoadMapPlaceBySquare *db_square; --- 322,336 ---- int i; int j; int square; int square_current; ! int layer_current; int square_count; + int layer_count; + int layer_sublist; BuildMapPlace *one_place; ! int *db_places; ! int *db_layer; RoadMapPlaceBySquare *db_square; *************** *** 335,338 **** --- 338,342 ---- buildmap_db *data_table; buildmap_db *square_table; + buildmap_db *layer_table; *************** *** 342,345 **** --- 346,390 ---- + /* First we must compute the size of the place/bylayer table. */ + + square_current = -1; + layer_current = 0; + layer_count = 0; + + for (i = 0; i < PlaceCount; ++i) { + + j = SortedPlace[i]; + + one_place = Place[j/BUILDMAP_BLOCK] + (j % BUILDMAP_BLOCK); + + square = buildmap_point_get_square_sorted (one_place->point); + + if (square != square_current) { + + if (square < square_current) { + buildmap_fatal (0, "abnormal square order: %d following %d", + square, square_current); + } + if (square_current >= 0) { + layer_count += (layer_current + 1); + } + square_current = square; + + layer_current = 0; /* Restart from first layer. */ + } + + if (one_place->layer < layer_current) { + buildmap_fatal (0, "abnormal layer order: %d following %d", + one_place->layer, layer_current); + } + layer_current = one_place->layer; + one_place->square = square; + } + + if (square_current >= 0) { + layer_count += (layer_current + 1); /* Space for the last square. */ + } + + /* Create the database space */ *************** *** 349,353 **** data_table = buildmap_db_add_section (root, "data"); if (data_table == NULL) buildmap_fatal (0, "Can't add a new section"); ! buildmap_db_add_data (data_table, PlaceCount, sizeof(RoadMapPlace)); square_table = buildmap_db_add_section (root, "bysquare"); --- 394,398 ---- data_table = buildmap_db_add_section (root, "data"); if (data_table == NULL) buildmap_fatal (0, "Can't add a new section"); ! buildmap_db_add_data (data_table, PlaceCount, sizeof(int)); square_table = buildmap_db_add_section (root, "bysquare"); *************** *** 356,372 **** square_count, sizeof(RoadMapPlaceBySquare)); ! db_places = (RoadMapPlace *) buildmap_db_get_data (data_table); ! db_square = (RoadMapPlaceBySquare *) buildmap_db_get_data (square_table); ! ! for (i = 0; i < square_count; ++i) { ! for (k = 0; k < ROADMAP_CATEGORY_RANGE; k++) { ! db_square[i].first[k] = -1; ! } ! } square_current = -1; ! cfcc_current = -1; for (i = 0; i < PlaceCount; ++i) { --- 401,416 ---- square_count, sizeof(RoadMapPlaceBySquare)); ! layer_table = buildmap_db_add_section (root, "bylayer"); ! if (layer_table == NULL) buildmap_fatal (0, "Can't add a new section"); ! buildmap_db_add_data (layer_table, layer_count, sizeof(int)); ! db_places = (int *) buildmap_db_get_data (data_table); ! db_layer = (int *) buildmap_db_get_data (layer_table); ! db_square = (RoadMapPlaceBySquare *) buildmap_db_get_data (square_table); square_current = -1; ! layer_current = 0; ! layer_sublist = 0; for (i = 0; i < PlaceCount; ++i) { *************** *** 377,414 **** db_places[i] = one_place->point; ! ! square = buildmap_point_get_square_sorted (one_place->point); if (square != square_current) { - if (square < square_current) { - buildmap_fatal (0, "abnormal square order: %d following %d", - square, square_current); - } if (square_current >= 0) { - db_square[square_current].last = i - 1; - } - square_current = square; ! cfcc_current = -1; /* Force cfcc change. */ ! } ! if (one_place->cfcc != cfcc_current) { ! if (one_place->cfcc < cfcc_current) { ! buildmap_fatal (0, "abnormal cfcc order: %d following %d", ! one_place->cfcc, cfcc_current); ! } ! if (one_place->cfcc <= 0 || ! one_place->cfcc > BUILDMAP_MAX_PLACE_CFCC) { ! buildmap_fatal (0, "illegal cfcc value"); } ! cfcc_current = one_place->cfcc; ! db_square[square].first[cfcc_current-1] = i; } } ! db_square[square_current].last = PlaceCount - 1; } --- 421,467 ---- db_places[i] = one_place->point; ! square = one_place->square; if (square != square_current) { if (square_current >= 0) { ! /* Complete the previous square. */ ! db_layer[layer_sublist+square_current] = i; ! db_square[square_current].first = layer_sublist; ! db_square[square_current].count = layer_current; ! /* Move on to the next square. */ ! ! layer_sublist += layer_current; ! if (layer_sublist >= layer_count) { ! buildmap_fatal (0, "invalid place/bylayer count"); ! } } ! square_current = square; ! layer_current = 0; /* Restart at the first layer. */ ! } ! /* The current place is the start of every layer up to and ! * including this layer. If there are skipped layers, they ! * will have 0 place since they start at the same position ! * as the next layer. ! */ ! while (layer_current < one_place->layer) { ! db_layer[layer_sublist+layer_current] = i; ! layer_current += 1; } } ! if (square_current >= 0) { ! db_layer[layer_sublist+square_current] = i; ! db_square[square_current].first = layer_sublist; ! db_square[square_current].count = layer_current; ! ! if (layer_sublist+square_current+1 != layer_count) { ! buildmap_fatal (0, "invalid place/bylayer count"); ! } ! } } |
From: Pascal F M. <pas...@us...> - 2006-02-05 23:15:20
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12058 Modified Files: buildmap_main.c Log Message: Remove hard-coded layers Index: buildmap_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_main.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** buildmap_main.c 16 Jan 2006 20:54:51 -0000 1.9 --- buildmap_main.c 5 Feb 2006 23:15:07 -0000 1.10 *************** *** 50,53 **** --- 50,55 ---- #include "buildmap_metadata.h" + #include "buildmap_layer.h" + #define BUILDMAP_FORMAT_TIGER 1 *************** *** 58,65 **** static int BuildMapFormatFamily = 0; - static int BuildMapCanals = 0; - static int BuildMapRivers = 0; static int BuildMapVerbose = 0; static char *BuildMapFormat = "2002"; static char *BuildMapResult; --- 60,66 ---- static int BuildMapFormatFamily = 0; static int BuildMapVerbose = 0; static char *BuildMapFormat = "2002"; + static char *BuildMapClass = "default/All"; static char *BuildMapResult; *************** *** 80,88 **** static struct poptOption BuildMapDataOptions [] = { ! {"canals", 'c', ! POPT_ARG_NONE, &BuildMapCanals, 0, "Show canals on maps", NULL}, ! ! {"rivers", 'r', ! POPT_ARG_NONE, &BuildMapRivers, 0, "Show rivers on maps", NULL}, POPT_TABLEEND --- 81,87 ---- static struct poptOption BuildMapDataOptions [] = { ! {"class", 'c', ! POPT_ARG_STRING, &BuildMapClass, 0, ! "The class file to create the map for", NULL}, POPT_TABLEEND *************** *** 173,194 **** static void buildmap_county_process (const char *source, const char *county, ! int verbose, int canals, int rivers) { switch (BuildMapFormatFamily) { case BUILDMAP_FORMAT_TIGER: ! buildmap_tiger_process ! (source, county, verbose, canals, rivers); break; #ifdef ROADMAP_USE_SHAPEFILES case BUILDMAP_FORMAT_SHAPE: ! buildmap_shapefile_process ! (source, county, verbose, canals, rivers); break; case BUILDMAP_FORMAT_DCW: ! buildmap_shapefile_dcw_process ! (source, county, verbose, canals, rivers); break; #endif --- 172,190 ---- static void buildmap_county_process (const char *source, const char *county, ! int verbose) { switch (BuildMapFormatFamily) { case BUILDMAP_FORMAT_TIGER: ! buildmap_tiger_process (source, county, verbose); break; #ifdef ROADMAP_USE_SHAPEFILES case BUILDMAP_FORMAT_SHAPE: ! buildmap_shapefile_process (source, county, verbose); break; case BUILDMAP_FORMAT_DCW: ! buildmap_shapefile_dcw_process (source, county, verbose); break; #endif *************** *** 240,247 **** } buildmap_county_process ((char *) (leftovers[1]), (char *) (leftovers[0]), ! BuildMapVerbose, BuildMapCanals, BuildMapRivers); poptFreeContext (decoder); --- 236,245 ---- } + buildmap_layer_load (BuildMapClass); + buildmap_county_process ((char *) (leftovers[1]), (char *) (leftovers[0]), ! BuildMapVerbose); poptFreeContext (decoder); |
From: Pascal F M. <pas...@us...> - 2006-02-05 23:14:51
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11780 Added Files: buildmap_layer.h Log Message: Remove hard-coded layers --- NEW FILE: buildmap_layer.h --- /* buildmap_layer.h - Read the RoadMap layers from the class file. * * LICENSE: * * Copyright 2002 Pascal F. Martin * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef INCLUDED__BUILDMAP_LAYER__H #define INCLUDED__BUILDMAP_LAYER__H int buildmap_layer_get (const char *name); void buildmap_layer_load (const char *class_file); #endif // INCLUDED__BUILDMAP_LAYER__H |
From: Pascal F M. <pas...@us...> - 2006-02-05 23:14:46
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11691 Added Files: buildmap_layer.c Log Message: Remove hard-coded layers --- NEW FILE: buildmap_layer.c --- /* buildmap_layer.c - Layer management: list, identify. * * LICENSE: * * Copyright 2003 Pascal F. Martin * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See buildmap_layer.h. * * This module is only concerned about retrieving which layers are * defined for a given class. It is used by the data source decoders * to filter out unwanted layers from the data source. */ #include <stdlib.h> #include <string.h> #include "roadmap_config.h" #include "buildmap.h" #include "buildmap_layer.h" #define BUILDMAP_LAYER_MAX 1024 static char *BuildMapLineLayerList[BUILDMAP_LAYER_MAX]; static int BuildMapLineLayerCount = 0; static char *BuildMapPolygonLayerList[BUILDMAP_LAYER_MAX]; static int BuildMapPolygonLayerCount = 0; int buildmap_layer_get (const char *name) { int i; for (i = 0; i < BuildMapLineLayerCount; ++i) { if (strcasecmp(BuildMapLineLayerList[i], name) == 0) { return i+1; } } for (i = 0; i < BuildMapPolygonLayerCount; ++i) { if (strcasecmp(BuildMapPolygonLayerList[i], name) == 0) { return BuildMapLineLayerCount + i + 1; } } return 0; } /* Initialization code. ------------------------------------------- */ static int buildmap_layer_split (char *text, char *field[], int max) { int i; char *p; field[0] = text; p = strchr (text, ' '); for (i = 1; p != NULL && *p != 0; ++i) { *p = 0; if (i >= max) return -1; field[i] = ++p; p = strchr (p, ' '); } return i; } static int buildmap_layer_decode (const char *config, const char *id, char**args, int max) { int count; char *buffer; if (max <= 0) { buildmap_fatal (0, "too many layers in class file %s", roadmap_config_file(config)); } /* We must allocate a new storage because we are going to split * the string, thus modify it. */ buffer = strdup(roadmap_config_get_from (config, "Class", id)); if (buffer == NULL) { buildmap_fatal (0, "no more memory"); } count = buildmap_layer_split (buffer, args, max); if (count <= 0) { buildmap_fatal (0, "invalid layer list %s in class file %s", id, roadmap_config_file(config)); } return count; } void buildmap_layer_load (const char *class_file) { const char *config; roadmap_config_initialize (); config = roadmap_config_new (class_file, 0); if (config == NULL) { buildmap_fatal (0, "cannot access class file %s", class_file); } BuildMapLineLayerCount = buildmap_layer_decode (config, "Lines", BuildMapLineLayerList, BUILDMAP_LAYER_MAX); if (BuildMapLineLayerCount <= 0) { buildmap_fatal (0, "cannot decode line layers in class %s", class_file); } BuildMapPolygonLayerCount = buildmap_layer_decode (config, "Polygons", BuildMapPolygonLayerList, BUILDMAP_LAYER_MAX); if (BuildMapPolygonLayerCount <= 0) { buildmap_fatal (0, "cannot decode polygon layers in class %s", class_file); } } |
From: Pascal F M. <pas...@us...> - 2006-02-05 23:12:58
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10817 Modified Files: buildmap_line.c Log Message: Add import code, debugged version Index: buildmap_line.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_line.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** buildmap_line.c 16 Jan 2006 20:43:39 -0000 1.5 --- buildmap_line.c 5 Feb 2006 23:12:47 -0000 1.6 *************** *** 23,27 **** * SYNOPSYS: * ! * int buildmap_line_add (int tlid, int cfcc, int from, int to); * * int buildmap_line_get_sorted (int line); --- 23,27 ---- * SYNOPSYS: * ! * int buildmap_line_add (int tlid, int layer, int from, int to); * * int buildmap_line_get_sorted (int line); *************** *** 60,64 **** int tlid; int sorted; ! int cfcc; } BuildMapLine; --- 60,66 ---- int tlid; int sorted; ! int layer; ! int square_from; ! int square_to; } BuildMapLine; *************** *** 92,96 **** ! int buildmap_line_add (int tlid, int cfcc, int from, int to) { int block; --- 94,98 ---- ! int buildmap_line_add (int tlid, int layer, int from, int to) { int block; *************** *** 120,127 **** if ((from < 0) || (to < 0)) { ! buildmap_fatal (0, "invalid points"); } this_line->tlid = tlid; ! this_line->cfcc = cfcc; this_line->record.from = from; this_line->record.to = to; --- 122,132 ---- if ((from < 0) || (to < 0)) { ! buildmap_fatal (0, "invalid points"); ! } ! if (layer <= 0) { ! buildmap_fatal (0, "invalid layer"); } this_line->tlid = tlid; ! this_line->layer = layer; this_line->record.from = from; this_line->record.to = to; *************** *** 262,267 **** } ! if (record1->cfcc != record2->cfcc) { ! return record1->cfcc - record2->cfcc; } --- 267,272 ---- } ! if (record1->layer != record2->layer) { ! return record1->layer - record2->layer; } *************** *** 300,305 **** } ! if (record1->cfcc != record2->cfcc) { ! return record1->cfcc - record2->cfcc; } --- 305,310 ---- } ! if (record1->layer != record2->layer) { ! return record1->layer - record2->layer; } *************** *** 326,329 **** --- 331,337 ---- if (SortedLine != NULL) return; /* Sort was already performed. */ + if (LineCount == 0) return; /* No line to sort. */ + + buildmap_point_sort (); *************** *** 390,401 **** int i; int j; - int k; int square; int square_current; ! int cfcc_current; int square_count; BuildMapLine *one_line; int *db_index2; RoadMapLine *db_lines; --- 398,413 ---- int i; int j; int square; int square_current; ! int layer_current; int square_count; + int layer1_count; + int layer2_count; + int layer_sublist; BuildMapLine *one_line; + int *db_layer1; + int *db_layer2; int *db_index2; RoadMapLine *db_lines; *************** *** 406,411 **** buildmap_db *data_table; buildmap_db *square1_table; ! buildmap_db *index2_table; buildmap_db *square2_table; --- 418,425 ---- buildmap_db *data_table; buildmap_db *square1_table; ! buildmap_db *layer1_table; buildmap_db *square2_table; + buildmap_db *layer2_table; + buildmap_db *index2_table; *************** *** 415,418 **** --- 429,536 ---- + /* We need to calculate how much space we will need for line/bylayer1 + * and line/bylayer2. We take this opportunity to make some coherency + * checks, which adds to the code. + */ + square_current = -1; + layer_current = 0; + layer1_count = 0; + + for (i = 0; i < LineCount; ++i) { + + j = SortedLine[i]; + one_line = Line[j/BUILDMAP_BLOCK] + (j % BUILDMAP_BLOCK); + + square = buildmap_point_get_square_sorted (one_line->record.from); + + if (square != square_current) { + + if (square < square_current) { + buildmap_fatal (0, "abnormal square order: %d following %d", + square, square_current); + } + if (square_current >= 0) { + /* Lets compute how much space is needed for the just finished + * square. + */ + if (layer_current <= 0) { + buildmap_fatal (0, "empty square %d has lines?", square); + } + layer1_count += (layer_current + 1); /* 1 slot for the end line. */ + } + square_current = square; + + layer_current = 0; /* Restart from the 1st layer. */ + } + + if (one_line->layer < layer_current) { + buildmap_fatal (0, "abnormal layer order: %d following %d", + one_line->layer, layer_current); + } + + layer_current = one_line->layer; + one_line->square_from = square; + } + + if (square_current >= 0) { + /* Lets compute how much space is needed for the last square. */ + if (layer_current < 0) { + buildmap_fatal (0, "empty square %d has lines?", square); + } + layer1_count += (layer_current + 1); /* 1 slot for the end line. */ + } + + square_current = -1; + layer_current = 0; + layer2_count = 0; + + for (i = 0; i < LineCrossingCount; ++i) { + + j = SortedLine2[i]; + one_line = Line[j/BUILDMAP_BLOCK] + (j % BUILDMAP_BLOCK); + + square = buildmap_point_get_square_sorted (one_line->record.to); + + if (square == one_line->square_from) { + buildmap_fatal (0, "non crossing line in the crossing line table"); + } + + if (square != square_current) { + + if (square < square_current) { + buildmap_fatal (0, "abnormal square order: d following %d", + square, square_current); + } + if (square_current >= 0) { + /* Lets compute how much space is needed for the just finished + * square. + */ + if (layer_current <= 0) { + buildmap_fatal (0, "empty square %d has lines?", square); + } + layer2_count += (layer_current + 1); /* 1 slot for the end line. */ + } + square_current = square; + + layer_current = 0; /* Restart from the 1st layer. */ + } + + if (one_line->layer < layer_current) { + buildmap_fatal (0, "abnormal layer order: %d following %d", + one_line->layer, layer_current); + } + layer_current = one_line->layer; + one_line->square_to = square; + } + + if (square_current >= 0) { + /* Lets compute how much space is needed for the last square. */ + if (layer_current < 0) { + buildmap_fatal (0, "empty square %d has lines?", square); + } + layer2_count += (layer_current + 1); /* 1 slot for the end line. */ + } + + /* Create the database space */ *************** *** 429,435 **** square_count, sizeof(RoadMapLineBySquare)); ! index2_table = buildmap_db_add_section (root, "index2"); ! if (index2_table == NULL) buildmap_fatal (0, "Can't add a new section"); ! buildmap_db_add_data (index2_table, LineCrossingCount, sizeof(int)); square2_table = buildmap_db_add_section (root, "bysquare2"); --- 547,553 ---- square_count, sizeof(RoadMapLineBySquare)); ! layer1_table = buildmap_db_add_section (root, "bylayer1"); ! if (layer1_table == NULL) buildmap_fatal (0, "Can't add a new section"); ! buildmap_db_add_data (layer1_table, layer1_count, sizeof(int)); square2_table = buildmap_db_add_section (root, "bysquare2"); *************** *** 438,457 **** square_count, sizeof(RoadMapLineBySquare)); db_lines = (RoadMapLine *) buildmap_db_get_data (data_table); db_square1 = (RoadMapLineBySquare *) buildmap_db_get_data (square1_table); ! db_index2 = (int *) buildmap_db_get_data (index2_table); db_square2 = (RoadMapLineBySquare *) buildmap_db_get_data (square2_table); ! ! ! for (i = 0; i < square_count; ++i) { ! for (k = 0; k < ROADMAP_CATEGORY_RANGE; k++) { ! db_square1[i].first[k] = -1; ! db_square2[i].first[k] = -1; ! } ! } square_current = -1; ! cfcc_current = -1; for (i = 0; i < LineCount; ++i) { --- 556,578 ---- square_count, sizeof(RoadMapLineBySquare)); + layer2_table = buildmap_db_add_section (root, "bylayer2"); + if (layer2_table == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (layer2_table, layer2_count, sizeof(int)); + + index2_table = buildmap_db_add_section (root, "index2"); + if (index2_table == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (index2_table, LineCrossingCount, sizeof(int)); + db_lines = (RoadMapLine *) buildmap_db_get_data (data_table); db_square1 = (RoadMapLineBySquare *) buildmap_db_get_data (square1_table); ! db_layer1 = (int *) buildmap_db_get_data (layer1_table); db_square2 = (RoadMapLineBySquare *) buildmap_db_get_data (square2_table); ! db_layer2 = (int *) buildmap_db_get_data (layer2_table); ! db_index2 = (int *) buildmap_db_get_data (index2_table); square_current = -1; ! layer_current = 0; ! layer_sublist = 0; for (i = 0; i < LineCount; ++i) { *************** *** 463,503 **** db_lines[i] = one_line->record; ! square = buildmap_point_get_square_sorted (one_line->record.from); if (square != square_current) { - if (square < square_current) { - buildmap_fatal (0, "abnormal square order: %d following %d", - square, square_current); - } if (square_current >= 0) { ! db_square1[square_current].last = i - 1; } square_current = square; ! cfcc_current = -1; /* Force cfcc change. */ } ! if (one_line->cfcc != cfcc_current) { ! if (one_line->cfcc < cfcc_current) { ! buildmap_fatal (0, "abnormal cfcc order: %d following %d", ! one_line->cfcc, cfcc_current); ! } ! if (one_line->cfcc <= 0 || one_line->cfcc > ROADMAP_CATEGORY_RANGE) { ! buildmap_fatal (0, "illegal cfcc value"); ! } ! cfcc_current = one_line->cfcc; ! db_square1[square].first[cfcc_current-1] = i; } } - db_square1[square_current].last = LineCount - 1; ! /* Generate the second table (complement). */ square_current = -1; ! cfcc_current = -1; for (i = 0; i < LineCrossingCount; ++i) { --- 584,639 ---- db_lines[i] = one_line->record; ! square = one_line->square_from; if (square != square_current) { if (square_current >= 0) { ! ! /* Complete the previous square. */ ! ! db_layer1[layer_sublist+layer_current] = i; ! db_square1[square_current].first = layer_sublist; ! db_square1[square_current].count = layer_current; ! ! /* Move on to the next square. */ ! ! layer_sublist += (layer_current + 1); ! if (layer_sublist >= layer1_count) { ! buildmap_fatal (0, "invalid line/bylayer1 count"); ! } } square_current = square; + layer_current = 0; /* Restart at the first layer. */ + } ! /* The current line is the start of every layer up to and ! * including this layer. If there are skipped layers, they ! * will have 0 lines since they start at the same place as ! * the next layer. ! */ ! while (layer_current < one_line->layer) { ! db_layer1[layer_sublist+layer_current] = i; ! layer_current += 1; } + } ! /* Complete the last square. */ ! if (square_current >= 0) { ! db_layer1[layer_sublist+layer_current] = i; ! db_square1[square_current].first = layer_sublist; ! db_square1[square_current].count = layer_current; ! if (layer_sublist+layer_current+1 != layer1_count) { ! buildmap_fatal (0, "invalid line/bylayer1 count"); } } ! /* Generate the second table (crossing streets). */ square_current = -1; ! layer_current = 0; ! layer_sublist = 0; for (i = 0; i < LineCrossingCount; ++i) { *************** *** 509,549 **** db_index2[i] = one_line->sorted; ! square = buildmap_point_get_square_sorted (one_line->record.to); ! ! if (square == buildmap_point_get_square_sorted (one_line->record.from)) { ! buildmap_fatal (0, "non crossing line in the crossing line table"); ! } if (square != square_current) { - if (square < square_current) { - buildmap_fatal (0, "abnormal square order: d following %d", - square, square_current); - } if (square_current >= 0) { ! db_square2[square_current].last = i - 1; ! } ! square_current = square; ! cfcc_current = -1; /* Force cfcc change. */ ! } ! if (one_line->cfcc != cfcc_current) { ! if (one_line->cfcc < cfcc_current) { ! buildmap_fatal (0, "abnormal cfcc order: %d following %d", ! one_line->cfcc, cfcc_current); ! } ! if (one_line->cfcc <= 0 || one_line->cfcc > ROADMAP_CATEGORY_RANGE) { ! buildmap_fatal (0, "illegal cfcc value"); } ! cfcc_current = one_line->cfcc; ! db_square2[square].first[cfcc_current-1] = i; } } if (square_current >= 0) { ! db_square2[square_current].last = LineCrossingCount - 1; } } --- 645,685 ---- db_index2[i] = one_line->sorted; ! square = one_line->square_to; if (square != square_current) { if (square_current >= 0) { ! ! /* Complete the previous square. */ ! db_layer2[layer_sublist+layer_current] = i; ! db_square2[square_current].first = layer_sublist; ! db_square2[square_current].count = layer_current; ! /* Move on to the next square. */ ! layer_sublist += (layer_current + 1); ! if (layer_sublist >= layer2_count) { ! buildmap_fatal (0, "invalid line/bylayer2 count"); ! } } ! square_current = square; ! layer_current = 0; /* Restart at the first layer. */ ! } ! while (layer_current < one_line->layer) { ! db_layer2[layer_sublist+layer_current] = i; ! layer_current += 1; } } if (square_current >= 0) { ! db_layer2[layer_sublist+layer_current] = i; ! db_square2[square_current].first = layer_sublist; ! db_square2[square_current].count = layer_current; ! ! if (layer_sublist+layer_current+1 != layer2_count) { ! buildmap_fatal (0, "invalid line/bylayer2 count"); ! } } } |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:22:45
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25216 Modified Files: buildmap_point.c Log Message: Don't mixup different structures, even if they happen to be the same (by chance?) Index: buildmap_point.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_point.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** buildmap_point.c 16 Jan 2006 20:48:01 -0000 1.4 --- buildmap_point.c 4 Feb 2006 09:22:36 -0000 1.5 *************** *** 338,341 **** --- 338,342 ---- int j; + int square_count; int last_square = -1; int reference_longitude; *************** *** 344,348 **** BuildMapPoint *one_point; RoadMapPoint *db_points; ! RoadMapSortedList *db_bysquare; --- 345,349 ---- BuildMapPoint *one_point; RoadMapPoint *db_points; ! RoadMapPointBySquare *db_bysquare; *************** *** 354,357 **** --- 355,360 ---- buildmap_info ("saving points..."); + square_count = buildmap_square_get_count(); + root = buildmap_db_add_section (NULL, "point"); if (root == NULL) buildmap_fatal (0, "Can't add a new section"); *************** *** 364,371 **** if (table_bysquare == NULL) buildmap_fatal (0, "Can't add a new section"); buildmap_db_add_data ! (table_bysquare, buildmap_square_get_count(), sizeof(RoadMapSortedList)); db_points = (RoadMapPoint *) buildmap_db_get_data (table_data); ! db_bysquare = (RoadMapSortedList *) buildmap_db_get_data (table_bysquare); --- 367,374 ---- if (table_bysquare == NULL) buildmap_fatal (0, "Can't add a new section"); buildmap_db_add_data ! (table_bysquare, square_count, sizeof(RoadMapPointBySquare)); db_points = (RoadMapPoint *) buildmap_db_get_data (table_data); ! db_bysquare = (RoadMapPointBySquare *) buildmap_db_get_data (table_bysquare); |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:21:38
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24916 Modified Files: rdmxchange_zip.c Log Message: Add import code, debugged version Index: rdmxchange_zip.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmxchange_zip.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rdmxchange_zip.c 11 Jan 2006 09:56:06 -0000 1.1 --- rdmxchange_zip.c 4 Feb 2006 09:21:27 -0000 1.2 *************** *** 9,14 **** * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, --- 9,13 ---- * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation, as of version 2 of the License. * * RoadMap is distributed in the hope that it will be useful, *************** *** 26,32 **** #include <stdlib.h> - #include "roadmap.h" - #include "roadmap_dbread.h" - #include "rdmxchange.h" --- 25,28 ---- *************** *** 104,108 **** static void rdmxchange_zip_export_head (FILE *file) { ! fprintf (file, "table zip %d\n", RoadMapZipActive->ZipCodeCount); } --- 100,104 ---- static void rdmxchange_zip_export_head (FILE *file) { ! fprintf (file, "zip,%d\n", RoadMapZipActive->ZipCodeCount); } *************** *** 113,117 **** int *zipcode; ! fprintf (file, "table zip\n" "code\n"); zipcode = RoadMapZipActive->ZipCode; --- 109,113 ---- int *zipcode; ! fprintf (file, "zip\n" "code\n"); zipcode = RoadMapZipActive->ZipCode; *************** *** 136,137 **** --- 132,238 ---- } + + /* The import side. ----------------------------------------------------- */ + + static int *ZipCode = NULL; + static int ZipCodeCount = 0; + static int ZipCodeCursor = 0; + + + static void rdmxchange_zip_save (void) { + + int i; + int *db_zip; + buildmap_db *root = buildmap_db_add_section (NULL, "zip"); + + /* Create the tables. */ + + if (root == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (root, ZipCodeCount, sizeof(int)); + + db_zip = (int *) buildmap_db_get_data (root); + + /* Fill the data in. */ + + for (i = 0; i < ZipCodeCount; ++i) { + db_zip[i] = ZipCode[i]; + } + + /* Do not save this data ever again. */ + free (ZipCode); + ZipCode = NULL; + ZipCodeCount = 0; + } + + + static buildmap_db_module RdmXchangeZipModule = { + "zip", + NULL, + rdmxchange_zip_save, + NULL, + NULL + }; + + + static void rdmxchange_zip_import_table (const char *name, int count) { + + buildmap_db_register (&RdmXchangeZipModule); + + if (strcmp (name, "zip") == 0) { + + if (ZipCode != NULL) free (ZipCode); + + ZipCode = calloc (count, sizeof(int)); + ZipCodeCount = count; + + } else { + + buildmap_fatal (1, "invalid table name %s", name); + } + } + + + static int rdmxchange_zip_import_schema (const char *table, + char *fields[], int count) { + + if (strcmp (table, "zip") == 0) { + + if (ZipCode == NULL || count != 1 || strcmp(fields[0], "code") != 0) { + buildmap_fatal (1, "invalid schema for table zip"); + } + ZipCodeCursor = 0; + + return 1; + } + + buildmap_fatal (1, "invalid table name %s", table); + return 0; + } + + static void rdmxchange_zip_import_data (int table, + char *fields[], int count) { + + switch (table) { + + case 1: + + if (count != 1) { + buildmap_fatal (count, "invalid zip record"); + } + ZipCode[ZipCodeCursor++] = rdmxchange_import_int (fields[0]); + break; + + default: + + buildmap_fatal (1, "invalid table"); + } + } + + + RdmXchangeImport RdmXchangeZipImport = { + "zip", + rdmxchange_zip_import_table, + rdmxchange_zip_import_schema, + rdmxchange_zip_import_data + }; + |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:21:08
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24678 Modified Files: rdmxchange_street.c Log Message: Add import code, debugged version Index: rdmxchange_street.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmxchange_street.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rdmxchange_street.c 15 Jan 2006 03:08:10 -0000 1.2 --- rdmxchange_street.c 4 Feb 2006 09:20:58 -0000 1.3 *************** *** 9,14 **** * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, --- 9,13 ---- * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation, as of version 2 of the License. * * RoadMap is distributed in the hope that it will be useful, *************** *** 123,128 **** static void rdmxchange_street_export_head (FILE *file) { ! fprintf (file, "table street/name %d\n", RoadMapStreetActive->StreetsCount); ! fprintf (file, "table street/type %d\n", RoadMapStreetActive->StreetsCount); } --- 122,127 ---- static void rdmxchange_street_export_head (FILE *file) { ! fprintf (file, "street/name,%d\n", RoadMapStreetActive->StreetsCount); ! fprintf (file, "street/type,%d\n", RoadMapStreetActive->StreetsCount); } *************** *** 135,139 **** ! fprintf (file, "table street/name\n" "fedirp," "fename," --- 134,138 ---- ! fprintf (file, "street/name\n" "fedirp," "fename," *************** *** 152,156 **** ! fprintf (file, "table street/type\n" "type\n"); streetstype = RoadMapStreetActive->StreetType; --- 151,155 ---- ! fprintf (file, "street/type\n" "type\n"); streetstype = RoadMapStreetActive->StreetType; *************** *** 175,176 **** --- 174,331 ---- } + + /* The import side. ----------------------------------------------------- */ + + static char *StreetLayer = NULL; + static RoadMapStreet *StreetName = NULL; + static int StreetLayerCount = 0; + static int StreetNameCount = 0; + static int StreetCursor = 0; + + + static void rdmxchange_street_save (void) { + + int i; + RoadMapStreet *db_name; + char *db_layer; + buildmap_db *root; + buildmap_db *table_name; + buildmap_db *table_layer; + + + root = buildmap_db_add_section (NULL, "street"); + if (root == NULL) buildmap_fatal (0, "Can't add a new section"); + + table_name = buildmap_db_add_section (root, "name"); + if (table_name == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (table_name, StreetNameCount, sizeof(RoadMapStreet)); + + table_layer = buildmap_db_add_section (root, "type"); + if (table_layer == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (table_layer, StreetLayerCount, sizeof(char)); + + db_name = (RoadMapStreet *) buildmap_db_get_data (table_name); + db_layer = (char *) buildmap_db_get_data (table_layer); + + for (i = StreetNameCount-1; i >= 0; --i) { + db_name[i] = StreetName[i]; + } + + for (i = StreetLayerCount-1; i >= 0; --i) { + db_layer[i] = StreetLayer[i]; + } + + /* Do not save this data ever again. */ + free (StreetName); + StreetName = NULL; + StreetNameCount = 0; + + free (StreetLayer); + StreetLayer = NULL; + StreetLayerCount = 0; + } + + + static buildmap_db_module RdmXchangeStreetModule = { + "street", + NULL, + rdmxchange_street_save, + NULL, + NULL + }; + + + static void rdmxchange_street_import_table (const char *name, int count) { + + if (strcmp (name, "street/name") == 0) { + + if (StreetName != NULL) free (StreetName); + + StreetName = calloc (count, sizeof(RoadMapStreet)); + StreetNameCount = count; + + } else if (strcmp (name, "street/type") == 0) { + + if (StreetLayer != NULL) free (StreetLayer); + + StreetLayer = calloc (count, sizeof(char)); + StreetLayerCount = count; + + } else { + + buildmap_fatal (1, "invalid table name %s", name); + } + + buildmap_db_register (&RdmXchangeStreetModule); + } + + + static int rdmxchange_street_import_schema (const char *table, + char *fields[], int count) { + + StreetCursor = 0; + + if (strcmp (table, "street/name") == 0) { + + if ((StreetName == NULL) || + (count != 4) || + (strcmp (fields[0], "fedirp") != 0) || + (strcmp (fields[1], "fename") != 0) || + (strcmp (fields[2], "fetype") != 0) || + (strcmp (fields[3], "fedirs") != 0)) { + buildmap_fatal (1, "invalid schema for table %s\n", table); + } + return 1; + + } else if (strcmp (table, "street/type") == 0) { + + if ((StreetLayer == NULL) || + (count != 1) || (strcmp (fields[0], "type") != 0)) { + buildmap_fatal (1, "invalid schema for table %s\n", table); + } + return 2; + } + + buildmap_fatal (1, "invalid table name %s", table); + return 0; + } + + + static void rdmxchange_street_import_data (int table, + char *fields[], int count) { + + RoadMapStreet *street; + + switch (table) { + case 1: + + if (count != 4) { + buildmap_fatal (count, "invalid street/name record"); + } + street = &(StreetName[StreetCursor++]); + + street->fedirp = (RoadMapString) rdmxchange_import_int (fields[0]); + street->fename = (RoadMapString) rdmxchange_import_int (fields[1]); + street->fetype = (RoadMapString) rdmxchange_import_int (fields[2]); + street->fedirs = (RoadMapString) rdmxchange_import_int (fields[3]); + + break; + + case 2: + + if (count != 1) { + buildmap_fatal (count, "invalid street/type record"); + } + StreetLayer[StreetCursor++] = (char)rdmxchange_import_int (fields[0]); + break; + } + } + + + RdmXchangeImport RdmXchangeStreetImport = { + "street", + rdmxchange_street_import_table, + rdmxchange_street_import_schema, + rdmxchange_street_import_data + }; + |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:20:49
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24623 Modified Files: rdmxchange_square.c Log Message: Add import code, debugged version Index: rdmxchange_square.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmxchange_square.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rdmxchange_square.c 11 Jan 2006 09:57:39 -0000 1.2 --- rdmxchange_square.c 4 Feb 2006 09:20:41 -0000 1.3 *************** *** 9,14 **** * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, --- 9,13 ---- * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation, as of version 2 of the License. * * RoadMap is distributed in the hope that it will be useful, *************** *** 113,120 **** static void rdmxchange_square_export_head (FILE *file) { ! fprintf (file, "table square/global 1\n"); ! ! fprintf (file, "table square/data %d\n", ! RoadMapSquareActive->SquareCount); } --- 112,117 ---- static void rdmxchange_square_export_head (FILE *file) { ! fprintf (file, "square/global,1\n"); ! fprintf (file, "square/data,%d\n", RoadMapSquareActive->SquareCount); } *************** *** 125,135 **** RoadMapSquare *square; ! fprintf (file, "table square/global\n" "edges.east," "edges.north," "edges.west," "edges.south," ! "step.longitude," ! "step.latitude," "squares.count\n"); --- 122,134 ---- RoadMapSquare *square; ! fprintf (file, "square/global\n" "edges.east," "edges.north," "edges.west," "edges.south," ! "longitude.step," ! "longitude.count," ! "latitude.step," ! "latitude.count," "squares.count\n"); *************** *** 142,152 **** fprintf (file, "%.0d,%.0d,%.0d,%.0d,%.0d\n\n", RoadMapSquareActive->SquareGlobal->step_longitude, - RoadMapSquareActive->SquareGlobal->step_latitude, RoadMapSquareActive->SquareGlobal->count_longitude, RoadMapSquareActive->SquareGlobal->count_latitude, RoadMapSquareActive->SquareGlobal->count_squares); ! fprintf (file, "table square/data\n" "edges.east," "edges.north," --- 141,151 ---- fprintf (file, "%.0d,%.0d,%.0d,%.0d,%.0d\n\n", RoadMapSquareActive->SquareGlobal->step_longitude, RoadMapSquareActive->SquareGlobal->count_longitude, + RoadMapSquareActive->SquareGlobal->step_latitude, RoadMapSquareActive->SquareGlobal->count_latitude, RoadMapSquareActive->SquareGlobal->count_squares); ! fprintf (file, "square/data\n" "edges.east," "edges.north," *************** *** 181,182 **** --- 180,359 ---- } + + /* The import side. ----------------------------------------------------- */ + + static RoadMapGlobal SquareGlobal; + static RoadMapSquare *Square = NULL; + static int SquareCount = 0; + static int SquareCursor = 0; + + + static void rdmxchange_square_save (void) { + + int i; + + RoadMapGlobal *db_global; + RoadMapSquare *db_square; + + buildmap_db *root; + buildmap_db *table_data; + buildmap_db *table_global; + + /* Create the tables. */ + + root = buildmap_db_add_section (NULL, "square"); + if (root == NULL) buildmap_fatal (0, "Can't add a new section"); + + table_global = buildmap_db_add_section (root, "global"); + if (table_global == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (table_global, 1, sizeof(RoadMapGlobal)); + + table_data = buildmap_db_add_section (root, "data"); + if (table_data == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (table_data, SquareCount, sizeof(RoadMapSquare)); + + db_global = (RoadMapGlobal *) buildmap_db_get_data (table_global); + db_square = (RoadMapSquare *) buildmap_db_get_data (table_data); + + /* Fill the data in. */ + + for (i = 0; i < SquareCount; ++i) { + db_square[i] = Square[i]; + } + *db_global = SquareGlobal; + + /* Do not save this data ever again. */ + free (Square); + Square = NULL; + SquareCount = 0; + } + + + static buildmap_db_module RdmXchangeSquareModule = { + "square", + NULL, + rdmxchange_square_save, + NULL, + NULL + }; + + + static void rdmxchange_square_import_table (const char *name, int count) { + + buildmap_db_register (&RdmXchangeSquareModule); + + if (strcmp (name, "square/global") == 0) { + + if (count != 1) { + buildmap_fatal (1, "invalid record count for table square/global"); + } + + } else if (strcmp (name, "square/data") == 0) { + + if (Square!= NULL) free (Square); + + Square = calloc (count, sizeof(RoadMapSquare)); + SquareCount = count; + + } else { + + buildmap_fatal (1, "invalid table name %s", name); + } + } + + + static int rdmxchange_square_import_schema (const char *table, + char *fields[], int count) { + + if (strcmp (table, "square/global") == 0) { + + if (count != 9 || + strcmp(fields[0], "edges.east") != 0 || + strcmp(fields[1], "edges.north") != 0 || + strcmp(fields[2], "edges.west") != 0 || + strcmp(fields[3], "edges.south") != 0 || + strcmp(fields[4], "longitude.step") != 0 || + strcmp(fields[5], "longitude.count") != 0 || + strcmp(fields[6], "latitude.step") != 0 || + strcmp(fields[7], "latitude.count") != 0 || + strcmp(fields[8], "squares.count") != 0) { + buildmap_fatal (1, "invalid schema for table square/global"); + } + SquareCursor = 0; + + return 1; + + } else if (strcmp (table, "square/data") == 0) { + + if (count != 6 || + strcmp(fields[0], "edges.east") != 0 || + strcmp(fields[1], "edges.north") != 0 || + strcmp(fields[2], "edges.west") != 0 || + strcmp(fields[3], "edges.south") != 0 || + strcmp(fields[4], "points.count") != 0 || + strcmp(fields[5], "position") != 0) { + buildmap_fatal (1, "invalid schema for table square/data"); + } + SquareCursor = 0; + + return 2; + } + + buildmap_fatal (1, "invalid table name %s", table); + return 0; + } + + + static void rdmxchange_square_import_data (int table, + char *fields[], int count) { + + switch (table) { + + case 1: + + if (count != 9) { + buildmap_fatal (count, "invalid square/global record"); + } + if (SquareCursor != 0) { + buildmap_fatal + (count, "invalid record count for table square/global"); + } + SquareGlobal.edges.east = rdmxchange_import_int (fields[0]); + SquareGlobal.edges.north = rdmxchange_import_int (fields[1]); + SquareGlobal.edges.west = rdmxchange_import_int (fields[2]); + SquareGlobal.edges.south = rdmxchange_import_int (fields[3]); + SquareGlobal.step_longitude = rdmxchange_import_int (fields[4]); + SquareGlobal.count_longitude = rdmxchange_import_int (fields[5]); + SquareGlobal.step_latitude = rdmxchange_import_int (fields[6]); + SquareGlobal.count_latitude = rdmxchange_import_int (fields[7]); + SquareGlobal.count_squares = rdmxchange_import_int (fields[8]); + break; + + case 2: + + if (count != 6) { + buildmap_fatal (count, "invalid square/data record"); + } + Square[SquareCursor].edges.east = rdmxchange_import_int (fields[0]); + Square[SquareCursor].edges.north = rdmxchange_import_int (fields[1]); + Square[SquareCursor].edges.west = rdmxchange_import_int (fields[2]); + Square[SquareCursor].edges.south = rdmxchange_import_int (fields[3]); + Square[SquareCursor].count_points = rdmxchange_import_int (fields[4]); + Square[SquareCursor].position = rdmxchange_import_int (fields[5]); + break; + + default: + + buildmap_fatal (1, "invalid table"); + } + SquareCursor += 1; + } + + + RdmXchangeImport RdmXchangeSquareImport = { + "square", + rdmxchange_square_import_table, + rdmxchange_square_import_schema, + rdmxchange_square_import_data + }; + |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:20:26
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24564 Modified Files: rdmxchange_shape.c Log Message: Add import code, debugged version Index: rdmxchange_shape.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmxchange_shape.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rdmxchange_shape.c 11 Jan 2006 09:57:17 -0000 1.2 --- rdmxchange_shape.c 4 Feb 2006 09:20:18 -0000 1.3 *************** *** 9,14 **** * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, --- 9,13 ---- * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation, as of version 2 of the License. * * RoadMap is distributed in the hope that it will be useful, *************** *** 153,163 **** static void rdmxchange_shape_export_head (FILE *file) { ! fprintf (file, "table shape/bysquare %d\n", RoadMapShapeActive->ShapeBySquareCount); ! fprintf (file, "table shape/byline %d\n", RoadMapShapeActive->ShapeByLineCount); ! fprintf (file, "table shape/data %d\n", RoadMapShapeActive->ShapeCount); } --- 152,162 ---- static void rdmxchange_shape_export_head (FILE *file) { ! fprintf (file, "shape/bysquare,%d\n", RoadMapShapeActive->ShapeBySquareCount); ! fprintf (file, "shape/byline,%d\n", RoadMapShapeActive->ShapeByLineCount); ! fprintf (file, "shape/data,%d\n", RoadMapShapeActive->ShapeCount); } *************** *** 172,176 **** ! fprintf (file, "table shape/bysquare\n" "first,count\n"); bysquare = RoadMapShapeActive->ShapeBySquare; --- 171,175 ---- ! fprintf (file, "shape/bysquare\n" "first,count\n"); bysquare = RoadMapShapeActive->ShapeBySquare; *************** *** 182,186 **** ! fprintf (file, "table shape/byline\n" "line,first,count\n"); byline = RoadMapShapeActive->ShapeByLine; --- 181,185 ---- ! fprintf (file, "shape/byline\n" "line,first,count\n"); byline = RoadMapShapeActive->ShapeByLine; *************** *** 194,198 **** ! fprintf (file, "table shape/data\n" "longitude,latitude\n"); point = RoadMapShapeActive->Shape; --- 193,197 ---- ! fprintf (file, "shape/data\n" "longitude,latitude\n"); point = RoadMapShapeActive->Shape; *************** *** 216,217 **** --- 215,432 ---- } + + /* The import side. ----------------------------------------------------- */ + + static RoadMapShape *Shape = NULL; + static RoadMapShapeByLine *ShapeByLine = NULL; + static RoadMapShapeBySquare *ShapeBySquare = NULL; + static int ShapeCount = 0; + static int ShapeByLineCount = 0; + static int ShapeBySquareCount = 0; + static int ShapeCursor = 0; + + + static void rdmxchange_shape_save (void) { + + int i; + RoadMapShape *db_shape; + RoadMapShapeByLine *db_byline; + RoadMapShapeBySquare *db_bysquare; + + buildmap_db *root; + buildmap_db *table_square; + buildmap_db *table_line; + buildmap_db *table_data; + + + root = buildmap_db_add_section (NULL, "shape"); + if (root == NULL) buildmap_fatal (0, "Can't add a new section"); + + table_square = buildmap_db_add_section (root, "bysquare"); + if (table_square == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (table_square, + ShapeBySquareCount, sizeof(RoadMapShapeBySquare)); + + table_line = buildmap_db_add_section (root, "byline"); + if (table_line == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (table_line, + ShapeByLineCount, sizeof(RoadMapShapeByLine)); + + table_data = buildmap_db_add_section (root, "data"); + if (table_data == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (table_data, ShapeCount, sizeof(RoadMapShape)); + + db_bysquare = (RoadMapShapeBySquare *) buildmap_db_get_data (table_square); + db_byline = (RoadMapShapeByLine *) buildmap_db_get_data (table_line); + db_shape = (RoadMapShape *) buildmap_db_get_data (table_data); + + + for (i = ShapeBySquareCount-1; i >= 0; --i) { + db_bysquare[i] = ShapeBySquare[i]; + } + + for (i = ShapeByLineCount-1; i >= 0; --i) { + db_byline[i] = ShapeByLine[i]; + } + + for (i = ShapeCount-1; i >= 0; --i) { + db_shape[i] = Shape[i]; + } + + /* Do not save this data ever again. */ + + free (ShapeBySquare); + ShapeBySquare = NULL; + ShapeBySquareCount = 0; + + free (ShapeByLine); + ShapeByLine = NULL; + ShapeByLineCount = 0; + + free (Shape); + Shape = NULL; + ShapeCount = 0; + } + + + static buildmap_db_module RdmXchangeShapeModule = { + "shape", + NULL, + rdmxchange_shape_save, + NULL, + NULL + }; + + + static void rdmxchange_shape_import_table (const char *name, int count) { + + if (strcmp (name, "shape/bysquare") == 0) { + + if (ShapeBySquare != NULL) free (ShapeBySquare); + + ShapeBySquare = calloc (count, sizeof(RoadMapShapeBySquare)); + ShapeBySquareCount = count; + + } else if (strcmp (name, "shape/byline") == 0) { + + if (ShapeByLine != NULL) free (ShapeByLine); + + ShapeByLine = calloc (count, sizeof(RoadMapShapeByLine)); + ShapeByLineCount = count; + + } else if (strcmp (name, "shape/data") == 0) { + + if (Shape != NULL) free (Shape); + + Shape = calloc (count, sizeof(RoadMapShape)); + ShapeCount = count; + + } else { + + buildmap_fatal (1, "invalid table name %s", name); + } + + buildmap_db_register (&RdmXchangeShapeModule); + } + + + static int rdmxchange_shape_import_schema (const char *table, + char *fields[], int count) { + + ShapeCursor = 0; + + if (strcmp (table, "shape/bysquare") == 0) { + + if ((ShapeBySquare == NULL) || + (count != 2) || + (strcmp (fields[0], "first") != 0) || + (strcmp (fields[1], "count") != 0)) { + buildmap_fatal (1, "invalid schema for table %s\n", table); + } + return 1; + + } else if (strcmp (table, "shape/byline") == 0) { + + if ((ShapeByLine == NULL) || + (count != 3) || + (strcmp (fields[0], "line") != 0) || + (strcmp (fields[1], "first") != 0) || + (strcmp (fields[2], "count") != 0)) { + buildmap_fatal (1, "invalid schema for table %s\n", table); + } + return 2; + + } else if (strcmp (table, "shape/data") == 0) { + + if ((Shape == NULL) || + (count != 2) || + (strcmp (fields[0], "longitude") != 0) || + (strcmp (fields[1], "latitude") != 0)) { + buildmap_fatal (1, "invalid schema for table %s\n", table); + } + return 3; + + } + + buildmap_fatal (1, "invalid table name %s", table); + return 0; + } + + + static void rdmxchange_shape_import_data (int table, + char *fields[], int count) { + + RoadMapShapeBySquare *bysquare; + RoadMapShapeByLine *byline; + RoadMapShape *shape; + + + switch (table) { + + case 1: + + if (count != 2) { + buildmap_fatal (count, "invalid shape/bysquare record"); + } + bysquare = &(ShapeBySquare[ShapeCursor]); + + bysquare->first = rdmxchange_import_int (fields[0]); + bysquare->count = rdmxchange_import_int (fields[1]); + + break; + + case 2: + + if (count != 3) { + buildmap_fatal (count, "invalid shape/byline record"); + } + byline = &(ShapeByLine[ShapeCursor]); + + byline->line = rdmxchange_import_int (fields[0]); + byline->first = rdmxchange_import_int (fields[1]); + byline->count = rdmxchange_import_int (fields[2]); + break; + + case 3: + + if (count != 2) { + buildmap_fatal (count, "invalid shape/data record"); + } + shape = &(Shape[ShapeCursor]); + + shape->delta_longitude = (short) rdmxchange_import_int (fields[0]); + shape->delta_latitude = (short) rdmxchange_import_int (fields[1]); + + break; + } + + ShapeCursor += 1; + } + + + RdmXchangeImport RdmXchangeShapeImport = { + "shape", + rdmxchange_shape_import_table, + rdmxchange_shape_import_schema, + rdmxchange_shape_import_data + }; |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:20:06
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24294 Modified Files: rdmxchange_range.c Log Message: Add import code, debugged version Index: rdmxchange_range.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmxchange_range.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rdmxchange_range.c 15 Jan 2006 03:08:21 -0000 1.1 --- rdmxchange_range.c 4 Feb 2006 09:19:56 -0000 1.2 *************** *** 9,14 **** * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, --- 9,13 ---- * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation, as of version 2 of the License. * * RoadMap is distributed in the hope that it will be useful, *************** *** 186,202 **** static void rdmxchange_range_export_head (FILE *file) { ! fprintf (file, "table range/bystreet %d\n", RoadMapRangeActive->ByStreetCount); ! fprintf (file, "table range/bycity %d\n", RoadMapRangeActive->ByCityCount); ! fprintf (file, "table range/place %d\n", RoadMapRangeActive->PlaceCount); ! fprintf (file, "table range/byzip %d\n", RoadMapRangeActive->ByZipCount); ! fprintf (file, "table range/bysquare %d\n", RoadMapRangeActive->BySquareCount); ! fprintf (file, "table range/addr %d\n", RoadMapRangeActive->AddressCount); ! fprintf (file, "table range/noaddr %d\n", RoadMapRangeActive->NoAddressCount); } --- 185,201 ---- static void rdmxchange_range_export_head (FILE *file) { ! fprintf (file, "range/bystreet,%d\n", RoadMapRangeActive->ByStreetCount); ! fprintf (file, "range/bycity,%d\n", RoadMapRangeActive->ByCityCount); ! fprintf (file, "range/place,%d\n", RoadMapRangeActive->PlaceCount); ! fprintf (file, "range/byzip,%d\n", RoadMapRangeActive->ByZipCount); ! fprintf (file, "range/bysquare,%d\n", RoadMapRangeActive->BySquareCount); ! fprintf (file, "range/addr,%d\n", RoadMapRangeActive->AddressCount); ! fprintf (file, "range/noaddr,%d\n", RoadMapRangeActive->NoAddressCount); } *************** *** 216,220 **** ! fprintf (file, "table range/bystreet\n" "first_range," "first_city," --- 215,219 ---- ! fprintf (file, "range/bystreet\n" "first_range," "first_city," *************** *** 233,237 **** ! fprintf (file, "table range/bycity\n" "city," "count\n"); --- 232,236 ---- ! fprintf (file, "range/bycity\n" "city," "count\n"); *************** *** 245,249 **** ! fprintf (file, "table range/place\n" "place," "city\n"); --- 244,248 ---- ! fprintf (file, "range/place\n" "place," "city\n"); *************** *** 257,261 **** ! fprintf (file, "table range/byzip\n" "zip," "count\n"); --- 256,260 ---- ! fprintf (file, "range/byzip\n" "zip," "count\n"); *************** *** 269,294 **** ! fprintf (file, "table range/bysquare\n" ! "excluded[%d]," ! "included[%d]," ! "start," ! "count\n", ROADMAP_RANGE_HOLES, ROADMAP_RANGE_HOLES); ! bysquare = RoadMapRangeActive->BySquare; ! ! for (i = 0; i < RoadMapRangeActive->BySquareCount; ++i, ++bysquare) { ! ! for (j = 0; j < ROADMAP_RANGE_HOLES; ++j) { ! fprintf (file, "%.0d,", bysquare->hole[j].excluded); ! } ! for (j = 0; j < ROADMAP_RANGE_HOLES; ++j) { ! fprintf (file, "%.0d,", bysquare->hole[j].included); ! } ! fprintf (file, "%.0d,%.0d\n", bysquare->noaddr_start, ! bysquare->noaddr_count); ! } ! fprintf (file, "\n"); ! ! ! fprintf (file, "table range/addr\n" "line," "fradd," --- 268,272 ---- ! fprintf (file, "range/addr\n" "line," "fradd," *************** *** 305,309 **** ! fprintf (file, "table range/noaddr\n" "line," "street\n"); --- 283,287 ---- ! fprintf (file, "range/noaddr\n" "line," "street\n"); *************** *** 315,318 **** --- 293,317 ---- } fprintf (file, "\n"); + + + fprintf (file, "range/bysquare\n" + "excluded[%d]," + "included[%d]," + "start," + "count\n", ROADMAP_RANGE_HOLES, ROADMAP_RANGE_HOLES); + bysquare = RoadMapRangeActive->BySquare; + + for (i = 0; i < RoadMapRangeActive->BySquareCount; ++i, ++bysquare) { + + for (j = 0; j < ROADMAP_RANGE_HOLES; ++j) { + fprintf (file, "%.0d,", bysquare->hole[j].excluded); + } + for (j = 0; j < ROADMAP_RANGE_HOLES; ++j) { + fprintf (file, "%.0d,", bysquare->hole[j].included); + } + fprintf (file, "%.0d,%.0d\n", bysquare->noaddr_start, + bysquare->noaddr_count); + } + fprintf (file, "\n"); } *************** *** 329,330 **** --- 328,757 ---- } + + /* The import side. ----------------------------------------------------- */ + + static RoadMapRangeByStreet *RangeByStreet = NULL; + static RoadMapRangeByCity *RangeByCity = NULL; + static RoadMapRangePlace *RangePlace = NULL; + static RoadMapRangeByZip *RangeByZip = NULL; + static RoadMapRange *RangeAddress = NULL; + static RoadMapRangeNoAddress *RangeNoAddress = NULL; + static RoadMapRangeBySquare *RangeBySquare = NULL; + + static int RangeByStreetCount = 0; + static int RangeByCityCount = 0; + static int RangePlaceCount = 0; + static int RangeByZipCount = 0; + static int RangeAddressCount = 0; + static int RangeNoAddressCount = 0; + static int RangeBySquareCount = 0; + + static int RangeCursor = 0; + + + static void rdmxchange_range_save (void) { + + int i; + + RoadMapRangeByZip *db_zip; + RoadMapRange *db_ranges; + RoadMapRangeNoAddress *db_noaddr; + RoadMapRangeByStreet *db_streets; + RoadMapRangeByCity *db_city; + RoadMapRangePlace *db_place; + RoadMapRangeBySquare *db_square; + + buildmap_db *root; + buildmap_db *table_street; + buildmap_db *table_addr; + buildmap_db *table_noaddr; + buildmap_db *table_zip; + buildmap_db *table_city; + buildmap_db *table_place; + buildmap_db *table_square; + + + /* Create all the tables. */ + + root = buildmap_db_add_section (NULL, "range"); + if (root == NULL) buildmap_fatal (0, "Can't add a new section"); + + table_street = buildmap_db_add_section (root, "bystreet"); + if (table_street == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data + (table_street, RangeByStreetCount, sizeof(RoadMapRangeByStreet)); + + table_city = buildmap_db_add_section (root, "bycity"); + if (table_city == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data + (table_city, RangeByCityCount, sizeof(RoadMapRangeByCity)); + + table_place = buildmap_db_add_section (root, "place"); + if (table_place == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data + (table_place, RangePlaceCount, sizeof(RoadMapRangePlace)); + + table_zip = buildmap_db_add_section (root, "byzip"); + if (table_zip == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (table_zip, RangeByZipCount, sizeof(RoadMapRangeByZip)); + + table_addr = buildmap_db_add_section (root, "addr"); + if (table_addr == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (table_addr, RangeAddressCount, sizeof(RoadMapRange)); + + table_noaddr = buildmap_db_add_section (root, "noaddr"); + if (table_noaddr == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (table_noaddr, + RangeNoAddressCount, sizeof(RoadMapRangeNoAddress)); + + table_square = buildmap_db_add_section (root, "bysquare"); + if (table_square == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data + (table_square, RangeBySquareCount, sizeof(RoadMapRangeBySquare)); + + db_streets = (RoadMapRangeByStreet *) buildmap_db_get_data (table_street); + db_city = (RoadMapRangeByCity *) buildmap_db_get_data (table_city); + db_place = (RoadMapRangePlace *) buildmap_db_get_data (table_place); + db_ranges = (RoadMapRange *) buildmap_db_get_data (table_addr); + db_noaddr = (RoadMapRangeNoAddress *) buildmap_db_get_data (table_noaddr); + db_zip = (RoadMapRangeByZip *) buildmap_db_get_data (table_zip); + db_square = (RoadMapRangeBySquare *) buildmap_db_get_data (table_square); + + + /* Write the data to the map. */ + + for (i = 0; i < RangeByStreetCount; ++i, ++db_streets) { + *db_streets = RangeByStreet[i]; + } + + for (i = 0; i < RangeByCityCount; ++i, ++db_city) { + *db_city = RangeByCity[i]; + } + + for (i = 0; i < RangePlaceCount; ++i, ++db_place) { + *db_place = RangePlace[i]; + } + + for (i = 0; i < RangeByZipCount; ++i, ++db_zip) { + *db_zip = RangeByZip[i]; + } + + for (i = 0; i < RangeBySquareCount; ++i, ++db_square) { + *db_square = RangeBySquare[i]; + } + + for (i = 0; i < RangeAddressCount; ++i, ++db_ranges) { + *db_ranges = RangeAddress[i]; + } + + for (i = 0; i < RangeNoAddressCount; ++i, ++db_noaddr) { + *db_noaddr = RangeNoAddress[i]; + } + + /* Do not save this data ever again. */ + + free (RangeByStreet); + RangeByStreet = NULL; + RangeByStreetCount = 0; + + free (RangeByCity); + RangeByCity = NULL; + RangeByCityCount = 0; + + free (RangePlace); + RangePlace = NULL; + RangePlaceCount = 0; + + free (RangeByZip); + RangeByZip = NULL; + RangeByZipCount = 0; + + free (RangeBySquare); + RangeBySquare = NULL; + RangeBySquareCount = 0; + + free (RangeAddress); + RangeAddress = NULL; + RangeAddressCount = 0; + + free (RangeNoAddress); + RangeNoAddress = NULL; + RangeNoAddressCount = 0; + } + + + static buildmap_db_module RdmXchangeRangeModule = { + "range", + NULL, + rdmxchange_range_save, + NULL, + NULL + }; + + + static void rdmxchange_range_import_table (const char *name, int count) { + + if (strcmp (name, "range/bystreet") == 0) { + + if (RangeByStreet != NULL) free (RangeByStreet); + + RangeByStreet = calloc (count, sizeof(RoadMapRangeByStreet)); + RangeByStreetCount = count; + + } else if (strcmp (name, "range/bycity") == 0) { + + if (RangeByCity != NULL) free (RangeByCity); + + RangeByCity = calloc (count, sizeof(RoadMapRangeByCity)); + RangeByCityCount = count; + + } else if (strcmp (name, "range/place") == 0) { + + if (RangePlace != NULL) free (RangePlace); + + RangePlace = calloc (count, sizeof(RoadMapRangePlace)); + RangePlaceCount = count; + + } else if (strcmp (name, "range/byzip") == 0) { + + if (RangeByZip != NULL) free (RangeByZip); + + RangeByZip = calloc (count, sizeof(RoadMapRangeByZip)); + RangeByZipCount = count; + + } else if (strcmp (name, "range/addr") == 0) { + + if (RangeAddress != NULL) free (RangeAddress); + + RangeAddress = calloc (count, sizeof(RoadMapRange)); + RangeAddressCount = count; + + } else if (strcmp (name, "range/noaddr") == 0) { + + if (RangeNoAddress != NULL) free (RangeNoAddress); + + RangeNoAddress = calloc (count, sizeof(RoadMapRangeNoAddress)); + RangeNoAddressCount = count; + + } else if (strcmp (name, "range/bysquare") == 0) { + + if (RangeBySquare != NULL) free (RangeBySquare); + + RangeBySquare = calloc (count, sizeof(RoadMapRangeBySquare)); + RangeBySquareCount = count; + + } else { + + buildmap_fatal (1, "invalid table name %s", name); + } + + buildmap_db_register (&RdmXchangeRangeModule); + } + + + static int rdmxchange_range_import_schema (const char *table, + char *fields[], int count) { + + RangeCursor = 0; + + if (strcmp (table, "range/bystreet") == 0) { + + if ((RangeByStreet == NULL) || + (count != 4) || + (strcmp(fields[0], "first_range") != 0) || + (strcmp(fields[1], "first_city") != 0) || + (strcmp(fields[2], "first_zip") != 0) || + (strcmp(fields[3], "count") != 0)) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 1; + + } else if (strcmp (table, "range/bycity") == 0) { + + if ((RangeByCity == NULL) || + (count != 2) || + (strcmp(fields[0], "city") != 0) || + (strcmp(fields[1], "count") != 0)) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 2; + + } else if (strcmp (table, "range/place") == 0) { + + if ((RangePlace == NULL) || + (count != 2) || + (strcmp(fields[0], "place") != 0) || + (strcmp(fields[1], "city") != 0)) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 3; + + } else if (strcmp (table, "range/byzip") == 0) { + + if ((RangeByZip == NULL) || + (count != 2) || + (strcmp(fields[0], "zip") != 0) || + (strcmp(fields[1], "count") != 0)) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 4; + + } else if (strcmp (table, "range/addr") == 0) { + + if ((RangeAddress == NULL) || + (count != 3) || + (strcmp(fields[0], "line") != 0) || + (strcmp(fields[1], "fradd") != 0) || + (strcmp(fields[2], "toadd") != 0)) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 5; + + } else if (strcmp (table, "range/noaddr") == 0) { + + if ((RangeNoAddress == NULL) || + (count != 2) || + (strcmp(fields[0], "line") != 0) || + (strcmp(fields[1], "street") != 0)) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 6; + + } else if (strcmp (table, "range/bysquare") == 0) { + + char excluded[20]; + char included[20]; + + sprintf (excluded, "excluded[%d]", ROADMAP_RANGE_HOLES); + sprintf (included, "included[%d]", ROADMAP_RANGE_HOLES); + + if ((RangeBySquare == NULL) || + (count != 4) || + (strcmp(fields[0], excluded) != 0) || + (strcmp(fields[1], included) != 0) || + (strcmp(fields[2], "start") != 0) || + (strcmp(fields[3], "count") != 0)) { + buildmap_fatal (1, "invalid schema for table %s", table); + } + return 7; + } + + buildmap_fatal (1, "invalid table name %s", table); + return 0; + } + + static void rdmxchange_range_import_data (int table, + char *fields[], int count) { + + int i; + + RoadMapRangeByStreet *bystreet; + RoadMapRangeByCity *bycity; + RoadMapRangePlace *place; + RoadMapRangeByZip *byzip; + RoadMapRange *address; + RoadMapRangeNoAddress *noaddress; + RoadMapRangeBySquare *bysquare; + + + switch (table) { + + case 1: + + if (count != 4) { + buildmap_fatal (count, "invalid range/bystreet record"); + } + bystreet = &(RangeByStreet[RangeCursor]); + bystreet->first_range = rdmxchange_import_int (fields[0]); + bystreet->first_city = rdmxchange_import_int (fields[1]); + bystreet->first_zip = rdmxchange_import_int (fields[2]); + bystreet->count_range = rdmxchange_import_int (fields[3]); + break; + + case 2: + + if (count != 2) { + buildmap_fatal (count, "invalid range/bycity record"); + } + bycity = &(RangeByCity[RangeCursor]); + bycity->city = rdmxchange_import_int (fields[0]); + bycity->count = rdmxchange_import_int (fields[1]); + break; + + case 3: + + if (count != 2) { + buildmap_fatal (count, "invalid range/place record"); + } + place = &(RangePlace[RangeCursor]); + place->place = rdmxchange_import_int (fields[0]); + place->city = rdmxchange_import_int (fields[1]); + break; + + case 4: + + if (count != 2) { + buildmap_fatal (count, "invalid range/byzip record"); + } + byzip = &(RangeByZip[RangeCursor]); + byzip->zip = rdmxchange_import_int (fields[0]); + byzip->count = rdmxchange_import_int (fields[1]); + break; + + case 5: + + if (count != 3) { + buildmap_fatal (count, "invalid range/addr record"); + } + address = &(RangeAddress[RangeCursor]); + address->line = rdmxchange_import_int (fields[0]); + address->fradd = rdmxchange_import_int (fields[1]); + address->toadd = rdmxchange_import_int (fields[2]); + break; + + case 6: + + if (count != 2) { + buildmap_fatal (count, "invalid range/noaddr record"); + } + noaddress = &(RangeNoAddress[RangeCursor]); + noaddress->line = rdmxchange_import_int (fields[0]); + noaddress->street = rdmxchange_import_int (fields[1]); + break; + + case 7: + + if (count != ((2 * ROADMAP_RANGE_HOLES) + 2)) { + buildmap_fatal (count, "invalid range/bysquare record"); + } + bysquare = &(RangeBySquare[RangeCursor]); + + for (i = 0; i < ROADMAP_RANGE_HOLES; ++i) { + + bysquare->hole[i].excluded = + rdmxchange_import_int (fields[i]); + bysquare->hole[i].included = + rdmxchange_import_int (fields[ROADMAP_RANGE_HOLES+i]); + } + bysquare->noaddr_start = + rdmxchange_import_int (fields[(2 * ROADMAP_RANGE_HOLES)]); + bysquare->noaddr_count = + rdmxchange_import_int (fields[(2 * ROADMAP_RANGE_HOLES) + 1]); + break; + + default: + + buildmap_fatal (1, "bad subtable ID in table range import"); + } + + RangeCursor += 1; + } + + + RdmXchangeImport RdmXchangeRangeImport = { + "range", + rdmxchange_range_import_table, + rdmxchange_range_import_schema, + rdmxchange_range_import_data + }; + |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:19:24
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24184 Modified Files: Makefile Log Message: Add import code, debugged version Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/Makefile,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** Makefile 15 Jan 2006 03:07:05 -0000 1.73 --- Makefile 4 Feb 2006 09:19:14 -0000 1.74 *************** *** 244,248 **** rdmxchange_street.c \ rdmxchange_range.c \ ! rdmxchange_zip.c XCHGOBJS=$(XCHGSRCS:.c=.o) --- 244,250 ---- rdmxchange_street.c \ rdmxchange_range.c \ ! rdmxchange_zip.c \ ! buildmap_messages.c \ ! buildmap_dbwrite.c XCHGOBJS=$(XCHGSRCS:.c=.o) |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:18:52
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23963 Modified Files: dumpmap_main.c Log Message: Implement the table dump (useful when debugging rdmxchange) Index: dumpmap_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/dumpmap_main.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dumpmap_main.c 3 Jan 2006 04:07:48 -0000 1.5 --- dumpmap_main.c 4 Feb 2006 09:18:44 -0000 1.6 *************** *** 255,261 **** --- 255,289 ---- static void *dumpmap_hexadump_map (roadmap_db *root) { + int i; + int size; + const char *data; + + size = roadmap_db_get_size (root); + data = roadmap_db_get_data (root); + + for (i = 0; i <= size - 16; i += 16) { + + int j; + + printf ("%08d ", i); + + for (j = 0; j < 16; ++j) { + printf (" %02x", 0xff & ((int)data[i+j])); + } + printf ("\n"); + } + + if (i < size) { + printf ("%08d ", i); + for (; i < size; ++i) { + printf (" %02x", 0xff & ((int)data[i])); + } + printf ("\n"); + } + return "OK"; } + roadmap_db_handler DumpMapHexaDump = {"hexadump", dumpmap_hexadump_map, NULL, NULL}; |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:18:00
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23642 Modified Files: rdmxchange_polygon.c Log Message: Add import code, debugged version Index: rdmxchange_polygon.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmxchange_polygon.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rdmxchange_polygon.c 11 Jan 2006 09:56:54 -0000 1.2 --- rdmxchange_polygon.c 4 Feb 2006 09:17:50 -0000 1.3 *************** *** 9,14 **** * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, --- 9,13 ---- * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation, as of version 2 of the License. * * RoadMap is distributed in the hope that it will be useful, *************** *** 127,134 **** static void rdmxchange_polygon_export_head (FILE *file) { ! fprintf (file, "table polygon/head %d\n", RoadMapPolygonActive->PolygonCount); ! fprintf (file, "table polygon/points %d\n", RoadMapPolygonActive->PolygonPointCount); } --- 126,133 ---- static void rdmxchange_polygon_export_head (FILE *file) { ! fprintf (file, "polygon/head,%d\n", RoadMapPolygonActive->PolygonCount); ! fprintf (file, "polygon/point,%d\n", RoadMapPolygonActive->PolygonPointCount); } *************** *** 142,146 **** ! fprintf (file, "table polygon/head\n" "points.first," "points.count," --- 141,145 ---- ! fprintf (file, "polygon/head\n" "points.first," "points.count," *************** *** 164,168 **** ! fprintf (file, "table polygon/point\n" "index\n"); point = RoadMapPolygonActive->PolygonPoint; --- 163,167 ---- ! fprintf (file, "polygon/point\n" "index\n"); point = RoadMapPolygonActive->PolygonPoint; *************** *** 184,185 **** --- 183,353 ---- rdmxchange_main_register_export (&RdmXchangePolygonExport); } + + + /* The import side. ----------------------------------------------------- */ + + static RoadMapPolygon *Polygon = NULL; + static RoadMapPolygonPoint *PolygonPoint = NULL; + static int PolygonCount = 0; + static int PolygonPointCount = 0; + static int PolygonCursor = 0; + + + static void rdmxchange_polygon_save (void) { + + int i; + + RoadMapPolygon *db_head; + RoadMapPolygonPoint *db_point; + + buildmap_db *root; + buildmap_db *head_table; + buildmap_db *point_table; + + + root = buildmap_db_add_section (NULL, "polygon"); + if (root == NULL) buildmap_fatal (0, "Can't add a new section"); + + head_table = buildmap_db_add_section (root, "head"); + if (head_table == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (head_table, PolygonCount, sizeof(RoadMapPolygon)); + + point_table = buildmap_db_add_section (root, "point"); + if (point_table == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (point_table, + PolygonPointCount, sizeof(RoadMapPolygonPoint)); + + db_head = (RoadMapPolygon *) buildmap_db_get_data (head_table); + db_point = (RoadMapPolygonPoint *) buildmap_db_get_data (point_table); + + for (i = PolygonCount-1; i >= 0; --i) { + db_head[i] = Polygon[i]; + } + + for (i = PolygonPointCount-1; i >= 0; --i) { + db_point[i] = PolygonPoint[i]; + } + + /* Do not save this data ever again. */ + free (Polygon); + Polygon = NULL; + PolygonCount = 0; + + free (PolygonPoint); + PolygonPoint = NULL; + PolygonPointCount = 0; + } + + + static buildmap_db_module RdmXchangePolygonModule = { + "polygon", + NULL, + rdmxchange_polygon_save, + NULL, + NULL + }; + + + static void rdmxchange_polygon_import_table (const char *name, int count) { + + if (strcmp (name, "polygon/head") == 0) { + + if (Polygon != NULL) free (Polygon); + + Polygon = calloc (count, sizeof(RoadMapPolygon)); + PolygonCount = count; + + } else if (strcmp (name, "polygon/point") == 0) { + + if (PolygonPoint != NULL) free (PolygonPoint); + + PolygonPoint = calloc (count, sizeof(RoadMapPolygonPoint)); + PolygonPointCount = count; + + } else { + + buildmap_fatal (1, "invalid table name %s", name); + } + + buildmap_db_register (&RdmXchangePolygonModule); + } + + + static int rdmxchange_polygon_import_schema (const char *table, + char *fields[], int count) { + + PolygonCursor = 0; + + if (strcmp (table, "polygon/head") == 0) { + + if ((Polygon == NULL) || + (count != 8) || + (strcmp (fields[0], "points.first") != 0) || + (strcmp (fields[1], "points.count") != 0) || + (strcmp (fields[2], "name") != 0) || + (strcmp (fields[3], "layer") != 0) || + (strcmp (fields[4], "edges.east") != 0) || + (strcmp (fields[5], "edges.north") != 0) || + (strcmp (fields[6], "edges.west") != 0) || + (strcmp (fields[7], "edges.south") != 0)) { + buildmap_fatal (1, "invalid schema for table %s\n", table); + } + return 1; + + } else if (strcmp (table, "polygon/point") == 0) { + + if ((PolygonPoint == NULL) || + (count != 1) || (strcmp (fields[0], "index") != 0)) { + buildmap_fatal (1, "invalid schema for table %s\n", table); + } + return 2; + } + + buildmap_fatal (1, "invalid table name %s", table); + return 0; + } + + + static void rdmxchange_polygon_import_data (int table, + char *fields[], int count) { + + RoadMapPolygon *polygon; + + switch (table) { + case 1: + + if (count != 8) { + buildmap_fatal (count, "invalid polygon/head record"); + } + polygon = &(Polygon[PolygonCursor++]); + + polygon->first = rdmxchange_import_int (fields[0]); + polygon->count = rdmxchange_import_int (fields[1]); + polygon->name = (RoadMapString) rdmxchange_import_int (fields[2]); + polygon->cfcc = (char) rdmxchange_import_int (fields[3]); + polygon->east = rdmxchange_import_int (fields[4]); + polygon->north = rdmxchange_import_int (fields[5]); + polygon->west = rdmxchange_import_int (fields[6]); + polygon->south = rdmxchange_import_int (fields[7]); + + break; + + case 2: + + if (count != 1) { + buildmap_fatal (count, "invalid polygon/point record"); + } + PolygonPoint[PolygonCursor++].point = + rdmxchange_import_int (fields[0]); + break; + } + } + + + RdmXchangeImport RdmXchangePolygonImport = { + "polygon", + rdmxchange_polygon_import_table, + rdmxchange_polygon_import_schema, + rdmxchange_polygon_import_data + }; + |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:17:28
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23539 Modified Files: rdmxchange_point.c Log Message: Add import code, debugged version Index: rdmxchange_point.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmxchange_point.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rdmxchange_point.c 11 Jan 2006 09:54:54 -0000 1.2 --- rdmxchange_point.c 4 Feb 2006 09:17:15 -0000 1.3 *************** *** 9,14 **** * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, --- 9,13 ---- * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation, as of version 2 of the License. * * RoadMap is distributed in the hope that it will be useful, *************** *** 121,128 **** static void rdmxchange_point_export_head (FILE *file) { ! fprintf (file, "table point/data %d\n", RoadMapPointActive->PointCount); ! fprintf (file, "table point/bysquare %d\n", RoadMapPointActive->BySquareCount); } --- 120,127 ---- static void rdmxchange_point_export_head (FILE *file) { ! fprintf (file, "point/data,%d\n", RoadMapPointActive->PointCount); ! fprintf (file, "point/bysquare,%d\n", RoadMapPointActive->BySquareCount); } *************** *** 136,140 **** ! fprintf (file, "table point/data\n" "longitude,latitude\n"); point = RoadMapPointActive->Point; --- 135,139 ---- ! fprintf (file, "point/data\n" "longitude,latitude\n"); point = RoadMapPointActive->Point; *************** *** 146,150 **** ! fprintf (file, "table point/bysquare\n" "first,count\n"); bysquare = RoadMapPointActive->BySquare; --- 145,149 ---- ! fprintf (file, "point/bysquare\n" "first,count\n"); bysquare = RoadMapPointActive->BySquare; *************** *** 167,168 **** --- 166,333 ---- } + + /* The import side. ----------------------------------------------------- */ + + static RoadMapPoint *Point = NULL; + static RoadMapPointBySquare *PointBySquare = NULL; + static int PointCount = 0; + static int PointBySquareCount = 0; + static int PointCursor = 0; + + + static void rdmxchange_point_save (void) { + + int i; + RoadMapPoint *db_points; + RoadMapPointBySquare *db_bysquare; + + buildmap_db *root; + buildmap_db *table_data; + buildmap_db *table_bysquare; + + + /* Create the tables. */ + + root = buildmap_db_add_section (NULL, "point"); + if (root == NULL) buildmap_fatal (0, "Can't add a new section"); + + table_data = buildmap_db_add_section (root, "data"); + if (table_data == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data (table_data, PointCount, sizeof(RoadMapPoint)); + + table_bysquare = buildmap_db_add_section (root, "bysquare"); + if (table_bysquare == NULL) buildmap_fatal (0, "Can't add a new section"); + buildmap_db_add_data + (table_bysquare, PointBySquareCount, sizeof(RoadMapPointBySquare)); + + db_points = (RoadMapPoint *) buildmap_db_get_data (table_data); + db_bysquare = (RoadMapPointBySquare *) buildmap_db_get_data (table_bysquare); + + /* Fill the data in. */ + + for (i = 0; i < PointCount; ++i) { + db_points[i] = Point[i]; + } + + for (i = 0; i < PointBySquareCount; ++i) { + db_bysquare[i] = PointBySquare[i]; + } + + /* Do not save this data ever again. */ + free (Point); + Point = NULL; + PointCount = 0; + + free (PointBySquare); + PointBySquare = NULL; + PointBySquareCount = 0; + } + + + static buildmap_db_module RdmXchangePointModule = { + "point", + NULL, + rdmxchange_point_save, + NULL, + NULL + }; + + + static void rdmxchange_point_import_table (const char *name, int count) { + + buildmap_db_register (&RdmXchangePointModule); + + if (strcmp (name, "point/data") == 0) { + + if (Point != NULL) free (Point); + + Point = calloc (count, sizeof(RoadMapPoint)); + PointCount = count; + + } else if (strcmp (name, "point/bysquare") == 0) { + + if (PointBySquare != NULL) free (PointBySquare); + + PointBySquare = calloc (count, sizeof(RoadMapPointBySquare)); + PointBySquareCount = count; + + } else { + + buildmap_fatal (1, "invalid table name %s", name); + } + } + + + static int rdmxchange_point_import_schema (const char *table, + char *fields[], int count) { + + if (strcmp (table, "point/data") == 0) { + + if (Point == NULL || + count != 2 || + strcmp(fields[0], "longitude") != 0 || + strcmp(fields[1], "latitude") != 0) { + buildmap_fatal (1, "invalid schema for table point/data"); + } + PointCursor = 0; + + return 1; + + } else if (strcmp (table, "point/bysquare") == 0) { + + if (PointBySquare == NULL || + count != 2 || + strcmp(fields[0], "first") != 0 || + strcmp(fields[1], "count") != 0) { + buildmap_fatal (1, "invalid schema for table point/bysquare"); + } + PointCursor = 0; + + return 2; + + } + + buildmap_fatal (1, "invalid table name %s", table); + return 0; + } + + static void rdmxchange_point_import_data (int table, + char *fields[], int count) { + + switch (table) { + + case 1: + + if (count != 2) { + buildmap_fatal (count, "invalid point/data record"); + } + Point[PointCursor].longitude = + (unsigned short) rdmxchange_import_int (fields[0]); + Point[PointCursor].latitude = + (unsigned short) rdmxchange_import_int (fields[1]); + break; + + case 2: + + if (count != 2) { + buildmap_fatal (count, "invalid point/bysquare record"); + } + PointBySquare[PointCursor].first = rdmxchange_import_int (fields[0]); + PointBySquare[PointCursor].count = rdmxchange_import_int (fields[1]); + break; + + default: + + buildmap_fatal (1, "invalid table"); + } + + PointCursor += 1; + } + + + RdmXchangeImport RdmXchangePointImport = { + "point", + rdmxchange_point_import_table, + rdmxchange_point_import_schema, + rdmxchange_point_import_data + }; |
From: Pascal F M. <pas...@us...> - 2006-02-04 09:17:06
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23336 Modified Files: rdmxchange_metadata.c Log Message: Add import code, debugged version Index: rdmxchange_metadata.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmxchange_metadata.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rdmxchange_metadata.c 11 Jan 2006 09:54:26 -0000 1.2 --- rdmxchange_metadata.c 4 Feb 2006 09:16:49 -0000 1.3 *************** *** 9,14 **** * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, --- 9,13 ---- * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation, as of version 2 of the License. * * RoadMap is distributed in the hope that it will be useful, *************** *** 140,147 **** if (RoadMapMetadataActive == NULL) return; /* No such table in that file. */ ! fprintf (file, "table metadata/attributes %d\n", RoadMapMetadataActive->AttributesCount); ! fprintf (file, "table metadata/values %d\n", RoadMapMetadataActive->ValuesCount); } --- 139,146 ---- if (RoadMapMetadataActive == NULL) return; /* No such table in that file. */ ! fprintf (file, "metadata/attributes,%d\n", RoadMapMetadataActive->AttributesCount); ! fprintf (file, "metadata/values,%d\n", RoadMapMetadataActive->ValuesCount); } *************** *** 157,161 **** if (RoadMapMetadataActive == NULL) return; /* No such table in that file. */ ! fprintf (file, "table metadata/attributes\n" "category," "name," --- 156,160 ---- if (RoadMapMetadataActive == NULL) return; /* No such table in that file. */ ! fprintf (file, "metadata/attributes\n" "category," "name," *************** *** 173,177 **** ! fprintf (file, "table metadata/values\n" "index\n"); values = RoadMapMetadataActive->Values; --- 172,176 ---- ! fprintf (file, "metadata/values\n" "index\n"); values = RoadMapMetadataActive->Values; *************** *** 194,195 **** --- 193,362 ---- rdmxchange_main_register_export (&RdmXchangeMetadataExport); } + + + /* The import side. ----------------------------------------------------- */ + + static RoadMapAttribute *MetadataAttribute = NULL; + static RoadMapString *MetadataValue = NULL; + static int MetadataAttributeCount = 0; + static int MetadataValueCount = 0; + static int MetadataCursor = 0; + + + static void rdmxchange_metadata_save (void) { + + int i; + + RoadMapAttribute *db_attributes; + RoadMapString *db_values; + + buildmap_db *root; + buildmap_db *table_attributes; + buildmap_db *table_values; + + + /* Create the tables. */ + + root = buildmap_db_add_section (NULL, "metadata"); + table_attributes = buildmap_db_add_section (root, "attributes"); + buildmap_db_add_data + (table_attributes, MetadataAttributeCount, sizeof(RoadMapAttribute)); + + table_values = buildmap_db_add_section (root, "values"); + buildmap_db_add_data + (table_values, MetadataValueCount, sizeof(RoadMapString)); + + db_attributes = (RoadMapAttribute *) buildmap_db_get_data (table_attributes); + db_values = (RoadMapString *) buildmap_db_get_data (table_values); + + /* Fill the data in. */ + + for (i = 0; i < MetadataAttributeCount; ++i) { + db_attributes[i] = MetadataAttribute[i]; + } + + for (i = 0; i < MetadataValueCount; ++i) { + db_values[i] = MetadataValue[i]; + } + + /* Do not save this data ever again. */ + free (MetadataAttribute); + MetadataAttribute = NULL; + MetadataAttributeCount = 0; + + free (MetadataValue); + MetadataValue = NULL; + MetadataValueCount = 0; + } + + + static buildmap_db_module RdmXchangeMetadataModule = { + "metadata", + NULL, + rdmxchange_metadata_save, + NULL, + NULL + }; + + + static void rdmxchange_metadata_import_table (const char *name, int count) { + + buildmap_db_register (&RdmXchangeMetadataModule); + + if (strcmp (name, "metadata/attributes") == 0) { + + if (MetadataAttribute != NULL) free (MetadataAttribute); + + MetadataAttribute = calloc (count, sizeof(RoadMapAttribute)); + MetadataAttributeCount = count; + + } else if (strcmp (name, "metadata/values") == 0) { + + if (MetadataValue != NULL) free (MetadataValue); + + MetadataValue = calloc (count, sizeof(RoadMapString)); + MetadataValueCount = count; + + } else { + + buildmap_fatal (1, "invalid table name %s", name); + } + } + + + static int rdmxchange_metadata_import_schema (const char *table, + char *fields[], int count) { + + MetadataCursor = 0; + + if (strcmp (table, "metadata/attributes") == 0) { + + if (MetadataAttribute == NULL || + count != 4 || + strcmp(fields[0], "category") != 0 || + strcmp(fields[1], "name") != 0 || + strcmp(fields[2], "value.first") != 0 || + strcmp(fields[3], "value.count") != 0) { + buildmap_fatal (1, "invalid schema for table metadata/attributes"); + } + + return 1; + + } else if (strcmp (table, "metadata/values") == 0) { + + if (MetadataAttribute == NULL || + count != 1 || strcmp(fields[0], "index") != 0) { + buildmap_fatal (1, "invalid schema for table metadata/values"); + } + + return 2; + } + + buildmap_fatal (1, "invalid table name %s", table); + return 0; + } + + static void rdmxchange_metadata_import_data (int table, + char *fields[], int count) { + + switch (table) { + + case 1: + + if (count != 4) { + buildmap_fatal (count, "invalid zip record"); + } + MetadataAttribute[MetadataCursor].category = + (RoadMapString) rdmxchange_import_int (fields[0]); + MetadataAttribute[MetadataCursor].name = + (RoadMapString) rdmxchange_import_int (fields[1]); + MetadataAttribute[MetadataCursor].value_first = + (short) rdmxchange_import_int (fields[2]); + MetadataAttribute[MetadataCursor].value_count = + (short) rdmxchange_import_int (fields[3]); + break; + + case 2: + + if (count != 1) { + buildmap_fatal (count, "invalid zip record"); + } + MetadataValue[MetadataCursor] = + (RoadMapString) rdmxchange_import_int (fields[0]); + break; + + default: + + buildmap_fatal (1, "invalid table"); + } + MetadataCursor += 1; + } + + + RdmXchangeImport RdmXchangeMetadataImport = { + "metadata", + rdmxchange_metadata_import_table, + rdmxchange_metadata_import_schema, + rdmxchange_metadata_import_data + }; + |