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: <pg...@us...> - 2015-05-31 23:07:46
|
Revision: 2804 http://sourceforge.net/p/roadmap/code/2804 Author: pgf Date: 2015-05-31 23:07:43 +0000 (Sun, 31 May 2015) Log Message: ----------- places basically working. finally. only tested on one quadtile. Modified Paths: -------------- trunk/roadmap/src/buildmap_place.c trunk/roadmap/src/roadmap_label.c trunk/roadmap/src/roadmap_label.h trunk/roadmap/src/roadmap_layer.c trunk/roadmap/src/roadmap_layer.h trunk/roadmap/src/roadmap_locator.c trunk/roadmap/src/roadmap_place.c trunk/roadmap/src/roadmap_place.h trunk/roadmap/src/roadmap_plugin.c trunk/roadmap/src/roadmap_plugin.h trunk/roadmap/src/roadmap_screen.c Modified: trunk/roadmap/src/buildmap_place.c =================================================================== --- trunk/roadmap/src/buildmap_place.c 2015-05-31 23:07:40 UTC (rev 2803) +++ trunk/roadmap/src/buildmap_place.c 2015-05-31 23:07:43 UTC (rev 2804) @@ -383,11 +383,13 @@ int *db_places; int *db_layer; + RoadMapString *db_name; RoadMapPlaceBySquare *db_square; buildmap_db *root; buildmap_db *data_table; buildmap_db *square_table; + buildmap_db *name_table; buildmap_db *layer_table; @@ -422,6 +424,8 @@ } square_current = square; + + layer_current = 0; /* Restart from first layer. */ } @@ -454,13 +458,19 @@ } buildmap_db_add_data (data_table, PlaceCount, sizeof(int)); + name_table = buildmap_db_add_section (root, "name"); + if (name_table == NULL) { + buildmap_error (0, "Can't add a new section"); + return 1; + } + buildmap_db_add_data (name_table, PlaceCount, sizeof(RoadMapString)); + square_table = buildmap_db_add_section (root, "bysquare"); if (square_table == NULL) { buildmap_error (0, "Can't add a new section"); return 1; } - buildmap_db_add_data (square_table, - square_count, sizeof(RoadMapPlaceBySquare)); + buildmap_db_add_data (square_table, square_count, sizeof(RoadMapPlaceBySquare)); layer_table = buildmap_db_add_section (root, "bylayer"); if (layer_table == NULL) { @@ -470,6 +480,7 @@ buildmap_db_add_data (layer_table, layer_count, sizeof(int)); db_places = (int *) buildmap_db_get_data (data_table); + db_name = (RoadMapString *) buildmap_db_get_data (name_table); db_layer = (int *) buildmap_db_get_data (layer_table); db_square = (RoadMapPlaceBySquare *) buildmap_db_get_data (square_table); @@ -485,8 +496,9 @@ one_place = Place[j/BUILDMAP_BLOCK] + (j % BUILDMAP_BLOCK); db_places[i] = one_place->point; + db_name[i] = one_place->name; + square = one_place->square; - if (square != square_current) { if (square_current >= 0) { Modified: trunk/roadmap/src/roadmap_label.c =================================================================== --- trunk/roadmap/src/roadmap_label.c 2015-05-31 23:07:40 UTC (rev 2803) +++ trunk/roadmap/src/roadmap_label.c 2015-05-31 23:07:43 UTC (rev 2804) @@ -101,6 +101,8 @@ int featuresize_sq; + int is_place; + PluginPlace place; PluginLine line; PluginStreet street; char *text; @@ -251,8 +253,8 @@ if (pen!=0) roadmap_canvas_select_pen (pen); else +#endif roadmap_canvas_select_pen (RoadMapLabelPen); -#endif if (doing_angles) { roadmap_screen_text_angle @@ -301,6 +303,7 @@ int roadmap_label_add (const RoadMapGuiPoint *point, int angle, int featuresize_sq, const PluginLine *line) { #endif + PluginPlace noplace = {ROADMAP_PLUGIN_ID, 0, 0, 0}; roadmap_label *cPtr = 0; @@ -318,7 +321,7 @@ if (RoadMapLabelCacheFull) return -1; if (RoadMapLabelCacheAlloced == MAX_LABELS) { - roadmap_log (ROADMAP_WARNING, "Too many streets to label them all."); + roadmap_log (ROADMAP_WARNING, "Not enough room for labels."); RoadMapLabelCacheFull = 1; return -1; } @@ -333,6 +336,8 @@ cPtr->bbox.minx = 1; cPtr->bbox.maxx = -1; + cPtr->is_place = 0; + cPtr->place = noplace; cPtr->line = *line; cPtr->featuresize_sq = featuresize_sq; cPtr->angle = normalize_angle(angle); @@ -358,6 +363,69 @@ return 0; } +#if defined(ROADMAP_ADVANCED_STYLE) +int roadmap_label_add_place (const RoadMapGuiPoint *point, + const PluginPlace *place, RoadMapPen pen) { +#else +int roadmap_label_add_place (const RoadMapGuiPoint *point, + const PluginPlace *place) { +#endif + PluginLine noline = {ROADMAP_PLUGIN_ID, 0, 0, 0}; + + roadmap_label *cPtr = 0; + + if (!ROADMAP_LIST_EMPTY(&RoadMapLabelSpares)) { + cPtr = (roadmap_label *)roadmap_list_remove + (ROADMAP_LIST_FIRST(&RoadMapLabelSpares)); + if (cPtr->text && *cPtr->text) { + free(cPtr->text); + } + } else { + if (RoadMapLabelCacheFull) return -1; + + if (RoadMapLabelCacheAlloced == MAX_LABELS) { + roadmap_log (ROADMAP_WARNING, "Not enough room for labels."); + RoadMapLabelCacheFull = 1; + return -1; + } + cPtr = malloc (sizeof (*cPtr)); + roadmap_check_allocated (cPtr); + RoadMapLabelCacheAlloced++; + } + + cPtr->notext = 0; + cPtr->text = NULL; + + cPtr->bbox.minx = 1; + cPtr->bbox.maxx = -1; + + cPtr->is_place = 1; + cPtr->place = *place; + cPtr->line = noline; + cPtr->featuresize_sq = 9999; + cPtr->angle = 0; + + cPtr->center_point = *point; +#if defined(ROADMAP_ADVANCED_STYLE) + cPtr->pen = pen; +#endif + + /* The stored point is not screen oriented, rotate is needed */ + roadmap_math_rotate_coordinates (1, &cPtr->center_point); + + + /* the "generation" of a label is refreshed when it is re-added. + * later, labels cache entries can be aged, and discarded. + */ + cPtr->gen = RoadMapLabelGeneration; + + cPtr->zoom = RoadMapLabelCurrentZoom; + + roadmap_list_append(&RoadMapLabelNew, &cPtr->link); + + return 0; +} + int roadmap_label_draw_cache (int angles) { RoadMapListItem *item, *tmp; @@ -389,7 +457,6 @@ (whichlist == OLDLIST ? &RoadMapLabelCache : &RoadMapLabelNew, item, tmp) { - PluginStreetProperties properties; cPtr = (roadmap_label *)item; @@ -407,8 +474,9 @@ ROADMAP_LIST_FOR_EACH (&RoadMapLabelNew, item2, tmp2) { ncPtr = (roadmap_label *)item2; - if (roadmap_plugin_same_line (&cPtr->line, &ncPtr->line)) { - /* Found a new version of this existing line */ + if ((!cPtr->is_place && roadmap_plugin_same_line (&cPtr->line, &ncPtr->line)) || + (cPtr->is_place && roadmap_plugin_same_place (&cPtr->place, &ncPtr->place))) { + /* Found a new version of this existing place or line */ if (cPtr->notext) { cPtr->gen = ncPtr->gen; @@ -466,22 +534,43 @@ if (!cPtr->text) { - roadmap_plugin_activate_db (&cPtr->line); - roadmap_plugin_get_street_properties (&cPtr->line, &properties); + if (cPtr->is_place) { + const char *name; + name = roadmap_plugin_get_placename (&cPtr->place); + if (!name) { + cPtr->text = ""; + } else { + cPtr->text = strdup(name); + } +#if LABEL_USING_LINEID + { + char buf[40]; + sprintf(buf, "x%d", cPtr->place.place_id); + cPtr->otext = cPtr->text; + cPtr->text = strdup(buf); + } +#endif + roadmap_log(ROADMAP_DEBUG, "place text is '%s' (%p)", cPtr->text, cPtr->text); + } else { + PluginStreetProperties properties; + roadmap_plugin_activate_db (&cPtr->line); + roadmap_plugin_get_street_properties (&cPtr->line, &properties); - if (!properties.street || !*properties.street) { - cPtr->text = ""; - } else { + if (!properties.street || !*properties.street) { + cPtr->text = ""; + } else { + cPtr->text = strdup(properties.street); + } #if LABEL_USING_LINEID - char buf[40]; - sprintf(buf, "%d", cPtr->line.line_id); - cPtr->text = strdup(buf); - cPtr->otext = strdup(properties.street); -#else - cPtr->text = strdup(properties.street); + { + char buf[40]; + sprintf(buf, "%d", cPtr->line.line_id); + cPtr->otext = cPtr->text; + cPtr->text = strdup(buf); + } #endif - } - cPtr->street = properties.plugin_street; + cPtr->street = properties.plugin_street; + } } if (!*cPtr->text) { Modified: trunk/roadmap/src/roadmap_label.h =================================================================== --- trunk/roadmap/src/roadmap_label.h 2015-05-31 23:07:40 UTC (rev 2803) +++ trunk/roadmap/src/roadmap_label.h 2015-05-31 23:07:43 UTC (rev 2804) @@ -35,9 +35,13 @@ int roadmap_label_add (const RoadMapGuiPoint *point, int angle, int featuresize, const PluginLine *line, RoadMapPen pen); +int roadmap_label_add_place (const RoadMapGuiPoint *point, + const PluginPlace *place, RoadMapPen pen); #else int roadmap_label_add (const RoadMapGuiPoint *point, int angle, int featuresize, const PluginLine *line); +int roadmap_label_add_place (const RoadMapGuiPoint *point, + const PluginPlace *place); #endif int roadmap_label_activate (void); Modified: trunk/roadmap/src/roadmap_layer.c =================================================================== --- trunk/roadmap/src/roadmap_layer.c 2015-05-31 23:07:40 UTC (rev 2803) +++ trunk/roadmap/src/roadmap_layer.c 2015-05-31 23:07:43 UTC (rev 2804) @@ -332,6 +332,33 @@ return count; } +int roadmap_layer_visible_places (int *layers, int size, unsigned int pen_index) +{ + int i; + int count = 0; + + RoadMapLayer *layerp; + + + if (RoadMapLayerCurrentClass == NULL) return 0; + + for (i = 0; i < RoadMapLayerCurrentClass->places_count; i++) { + + layerp = RoadMapLayerCurrentClass->layers + i; + + if (pen_index >= layerp->pen_count) continue; + if (! layerp->in_use[pen_index]) continue; + + if (roadmap_layer_is_visible (layerp)) { + if (count >= size) goto done; + layers[count++] = i + 1; + } + } + +done: + return count; +} + /** * @brief */ @@ -349,9 +376,7 @@ layerp = RoadMapLayerCurrentClass->layers + i; - roadmap_log(ROADMAP_DEBUG, "r_l_a: checking layer %s", layerp->name); if (roadmap_layer_is_visible(layerp)) { - roadmap_log(ROADMAP_DEBUG, "r_l_a: layer %s is visible", layerp->name); thickness = roadmap_math_thickness @@ -504,7 +529,7 @@ if (total > max) { - roadmap_log (ROADMAP_FATAL, "unsufficient space"); + roadmap_log (ROADMAP_FATAL, "insufficient space"); } for (i = total - 1; i >= 0; --i) { @@ -746,7 +771,6 @@ const char *class_config = roadmap_config_new (class_file, 0); const char *class_name; - roadmap_log (ROADMAP_DEBUG, "roadmap_layer_load_file(%s)", class_file); if (class_config == NULL) { roadmap_log (ROADMAP_FATAL, "cannot access class file %s", class_file); } @@ -910,7 +934,8 @@ /* Create all necessary pens. */ - if (i >= lines_count + places_count) { /* This is a polygon. */ + if (i < places_count || i >= lines_count + places_count) { + /* this is a place or a polygon */ layer->in_use[0] = 1; } @@ -955,9 +980,11 @@ } } - if (i >= lines_count + places_count) { /* This is a polygon. */ - layer->in_use[pen_index] = 1; + if (i < places_count || i >= lines_count + places_count) { + /* this is a place or a polygon */ + layer->in_use[0] = 1; } + } } Modified: trunk/roadmap/src/roadmap_layer.h =================================================================== --- trunk/roadmap/src/roadmap_layer.h 2015-05-31 23:07:40 UTC (rev 2803) +++ trunk/roadmap/src/roadmap_layer.h 2015-05-31 23:07:43 UTC (rev 2804) @@ -88,6 +88,7 @@ int roadmap_layer_navigable (int mode, int *layers, int size); int roadmap_layer_visible_lines (int *layers, int size, unsigned int pen_index); +int roadmap_layer_visible_places (int *layers, int size, unsigned int pen_index); int roadmap_layer_line_is_visible (int layer); Modified: trunk/roadmap/src/roadmap_locator.c =================================================================== --- trunk/roadmap/src/roadmap_locator.c 2015-05-31 23:07:40 UTC (rev 2803) +++ trunk/roadmap/src/roadmap_locator.c 2015-05-31 23:07:43 UTC (rev 2804) @@ -45,6 +45,7 @@ #include "roadmap_square.h" #include "roadmap_shape.h" #include "roadmap_line.h" +#include "roadmap_place.h" #include "roadmap_street.h" #include "roadmap_polygon.h" #include "roadmap_osm.h" @@ -121,6 +122,9 @@ (RoadMapCountyModel, "line", &RoadMapLineHandler); RoadMapCountyModel = roadmap_db_register + (RoadMapCountyModel, "place", &RoadMapPlaceHandler); + RoadMapCountyModel = + roadmap_db_register (RoadMapCountyModel, "point", &RoadMapPointHandler); RoadMapCountyModel = roadmap_db_register Modified: trunk/roadmap/src/roadmap_place.c =================================================================== --- trunk/roadmap/src/roadmap_place.c 2015-05-31 23:07:40 UTC (rev 2803) +++ trunk/roadmap/src/roadmap_place.c 2015-05-31 23:07:43 UTC (rev 2804) @@ -47,6 +47,7 @@ #include "roadmap_place.h" #include "roadmap_square.h" +#include "roadmap_dictionary.h" static char *RoadMapPlaceType = "RoadMapPlaceContext"; @@ -58,6 +59,7 @@ char *type; int *Place; + RoadMapString *NameByPlace; int PlaceCount; int *PlaceByLayer; @@ -66,6 +68,8 @@ RoadMapPlaceBySquare *PlaceBySquare; int PlaceBySquareCount; + RoadMapDictionary PlaceNames; + } RoadMapPlaceContext; static RoadMapPlaceContext *RoadMapPlaceActive = NULL; @@ -80,6 +84,7 @@ RoadMapPlaceContext *context; roadmap_db *place_table; + roadmap_db *name_table; roadmap_db *layer_table; roadmap_db *square_table; @@ -92,22 +97,32 @@ context->type = RoadMapPlaceType; place_table = roadmap_db_get_subsection (root, "data"); + name_table = roadmap_db_get_subsection (root, "name"); layer_table = roadmap_db_get_subsection (root, "bylayer"); square_table = roadmap_db_get_subsection (root, "bysquare"); context->Place = (int *) roadmap_db_get_data (place_table); context->PlaceCount = roadmap_db_get_count (place_table); - if (roadmap_db_get_size (place_table) != context->PlaceCount * sizeof(int)) { - roadmap_log (ROADMAP_ERROR, "invalid place/data structure (1)"); + roadmap_log (ROADMAP_ERROR, "invalid place/size values"); goto roadmap_place_map_abort; } + context->NameByPlace = (RoadMapString *) roadmap_db_get_data (name_table); + if (context->PlaceCount != roadmap_db_get_count (name_table)) { + roadmap_log (ROADMAP_ERROR, "invalid name/count values"); + goto roadmap_place_map_abort; + } + if (roadmap_db_get_size (name_table) != context->PlaceCount * sizeof(RoadMapString)) { + roadmap_log (ROADMAP_ERROR, "invalid name/size values"); + goto roadmap_place_map_abort; + } + context->PlaceByLayer = (int *) roadmap_db_get_data (layer_table); context->PlaceByLayerCount = roadmap_db_get_count (layer_table); if (roadmap_db_get_size (layer_table) != context->PlaceByLayerCount * sizeof(int)) { - roadmap_log (ROADMAP_ERROR, "invalid place/bylayer structure (2)"); + roadmap_log (ROADMAP_ERROR, "invalid layer/size values"); goto roadmap_place_map_abort; } @@ -117,10 +132,12 @@ if (roadmap_db_get_size (square_table) != context->PlaceBySquareCount * sizeof(RoadMapPlaceBySquare)) { - roadmap_log (ROADMAP_ERROR, "invalid place/bysquare structure"); + roadmap_log (ROADMAP_ERROR, "invalid square/size values"); goto roadmap_place_map_abort; } + context->PlaceNames = NULL; + return context; roadmap_place_map_abort: @@ -140,6 +157,9 @@ if (place_context && place_context->type != RoadMapPlaceType) { roadmap_log (ROADMAP_FATAL, "invalid place context activated"); } + if (place_context->PlaceNames == NULL) { + place_context->PlaceNames = roadmap_dictionary_open ("city"); + } RoadMapPlaceActive = place_context; } @@ -154,6 +174,9 @@ if (place_context->type != RoadMapPlaceType) { roadmap_log (ROADMAP_FATAL, "unmapping invalid place context"); } + if (RoadMapPlaceActive == place_context) { + RoadMapPlaceActive = NULL; + } free (place_context); } @@ -179,16 +202,13 @@ int *index; - if (RoadMapPlaceActive == NULL) return 0; /* No line. */ + if (RoadMapPlaceActive == NULL) return 0; /* No place. */ square = roadmap_square_index(square); if (square < 0) { return 0; /* This square is empty. */ } - if (layer <= 0 || layer > RoadMapPlaceActive->PlaceBySquare[square].count) { - return 0; - } index = RoadMapPlaceActive->PlaceByLayer + RoadMapPlaceActive->PlaceBySquare[square].first; @@ -222,3 +242,13 @@ return RoadMapPlaceActive->PlaceCount; } +const char *roadmap_place_get_name(int place_id) +{ + RoadMapString stringid; + + stringid = RoadMapPlaceActive->NameByPlace[place_id]; + + return roadmap_dictionary_get(RoadMapPlaceActive->PlaceNames, stringid); +} + + Modified: trunk/roadmap/src/roadmap_place.h =================================================================== --- trunk/roadmap/src/roadmap_place.h 2015-05-31 23:07:40 UTC (rev 2803) +++ trunk/roadmap/src/roadmap_place.h 2015-05-31 23:07:43 UTC (rev 2804) @@ -32,6 +32,8 @@ int roadmap_place_count (void); +const char *roadmap_place_get_name(int place_id); + extern roadmap_db_handler RoadMapPlaceHandler; #endif // _ROADMAP_PLACE__H_ Modified: trunk/roadmap/src/roadmap_plugin.c =================================================================== --- trunk/roadmap/src/roadmap_plugin.c 2015-05-31 23:07:40 UTC (rev 2803) +++ trunk/roadmap/src/roadmap_plugin.c 2015-05-31 23:07:43 UTC (rev 2804) @@ -33,6 +33,7 @@ #include "roadmap_locator.h" #include "roadmap_street.h" #include "roadmap_shape.h" +#include "roadmap_place.h" #include "roadmap_file.h" #include "roadmap_library.h" #include "roadmap_gps.h" @@ -168,6 +169,20 @@ } /** + * @brief are the two places the same ? + * @param line1 + * @param line2 + * @return + */ +int roadmap_plugin_same_place (const PluginPlace *place1, + const PluginPlace *place2) { + + return ( (place1->plugin_id == place2->plugin_id) && + (place1->place_id == place2->place_id) && + (place1->fips == place2->fips) ); +} + +/** * @brief * @param street1 * @param street2 @@ -514,6 +529,11 @@ } } +const char *roadmap_plugin_get_placename (const PluginPlace *place) +{ + return roadmap_place_get_name (place->place_id); +} + #if 0 void roadmap_plugin_get_street_properties (const PluginLine *line, PluginStreetProperties *props, Modified: trunk/roadmap/src/roadmap_plugin.h =================================================================== --- trunk/roadmap/src/roadmap_plugin.h 2015-05-31 23:07:40 UTC (rev 2803) +++ trunk/roadmap/src/roadmap_plugin.h 2015-05-31 23:07:43 UTC (rev 2804) @@ -61,7 +61,15 @@ int fips; } PluginLine; +typedef struct { + int plugin_id; + int place_id; + int layer; + int fips; + +} PluginPlace; + typedef struct { int plugin_id; @@ -110,6 +118,9 @@ int roadmap_plugin_same_line (const PluginLine *line1, const PluginLine *line2); +int roadmap_plugin_same_place (const PluginPlace *place1, + const PluginPlace *place2); + int roadmap_plugin_same_street (const PluginStreet *street1, const PluginStreet *street2); @@ -313,4 +324,5 @@ void roadmap_plugin_update_position (const RoadMapPosition *, const PluginLine *, const PluginStreet *, const int); +const char *roadmap_plugin_get_placename (const PluginPlace *place); #endif /* INCLUDED__ROADMAP_PLUGIN__H */ Modified: trunk/roadmap/src/roadmap_screen.c =================================================================== --- trunk/roadmap/src/roadmap_screen.c 2015-05-31 23:07:40 UTC (rev 2803) +++ trunk/roadmap/src/roadmap_screen.c 2015-05-31 23:07:43 UTC (rev 2804) @@ -41,6 +41,7 @@ #include "roadmap_layer.h" #include "roadmap_square.h" #include "roadmap_line.h" +#include "roadmap_place.h" #include "roadmap_shape.h" #include "roadmap_point.h" #include "roadmap_polygon.h" @@ -1044,7 +1045,7 @@ return 1; } -static int roadmap_screen_draw_square +static int roadmap_screen_draw_square_lines (int square, int layer, int fully_visible, int pen_index) { int line; @@ -1056,7 +1057,7 @@ int fips; int drawn = 0; - roadmap_log_push ("roadmap_screen_draw_square"); + roadmap_log_push ("roadmap_screen_draw_square_lines"); layer_pen = roadmap_layer_get_pen (layer, pen_index); if (layer_pen == NULL) return 0; @@ -1271,7 +1272,56 @@ return drawn; } +static int roadmap_screen_draw_square_places + (int square, int layer, int fully_visible, int pen_index) { + int place; + int first_place; + int last_place; + RoadMapPen layer_pen; + int fips; + int drawn = 0; + + roadmap_log_push ("roadmap_screen_draw_square_places"); + + layer_pen = roadmap_layer_get_pen (layer, pen_index); + if (layer_pen == NULL) return 0; + + fips = roadmap_locator_active (); + + /* Draw each place that belongs to this square. */ + if (roadmap_place_in_square (square, layer, &first_place, &last_place) > 0) { + + for (place = first_place; place <= last_place; ++place) { + RoadMapPosition pos; + RoadMapGuiPoint guipoint; + + roadmap_place_point(place, &pos); + roadmap_math_coordinate (&pos, &guipoint); +#if PLACE_MARK + roadmap_sprite_draw ("PurpleCross" , &guipoint, 0); + roadmap_math_rotate_coordinates (1, &guipoint); + roadmap_canvas_set_foreground("black"); +#endif + + if ((pen_index == 0) && /* we do labels only for the first pen */ + !RoadMapScreenDragging && + RoadMapScreenLabels) { + PluginPlace p = {ROADMAP_PLUGIN_ID, place, layer, fips}; +#if defined(ROADMAP_ADVANCED_STYLE) + roadmap_label_add_place (&guipoint, &p, layer_pen); +#else + roadmap_label_add_place (&guipoint, &p); +#endif + drawn += 1; + } + } + } + + roadmap_log_pop (); + return drawn; +} + static void roadmap_screen_draw_sprite_object (const char *name, const char *sprite, @@ -1388,7 +1438,7 @@ static int roadmap_screen_repaint_square (int square, int pen_type, - int layer_count, int *layers) { + int layer_count, int *layers, int lines) { int i; @@ -1433,13 +1483,20 @@ category = layers[i]; - drawn += roadmap_screen_draw_square + if (lines) { + drawn += roadmap_screen_draw_square_lines (square, category, fully_visible, pen_type); + } else { // places + drawn += roadmap_screen_draw_square_places + (square, category, fully_visible, pen_type); + } } - roadmap_screen_flush_lines(); - roadmap_screen_flush_points(); + if (lines) { + roadmap_screen_flush_lines(); + roadmap_screen_flush_points(); + } roadmap_log_pop (); @@ -1474,7 +1531,7 @@ int pen; int count, sqcount; int *drawnlist; - int max_pen = roadmap_layer_max_pen(); + int max_pen; static int nomap; if (!RoadMapScreenDragging && RoadMapScreenFrozen) return; @@ -1483,6 +1540,8 @@ if (RoadMapScreenDragging && (! roadmap_config_match(&RoadMapConfigStylePrettyDrag, "yes"))) { max_pen = 1; + } else { + max_pen = roadmap_layer_max_pen(); } roadmap_math_display_context(1); @@ -1534,6 +1593,7 @@ drawnlist = (int *)calloc(count, sizeof(int)); roadmap_check_allocated(drawnlist); + /* -- debugging squares -- */ if (roadmap_is_visible (ROADMAP_SHOW_GLOBAL_SQUARE)) { /* draw global square outline (with "--square" or "--map-boxes") */ for (i = count-1; i >= 0; --i) { @@ -1545,6 +1605,7 @@ } } + /* -- polygons -- */ for (i = count-1; i >= 0; --i) { /* -- nothing to draw at this zoom? -- */ if (roadmap_locator_get_decluttered(fipslist[i])) @@ -1563,6 +1624,7 @@ } + /* -- lines -- */ for (i = count-1; i >= 0; --i) { /* -- nothing to draw at this zoom? -- */ if (roadmap_locator_get_decluttered(fipslist[i])) @@ -1596,7 +1658,7 @@ for (sq = sqcount - 1; sq >= 0; --sq) { drawnlist[i] += roadmap_screen_repaint_square (in_view[sq], - pen, layer_count, layers); + pen, layer_count, layers, 1); } } @@ -1617,13 +1679,61 @@ } + /* -- places -- */ for (i = count-1; i >= 0; --i) { /* -- nothing to draw at this zoom? -- */ if (roadmap_locator_get_decluttered(fipslist[i])) continue; /* -- Access the county's database. */ + if (roadmap_locator_activate (fipslist[i]) != ROADMAP_US_OK) + continue; + /* -- Look for the squares that are currently visible. */ + sqcount = roadmap_square_view (&in_view); + + for (pen = 0; pen < max_pen; ++pen) { + + if (sqcount > 0) { + static int *layers = NULL; + static int layers_size = 0; + int layer_count; + + roadmap_screen_reset_square_mask(); + + if (layers == NULL) { + layers_size = roadmap_layer_max_defined(); + layers = (int *)calloc (layers_size, sizeof(int)); + roadmap_check_allocated(layers); + } + layer_count = roadmap_layer_visible_places + (layers, layers_size, pen); + if (!layer_count) continue; + + for (sq = sqcount - 1; sq >= 0; --sq) { + drawnlist[i] += roadmap_screen_repaint_square (in_view[sq], + pen, layer_count, layers, 0); + } + + } + } + + if (roadmap_screen_repaint_leave(count, count - i)) { + roadmap_label_new_invalidate(); + goto out; + } + + } + + + /* -- labels -- */ + for (i = count-1; i >= 0; --i) { + /* -- nothing to draw at this zoom? -- */ + if (roadmap_locator_get_decluttered(fipslist[i])) + continue; + + /* -- Access the county's database. */ + if (roadmap_locator_activate (fipslist[i]) != ROADMAP_US_OK) continue; if (drawnlist[i] && !RoadMapScreenDragging) { @@ -2198,8 +2308,8 @@ } -void roadmap_screen_text - (int id, RoadMapGuiPoint *center, int where, int size, const char *text) { +void roadmap_screen_text (int id, RoadMapGuiPoint *center, int where, + int size, const char *text) { if ((RoadMapLineFontSelect & id) != 0) { roadmap_linefont_text ( center, where, size, text); } else { @@ -2207,9 +2317,9 @@ } } -void roadmap_screen_text_angle - (int id, RoadMapGuiPoint *center, +void roadmap_screen_text_angle (int id, RoadMapGuiPoint *center, int theta, int size, const char *text) { + if ((RoadMapLineFontSelect & id) != 0) { roadmap_linefont_text_angle ( center, size, theta, text); } else { @@ -2227,8 +2337,7 @@ * @param descent * @param can_tilt */ -void roadmap_screen_text_extents - (int id, const char *text, int size, +void roadmap_screen_text_extents (int id, const char *text, int size, int *width, int *ascent, int *descent, int *can_tilt) { if ((RoadMapLineFontSelect & id) != 0) { roadmap_linefont_extents This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:42
|
Revision: 2803 http://sourceforge.net/p/roadmap/code/2803 Author: pgf Date: 2015-05-31 23:07:40 +0000 (Sun, 31 May 2015) Log Message: ----------- add placename codes Modified Paths: -------------- trunk/roadmap/src/app_a02.txt Modified: trunk/roadmap/src/app_a02.txt =================================================================== --- trunk/roadmap/src/app_a02.txt 2015-05-31 23:07:37 UTC (rev 2802) +++ trunk/roadmap/src/app_a02.txt 2015-05-31 23:07:40 UTC (rev 2803) @@ -3249,6 +3249,15 @@ 81 078 World Boundaries SB 81 079 World Boundaries SB 82 001 Placenames PN +82 002 Placenames PN +82 003 Placenames PN +82 004 Placenames PN +82 005 Placenames PN +82 006 Placenames PN +82 007 Placenames PN +82 008 Placenames PN +82 009 Placenames PN +82 010 Placenames PN 83 010 DCW Europe and North Asia DW 83 011 DCW Europe and North Asia DW 83 012 DCW Europe and North Asia DW This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:39
|
Revision: 2802 http://sourceforge.net/p/roadmap/code/2802 Author: pgf Date: 2015-05-31 23:07:37 +0000 (Sun, 31 May 2015) Log Message: ----------- agg_support/roadmap_canvas.cpp -- ifdefed pen debugging Modified Paths: -------------- trunk/roadmap/src/agg_support/roadmap_canvas.cpp Modified: trunk/roadmap/src/agg_support/roadmap_canvas.cpp =================================================================== --- trunk/roadmap/src/agg_support/roadmap_canvas.cpp 2015-05-31 23:07:34 UTC (rev 2801) +++ trunk/roadmap/src/agg_support/roadmap_canvas.cpp 2015-05-31 23:07:37 UTC (rev 2802) @@ -25,6 +25,7 @@ * See roadmap_canvas.h. */ +#define PEN_DEBUG 0 #ifdef WIN32_PROFILE @@ -201,7 +202,7 @@ { RoadMapPen old_pen = CurrentPen; dbg_time_start(DBG_TIME_SELECT_PEN); - if (pen) { + if (pen && PEN_DEBUG) { roadmap_log(ROADMAP_DEBUG, "selecting pen %s color %s", pen->name, pen->color_name); } if (!CurrentPen || (pen->thickness != CurrentPen->thickness)) { @@ -785,7 +786,8 @@ } } - roadmap_log(ROADMAP_DEBUG, "loading AGG font from %s", font_file); + if (PEN_DEBUG) + roadmap_log(ROADMAP_DEBUG, "loading AGG font from %s", font_file); if(m_feng.load_font(font_file, 0, gren) && This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:36
|
Revision: 2801 http://sourceforge.net/p/roadmap/code/2801 Author: pgf Date: 2015-05-31 23:07:34 +0000 (Sun, 31 May 2015) Log Message: ----------- roadmap_layer: code is now tolerant of place layers the layers are one long list. it used to be line layers, then polygon layers. now place layers come before either of those. the code needed adjusting, and cleanup. Modified Paths: -------------- trunk/roadmap/src/roadmap_layer.c Modified: trunk/roadmap/src/roadmap_layer.c =================================================================== --- trunk/roadmap/src/roadmap_layer.c 2015-05-31 23:07:31 UTC (rev 2800) +++ trunk/roadmap/src/roadmap_layer.c 2015-05-31 23:07:34 UTC (rev 2801) @@ -25,12 +25,25 @@ * @file * @brief Layer management: declutter, filtering, etc.. * - * This source file has a problem : it should be split into one that provides basic - * layer functionality, and another one that cause roadmap_canvas.c to be pulled in. - * Right now this makes it impossible to call a roadmap_layer function from - * roadmap_line.c (and roadmap_line_get_layer() would like to use roadmap_layer_road_last()). + * This source file has a problem : it should be split into one that + * provides basic layer functionality, and another one that cause + * roadmap_canvas.c to be pulled in. Right now this makes it + * impossible to call a roadmap_layer function from roadmap_line.c + * (and roadmap_line_get_layer() would like to use + * roadmap_layer_road_last()). + * + * NB: layers, as enumerated outside this file, begin counting at '1'. + * Internally, the list starts at 0, of course. All internal loops etc + * use 0-based math -- the conversions are done on entry and exit from + * the worker routines. */ +/* + * Layers appear in the layers list in places, lines, and then polygons ordering. + * buildmap_layer.c uses this ordering when mapping the classfile layer names + * to integers, and we must honor the same ordering. + */ + #include <stdlib.h> #include <string.h> @@ -54,7 +67,7 @@ * Having this limit makes life easier for everyone, and the downside is nil. * Note that this has no impact on the API of roadmap_layer. */ -#define ROADMAP_MAX_LAYERS 1024 +#define ROADMAP_MAX_LAYERS 512 /** * @brief There is a maximum number of navigation modules that can be registered. @@ -105,8 +118,14 @@ const char *before; const char *after; + short places_count; short lines_count; short polygons_count; + + /* "first_line" and "last_line" make it easier to loop through lines */ +#define first_line places_count + short last_line; // really this is one past the last line + struct roadmap_layer_record *layers; int predecessor_count; @@ -270,15 +289,15 @@ if (RoadMapLayerCurrentClass == NULL) return 0; - for (i = 1; i <= RoadMapLayerCurrentClass->lines_count; ++i) { + for (i = RoadMapLayerCurrentClass->first_line; i < RoadMapLayerCurrentClass->last_line; ++i) { - layer = RoadMapLayerCurrentClass->layers + i - 1; + layer = RoadMapLayerCurrentClass->layers + i; if (mode == -1 || layer->navigation_modes & mask) { if (roadmap_layer_is_visible (layer)) { if (count >= size) break; - layers[count++] = i; + layers[count++] = i + 1; } } } @@ -291,21 +310,21 @@ int i; int count = 0; - RoadMapLayer *layer; + RoadMapLayer *layerp; if (RoadMapLayerCurrentClass == NULL) return 0; - for (i = RoadMapLayerCurrentClass->lines_count; i > 0; --i) { + for (i = RoadMapLayerCurrentClass->last_line - 1; i >= RoadMapLayerCurrentClass->first_line; --i) { - layer = RoadMapLayerCurrentClass->layers + i - 1; + layerp = RoadMapLayerCurrentClass->layers + i; - if (pen_index >= layer->pen_count) continue; - if (! layer->in_use[pen_index]) continue; + if (pen_index >= layerp->pen_count) continue; + if (! layerp->in_use[pen_index]) continue; - if (roadmap_layer_is_visible (layer)) { + if (roadmap_layer_is_visible (layerp)) { if (count >= size) goto done; - layers[count++] = i; + layers[count++] = i + 1; } } @@ -322,84 +341,86 @@ int thickness; int future_thickness; unsigned int pen_index; - RoadMapLayer *layer; + RoadMapLayer *layerp; if (RoadMapLayerCurrentClass == NULL) return; - for (i = RoadMapLayerCurrentClass->lines_count - 1; i >= 0; --i) { + for (i = RoadMapLayerCurrentClass->last_line - 1; i >= RoadMapLayerCurrentClass->first_line; --i) { - layer = RoadMapLayerCurrentClass->layers + i; + layerp = RoadMapLayerCurrentClass->layers + i; - if (roadmap_layer_is_visible(layer)) { + roadmap_log(ROADMAP_DEBUG, "r_l_a: checking layer %s", layerp->name); + if (roadmap_layer_is_visible(layerp)) { + roadmap_log(ROADMAP_DEBUG, "r_l_a: layer %s is visible", layerp->name); thickness = roadmap_math_thickness - (roadmap_config_get_integer (&layer->thickness), - roadmap_config_get_integer (&layer->declutter), - layer->pen_count > 1); + (roadmap_config_get_integer (&layerp->thickness), + roadmap_config_get_integer (&layerp->declutter), + layerp->pen_count > 1); - roadmap_plugin_adjust_layer (i, thickness, layer->pen_count); + roadmap_plugin_adjust_layer (i, thickness, layerp->pen_count); /* As a matter of taste, I do dislike roads with a filler * of 1 pixel. Lets force at least a filler of 2. */ future_thickness = thickness; - for (pen_index = 1; pen_index < layer->pen_count; ++pen_index) { + for (pen_index = 1; pen_index < layerp->pen_count; ++pen_index) { - if (layer->delta_thickness[pen_index] > 0) break; + if (layerp->delta_thickness[pen_index] > 0) break; future_thickness = - future_thickness + layer->delta_thickness[pen_index]; + future_thickness + layerp->delta_thickness[pen_index]; if (future_thickness == 1) { thickness += 1; } } if (thickness > 0) { - roadmap_canvas_select_pen (layer->pen[0]); + roadmap_canvas_select_pen (layerp->pen[0]); roadmap_canvas_set_thickness (thickness); } - layer->in_use[0] = 1; + layerp->in_use[0] = 1; - for (pen_index = 1; pen_index < layer->pen_count; ++pen_index) { + for (pen_index = 1; pen_index < layerp->pen_count; ++pen_index) { /* The previous thickness was already the minimum: * the pens that follow should not be used. */ if (thickness <= 1) { - layer->in_use[pen_index] = 0; + layerp->in_use[pen_index] = 0; continue; } - if (layer->delta_thickness[pen_index] < 0) { + if (layerp->delta_thickness[pen_index] < 0) { - thickness += layer->delta_thickness[pen_index]; + thickness += layerp->delta_thickness[pen_index]; } else { /* Don't end with a road mostly drawn with the latter * pen. */ - if (layer->delta_thickness[pen_index] >= thickness / 2) { - layer->in_use[pen_index] = 0; + if (layerp->delta_thickness[pen_index] >= thickness / 2) { + layerp->in_use[pen_index] = 0; thickness = 1; continue; } - thickness = layer->delta_thickness[pen_index]; + thickness = layerp->delta_thickness[pen_index]; } /* If this pen is not visible, there is no reason * to draw it. */ if (thickness < 1) { - layer->in_use[pen_index] = 0; + layerp->in_use[pen_index] = 0; continue; } - roadmap_canvas_select_pen (layer->pen[pen_index]); + roadmap_canvas_select_pen (layerp->pen[pen_index]); roadmap_canvas_set_thickness (thickness); - layer->in_use[pen_index] = 1; + layerp->in_use[pen_index] = 1; } } } @@ -416,26 +437,30 @@ int total; + layer--; + if (RoadMapLayerCurrentClass == NULL) return NULL; total = RoadMapLayerCurrentClass->polygons_count + + RoadMapLayerCurrentClass->places_count + RoadMapLayerCurrentClass->lines_count; - if (layer >= 1 && layer <= total && pen_index < RoadMapMaxUsedPen) { + if (layer >= 0 && layer < total && pen_index < RoadMapMaxUsedPen) { - RoadMapLayer *this_layer = RoadMapLayerCurrentClass->layers + layer - 1; + RoadMapLayer *layerp = RoadMapLayerCurrentClass->layers + layer; - if (!roadmap_layer_is_visible (this_layer)) return NULL; + if (!roadmap_layer_is_visible (layerp)) return NULL; - if (!this_layer->in_use[pen_index]) return NULL; + if (!layerp->in_use[pen_index]) return NULL; - return this_layer->pen[pen_index]; + return layerp->pen[pen_index]; } return NULL; } +#if NEEDED void roadmap_layer_class_first (void) { RoadMapLayerCurrentClass = RoadMapLayerActiveSet->classes; @@ -448,6 +473,7 @@ } } + int roadmap_layer_select_class (const char *name) { RoadMapClass *selected = @@ -472,7 +498,8 @@ int roadmap_layer_names (const char *names[], int max) { short i; - short total = RoadMapLayerCurrentClass->lines_count + short total = RoadMapLayerCurrentClass->places_count + + RoadMapLayerCurrentClass->lines_count + RoadMapLayerCurrentClass->polygons_count; @@ -486,6 +513,7 @@ return total; } +#endif void roadmap_layer_select_set (const char *name) { @@ -709,9 +737,8 @@ int j; unsigned int pen_index; - int lines_count; - int polygons_count; - char *layers[ROADMAP_MAX_LAYERS]; + int places_count, lines_count, polygons_count, total_count; + char *layernames[ROADMAP_MAX_LAYERS]; RoadMapSet *set; RoadMapClass *new_class; @@ -747,33 +774,45 @@ } - /* We allocate the lines (first) and the polygons (then) consecutive - * to each other, so that we can manage them as a single list. + /* We allocate the places (first), lines, and then polygons + * consecutive to each other, so that we can manage them as a + * single list. */ + places_count = + roadmap_layer_decode (class_config, "Class", "Places", + layernames, + ROADMAP_MAX_LAYERS); + lines_count = - roadmap_layer_decode - (class_config, "Class", "Lines", layers, ROADMAP_MAX_LAYERS); - if (lines_count <= 0) return; + roadmap_layer_decode (class_config, "Class", "Lines", + layernames + places_count, + ROADMAP_MAX_LAYERS - places_count); polygons_count = - roadmap_layer_decode - (class_config, "Class", "Polygons", - layers + lines_count, ROADMAP_MAX_LAYERS - lines_count); - if (polygons_count <= 0) return; + roadmap_layer_decode (class_config, "Class", "Polygons", + layernames + lines_count + places_count, + ROADMAP_MAX_LAYERS - (lines_count + places_count)); + total_count = polygons_count + lines_count + places_count; + if (total_count == 0) { + roadmap_log (ROADMAP_FATAL, "No Class entries found in %s", class_file); + } + /* Create the new class. */ new_class = calloc (sizeof(RoadMapClass) + - ((polygons_count + lines_count) * sizeof(RoadMapLayer)), 1); + (total_count * sizeof(RoadMapLayer)), 1); roadmap_check_allocated(new_class); - roadmap_log (ROADMAP_DEBUG, "Class [%s] lines %d polygons %d", - class_name, lines_count, polygons_count); + roadmap_log (ROADMAP_DEBUG, "Class [%s] lines %d polygons %d places %d", + class_name, lines_count, polygons_count, places_count); new_class->name = class_name; + new_class->places_count = places_count; new_class->lines_count = lines_count; + new_class->last_line = lines_count + places_count; // one past the last line layer new_class->polygons_count = polygons_count; new_class->layers = (RoadMapLayer *) (new_class + 1); @@ -791,41 +830,41 @@ set->class_count += 1; - if (RoadMapMaxDefinedLayers < (unsigned int) lines_count + polygons_count) { - RoadMapMaxDefinedLayers = lines_count + polygons_count; + if (RoadMapMaxDefinedLayers < (unsigned int) total_count) { + RoadMapMaxDefinedLayers = total_count; } int n_of_callbacks = (int) sizeof(RoadMapLayerPenSetupTable) / sizeof(RoadMapLayerPenAttribute); - for (i = lines_count + polygons_count - 1; i >= 0; --i) { + for (i = total_count - 1; i >= 0; --i) { const char *svalues[ROADMAP_MAX_LAYER_PENS][n_of_callbacks]; int ivalues[ROADMAP_MAX_LAYER_PENS][n_of_callbacks]; RoadMapLayer *layer = new_class->layers + i; RoadMapConfigDescriptor descriptor = ROADMAP_CONFIG_ITEM_EMPTY; - int other_pen_length = strlen(layers[i]) + 64; + int other_pen_length = strlen(layernames[i]) + 64; static char *other_pen; int thickness = 1; /* suppress warning: will set again before use */ other_pen = realloc(other_pen, other_pen_length); - roadmap_log(ROADMAP_DEBUG, "Layer %d is %s", i, layers[i]); - layer->name = layers[i]; + roadmap_log(ROADMAP_DEBUG, "Layer %d is %s", i, layernames[i]); + layer->name = layernames[i]; layer->class = new_class; layer->navigation_modes = 0; /* Retrieve the layer's thickness & declutter. */ - layer->thickness.category = layers[i]; + layer->thickness.category = layernames[i]; layer->thickness.name = "Thickness"; roadmap_config_declare (class_config, &layer->thickness, "1"); - layer->declutter.category = layers[i]; + layer->declutter.category = layernames[i]; layer->declutter.name = "Declutter"; roadmap_config_declare (class_config, &layer->declutter, "20248000000"); - layer->speed.category = layers[i]; + layer->speed.category = layernames[i]; layer->speed.name = "Speed"; roadmap_config_declare (class_config, &layer->speed, "120"); @@ -837,7 +876,7 @@ snprintf (other_pen, other_pen_length, "Delta%d", pen_index); image = - roadmap_config_get_from (class_config, layers[i], other_pen); + roadmap_config_get_from (class_config, layernames[i], other_pen); if (image == NULL || image[0] == 0) break; layer->delta_thickness[pen_index] = atoi(image); @@ -851,7 +890,7 @@ snprintf (other_pen, other_pen_length, "%s%d", RoadMapLayerPenSetupTable[j].name, pen_index); } - descriptor.category = layers[i]; + descriptor.category = layernames[i]; descriptor.name = other_pen; descriptor.reference = NULL; roadmap_config_declare (class_config, &descriptor, RoadMapLayerPenSetupTable[j].default_value); @@ -871,15 +910,15 @@ /* Create all necessary pens. */ - if (i >= lines_count) { /* This is a polygon. */ + if (i >= lines_count + places_count) { /* This is a polygon. */ layer->in_use[0] = 1; } for (pen_index = 0; pen_index < layer->pen_count; ++pen_index) { if (pen_index == 0) { - sprintf (other_pen, "%s", layers[i]); + sprintf (other_pen, "%s", layernames[i]); } else { - snprintf (other_pen, other_pen_length, "%s%d", layers[i], pen_index); + snprintf (other_pen, other_pen_length, "%s%d", layernames[i], pen_index); } layer->pen[pen_index] = roadmap_canvas_create_pen (other_pen); @@ -916,7 +955,7 @@ } } - if (i >= lines_count) { /* This is a polygon. */ + if (i >= lines_count + places_count) { /* This is a polygon. */ layer->in_use[pen_index] = 1; } } @@ -938,8 +977,7 @@ int mask = 1 << i; char *navigation_layers[ROADMAP_MAX_LAYERS]; - int layers_count = - roadmap_layer_decode (class_config, + int layers_count = roadmap_layer_decode (class_config, "Navigation", RoadMapNavigationMode[i], navigation_layers, ROADMAP_MAX_LAYERS); @@ -948,9 +986,9 @@ for (j = layers_count - 1; j >= 0; --j) { - for (k = lines_count - 1; k >= 0; --k) { + for (k = lines_count - 1; k >= places_count; --k) { - if (strcasecmp(layers[k], navigation_layers[j]) == 0) { + if (strcasecmp(layernames[k], navigation_layers[j]) == 0) { new_class->layers[k].navigation_modes |= mask; break; } @@ -1041,93 +1079,39 @@ /** * @brief returns true if this layer is a street * Based on the list of lines (Class.Lines) in default/All . - * The code relies on the fact that Lines have the lowest numbers, - * this is how they're loaded. * @param layer the layer's integer value * @return true if this is a street / line */ int roadmap_layer_is_street(int layer) { + layer--; + if (RoadMapLayerCurrentClass == NULL) { roadmap_log (ROADMAP_FATAL, "roadmap_layer_is_street : no current class"); return 0; } - return (layer <= RoadMapLayerCurrentClass->lines_count); + return (layer >= RoadMapLayerCurrentClass->first_line && + layer < RoadMapLayerCurrentClass->last_line); } /** - * @brief get the id of the first "road" type (assumption: they're consecutive) - * @return id of the first road type (whatever the first may be, this is actually meaningless) - */ -int roadmap_layer_road_first(void) -{ - return 0; -} - -/** - * @brief get the id of the next road type (whatever "next" may mean) - * @param layer the current road type - * @return the next road type - */ -int roadmap_layer_road_next(int layer) -{ - return layer + 1; -} - -/** - * @brief - * @return - */ -int roadmap_layer_count_roads(void) -{ - if (RoadMapLayerCurrentClass == NULL) { - roadmap_log (ROADMAP_FATAL, "roadmap_layer_count_roads : no current class"); - return 0; - } - return RoadMapLayerCurrentClass->lines_count; -} - -/** - * @brief - */ -int roadmap_layer_road_last(void) -{ - if (RoadMapLayerCurrentClass == NULL) { - roadmap_log (ROADMAP_FATAL, "roadmap_layer_road_last : no current class"); - return 0; - } - return RoadMapLayerCurrentClass->lines_count; -} - -/** - * @brief - * @return - */ -int roadmap_layer_last(void) -{ - if (RoadMapLayerCurrentClass == NULL) { - roadmap_log (ROADMAP_FATAL, "roadmap_layer_last : no current class"); - return 0; - } - return RoadMapLayerCurrentClass->lines_count; -} - -/** * @brief returns the value of the Speed parameter of this layer, from default/All. * @param layer * @return speed, assumed by calling code to be in km/h (FIX ME) */ int roadmap_layer_speed(int layer) { - RoadMapLayer *TheLayer; + RoadMapLayer *layerp; + layer--; + if (RoadMapLayerCurrentClass == NULL) { roadmap_log (ROADMAP_FATAL, "roadmap_layer_road_last : no current class"); return 0; } - TheLayer = RoadMapLayerCurrentClass->layers + layer - 1; - return roadmap_config_get_integer (&TheLayer->speed); + layerp = RoadMapLayerCurrentClass->layers + layer; + return roadmap_config_get_integer (&layerp->speed); } void roadmap_layer_shutdown (void) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:33
|
Revision: 2800 http://sourceforge.net/p/roadmap/code/2800 Author: pgf Date: 2015-05-31 23:07:31 +0000 (Sun, 31 May 2015) Log Message: ----------- roadmap_place: bug fixes Modified Paths: -------------- trunk/roadmap/src/roadmap_place.c Modified: trunk/roadmap/src/roadmap_place.c =================================================================== --- trunk/roadmap/src/roadmap_place.c 2015-05-31 23:07:28 UTC (rev 2799) +++ trunk/roadmap/src/roadmap_place.c 2015-05-31 23:07:31 UTC (rev 2800) @@ -106,7 +106,7 @@ context->PlaceByLayer = (int *) roadmap_db_get_data (layer_table); context->PlaceByLayerCount = roadmap_db_get_count (layer_table); - if (roadmap_db_get_size (layer_table) != context->PlaceCount * sizeof(int)) { + if (roadmap_db_get_size (layer_table) != context->PlaceByLayerCount * sizeof(int)) { roadmap_log (ROADMAP_ERROR, "invalid place/bylayer structure (2)"); goto roadmap_place_map_abort; } @@ -137,7 +137,7 @@ RoadMapPlaceContext *place_context = (RoadMapPlaceContext *) context; - if (place_context->type != RoadMapPlaceType) { + if (place_context && place_context->type != RoadMapPlaceType) { roadmap_log (ROADMAP_FATAL, "invalid place context activated"); } RoadMapPlaceActive = place_context; @@ -179,13 +179,15 @@ int *index; + if (RoadMapPlaceActive == NULL) return 0; /* No line. */ + square = roadmap_square_index(square); if (square < 0) { return 0; /* This square is empty. */ } if (layer <= 0 || layer > RoadMapPlaceActive->PlaceBySquare[square].count) { - roadmap_log (ROADMAP_FATAL, "illegal layer %d", layer); + return 0; } index = RoadMapPlaceActive->PlaceByLayer + RoadMapPlaceActive->PlaceBySquare[square].first; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:30
|
Revision: 2799 http://sourceforge.net/p/roadmap/code/2799 Author: pgf Date: 2015-05-31 23:07:28 +0000 (Sun, 31 May 2015) Log Message: ----------- buildmap_layers: reorder layers list so places come first, to match roadmap code Modified Paths: -------------- trunk/roadmap/src/buildmap_layer.c Modified: trunk/roadmap/src/buildmap_layer.c =================================================================== --- trunk/roadmap/src/buildmap_layer.c 2015-05-31 23:07:25 UTC (rev 2798) +++ trunk/roadmap/src/buildmap_layer.c 2015-05-31 23:07:28 UTC (rev 2799) @@ -58,24 +58,24 @@ int i; + for (i = 0; i < BuildMapPlaceLayerCount; ++i) { + if (strcasecmp(BuildMapPlaceLayerList[i], name) == 0) { + return i + 1; + } + } + for (i = 0; i < BuildMapLineLayerCount; ++i) { if (strcasecmp(BuildMapLineLayerList[i], name) == 0) { - return i+1; + return BuildMapPlaceLayerCount + i + 1; } } for (i = 0; i < BuildMapPolygonLayerCount; ++i) { if (strcasecmp(BuildMapPolygonLayerList[i], name) == 0) { - return BuildMapLineLayerCount + i + 1; + return BuildMapPlaceLayerCount + BuildMapLineLayerCount + i + 1; } } - for (i = 0; i < BuildMapPlaceLayerCount; ++i) { - if (strcasecmp(BuildMapPlaceLayerList[i], name) == 0) { - return BuildMapPolygonLayerCount + i + 1; - } - } - return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:27
|
Revision: 2798 http://sourceforge.net/p/roadmap/code/2798 Author: pgf Date: 2015-05-31 23:07:25 +0000 (Sun, 31 May 2015) Log Message: ----------- agg_support/roadmap_canvas.cpp: add pen debug support Modified Paths: -------------- trunk/roadmap/src/agg_support/roadmap_canvas.cpp Modified: trunk/roadmap/src/agg_support/roadmap_canvas.cpp =================================================================== --- trunk/roadmap/src/agg_support/roadmap_canvas.cpp 2015-05-31 23:07:22 UTC (rev 2797) +++ trunk/roadmap/src/agg_support/roadmap_canvas.cpp 2015-05-31 23:07:25 UTC (rev 2798) @@ -108,6 +108,7 @@ struct roadmap_canvas_pen { struct roadmap_canvas_pen *next; char *name; + char *color_name; agg::rgba8 color; int thickness; }; @@ -200,6 +201,9 @@ { RoadMapPen old_pen = CurrentPen; dbg_time_start(DBG_TIME_SELECT_PEN); + if (pen) { + roadmap_log(ROADMAP_DEBUG, "selecting pen %s color %s", pen->name, pen->color_name); + } if (!CurrentPen || (pen->thickness != CurrentPen->thickness)) { profile.width(pen->thickness); } @@ -228,6 +232,7 @@ roadmap_check_allocated(pen); pen->name = strdup (name); + pen->color_name = 0; pen->color = agg::rgba8(0, 0, 0); pen->thickness = 1; pen->next = RoadMapPenList; @@ -244,7 +249,7 @@ void roadmap_canvas_set_foreground (const char *color) { if (!CurrentPen) return; - + CurrentPen->color_name = strdup (color); CurrentPen->color = roadmap_canvas_agg_parse_color(color); roadmap_canvas_select_pen(CurrentPen); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:24
|
Revision: 2797 http://sourceforge.net/p/roadmap/code/2797 Author: pgf Date: 2015-05-31 23:07:22 +0000 (Sun, 31 May 2015) Log Message: ----------- buildus_county.c: warning suppression Modified Paths: -------------- trunk/roadmap/src/buildus_county.c Modified: trunk/roadmap/src/buildus_county.c =================================================================== --- trunk/roadmap/src/buildus_county.c 2015-05-31 23:07:19 UTC (rev 2796) +++ trunk/roadmap/src/buildus_county.c 2015-05-31 23:07:22 UTC (rev 2797) @@ -509,7 +509,7 @@ /** * @brief */ -static void buildus_county_save (void) { +static int buildus_county_save (void) { int i; int j; @@ -658,6 +658,7 @@ db_state[i].edges = State[state].edges; } } + return 0; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:21
|
Revision: 2796 http://sourceforge.net/p/roadmap/code/2796 Author: pgf Date: 2015-05-31 23:07:19 +0000 (Sun, 31 May 2015) Log Message: ----------- Makefile: don't build roadmap_turns.c Modified Paths: -------------- trunk/roadmap/src/Makefile Modified: trunk/roadmap/src/Makefile =================================================================== --- trunk/roadmap/src/Makefile 2015-05-31 23:07:16 UTC (rev 2795) +++ trunk/roadmap/src/Makefile 2015-05-31 23:07:19 UTC (rev 2796) @@ -48,8 +48,8 @@ roadmap_gpx.c \ roadmap_linefont.c \ roadmap_lang.c \ - roadmap_iso.c \ - roadmap_turns.c + roadmap_iso.c +# roadmap_turns.c RMLIBOBJS = $(RMLIBSRC:.c=.o) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:18
|
Revision: 2795 http://sourceforge.net/p/roadmap/code/2795 Author: pgf Date: 2015-05-31 23:07:16 +0000 (Sun, 31 May 2015) Log Message: ----------- eliminate unneeded vars, to suppress compilation warnings Modified Paths: -------------- trunk/roadmap/src/buildmap_dictionary.c trunk/roadmap/src/buildmap_shapefile.c trunk/roadmap/src/buildus_main.c trunk/roadmap/src/gpx/mkshort.c trunk/roadmap/src/roadgps_screen.c trunk/roadmap/src/roadmap_gps.c trunk/roadmap/src/roadmap_gpsd3.c trunk/roadmap/src/roadmap_navigate.c trunk/roadmap/src/roadmap_screen_obj.c trunk/roadmap/src/roadmap_sunrise.c Modified: trunk/roadmap/src/buildmap_dictionary.c =================================================================== --- trunk/roadmap/src/buildmap_dictionary.c 2015-05-31 23:07:12 UTC (rev 2794) +++ trunk/roadmap/src/buildmap_dictionary.c 2015-05-31 23:07:16 UTC (rev 2795) @@ -626,7 +626,6 @@ int result; struct dictionary_tree *tree; - struct dictionary_tree *start_tree; if (length == 0) { @@ -634,7 +633,6 @@ } result = buildmap_dictionary_search (dictionary, string, length, &tree); - start_tree = tree; if (result < 0) { Modified: trunk/roadmap/src/buildmap_shapefile.c =================================================================== --- trunk/roadmap/src/buildmap_shapefile.c 2015-05-31 23:07:12 UTC (rev 2794) +++ trunk/roadmap/src/buildmap_shapefile.c 2015-05-31 23:07:16 UTC (rev 2795) @@ -408,7 +408,7 @@ int diff_to; int iCARTO, iFRADDL, iTOADDL, iFRADDR, iTOADDR, iZIPL, iZIPR; - int iFEDIRP, iFETYPEP, iFENAME, iFETYPES, iFEDIRS; + int iFEDIRP, iFENAME, iFETYPES, iFEDIRS; int iLEFT_MUN, iRIGHT_MUN, iLEFT_MAF, iRIGHT_MAF, iUID; DBFHandle hDBF; @@ -442,7 +442,7 @@ iZIPL = DBFGetFieldIndex(hDBF, F_FSAL); iZIPR = DBFGetFieldIndex(hDBF, F_FSAR); iFEDIRP = DBFGetFieldIndex(hDBF, F_FEDIRP); - iFETYPEP = DBFGetFieldIndex(hDBF, F_FETYPEP); + // iFETYPEP = DBFGetFieldIndex(hDBF, F_FETYPEP); iFENAME = DBFGetFieldIndex(hDBF, F_FENAME); iFETYPES = DBFGetFieldIndex(hDBF, F_FETYPES); iFEDIRS = DBFGetFieldIndex(hDBF, F_FEDIRS); @@ -907,7 +907,7 @@ int j, lat, lon; char *full_name; - int iEXS, iMED, iACC, iRTT, iUID; + int iEXS, iRTT, iUID; DBFHandle hDBF; SHPHandle hSHP; @@ -950,8 +950,8 @@ ****************************************/ iEXS = DBFGetFieldIndex(hDBF, F_EXS); - iMED = DBFGetFieldIndex(hDBF, F_MED); - iACC = DBFGetFieldIndex(hDBF, F_ACC); + // iMED = DBFGetFieldIndex(hDBF, F_MED); + // iACC = DBFGetFieldIndex(hDBF, F_ACC); iRTT = DBFGetFieldIndex(hDBF, F_RTT); iUID = DBFGetFieldIndex(hDBF, F_ID); @@ -1091,7 +1091,6 @@ int irec; int record_count; - int line; int line_index; int tlid, cfcc; @@ -1153,7 +1152,7 @@ from_point = buildmap_point_add (frlong, frlat); to_point = buildmap_point_add (tolong, tolat); - line = buildmap_line_add (tlid, cfcc, from_point, to_point, + buildmap_line_add (tlid, cfcc, from_point, to_point, ROADMAP_LINE_DIRECTION_BOTH); } @@ -1254,7 +1253,6 @@ int irec; int record_count; - int line; int line_index; int tlid, cfcc; @@ -1316,7 +1314,7 @@ from_point = buildmap_point_add (frlong, frlat); to_point = buildmap_point_add (tolong, tolat); - line = buildmap_line_add (tlid, cfcc, from_point, to_point, + buildmap_line_add (tlid, cfcc, from_point, to_point, ROADMAP_LINE_DIRECTION_BOTH); } Modified: trunk/roadmap/src/buildus_main.c =================================================================== --- trunk/roadmap/src/buildus_main.c 2015-05-31 23:07:12 UTC (rev 2794) +++ trunk/roadmap/src/buildus_main.c 2015-05-31 23:07:16 UTC (rev 2795) @@ -309,13 +309,12 @@ { int i; static BuildMapDictionary state_dictionary; - static BuildMapDictionary county_dictionary; - RoadMapString state_symbol, state_name, dw; + RoadMapString state_symbol, state_name; char symbol[8]; state_dictionary = buildmap_dictionary_open ("state"); - county_dictionary = buildmap_dictionary_open ("county"); - dw = buildmap_dictionary_add(state_dictionary, "DW", 2); + buildmap_dictionary_open ("county"); + buildmap_dictionary_add(state_dictionary, "DW", 2); for (i=0; IsoCountryCodeTable[i].name; i++) { sprintf(symbol, "%s", IsoCountryCodeTable[i].alpha2); state_symbol = buildmap_dictionary_add (state_dictionary, Modified: trunk/roadmap/src/gpx/mkshort.c =================================================================== --- trunk/roadmap/src/gpx/mkshort.c 2015-05-31 23:07:12 UTC (rev 2794) +++ trunk/roadmap/src/gpx/mkshort.c 2015-05-31 23:07:16 UTC (rev 2795) @@ -336,7 +336,10 @@ char *tstring; char *cp; char *np; - int i, l, nlen, replaced; + int i, l, replaced; +#if NEEDED + int nlen; +#endif mkshort_handle *hdl = (mkshort_handle *) h; /* @@ -438,9 +441,11 @@ while ((np != ostring) && *(np-1) && isdigit(*(np-1) )) { np--; } +#if NEEDED if (np) { nlen = strlen(np); } +#endif /* * Now brutally truncate the resulting string, preserve trailing Modified: trunk/roadmap/src/roadgps_screen.c =================================================================== --- trunk/roadmap/src/roadgps_screen.c 2015-05-31 23:07:12 UTC (rev 2794) +++ trunk/roadmap/src/roadgps_screen.c 2015-05-31 23:07:16 UTC (rev 2795) @@ -217,7 +217,6 @@ double scale = 0.0; double azimuth; - int count; int strength; RoadMapGuiPoint centers[1]; int radius[1]; @@ -251,8 +250,6 @@ centers[0].x = satellite->position.x; centers[0].y = satellite->position.y; - count = 4; - if (strength > 0) { radius[0]=radius[0]-1; roadmap_canvas_select_pen (reverse?RoadGpsInactiveFill:RoadGpsActiveFill); @@ -336,7 +333,7 @@ char data[100]; RoadMapGuiPoint point; - int satcount, i, s, fix; + int satcount, i, fix; satcount = 0; @@ -399,7 +396,7 @@ fix = RoadGpsPrecision.dimension; if (fix < 1) fix = 1; else if (fix > 3) fix = 3; - s = sprintf(data,"%d active satellites, %s fix", satcount, fixes[fix-1]); + sprintf(data,"%d active satellites, %s fix", satcount, fixes[fix-1]); roadmap_canvas_draw_string (&point, ROADMAP_CANVAS_LEFT, RoadMapGPSFontSize, data); Modified: trunk/roadmap/src/roadmap_gps.c =================================================================== --- trunk/roadmap/src/roadmap_gps.c 2015-05-31 23:07:12 UTC (rev 2794) +++ trunk/roadmap/src/roadmap_gps.c 2015-05-31 23:07:16 UTC (rev 2795) @@ -399,18 +399,16 @@ */ static void roadmap_gps_gga (void *context, const RoadMapNmeaFields *fields) { - char status; - RoadMapGpsQuality.dilution_horizontal = fields->gga.dilution/100.0; RoadMapGpsActiveSatelliteCount = fields->gga.count; if (fields->gga.quality == ROADMAP_NMEA_QUALITY_INVALID) { - status = roadmap_gps_update_status ('V'); + roadmap_gps_update_status ('V'); } else { - status = roadmap_gps_update_status ('A'); + roadmap_gps_update_status ('A'); RoadMapGpsReceivedTime = fields->gga.fixtime; Modified: trunk/roadmap/src/roadmap_gpsd3.c =================================================================== --- trunk/roadmap/src/roadmap_gpsd3.c 2015-05-31 23:07:12 UTC (rev 2794) +++ trunk/roadmap/src/roadmap_gpsd3.c 2015-05-31 23:07:16 UTC (rev 2795) @@ -192,6 +192,8 @@ used[i] = true; } +#warning 'used' not used. seems fishy. + for (i=0, s=1; i<MAX_POSSIBLE_SATS; i++) { if (gpsdp->used[i]) { (*RoadmapGpsd2SatelliteListener) Modified: trunk/roadmap/src/roadmap_navigate.c =================================================================== --- trunk/roadmap/src/roadmap_navigate.c 2015-05-31 23:07:12 UTC (rev 2794) +++ trunk/roadmap/src/roadmap_navigate.c 2015-05-31 23:07:16 UTC (rev 2795) @@ -648,10 +648,9 @@ */ void roadmap_navigate_initialize (void) { - int RoadMapNavigationClasses; roadmap_log (ROADMAP_WARNING, "roadmap_navigate_initialize"); - RoadMapNavigationClasses = roadmap_layer_declare_navigation_mode ("Classes"); + roadmap_layer_declare_navigation_mode ("Classes"); roadmap_config_declare_enumeration ("session", &RoadMapNavigateFlag, "yes", "no", NULL); } @@ -671,7 +670,7 @@ PluginLine *roadmap_navigate_position2line(RoadMapPosition pos) { RoadMapNeighbour nb[ROADMAP_NEIGHBOURHOOD]; - RoadMapTracking nominated, candidate; + RoadMapTracking candidate; RoadMapArea focus; int found, result, best, i, num; static PluginLine res; @@ -687,7 +686,6 @@ if (result > best) { found = i; best = result; - nominated = candidate; } } if (roadmap_fuzzy_is_acceptable (best)) { Modified: trunk/roadmap/src/roadmap_screen_obj.c =================================================================== --- trunk/roadmap/src/roadmap_screen_obj.c 2015-05-31 23:07:12 UTC (rev 2794) +++ trunk/roadmap/src/roadmap_screen_obj.c 2015-05-31 23:07:16 UTC (rev 2795) @@ -779,7 +779,9 @@ for (cursor = RoadMapObjectList; cursor != NULL; cursor = cursor->next) { int state = 0; int angle = 0; +#if LATER_ICON_SUPPORT int image_mode = IMAGE_NORMAL; +#endif RoadMapGuiPoint pos; if (cursor->state_fn) { @@ -790,13 +792,13 @@ if (state < 0 || state >= MAX_STATES) continue; } + roadmap_screen_obj_pos (cursor, &pos); + +#if LATER_ICON_SUPPORT if (cursor == RoadMapScreenObjSelected) { image_mode = IMAGE_SELECTED; } - roadmap_screen_obj_pos (cursor, &pos); - -#if LATER_ICON_SUPPORT if (cursor->images[state]) { roadmap_canvas_draw_image (cursor->images[state], &pos, Modified: trunk/roadmap/src/roadmap_sunrise.c =================================================================== --- trunk/roadmap/src/roadmap_sunrise.c 2015-05-31 23:07:12 UTC (rev 2794) +++ trunk/roadmap/src/roadmap_sunrise.c 2015-05-31 23:07:16 UTC (rev 2795) @@ -209,7 +209,11 @@ double xhor,yhor,zhor; double E0,E1,xeclip,yeclip,zeclip,Ls; double Moon_RA,Moon_Decl; - double xh,yh,zh,Iterations,E_error,Ebeforeit,Eafterit,E_ErrorBefore; + double xh,yh,zh,Iterations,E_error; + +#if NEEDED + double Ebeforeit, Eafterit, E_ErrorBefore; +#endif double lat = LU_TO_DEG(position->latitude); double lon = LU_TO_DEG(position->longitude); @@ -256,7 +260,9 @@ E=M+ DEGREES*e*sin(RADIANS * M)*(1+e * cos(RADIANS*M)); E=Rev(E); +#if NEEDED Ebeforeit=E; +#endif // now iterate until difference between E0 and E1 is less than 0.005_deg // use E0, calculate E1 @@ -271,14 +277,18 @@ E1= E0-(E0-DEGREES*e*sin(RADIANS*E0)-M) / (1-e * cos(RADIANS*E0)) ; E=Rev(E1); +#if NEEDED Eafterit=E; +#endif if (E<E0) E_error=E0-E; else E_error=E-E0; +#if NEEDED if (E<Ebeforeit) E_ErrorBefore=Ebeforeit-E; else E_ErrorBefore=E-Ebeforeit; +#endif } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:14
|
Revision: 2794 http://sourceforge.net/p/roadmap/code/2794 Author: pgf Date: 2015-05-31 23:07:12 +0000 (Sun, 31 May 2015) Log Message: ----------- fix printf format type warnings Modified Paths: -------------- trunk/roadmap/src/buildmap_turn_restrictions.c Modified: trunk/roadmap/src/buildmap_turn_restrictions.c =================================================================== --- trunk/roadmap/src/buildmap_turn_restrictions.c 2015-05-31 23:07:09 UTC (rev 2793) +++ trunk/roadmap/src/buildmap_turn_restrictions.c 2015-05-31 23:07:12 UTC (rev 2794) @@ -389,8 +389,8 @@ void buildmap_turn_restrictions_summary (void) { fprintf (stderr, - "-- turn restrictions table: %d items, %d add, %d bytes used\n" - " %d lines (range %d), max %lu points per line\n", + "-- turn restrictions table: %d items, %d add, %lu bytes used\n" + " %d lines (range %d), max %d points per line\n", TurnsCount, 0, TurnsCount * sizeof(RoadMapTurns) + (TurnsMaxNode + 1) * sizeof(RoadMapTurnsByNode), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:11
|
Revision: 2793 http://sourceforge.net/p/roadmap/code/2793 Author: pgf Date: 2015-05-31 23:07:09 +0000 (Sun, 31 May 2015) Log Message: ----------- roadmap_polygon.h: use 32 bit ints for polygon counting i inadvertently gave them 64 bits. this breaks maps built previously with the "lots and lots of polygons" fix. Modified Paths: -------------- trunk/roadmap/src/roadmap_db_polygon.h Modified: trunk/roadmap/src/roadmap_db_polygon.h =================================================================== --- trunk/roadmap/src/roadmap_db_polygon.h 2015-05-31 23:07:06 UTC (rev 2792) +++ trunk/roadmap/src/roadmap_db_polygon.h 2015-05-31 23:07:09 UTC (rev 2793) @@ -55,8 +55,8 @@ typedef struct { /* table polygon/head */ - unsigned long first; /* 32 bits */ - unsigned long count; /* 32 bits */ + unsigned int first; /* 32 bits */ + unsigned int count; /* 32 bits */ RoadMapString name; unsigned char cfcc; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:08
|
Revision: 2792 http://sourceforge.net/p/roadmap/code/2792 Author: pgf Date: 2015-05-31 23:07:06 +0000 (Sun, 31 May 2015) Log Message: ----------- buildplace: cleanup some renaming, refactoring, and reformatting. in the end, i'm not sure this will be used. at least for now, i think putting place support directly into buildmap_osm is better. Modified Paths: -------------- trunk/roadmap/src/buildmap_place.h trunk/roadmap/src/buildplace_main.c Modified: trunk/roadmap/src/buildmap_place.h =================================================================== --- trunk/roadmap/src/buildmap_place.h 2015-05-31 23:07:03 UTC (rev 2791) +++ trunk/roadmap/src/buildmap_place.h 2015-05-31 23:07:06 UTC (rev 2792) @@ -24,7 +24,7 @@ #ifndef INCLUDED__BUILDMAP_PLACE__H #define INCLUDED__BUILDMAP_PLACE__H -#define BUILDMAP_MAX_PLACE_CFCC 10 +#define BUILDMAP_MAX_PLACE_LAYER 10 int buildmap_place_add (int name, int cfcc, int point); Modified: trunk/roadmap/src/buildplace_main.c =================================================================== --- trunk/roadmap/src/buildplace_main.c 2015-05-31 23:07:03 UTC (rev 2791) +++ trunk/roadmap/src/buildplace_main.c 2015-05-31 23:07:06 UTC (rev 2792) @@ -50,152 +50,153 @@ #define F_CC "CC" #define F_TYPE "TYPE" -#endif /* ROADMAP_USE_SHAPEFILES */ +#endif /* ROADMAP_USE_SHAPEFILES */ #define BUILDPLACE_FORMAT_SHAPE 1 #define BUILDPLACE_FORMAT_TXT 2 #define BUILDPLACE_MAX_DSG 1024 -static char *BuildPlaceDSGStrings[BUILDPLACE_MAX_DSG] = {NULL}; -static int BuildPlaceDSGcfcc[BUILDPLACE_MAX_DSG]; -static int BuildPlaceDSGCount = 0; +char *progname; +static char *BuildPlaceDSGStrings[BUILDPLACE_MAX_DSG] = { NULL }; -static int BuildPlaceFormatFamily = 0; +static int BuildPlaceDSGlayer[BUILDPLACE_MAX_DSG]; +static int BuildPlaceDSGCount = 0; -static int BuildPlaceVerbose = 0; -static char *BuildPlaceFormat = "SHAPE"; +static char *BuildPlaceFormat = "TXT"; static char *BuildPlaceResult; -static char *BuildPlaceDSGFile = "./designations.txt"; +static char *BuildPlaceDSGFile = "./designations.txt"; struct opt_defs options[] = { - {"format", "f", opt_string, "TXT", - "Input files format (Text or ShapeFile)"}, - {"dsg", "d", opt_string, "./designations.txt", - "The designations.txt file"}, - {"maps", "m", opt_string, "", - "Location for the generated map files"}, - {"verbose", "v", opt_flag, "0", - "Show progress information"}, - OPT_DEFS_END + {"format", "f", opt_string, "TXT", + "Input files format (Text or ShapeFile)"}, + {"dsg", "d", opt_string, "./designations.txt", + "The designations.txt file"}, + {"maps", "m", opt_string, "", + "Location for the generated map files"}, + {"verbose", "v", opt_flag, "0", + "Show more progress information"}, + {"debug", "d", opt_flag, "0", + "Show debug information"}, + OPT_DEFS_END }; #if ROADMAP_USE_SHAPEFILES static RoadMapString -str2dict (BuildMapDictionary d, const char *string) { +str2dict(BuildMapDictionary d, const char *string) +{ if (!strlen(string)) { - return buildmap_dictionary_add (d, "", 0); + return buildmap_dictionary_add(d, "", 0); } - return buildmap_dictionary_add (d, (char *) string, strlen(string)); + return buildmap_dictionary_add(d, (char *) string, strlen(string)); } -#endif /* ROADMAP_USE_SHAPEFILES */ +#endif /* ROADMAP_USE_SHAPEFILES */ -static int buildplace_select_format (void) { +static void +buildplace_save(const char *name) +{ - if (strcmp (BuildPlaceFormat, "TXT") == 0) { + char db_name[128]; - BuildPlaceFormatFamily = BUILDPLACE_FORMAT_TXT; - } else if (strcmp (BuildPlaceFormat, "SHAPE") == 0) { +#ifdef WHY + char *cursor; + snprintf(db_name, 127, "usc%s", name); - BuildPlaceFormatFamily = BUILDPLACE_FORMAT_SHAPE; + /* Remove the suffix if any was provided. */ + cursor = strrchr(db_name, '.'); + if (cursor != NULL) { + *cursor = 0; + } +#endif + snprintf(db_name, 127, "usc%s.rdm", name); - } else { - fprintf (stderr, "%s: unsupported input format, must be TXT or SHAPE\n", - BuildPlaceFormat); - return 0; - } - return 1; -} + if (buildmap_db_open(BuildPlaceResult, db_name) < 0) { + buildmap_fatal(0, "cannot create database %s", db_name); + } + buildmap_db_save(); -static void buildplace_save (const char *name) { - - char *cursor; - char db_name[128]; - - snprintf (db_name, 127, "usc%s", name); - - /* Remove the suffix if any was provided. */ - - cursor = strrchr (db_name, '.'); - if (cursor != NULL) { - *cursor = 0; - } - - if (buildmap_db_open (BuildPlaceResult, db_name) < 0) { - buildmap_fatal (0, "cannot create database %s", db_name); - } - - buildmap_db_save (); - - buildmap_db_close (); + buildmap_db_close(); } -static void buildplace_dsg_reset(void) { +static void +buildplace_dsg_reset(void) +{ int i; hdestroy(); - for (i=0; i<BUILDPLACE_MAX_DSG; i++) { - if (BuildPlaceDSGStrings[i]) free(BuildPlaceDSGStrings[i]); - BuildPlaceDSGStrings[i] = NULL; + for (i = 0; i < BUILDPLACE_MAX_DSG; i++) { + if (BuildPlaceDSGStrings[i]) + free(BuildPlaceDSGStrings[i]); + BuildPlaceDSGStrings[i] = NULL; } BuildPlaceDSGCount = 0; } -static void buildplace_dsg_initialize (void) { +static void +buildplace_dsg_initialize(void) +{ int i; hcreate(BUILDPLACE_MAX_DSG); - for (i=0; i<BUILDPLACE_MAX_DSG; i++) BuildPlaceDSGcfcc[i] = 0; + for (i = 0; i < BUILDPLACE_MAX_DSG; i++) + BuildPlaceDSGlayer[i] = 0; BuildPlaceDSGCount = 0; } #if ROADMAP_USE_SHAPEFILES -static int dsg2cfcc (const char *dsg) { +static int +dsg2layer(const char *dsg) +{ ENTRY e, *ep; e.key = (char *) dsg; ep = hsearch(e, FIND); - return ep ? *(int *)ep->data : 0; + return ep ? *(int *) ep->data : 0; } #endif -static void buildplace_dsg_add (const char *dsg, int cfcc) { +static void +buildplace_dsg_add(const char *dsg, int layer) +{ ENTRY e, *ep; e.key = (char *) dsg; ep = hsearch(e, FIND); if (!ep) { - if (BuildPlaceDSGCount + 1 > BUILDPLACE_MAX_DSG) - buildmap_fatal(0, "maximum designations has been exceeded"); - e.key = BuildPlaceDSGStrings[BuildPlaceDSGCount] = strdup(dsg); - e.data = (void *) &BuildPlaceDSGcfcc[BuildPlaceDSGCount]; - ep = hsearch(e, ENTER); - if (!ep) - buildmap_fatal(0, "failed to add designation to hash"); - BuildPlaceDSGcfcc[BuildPlaceDSGCount++] = cfcc; + if (BuildPlaceDSGCount + 1 > BUILDPLACE_MAX_DSG) + buildmap_fatal(0, "maximum designations has been exceeded"); + e.key = BuildPlaceDSGStrings[BuildPlaceDSGCount] = strdup(dsg); + e.data = (void *) &BuildPlaceDSGlayer[BuildPlaceDSGCount]; + ep = hsearch(e, ENTER); + if (!ep) + buildmap_fatal(0, "failed to add designation to hash"); + BuildPlaceDSGlayer[BuildPlaceDSGCount++] = layer; } } -static void buildplace_dsg_summary (void) { +static void +buildplace_dsg_summary(void) +{ - fprintf (stderr, - "-- DSG hash statistics: %d DSG codes\n", - BuildPlaceDSGCount); + fprintf(stderr, + "-- DSG hash statistics: %d DSG codes\n", BuildPlaceDSGCount); } -static void buildplace_shapefile_process (const char *source, int verbose) { +static void +buildplace_shapefile_process(const char *source) +{ #if ROADMAP_USE_SHAPEFILES @@ -205,7 +206,7 @@ int irec; int record_count; int pname; - int cfcc; + int layer; int point; int lat, lon; @@ -215,53 +216,51 @@ SHPHandle hSHP; SHPObject *shp; - DictionaryName = buildmap_dictionary_open ("placename"); - + DictionaryName = buildmap_dictionary_open("placename"); + buildmap_set_source((char *) source); - + hDBF = DBFOpen(source, "rb"); hSHP = SHPOpen(source, "rb"); - iNAME = DBFGetFieldIndex(hDBF, F_NAME); + iNAME = DBFGetFieldIndex(hDBF, F_NAME); iSTATE = DBFGetFieldIndex(hDBF, F_STATE); - iCC = DBFGetFieldIndex(hDBF, F_CC ); - iTYPE = DBFGetFieldIndex(hDBF, F_TYPE); + iCC = DBFGetFieldIndex(hDBF, F_CC); + iTYPE = DBFGetFieldIndex(hDBF, F_TYPE); record_count = DBFGetRecordCount(hDBF); - for (irec=0; irec<record_count; irec++) { - - strcpy(name, DBFReadStringAttribute(hDBF, irec, iCC)); - strcat(name, "/"); - strcat(name, DBFReadStringAttribute(hDBF, irec, iSTATE)); - strcat(name, "/"); - strcat(name, DBFReadStringAttribute(hDBF, irec, iNAME)); + for (irec = 0; irec < record_count; irec++) { - pname = str2dict (DictionaryName, name); + strcpy(name, DBFReadStringAttribute(hDBF, irec, iCC)); + strcat(name, "/"); + strcat(name, DBFReadStringAttribute(hDBF, irec, iSTATE)); + strcat(name, "/"); + strcat(name, DBFReadStringAttribute(hDBF, irec, iNAME)); - cfcc = dsg2cfcc(DBFReadStringAttribute(hDBF, irec, iTYPE)); - if (cfcc == 0) - continue; + pname = str2dict(DictionaryName, name); - /* add the place */ + layer = dsg2layer(DBFReadStringAttribute(hDBF, irec, iTYPE)); + if (layer == 0) + continue; - shp = SHPReadObject(hSHP, irec); + /* add the place */ - lon = shp->padfX[0] * 1000000.0; - lat = shp->padfY[0] * 1000000.0; + shp = SHPReadObject(hSHP, irec); - SHPDestroyObject(shp); + lon = shp->padfX[0] * 1000000.0; + lat = shp->padfY[0] * 1000000.0; - point = buildmap_point_add (lon, lat); + SHPDestroyObject(shp); - buildmap_place_add (pname, cfcc, point); - - if (verbose) { - if ((irec & 0xff) == 0) { - buildmap_progress (irec, record_count); - } - } - + point = buildmap_point_add(lon, lat); + + buildmap_place_add(pname, layer, point); + + if ((irec & 0xff) == 0) { + buildmap_progress(irec, record_count); + } + } DBFClose(hDBF); @@ -269,16 +268,17 @@ #else - fprintf (stderr, - "cannot process %s: built with no shapefile support.\n", - source); - exit(1); + fprintf(stderr, + "cannot process %s: built with no shapefile support.\n", source); + exit(1); -#endif /* ROADMAP_USE_SHAPEFILES */ +#endif /* ROADMAP_USE_SHAPEFILES */ } -static void buildplace_txt_process (const char *source, int verbose) { +static void +buildplace_txt_process(const char *source) +{ static BuildMapDictionary DictionaryName; @@ -292,15 +292,15 @@ int lineno; int nameindex; int pname; - int cfcc; + int layer; int point; buildmap_set_source((char *) source); - DictionaryName = buildmap_dictionary_open ("placename"); + DictionaryName = buildmap_dictionary_open("placename"); if (strcmp(source, "-") != 0) - buildmap_fatal(0, "TXT format must come from stdin: use '-'"); + buildmap_fatal(0, "TXT format must come from stdin: use '-'"); lineno = 0; while ((gotlen = getline(&bufp, &buflen, stdin)) != -1) { @@ -308,144 +308,164 @@ lineno++; n = sscanf(bufp, "%lf\t%lf\t%s\t%n", &lat, &lon, place, &nameindex); if (n != 3) - buildmap_fatal(0, "bad text line format, line %d: %s", lineno, bufp); + buildmap_fatal(0, "bad text line format, line %d: %s", lineno, + bufp); name = &bufp[nameindex]; - printf("got %f %f %s %s\n", lat, lon, place, name); + buildmap_debug("got %f %f %s %s", lat, lon, place, name); - pname = str2dict (DictionaryName, name); + pname = str2dict(DictionaryName, name); - cfcc = dsg2cfcc(place); - if (cfcc == 0) - continue; + layer = dsg2layer(place); + if (layer == 0) + continue; - ilat = lat * 1000000.0; - ilon = lon * 1000000.0; + ilat = lat * 1000000.0; + ilon = lon * 1000000.0; - point = buildmap_point_add (ilon, ilat); + point = buildmap_point_add(ilon, ilat); - buildmap_place_add (pname, cfcc, point); + buildmap_place_add(pname, layer, point); - if ((lineno & 0xff) == 0) { - buildmap_progress (lineno, 0); + if ((lineno % 100) == 0) { + buildmap_progress(lineno, 0); } } } -static void buildplace_read_dsg (const char *dsgfile) { +static void +buildplace_read_dsg(const char *dsgfile) +{ FILE *file; char buff[2048]; char *p; - int c; - int cfcc; - + int c; + int layer; + buildplace_dsg_initialize(); - - file = fopen (dsgfile, "rb"); + + file = fopen(dsgfile, "rb"); if (file == NULL) { - buildmap_fatal (0, "cannot open file %s", dsgfile); + buildmap_fatal(0, "cannot open file %s", dsgfile); } while (!feof(file)) { - if (fgets(buff, 2048, file)) { - c = strspn(buff, " \t\r\n"); - if (buff[c] == '#' || strlen(buff+c) == 0) continue; - // buff[c] == '\0' - - cfcc = strtol(buff+c, &p, 10); - if (cfcc < 0 || cfcc > BUILDMAP_MAX_PLACE_CFCC) - buildmap_fatal (0, "place cfcc is out of range"); - - while (isspace(*p)) p++; /* skip leading blanks */ - c = strcspn(p, " \t\r\n"); - p[c] = '\0'; - - buildplace_dsg_add(p, cfcc); - } + if (fgets(buff, 2048, file)) { + c = strspn(buff, " \t\r\n"); + if (buff[c] == '#' || strlen(buff + c) == 0) + continue; + // buff[c] == '\0' + + layer = strtol(buff + c, &p, 10); + if (layer < 0 || layer > BUILDMAP_MAX_PLACE_LAYER) + buildmap_fatal(0, "place layer is out of range"); + + while (isspace(*p)) + p++; /* skip leading blanks */ + c = strcspn(p, " \t\r\n"); + p[c] = '\0'; + + buildplace_dsg_add(p, layer); + } } - fclose (file); + fclose(file); } -static void buildplace_process (const char *source, const char *fips, - int verbose) { - switch (BuildPlaceFormatFamily) { +void +usage(char *progpath, const char *msg) +{ - case BUILDPLACE_FORMAT_SHAPE: - buildplace_shapefile_process (source, verbose); - break; + char *prog = strrchr(progpath, '/'); - case BUILDPLACE_FORMAT_TXT: - buildplace_txt_process (source, verbose); - break; - } + if (prog) + prog++; + else + prog = progpath; - buildmap_db_sort(); + if (msg) + fprintf(stderr, "%s: %s\n", prog, msg); + fprintf(stderr, "usage: %s [options] <FIPS code> <source>\n", prog); + opt_desc(options, 1); + exit(1); +} - if (verbose) { +int +main(int argc, char **argv) +{ - roadmap_hash_summary (); - buildmap_db_summary (); - buildplace_dsg_summary (); - } + int verbose = 0, debug = 0; + int error; + char *source, *fips; - buildplace_save (fips); + progname = strrchr(argv[0], '/'); - buildmap_db_reset (); - buildplace_dsg_reset (); - roadmap_hash_reset (); -} + if (progname) + progname++; + else + progname = argv[0]; + // BuildPlaceResult = strdup(roadmap_path_preferred("maps")); /* default. */ -void usage(char *progpath, const char *msg) { + /* parse the options */ + error = opt_parse(options, &argc, argv, 0); + if (error) + usage(progname, opt_strerror(error)); - char *prog = strrchr(progpath, '/'); + /* then, fetch the option values */ + error = opt_val("maps", &BuildPlaceResult) || + opt_val("format", &BuildPlaceFormat) || + opt_val("dsg", &BuildPlaceDSGFile) || + opt_val("verbose", &verbose) || opt_val("debug", &debug); + if (error) + usage(progname, opt_strerror(error)); - if (prog) - prog++; - else - prog = progpath; + if (debug) + buildmap_message_adjust_level(BUILDMAP_MESSAGE_DEBUG); + else if (verbose) + buildmap_message_adjust_level(BUILDMAP_MESSAGE_VERBOSE); - if (msg) - fprintf(stderr, "%s: %s\n", prog, msg); - fprintf(stderr, - "usage: %s [options] <FIPS code> <source>\n", prog); - opt_desc(options, 1); - exit(1); -} + if (argc != 3) + usage(progname, "missing required arguments"); -int main (int argc, char **argv) { + fips = argv[1]; + source = argv[2]; - int error; - BuildPlaceResult = strdup(roadmap_path_preferred("maps")); /* default. */ + buildplace_read_dsg(BuildPlaceDSGFile); - /* parse the options */ - error = opt_parse(options, &argc, argv, 0); - if (error) usage(argv[0], opt_strerror(error)); + if (strcasecmp(BuildPlaceFormat, "TXT") == 0) { - /* then, fetch the option values */ - error = opt_val("verbose", &BuildPlaceVerbose) || - opt_val("format", &BuildPlaceFormat) || - opt_val("dsg", &BuildPlaceDSGFile) || - opt_val("maps", &BuildPlaceResult); - if (error) - usage(argv[0], opt_strerror(error)); + buildplace_txt_process(source); - if (!buildplace_select_format()) - exit(1); + } else if (strcasecmp(BuildPlaceFormat, "SHAPE") == 0) { - if (argc != 3) usage(argv[0], "missing required arguments"); + buildplace_shapefile_process(source); - buildplace_read_dsg (BuildPlaceDSGFile); + } else { + fprintf(stderr, "%s: unsupported input format, must be TXT or SHAPE\n", + BuildPlaceFormat); + exit(1); + } - buildplace_process (argv[2], argv[1], BuildPlaceVerbose); + buildmap_db_sort(); - return 0; + if (verbose) { + roadmap_hash_summary(); + buildmap_db_summary(); + buildplace_dsg_summary(); + } + + buildplace_save(fips); + + buildmap_db_reset(); + buildplace_dsg_reset(); + roadmap_hash_reset(); + + return 0; } - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:05
|
Revision: 2791 http://sourceforge.net/p/roadmap/code/2791 Author: pgf Date: 2015-05-31 23:07:03 +0000 (Sun, 31 May 2015) Log Message: ----------- default/All: initial layers definitions for places Modified Paths: -------------- trunk/roadmap/src/default/All Modified: trunk/roadmap/src/default/All =================================================================== --- trunk/roadmap/src/default/All 2015-05-31 23:07:00 UTC (rev 2790) +++ trunk/roadmap/src/default/All 2015-05-31 23:07:03 UTC (rev 2791) @@ -1,6 +1,7 @@ Class.Name: All Class.Lines: Freeways Ramps Highways Streets Trails Rivers Shore Railroads Boundaries -Class.Polygons: Lakes Sea Parks Hospitals Airports Stations Malls Nature Amenity Suburbs +Class.Polygons: Lakes Sea Parks Hospitals Airports Stations Malls Nature Amenity +Class.Places: City Town Village Hamlet Suburbs Class.NavigationModes: Car Bike Foot Boat Navigation.Car: Freeways Ramps Highways Streets Navigation.Bike: Streets Trails Shore Parks @@ -89,7 +90,15 @@ Amenity.Declutter: 160 Amenity.Thickness: 1 Amenity.Speed: 1 +City.Color: red +City.Declutter 2000 +Town.Color: red +Town.Declutter 1300 +Village.Color: red +Village.Declutter 800 +Hamlet.Color: red +Hamlet.Declutter 160 Suburbs.Color: grey Suburbs.Declutter: 300 -Suburbs.Thickness: 1 -Suburbs.Speed: 50 +Peak.Color: brown +Peak.Declutter: 1000 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:07:02
|
Revision: 2790 http://sourceforge.net/p/roadmap/code/2790 Author: pgf Date: 2015-05-31 23:07:00 +0000 (Sun, 31 May 2015) Log Message: ----------- buildmap_osm_text.c: initial cut at putting OSM places into rdm Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-05-31 23:06:57 UTC (rev 2789) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-05-31 23:07:00 UTC (rev 2790) @@ -55,6 +55,7 @@ #include "buildmap_city.h" #include "buildmap_square.h" #include "buildmap_point.h" +#include "buildmap_place.h" #include "buildmap_line.h" #include "buildmap_street.h" #include "buildmap_range.h" @@ -97,8 +98,11 @@ */ static struct NodeInfo { nodeid_t NodeId; /**< which node */ + int NodeLayer; /**< the layer for this node */ + int NodeFlags; /**< properties of this node, from + the table flags */ char *NodePlace; /**< what kind of place is this */ - char *NodeTownName; /**< which town */ + char *NodeName; /**< which town */ char *NodePostalCode; /**< postal code */ int NodeLon, /**< coordinates */ NodeLat; /**< coordinates */ @@ -181,7 +185,7 @@ buildmap_osm_text_reset_node(void) { if (ni.NodePlace) free(ni.NodePlace); - if (ni.NodeTownName) free(ni.NodeTownName); + if (ni.NodeName) free(ni.NodeName); if (ni.NodePostalCode) free(ni.NodePostalCode); memset(&ni, 0, sizeof(ni)); } @@ -208,7 +212,7 @@ static int nPoints = 0; static struct points { int id; - int npoint; + int point; } *points = 0; #define NPOINTSINC 10000 @@ -226,7 +230,7 @@ } static void -buildmap_osm_text_point_add(int id, int npoint) +buildmap_osm_text_point_add(int id, int point) { if (nPoints == nPointsAlloc) { nPointsAlloc += NPOINTSINC; @@ -243,7 +247,7 @@ roadmap_hash_add(PointsHash, id, nPoints); points[nPoints].id = id; - points[nPoints++].npoint = npoint; + points[nPoints++].point = point; } /** @@ -260,7 +264,7 @@ i >= 0; i = roadmap_hash_get_next(PointsHash, i)) if (points[i].id == id) - return points[i].npoint; + return points[i].point; return -1; } @@ -273,8 +277,9 @@ void buildmap_osm_text_node_finish(void) { - int npoints, s; +#ifdef BEFORE + int point, s; if (ni.NodeFakeFips) { if (ni.NodePlace && (strcmp(ni.NodePlace, "town") == 0 || strcmp(ni.NodePlace, "village") == 0 @@ -282,13 +287,13 @@ || strcmp(ni.NodePlace, "city") == 0)) { /* We have a town, process it */ - if (ni.NodeTownName) { + if (ni.NodeName) { ni.NodeFakeFips++; int year = 2008; RoadMapString s; s = buildmap_dictionary_add (DictionaryCity, - (char *) ni.NodeTownName, strlen(ni.NodeTownName)); + (char *) ni.NodeName, strlen(ni.NodeName)); buildmap_city_add(ni.NodeFakeFips, year, s); } if (ni.NodePostalCode) { @@ -301,11 +306,29 @@ } } } +#else + int point; + RoadMapString s; /* Add the node */ - npoints = buildmap_point_add(ni.NodeLon, ni.NodeLat); - buildmap_osm_text_point_add(ni.NodeId, npoints); + point = buildmap_point_add(ni.NodeLon, ni.NodeLat); + buildmap_osm_text_point_add(ni.NodeId, point); + if (ni.NodeName && ni.NodePlace) { + if (ni.NodeLayer) { + buildmap_verbose("finishing %f %f %s %s", + (float)ni.NodeLat/1000000.0, (float)ni.NodeLon/1000000.0, + ni.NodePlace, ni.NodeName); + + s = buildmap_dictionary_add (DictionaryCity, + (char *) ni.NodeName, strlen(ni.NodeName)); + buildmap_place_add(s, ni.NodeLayer, point); + } else { + buildmap_verbose("dropping %s %s", ni.NodePlace, ni.NodeName); + } + } +#endif + buildmap_osm_text_reset_node(); } @@ -516,23 +539,14 @@ * lat="50.4443626" lon="3.6855288"/> */ void -buildmap_osm_text_node_read_lat_lon(char *data) +buildmap_osm_text_node_read_lat_lon(char *p) { int nchars; -#if 1 double flat, flon; -#endif - char *p; int NodeLatRead, NodeLonRead; char tag[512], value[512]; int s; - s = sscanf(data, "node id=%*[\"']%u%*[\"']%n", &ni.NodeId, &nchars); - if (s != 1) - buildmap_fatal(0, "buildmap_osm_text(%s) node error", data); - - p = data + nchars; - ni.NodeLat = ni.NodeLon = 0; NodeLatRead = NodeLonRead = 0; @@ -558,9 +572,12 @@ p += nchars; } - /* if the node is finished ("\>"), then finish it off */ + /* if the node is finished ("\>"), then finish it off. i.e., + * these are untagged nodes */ for (; *p && isspace(*p); p++) ; if (*p == '/' && *(p+1) == '>') { + /* since this is a tagless node, it can only be interesting + * because it's in the interesting list. */ if (isNodeInteresting(ni.NodeId)) { buildmap_osm_text_node_finish(); } @@ -614,6 +631,7 @@ if (s != 2) buildmap_fatal(0, "fail to scanf tag k and v (%s)", data); +#ifdef BEFORE if (strcmp(tagk, "postal_code") == 0) { /* <tag k="postal_code" v="3020"/> */ if (ni.NodePostalCode) @@ -621,29 +639,34 @@ ni.NodePostalCode = strdup(tagv); if (catalog) { saveInterestingNode(ni.NodeId); - buildmap_verbose("saving node info k %s v %s", tagk, tagv); + // buildmap_verbose("saving node info k %s v %s", tagk, tagv); } - } else if (strcmp(tagk, "place") == 0) { + } else +#endif + if (strcmp(tagk, "place") == 0) { /* <tag k="place" v="town"/> */ if (ni.NodePlace) free(ni.NodePlace); ni.NodePlace = strdup(tagv); if (catalog) { saveInterestingNode(ni.NodeId); - buildmap_verbose("saving node info k %s v %s", tagk, tagv); + // buildmap_verbose("saving node %u info k %s v %s", + // ni.NodeId, tagk, tagv); } + buildmap_osm_get_layer(tagk, tagv, &ni.NodeFlags, &ni.NodeLayer); } else if (strcmp(tagk, "name") == 0) { /* <tag k="name" v="Herent"/> */ - if (ni.NodeTownName) - free(ni.NodeTownName); - ni.NodeTownName = FromXmlAndDup(tagv); + if (ni.NodeName) + free(ni.NodeName); + ni.NodeName = FromXmlAndDup(tagv); if (catalog) { saveInterestingNode(ni.NodeId); - buildmap_verbose("saving node info k %s v %s", tagk, tagv); + // buildmap_verbose("saving node %u info k %s v %s", ni.NodeId, tagk, tagv); } } else { - buildmap_debug("dropping node info k %s v%s", tagk, tagv); + buildmap_debug("dropping node %u info k %s v%s", ni.NodeId, tagk, tagv); } + } /** @@ -682,22 +705,34 @@ free(wi.WayStreetName); wi.WayStreetName = FromXmlAndDup(value); return; - } else if (strcasecmp(tag, "ref") == 0) { + } + + if (strcasecmp(tag, "ref") == 0) { if (wi.WayStreetRef) free(wi.WayStreetRef); wi.WayStreetRef = FromXmlAndDup(value); return; - } else if (strcasecmp(tag, "landuse") == 0) { + } + + if (strcasecmp(tag, "landuse") == 0) { wi.WayIsInteresting = 0; return; - } else if (strcasecmp(tag, "oneway") == 0 && strcasecmp(value, "yes") == 0) { + } + + if (strcasecmp(tag, "oneway") == 0 && strcasecmp(value, "yes") == 0) { wi.WayIsOneWay = ROADMAP_LINE_DIRECTION_ONEWAY; - } else if (strcasecmp(tag, "building") == 0) { + return; + } + + if (strcasecmp(tag, "building") == 0) { if (strcasecmp(value, "yes") == 0) { + /* what else would the value be? */ wi.WayIsInteresting = 0; - return; } - } else if (strcasecmp(tag, "admin_level") == 0) { + return; + } + + if (strcasecmp(tag, "admin_level") == 0) { wi.WayAdminLevel = atoi(value); } else if (strcasecmp(tag, "border_type") == 0 || strcasecmp(tag, "boundary_type") == 0) { @@ -756,7 +791,7 @@ if ( !wi.WayIsInteresting || wi.WayLayer == 0) { wayid_t *wp; - buildmap_verbose("discarding way %d, not interesting (%s)", wi.WayId, data); + buildmap_debug("discarding way %d, not interesting (%s)", wi.WayId, data); wp = isWayInteresting(wi.WayId); if (wp) { WayTableCopy[wp-WayTable] = 0; @@ -831,7 +866,7 @@ // to_point = buildmap_osm_text_point_get(WayNodes[wi.nWayNodes-1]); /* Street name */ - buildmap_verbose ("Way %d [%s] ref [%s]", wi.WayId, + buildmap_debug ("Way %d [%s] ref [%s]", wi.WayId, wi.WayStreetName ? wi.WayStreetName : "", wi.WayStreetRef ? wi.WayStreetRef : ""); @@ -910,7 +945,7 @@ buildmap_check_allocated(shapes); } - buildmap_verbose("lineid %d wi.nWayNodes %d\n", + buildmap_debug("lineid %d wi.nWayNodes %d\n", LineId, wi.nWayNodes); /* Keep info for the shapes */ shapes[numshapes].lons = lonsbuf; @@ -1048,7 +1083,6 @@ if (count <= 2) continue; - // buildmap_verbose("trying line %d, %d points", lineid, count); lineid = shapes[i].lineid; line_index = buildmap_line_find_sorted(lineid); @@ -1363,8 +1397,10 @@ } else if (strncasecmp(p, "tag", 3) == 0) { +#if 0 if (!wi.WayId) buildmap_osm_text_node_tag(p, 1); +#endif continue; } } @@ -1380,6 +1416,9 @@ /* * Pass 3 - look for all <node>s, define the interesting ones. + * nodes that are interesting because they're a part of + * interesting ways are already on the interesting list. + * nodes interesting in their own right (i.e., places) are not. * Pass 3 - define ways flagged as interesting */ LineNo = 0; @@ -1428,25 +1467,15 @@ continue; } else if (strncasecmp(p, "node", 4) == 0) { -#if 0 - /* - * Avoid figuring out whether we're in a - * <node ... /> - * or - * <node ... > - * .. - * </node> - * case, by resetting first if needed. - */ - if (ni.NodeId && isNodeInteresting(ni.NodeId)) - buildmap_osm_text_node_finish(); -#endif + int nchars; - s = sscanf(p, "node id=%*[\"']%u%*[\"']", &ni.NodeId); + s = sscanf(p, "node id=%*[\"']%u%*[\"']%n", &ni.NodeId, &nchars); if (s != 1) - buildmap_fatal(0, "buildmap_osm_text(%s) node error", p); + buildmap_fatal(0, "buildmap_osm_text(%s) node error", p); - /* will read lat/lon k/v tags, and also call _finish() + p += nchars; + + /* next read lat/lon k/v tags, and also call _finish() * if necessary. */ buildmap_osm_text_node_read_lat_lon(p); @@ -1457,15 +1486,18 @@ /* if what we had was <node .... />, then we won't get * here. buildmap_osm_text_node_finish() was called * already, from buildmap_osm_text_node_read_lat_lon() */ - if (isNodeInteresting(ni.NodeId)) { + // if (isNodeInteresting(ni.NodeId)) { + /* this could be either a tagged or untagged node. + * it will be interesting, and saved to the db, if + * the tags tell us to do so. */ buildmap_osm_text_node_finish(); - } + // } continue; } else if (strncasecmp(p, "tag", 3) == 0) { if (!wi.WayId) - buildmap_osm_text_node_tag(p, 0); + buildmap_osm_text_node_tag(p, 1); else buildmap_osm_text_way_tag(p); continue; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:06:59
|
Revision: 2789 http://sourceforge.net/p/roadmap/code/2789 Author: pgf Date: 2015-05-31 23:06:57 +0000 (Sun, 31 May 2015) Log Message: ----------- buildmap_osm: add support for place layers Modified Paths: -------------- trunk/roadmap/src/buildmap_layer.c trunk/roadmap/src/buildmap_osm_common.c trunk/roadmap/src/buildmap_osm_common.h Modified: trunk/roadmap/src/buildmap_layer.c =================================================================== --- trunk/roadmap/src/buildmap_layer.c 2015-05-31 23:06:54 UTC (rev 2788) +++ trunk/roadmap/src/buildmap_layer.c 2015-05-31 23:06:57 UTC (rev 2789) @@ -46,6 +46,9 @@ static char *BuildMapPolygonLayerList[BUILDMAP_LAYER_MAX]; static int BuildMapPolygonLayerCount = 0; +static char *BuildMapPlaceLayerList[BUILDMAP_LAYER_MAX]; +static int BuildMapPlaceLayerCount = 0; + /** * @brief look up the layer number, for a given layer name * @param name a layer name (string) @@ -67,6 +70,12 @@ } } + for (i = 0; i < BuildMapPlaceLayerCount; ++i) { + if (strcasecmp(BuildMapPlaceLayerList[i], name) == 0) { + return BuildMapPolygonLayerCount + i + 1; + } + } + return 0; } @@ -164,8 +173,15 @@ (config, "Polygons", BuildMapPolygonLayerList, BUILDMAP_LAYER_MAX); if (BuildMapPolygonLayerCount <= 0) { - buildmap_fatal - (0, "cannot decode polygon layers in class %s", class_file); + buildmap_fatal (0, "cannot decode polygon layers in class %s", class_file); } + + BuildMapPlaceLayerCount = + buildmap_layer_decode + (config, "Places", BuildMapPlaceLayerList, BUILDMAP_LAYER_MAX); + + if (BuildMapPlaceLayerCount <= 0) { + buildmap_fatal (0, "cannot decode pplace layers in class %s", class_file); + } } Modified: trunk/roadmap/src/buildmap_osm_common.c =================================================================== --- trunk/roadmap/src/buildmap_osm_common.c 2015-05-31 23:06:54 UTC (rev 2788) +++ trunk/roadmap/src/buildmap_osm_common.c 2015-05-31 23:06:57 UTC (rev 2789) @@ -83,7 +83,12 @@ int BuildMapLayerMall = 0; int BuildMapLayerNature = 0; int BuildMapLayerAmenity = 0; +int BuildMapLayerCity = 0; +int BuildMapLayerTown = 0; +int BuildMapLayerVillage = 0; +int BuildMapLayerHamlet = 0; int BuildMapLayerSuburbs = 0; +int BuildMapLayerPeak = 0; /* Water layers. */ @@ -116,7 +121,12 @@ #define BOUNDARY &BuildMapLayerBoundary #define NATURE &BuildMapLayerNature #define AMENITY &BuildMapLayerAmenity +#define CITY &BuildMapLayerCity +#define TOWN &BuildMapLayerTown +#define VILLAGE &BuildMapLayerVillage +#define HAMLET &BuildMapLayerHamlet #define SUBURBS &BuildMapLayerSuburbs +#define PEAK &BuildMapLayerPeak BuildMapDictionary DictionaryPrefix; BuildMapDictionary DictionaryStreet; @@ -150,7 +160,12 @@ BuildMapLayerNature = buildmap_layer_get ("nature"); BuildMapLayerAmenity = buildmap_layer_get ("amenity"); + BuildMapLayerCity = buildmap_layer_get ("city"); + BuildMapLayerTown = buildmap_layer_get ("town"); + BuildMapLayerVillage = buildmap_layer_get ("village"); + BuildMapLayerHamlet = buildmap_layer_get ("hamlet"); BuildMapLayerSuburbs = buildmap_layer_get ("suburbs"); + BuildMapLayerPeak = buildmap_layer_get ("peak"); BuildMapLayerBoundary = buildmap_layer_get ("boundaries"); } @@ -308,7 +323,7 @@ { "coastline", SHORELINE, 0 }, /* 1 */ { "water", LAKE, AREA }, /* 2 */ { "wood", NATURE, AREA }, /* 3 */ - { "peak", NULL, 0 }, /* 4 */ + { "peak", PEAK, PLACE }, /* 4 */ { "land", NULL, AREA }, /* 5 */ { "bay", NULL, AREA }, /* 6 */ { "beach", NULL, AREA }, /* 7 */ @@ -325,7 +340,7 @@ { "sprint", NULL, AREA }, /* 18 */ { "stone", NULL, AREA }, /* 19 */ { "tree", NULL, AREA }, /* 20 */ - { "volcano", NULL, AREA }, /* 21 */ + { "volcano", PEAK, PLACE }, /* 21 */ { "wetland", NULL, AREA }, /* 22 */ { 0, NULL, 0 }, }; @@ -428,11 +443,11 @@ { "state", NULL, 0 }, /* 3 */ { "region", NULL, 0 }, /* 4 */ { "county", NULL, 0 }, /* 5 */ - { "city", NULL, 0 }, /* 6 */ - { "town", NULL, 0 }, /* 7 */ - { "village", NULL, 0 }, /* 8 */ - { "hamlet", NULL, 0 }, /* 9 */ - { "suburb", SUBURBS, 0 }, /* 10 */ + { "city", CITY, PLACE }, /* 6 */ + { "town", TOWN, PLACE }, /* 7 */ + { "village", VILLAGE, PLACE }, /* 8 */ + { "hamlet", HAMLET, PLACE }, /* 9 */ + { "suburb", SUBURBS, PLACE }, /* 10 */ { 0, NULL, 0 }, }; Modified: trunk/roadmap/src/buildmap_osm_common.h =================================================================== --- trunk/roadmap/src/buildmap_osm_common.h 2015-05-31 23:06:54 UTC (rev 2788) +++ trunk/roadmap/src/buildmap_osm_common.h 2015-05-31 23:06:57 UTC (rev 2789) @@ -59,7 +59,8 @@ #include "buildmap_layer.h" -#define AREA 1 +#define AREA 1 +#define PLACE 2 typedef struct layer_info { char *name; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:06:56
|
Revision: 2788 http://sourceforge.net/p/roadmap/code/2788 Author: pgf Date: 2015-05-31 23:06:54 +0000 (Sun, 31 May 2015) Log Message: ----------- icons/Makefile: reduce output when there's nothing to do Modified Paths: -------------- trunk/roadmap/src/icons/Makefile Modified: trunk/roadmap/src/icons/Makefile =================================================================== --- trunk/roadmap/src/icons/Makefile 2015-05-31 23:06:51 UTC (rev 2787) +++ trunk/roadmap/src/icons/Makefile 2015-05-31 23:06:54 UTC (rev 2788) @@ -50,13 +50,16 @@ # the only pieces we try to build are the roadmap*.xpm files, and # these are optional if the "convert" program is missing. -all: - @echo - @echo "If the $(CONVERT) program is missing, this next step(s)" - @echo " may fail. These errors can be ignored." - @echo - -$(MAKE) $(ROADMAP_ICONS_XPM) +all: msg $(ROADMAP_ICONS_XPM) +msg: + @if ! which convert >/dev/null ; then \ + echo ;\ + echo "If the $(CONVERT) program is missing, this next step(s)" ;\ + echo " may fail. These errors can be ignored." ;\ + echo ;\ + fi + clean: $(RM) $(ROADMAP_ICONS_XPM) .depends.mk @@ -91,7 +94,7 @@ road%.xpm : road%.png $(CONVERT) $< $@ -.PHONY: all install uninstall icons clean rm_icons +.PHONY: all msg install uninstall icons clean rm_icons depends: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:06:53
|
Revision: 2787 http://sourceforge.net/p/roadmap/code/2787 Author: pgf Date: 2015-05-31 23:06:51 +0000 (Sun, 31 May 2015) Log Message: ----------- buildplace_main: implement a simple text parser for place data this is currently driven by an unfinished script that extracts places from OSM xml data. Modified Paths: -------------- trunk/roadmap/src/buildplace_main.c Modified: trunk/roadmap/src/buildplace_main.c =================================================================== --- trunk/roadmap/src/buildplace_main.c 2015-05-31 23:06:48 UTC (rev 2786) +++ trunk/roadmap/src/buildplace_main.c 2015-05-31 23:06:51 UTC (rev 2787) @@ -164,7 +164,7 @@ e.key = (char *) dsg; ep = hsearch(e, FIND); - return ep ? BuildPlaceDSGcfcc[(int)ep->data] : 0; + return ep ? *(int *)ep->data : 0; } #endif @@ -178,7 +178,7 @@ if (BuildPlaceDSGCount + 1 > BUILDPLACE_MAX_DSG) buildmap_fatal(0, "maximum designations has been exceeded"); e.key = BuildPlaceDSGStrings[BuildPlaceDSGCount] = strdup(dsg); - e.data = (char *) BuildPlaceDSGCount; + e.data = (void *) &BuildPlaceDSGcfcc[BuildPlaceDSGCount]; ep = hsearch(e, ENTER); if (!ep) buildmap_fatal(0, "failed to add designation to hash"); @@ -204,7 +204,6 @@ char name[160]; int irec; int record_count; - int place; int pname; int cfcc; int point; @@ -255,7 +254,7 @@ point = buildmap_point_add (lon, lat); - place = buildmap_place_add (pname, cfcc, point); + buildmap_place_add (pname, cfcc, point); if (verbose) { if ((irec & 0xff) == 0) { @@ -281,6 +280,57 @@ static void buildplace_txt_process (const char *source, int verbose) { + static BuildMapDictionary DictionaryName; + + char *bufp = NULL; + size_t buflen; + ssize_t gotlen; + char place[512]; + char *name; + double lat, lon; + int ilat, ilon; + int lineno; + int nameindex; + int pname; + int cfcc; + int point; + + buildmap_set_source((char *) source); + + DictionaryName = buildmap_dictionary_open ("placename"); + + if (strcmp(source, "-") != 0) + buildmap_fatal(0, "TXT format must come from stdin: use '-'"); + + lineno = 0; + while ((gotlen = getline(&bufp, &buflen, stdin)) != -1) { + int n; + lineno++; + n = sscanf(bufp, "%lf\t%lf\t%s\t%n", &lat, &lon, place, &nameindex); + if (n != 3) + buildmap_fatal(0, "bad text line format, line %d: %s", lineno, bufp); + + name = &bufp[nameindex]; + printf("got %f %f %s %s\n", lat, lon, place, name); + + pname = str2dict (DictionaryName, name); + + cfcc = dsg2cfcc(place); + if (cfcc == 0) + continue; + + ilat = lat * 1000000.0; + ilon = lon * 1000000.0; + + point = buildmap_point_add (ilon, ilat); + + buildmap_place_add (pname, cfcc, point); + + if ((lineno & 0xff) == 0) { + buildmap_progress (lineno, 0); + } + } + } @@ -304,6 +354,7 @@ if (fgets(buff, 2048, file)) { c = strspn(buff, " \t\r\n"); if (buff[c] == '#' || strlen(buff+c) == 0) continue; + // buff[c] == '\0' cfcc = strtol(buff+c, &p, 10); if (cfcc < 0 || cfcc > BUILDMAP_MAX_PLACE_CFCC) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:06:50
|
Revision: 2786 http://sourceforge.net/p/roadmap/code/2786 Author: pgf Date: 2015-05-31 23:06:48 +0000 (Sun, 31 May 2015) Log Message: ----------- buildmap_place.c: fix some minor mistakes to make the db build complete Modified Paths: -------------- trunk/roadmap/src/buildmap_place.c Modified: trunk/roadmap/src/buildmap_place.c =================================================================== --- trunk/roadmap/src/buildmap_place.c 2015-05-31 23:06:45 UTC (rev 2785) +++ trunk/roadmap/src/buildmap_place.c 2015-05-31 23:06:48 UTC (rev 2786) @@ -501,7 +501,7 @@ layer_sublist += layer_current; if (layer_sublist >= layer_count) { - buildmap_error (0, "invalid place/bylayer count"); + buildmap_error (0, "invalid place/bylayer count (1)"); return 1; } } @@ -520,15 +520,27 @@ } } + if (square_current >= 0) { +#ifdef BEFORE 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_error (0, "invalid place/bylayer count"); + buildmap_error (0, "invalid place/bylayer count (2)"); return 1; } +#else // pgf changed -- the conditions here now match those in the loop above + db_layer[layer_sublist+square_current] = i + 1; + db_square[square_current].first = layer_sublist; + db_square[square_current].count = layer_current; + + if (layer_sublist+layer_current >= layer_count) { + buildmap_error (0, "invalid place/bylayer count (2)"); + return 1; + } +#endif } return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:06:47
|
Revision: 2785 http://sourceforge.net/p/roadmap/code/2785 Author: pgf Date: 2015-05-31 23:06:45 +0000 (Sun, 31 May 2015) Log Message: ----------- roadmap_place.c: distinguish some identical error messages Modified Paths: -------------- trunk/roadmap/src/roadmap_place.c Modified: trunk/roadmap/src/roadmap_place.c =================================================================== --- trunk/roadmap/src/roadmap_place.c 2015-05-31 23:06:41 UTC (rev 2784) +++ trunk/roadmap/src/roadmap_place.c 2015-05-31 23:06:45 UTC (rev 2785) @@ -99,7 +99,7 @@ context->PlaceCount = roadmap_db_get_count (place_table); if (roadmap_db_get_size (place_table) != context->PlaceCount * sizeof(int)) { - roadmap_log (ROADMAP_ERROR, "invalid place/data structure"); + roadmap_log (ROADMAP_ERROR, "invalid place/data structure (1)"); goto roadmap_place_map_abort; } @@ -107,7 +107,7 @@ context->PlaceByLayerCount = roadmap_db_get_count (layer_table); if (roadmap_db_get_size (layer_table) != context->PlaceCount * sizeof(int)) { - roadmap_log (ROADMAP_ERROR, "invalid place/bylayer structure"); + roadmap_log (ROADMAP_ERROR, "invalid place/bylayer structure (2)"); goto roadmap_place_map_abort; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:06:44
|
Revision: 2784 http://sourceforge.net/p/roadmap/code/2784 Author: pgf Date: 2015-05-31 23:06:41 +0000 (Sun, 31 May 2015) Log Message: ----------- buildmap_osm_text.c: refactor layer lookup code Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_text.c Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-05-31 23:06:38 UTC (rev 2783) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-05-31 23:06:41 UTC (rev 2784) @@ -568,6 +568,30 @@ } +void +buildmap_osm_get_layer(char *tag, char *value, int *flags, int *layer) +{ + int i; + layer_info_t *list; + + for (i=1; list_info[i].name != 0; i++) { + if (strcmp(tag, list_info[i].name) == 0) { + list = list_info[i].list; + if (list) { + for (i=1; list[i].name; i++) { + if (strcmp(value, list[i].name) == 0) { + *flags = list[i].flags; + if (list[i].layerp) + *layer = *(list[i].layerp); + break; + } + } + } + break; + } + } +} + /** * @brief deal with tag lines outside of ways * @param data points into the line of text being processed @@ -638,8 +662,7 @@ buildmap_osm_text_way_tag(char *data) { static char *tag = 0, *value = 0; - int i, s; - layer_info_t *list; + int s; /* have we already decided this way is uninteresting? */ if (!wi.WayIsInteresting) @@ -687,22 +710,8 @@ /* * Get layer info */ - for (i=1; list_info[i].name != 0; i++) { - if (strcmp(tag, list_info[i].name) == 0) { - list = list_info[i].list; - if (list) { - for (i=1; list[i].name; i++) { - if (strcmp(value, list[i].name) == 0) { - wi.WayFlags = list[i].flags; - if (list[i].layerp) - wi.WayLayer = *(list[i].layerp); - break; - } - } - } - break; - } - } + buildmap_osm_get_layer(tag, value, &wi.WayFlags, &wi.WayLayer); + } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:06:41
|
Revision: 2783 http://sourceforge.net/p/roadmap/code/2783 Author: pgf Date: 2015-05-31 23:06:38 +0000 (Sun, 31 May 2015) Log Message: ----------- buildmap_osm: better usage error reporting Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_main.c Modified: trunk/roadmap/src/buildmap_osm_main.c =================================================================== --- trunk/roadmap/src/buildmap_osm_main.c 2015-05-31 23:06:35 UTC (rev 2782) +++ trunk/roadmap/src/buildmap_osm_main.c 2015-05-31 23:06:38 UTC (rev 2783) @@ -52,6 +52,7 @@ #include "roadmap_osm.h" #include "roadmap_iso.h" +char *progname; int BuildMapNoLongLines; static int BuildMapReplaceAll = 0; @@ -786,25 +787,22 @@ * @param progpath * @param msg */ -void usage(char *progpath, const char *msg) { +void usage(const char *msg) { - char *prog = strrchr(progpath, '/'); - - if (prog) - prog++; - else - prog = progpath; - - if (msg) - fprintf(stderr, "%s: %s\n", prog, msg); fprintf(stderr, "usage: %s [options] lat,lon[:lat,lon] -or- lat,lon:NN{mi|km}\n" " Use '--' after the options if the 'lat' value is negative.\n", - prog); + progname); opt_desc(options, 1); exit(1); } +void usage_err(const char *msg) { + if (msg) + fprintf(stderr, "%s: %s\n", progname, msg); + exit(1); +} + void buildmap_osm_list_tiles(int *tileslist, int count) { int i, n; @@ -843,12 +841,18 @@ int listonly; int tileid; char *class, *latlonarg, *fetcher, *inputfile; + + progname = strrchr(argv[0], '/'); + if (progname) progname++; + else progname = argv[0]; + + BuildMapResult = strdup(roadmap_path_preferred("maps")); /* default. */ /* parse the options */ error = opt_parse(options, &argc, argv, 0); - if (error) usage(argv[0], opt_strerror(error)); + if (error) usage(opt_strerror(error)); /* then, fetch the option values */ error = opt_val("verbose", &verbose) || @@ -866,7 +870,7 @@ opt_val("outputfile", &BuildMapFileName) || opt_val("inputfile", &inputfile); if (error) - usage(argv[0], opt_strerror(error)); + usage(opt_strerror(error)); if (osm_bits < TILE_MINBITS || TILE_MAXBITS < osm_bits) { fprintf (stderr, "bits value %d out of range (%d to %d)", @@ -883,7 +887,7 @@ } if (!*fetcher) { - usage (argv[0], "missing fetcher command option"); + usage_err ("missing fetcher command option"); } @@ -906,21 +910,24 @@ count = 1; } else if (*inputfile && *BuildMapFileName) { - int r = buildmap_osm_text_process_file(inputfile, BuildMapFileName); + int r; + + if (argc > 0) usage_err("too many arguments"); + + r = buildmap_osm_text_process_file(inputfile, BuildMapFileName); exit(r); - } else if (*inputfile) { - usage(argv[0], "cannot specify -i without -o"); - } else if (*BuildMapFileName) { - usage(argv[0], "cannot specify -o without -i"); + + } else if (*inputfile || *BuildMapFileName) { + + usage_err("must specify -i and -o together"); + } else { if (argc < 2) - usage(argv[0], "missing required arguments"); + usage_err("missing required lat/lon argument"); - if (argc > 2) - usage(argv[0], "too many arguments"); - latlonarg = argv[1]; + argv++; argc--; buildmap_info("processing with bits '%d'", osm_bits); @@ -935,6 +942,8 @@ } + if (argc != 1) usage_err("too many arguments"); + if (listonly) { buildmap_osm_list_tiles(tileslist, count); exit(0); @@ -945,7 +954,5 @@ free (tileslist); - if (error) exit(1); - - exit(0); + exit(!!error); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-05-31 23:06:38
|
Revision: 2782 http://sourceforge.net/p/roadmap/code/2782 Author: pgf Date: 2015-05-31 23:06:35 +0000 (Sun, 31 May 2015) Log Message: ----------- rdm_osm_fetch_tile: better error detection Modified Paths: -------------- trunk/roadmap/src/rdm_osm_fetch_tile Modified: trunk/roadmap/src/rdm_osm_fetch_tile =================================================================== --- trunk/roadmap/src/rdm_osm_fetch_tile 2014-06-09 14:12:49 UTC (rev 2781) +++ trunk/roadmap/src/rdm_osm_fetch_tile 2015-05-31 23:06:35 UTC (rev 2782) @@ -83,7 +83,7 @@ if [ "$want_compressed" ] then wget_opt="--header=Accept-Encoding: gzip" - if wget "$wget_opt" -O - "$url" >$xmlfile.tmp + if wget "$wget_opt" -O - "$url" >$xmlfile.tmp || exit 1 then case $(file $xmlfile.tmp) in *gzip*) @@ -92,12 +92,12 @@ *) echo "Note: download didn't use gzip encoding." echo "Compressing now..." - gzip -c -d $xmlfile.tmp > $xmlfile + gzip -c -d $xmlfile.tmp > $xmlfile || exit 1 ;; esac fi else - if wget $wget_opt -O - "$url" >$xmlfile.tmp + if wget $wget_opt -O - "$url" >$xmlfile.tmp || exit 1 then mv $xmlfile.tmp $xmlfile fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2014-06-09 14:12:52
|
Revision: 2781 http://sourceforge.net/p/roadmap/code/2781 Author: pgf Date: 2014-06-09 14:12:49 +0000 (Mon, 09 Jun 2014) Log Message: ----------- roadmap.desktop: fix (i think) the desktop file installation path Modified Paths: -------------- trunk/roadmap/src/Makefile trunk/roadmap/src/options.mk trunk/roadmap/src/roadmap.desktop Modified: trunk/roadmap/src/Makefile =================================================================== --- trunk/roadmap/src/Makefile 2014-06-09 13:56:33 UTC (rev 2780) +++ trunk/roadmap/src/Makefile 2014-06-09 14:12:49 UTC (rev 2781) @@ -620,6 +620,7 @@ -test -d $(menudir) && cp roadmap.menu $(menudir)/roadmap mkdir -p $(desktopdir) cp -f roadmap.desktop $(desktopdir)/. + sed -i -e 's;%BIN%;$(pkgbindir)/;' $(desktopdir)/roadmap.desktop installicons: $(MAKE) -C icons install Modified: trunk/roadmap/src/options.mk =================================================================== --- trunk/roadmap/src/options.mk 2014-06-09 13:56:33 UTC (rev 2780) +++ trunk/roadmap/src/options.mk 2014-06-09 14:12:49 UTC (rev 2781) @@ -24,7 +24,7 @@ override INSTALLDIR := $(DESTDIR)/$(INSTALLDIR) endif -desktopdir = $(INSTALLDIR)/applications +desktopdir = $(DESTDIR)/usr/share/applications bindir = $(INSTALLDIR)/bin pkgbindir = $(bindir) Modified: trunk/roadmap/src/roadmap.desktop =================================================================== --- trunk/roadmap/src/roadmap.desktop 2014-06-09 13:56:33 UTC (rev 2780) +++ trunk/roadmap/src/roadmap.desktop 2014-06-09 14:12:49 UTC (rev 2781) @@ -1,6 +1,6 @@ [Desktop Entry] Comment=Car Navigation System -Exec=roadmap +Exec=%BIN%roadmap Icon=roadmap Type=Application Name=RoadMap This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2014-06-09 13:56:36
|
Revision: 2780 http://sourceforge.net/p/roadmap/code/2780 Author: pgf Date: 2014-06-09 13:56:33 +0000 (Mon, 09 Jun 2014) Log Message: ----------- roadmap_screen: add config to turn off polygon fill when dragging Modified Paths: -------------- trunk/roadmap/src/roadmap_screen.c Modified: trunk/roadmap/src/roadmap_screen.c =================================================================== --- trunk/roadmap/src/roadmap_screen.c 2014-06-09 13:56:28 UTC (rev 2779) +++ trunk/roadmap/src/roadmap_screen.c 2014-06-09 13:56:33 UTC (rev 2780) @@ -102,6 +102,9 @@ static RoadMapConfigDescriptor RoadMapConfigStyleObjects = ROADMAP_CONFIG_ITEM("Style", "Show Objects when Dragging"); +static RoadMapConfigDescriptor RoadMapConfigStyleFilledPolygonDrag = + ROADMAP_CONFIG_ITEM("Style", "Fill Polygons when Dragging"); + static RoadMapConfigDescriptor RoadMapConfigMapLabels = ROADMAP_CONFIG_ITEM("Map", "Labels"); @@ -631,8 +634,10 @@ (LinePoints.cursor - LinePoints.data, LinePoints.data); roadmap_canvas_draw_multiple_polygons - (count, RoadMapScreenObjects.data, LinePoints.data, 1, - RoadMapScreenDragging); + (count, RoadMapScreenObjects.data, LinePoints.data, + !RoadMapScreenDragging || + roadmap_config_match(&RoadMapConfigStyleFilledPolygonDrag, "yes") , + RoadMapScreenDragging); RoadMapScreenObjects.cursor = RoadMapScreenObjects.data; LinePoints.cursor = LinePoints.data; @@ -1465,8 +1470,8 @@ int *in_view; int i; - int j; - int k; + int sq; + int pen; int count, sqcount; int *drawnlist; int max_pen = roadmap_layer_max_pen(); @@ -1570,13 +1575,12 @@ /* -- Look for the squares that are currently visible. */ sqcount = roadmap_square_view (&in_view); - for (k = 0; k < max_pen; ++k) { + for (pen = 0; pen < max_pen; ++pen) { if (sqcount > 0) { static int *layers = NULL; static int layers_size = 0; int layer_count; - int pen_type = k; roadmap_screen_reset_square_mask(); @@ -1586,18 +1590,18 @@ roadmap_check_allocated(layers); } layer_count = roadmap_layer_visible_lines - (layers, layers_size, k); + (layers, layers_size, pen); if (!layer_count) continue; - for (j = sqcount - 1; j >= 0; --j) { - drawnlist[i] += roadmap_screen_repaint_square (in_view[j], pen_type, - layer_count, layers); + for (sq = sqcount - 1; sq >= 0; --sq) { + drawnlist[i] += roadmap_screen_repaint_square (in_view[sq], + pen, layer_count, layers); } } - drawnlist[i] += roadmap_screen_draw_long_lines (k); + drawnlist[i] += roadmap_screen_draw_long_lines (pen); } @@ -2278,6 +2282,9 @@ ("preferences", &RoadMapConfigStyleObjects, "yes", "no", NULL); roadmap_config_declare_enumeration + ("preferences", &RoadMapConfigStyleFilledPolygonDrag, "yes", "no", NULL); + + roadmap_config_declare_enumeration ("preferences", &RoadMapConfigMapLabels, "on", "off", NULL); roadmap_config_declare_enumeration This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |