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-06-23 14:02:12
|
Revision: 2879 http://sourceforge.net/p/roadmap/code/2879 Author: pgf Date: 2015-06-23 14:02:11 +0000 (Tue, 23 Jun 2015) Log Message: ----------- roadmap_gpsd3.c: fix parsing of offline/online state from gpsd Modified Paths: -------------- trunk/roadmap/src/roadmap_gpsd3.c Modified: trunk/roadmap/src/roadmap_gpsd3.c =================================================================== --- trunk/roadmap/src/roadmap_gpsd3.c 2015-06-17 03:45:34 UTC (rev 2878) +++ trunk/roadmap/src/roadmap_gpsd3.c 2015-06-23 14:02:11 UTC (rev 2879) @@ -145,7 +145,7 @@ if (!gpsdp->online) { roadmap_gps_satellites (-1, 0, 0, 0, 0, 0); roadmap_gps_navigation ('V', 0, 0, 0, 0, 0, 0); - roadmap_log (ROADMAP_WARNING, "gpsd: not online"); + roadmap_log (ROADMAP_DEBUG, "gpsd: not online"); return 0; // No data } #endif @@ -242,16 +242,29 @@ return 1; #else + static int active, old_active = -1; // fprintf(stderr, "%s\n", sentence); if (!strncmp(sentence, "{\"class\":",9)) /* } */ { // try to detect: {"class":"DEVICE","path":"/dev/ttyUSB1","activated":0} roadmap_log (ROADMAP_DEBUG, "gpsd: found 'class'"); if (strstr(sentence, "\"activated\":0}")) { roadmap_log (ROADMAP_DEBUG, "gpsd: not online"); - roadmap_gps_satellites (-1, 0, 0, 0, 0, 0); + active = 0; + } else if (strstr(sentence, "\"activated\":")) { // anything but '0' + roadmap_log (ROADMAP_DEBUG, "gpsd: online"); + active = 1; } - return 0; + } else if (*sentence == '$') { + roadmap_log (ROADMAP_DEBUG, "gpsd: online with NMEA"); + active = 1; } - return roadmap_nmea_decode (user_context, decoder_context, sentence); + if (active) + return roadmap_nmea_decode (user_context, decoder_context, sentence); + + if (old_active != active) { + roadmap_gps_satellites (active ? 0:-1, 0, 0, 0, 0, 0); + old_active = active; + } + return 0; #endif } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-17 03:45:36
|
Revision: 2878 http://sourceforge.net/p/roadmap/code/2878 Author: pgf Date: 2015-06-17 03:45:34 +0000 (Wed, 17 Jun 2015) Log Message: ----------- roadmap_voice/trip: allow duplicate sequential speech if forced it's important for the user to be able to get to hear it again. Modified Paths: -------------- trunk/roadmap/src/roadmap_display.c trunk/roadmap/src/roadmap_trip.c trunk/roadmap/src/roadmap_voice.c trunk/roadmap/src/roadmap_voice.h Modified: trunk/roadmap/src/roadmap_display.c =================================================================== --- trunk/roadmap/src/roadmap_display.c 2015-06-16 19:35:26 UTC (rev 2877) +++ trunk/roadmap/src/roadmap_display.c 2015-06-17 03:45:34 UTC (rev 2878) @@ -565,7 +565,7 @@ if (street_has_changed) { - roadmap_voice_announce (sign->title); + roadmap_voice_announce (sign->title, 0); } if (message_has_changed) { Modified: trunk/roadmap/src/roadmap_trip.c =================================================================== --- trunk/roadmap/src/roadmap_trip.c 2015-06-16 19:35:26 UTC (rev 2877) +++ trunk/roadmap/src/roadmap_trip.c 2015-06-17 03:45:34 UTC (rev 2878) @@ -2087,6 +2087,7 @@ */ void roadmap_trip_route_resume (void) { + lastRoadMapTripNext = NULL; if (RoadMapCurrentRoute == NULL) { /* convenient side effect. if there _is_ a route, the code * below forces GPS to be centered. so may as well do that @@ -2101,7 +2102,6 @@ if (RoadMapTripGps->has_value) { RoadMapTripNext = roadmap_trip_choose_best_next (&RoadMapTripGps->map); - lastRoadMapTripNext = NULL; roadmap_trip_set_departure (0); roadmap_trip_activate (); roadmap_trip_set_directions(0, 0, NULL); @@ -2421,7 +2421,7 @@ if (lastRoadMapTripNext != RoadMapTripNext || distance_to_next < distance_announce_threshold) { - roadmap_voice_announce ("Waypoint"); + roadmap_voice_announce ("Waypoint", 1); distance_announce_threshold = roadmap_trip_new_threshold(distance_to_next); lastRoadMapTripNext = RoadMapTripNext; Modified: trunk/roadmap/src/roadmap_voice.c =================================================================== --- trunk/roadmap/src/roadmap_voice.c 2015-06-16 19:35:26 UTC (rev 2877) +++ trunk/roadmap/src/roadmap_voice.c 2015-06-17 03:45:34 UTC (rev 2878) @@ -176,18 +176,7 @@ } } - if ((RoadMapVoiceCurrentCommand != NULL) && - (RoadMapVoiceCurrentArguments != NULL) && - (strcmp (name, RoadMapVoiceCurrentCommand) == 0) && - (strcmp (arguments, RoadMapVoiceCurrentArguments) == 0)) { - - /* Do not repeat the same message again. */ - RoadMapVoiceInUse = 0; - roadmap_log(ROADMAP_DEBUG, "voice now idle"); - return; - } - roadmap_log(ROADMAP_DEBUG, "activating message %s", arguments); RoadMapVoiceInUse = 1; @@ -360,11 +349,12 @@ } -void roadmap_voice_announce (const char *title) { +void roadmap_voice_announce (const char *title, int force) { int i; char text[1024]; char expanded[1024]; + static char *prev; char *final; char *arguments; @@ -405,6 +395,14 @@ final = text; } + /* don't say it twice, unless forced */ + if (!force && prev && strcmp (final, prev) == 0) { + return; + } + + if (prev) free(prev); + prev = strdup(final); + arguments = strchr (final, ' '); if (arguments == NULL) { Modified: trunk/roadmap/src/roadmap_voice.h =================================================================== --- trunk/roadmap/src/roadmap_voice.h 2015-06-16 19:35:26 UTC (rev 2877) +++ trunk/roadmap/src/roadmap_voice.h 2015-06-17 03:45:34 UTC (rev 2878) @@ -24,7 +24,7 @@ #ifndef INCLUDE__ROADMAP_VOICE__H #define INCLUDE__ROADMAP_VOICE__H -void roadmap_voice_announce (const char *title); +void roadmap_voice_announce (const char *title, int force); void roadmap_voice_mute (void); void roadmap_voice_enable (void); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-16 19:35:28
|
Revision: 2877 http://sourceforge.net/p/roadmap/code/2877 Author: pgf Date: 2015-06-16 19:35:26 +0000 (Tue, 16 Jun 2015) Log Message: ----------- roadmap_trip: add voice announcement for upcoming waypoint Modified Paths: -------------- trunk/roadmap/src/roadmap_trip.c trunk/roadmap/src/roadmap_voice.c Modified: trunk/roadmap/src/roadmap_trip.c =================================================================== --- trunk/roadmap/src/roadmap_trip.c 2015-06-16 19:35:23 UTC (rev 2876) +++ trunk/roadmap/src/roadmap_trip.c 2015-06-16 19:35:26 UTC (rev 2877) @@ -60,6 +60,7 @@ #include "roadmap_gpx.h" #include "roadmap_track.h" #include "roadmap_landmark.h" +#include "roadmap_voice.h" #ifdef HAVE_NAVIGATE_PLUGIN #include "roadmap_tripdb.h" #endif @@ -236,6 +237,7 @@ waypoint *RoadMapTripDest = NULL; static waypoint *RoadMapTripStart = NULL; static waypoint *RoadMapTripNext = NULL; +static waypoint *lastRoadMapTripNext; /* This is the name of the waypoint used to set the WaypointFocus * focal point. @@ -1997,7 +1999,8 @@ * @param suppress_dist * @param next */ -static void roadmap_trip_set_directions (int dist_to_next, int suppress_dist, waypoint *next) +static void roadmap_trip_set_directions (int dist_to_next, + int suppress_dist, waypoint *next) { static waypoint *last_next; static char *desc; @@ -2073,6 +2076,7 @@ } RoadMapTripNext = RoadMapTripStart; + lastRoadMapTripNext = NULL; roadmap_trip_set_departure (1); roadmap_trip_activate (); roadmap_trip_set_directions(0, 0, NULL); @@ -2097,6 +2101,7 @@ if (RoadMapTripGps->has_value) { RoadMapTripNext = roadmap_trip_choose_best_next (&RoadMapTripGps->map); + lastRoadMapTripNext = NULL; roadmap_trip_set_departure (0); roadmap_trip_activate (); roadmap_trip_set_directions(0, 0, NULL); @@ -2235,6 +2240,25 @@ roadmap_screen_refresh (); } +int announce_threshold_tenths[] = { + // 100mi 50mi 20mi 10mi 5mi 1mi .3mi or + // 100km 50km 20km 10km 5km 1km .3km + 1000, 500, 200, 100, 50, 10, 3, 0 +}; + +int roadmap_trip_new_threshold(int distance) +{ + int i; + int *thresh = announce_threshold_tenths; + int distance_far = roadmap_math_to_trip_distance_tenths (distance); + + for (i = 0; thresh[i]; i++) { + if (distance_far > thresh[i]) { + return thresh[i]; + } + } + return 0; +} /** * @brief send messages to the user indicating current state * @@ -2258,6 +2282,7 @@ int waypoint_size; static RoadMapPosition lastgpsmap = {-1, -1}; static waypoint *within_waypoint = NULL; + static int distance_announce_threshold; if (! RoadMapRouteInProgress || RoadMapCurrentRoute == NULL) { @@ -2330,6 +2355,8 @@ roadmap_log (ROADMAP_DEBUG, "attained waypoint %s, distance %d", RoadMapTripNext->shortname, distance_to_next); +// maybe announce "at waypoint" + within_waypoint = RoadMapTripNext; need_newgoal = 1; getting_close = 0; @@ -2392,6 +2419,14 @@ } + if (lastRoadMapTripNext != RoadMapTripNext || + distance_to_next < distance_announce_threshold) { + roadmap_voice_announce ("Waypoint"); + distance_announce_threshold = + roadmap_trip_new_threshold(distance_to_next); + lastRoadMapTripNext = RoadMapTripNext; + } + lastgpsmap = gps->map; } Modified: trunk/roadmap/src/roadmap_voice.c =================================================================== --- trunk/roadmap/src/roadmap_voice.c 2015-06-16 19:35:23 UTC (rev 2876) +++ trunk/roadmap/src/roadmap_voice.c 2015-06-16 19:35:26 UTC (rev 2877) @@ -56,6 +56,7 @@ ROADMAP_CONFIG_ITEM("Voice", "Mute"); static struct roadmap_voice_config RoadMapVoiceText[] = { + {ROADMAP_CONFIG_ITEM("Voice", "Waypoint"), "flite" _EXE " -t 'Next way point in %W'"}, {ROADMAP_CONFIG_ITEM("Voice", "Approach"), "flite" _EXE " -t 'Approaching %N'"}, {ROADMAP_CONFIG_ITEM("Voice", "Current Street"), "flite" _EXE " -t 'On %N'"}, {ROADMAP_CONFIG_ITEM("Voice", "Next Intersection"), "flite" _EXE " -t 'Next intersection: %N'"}, @@ -100,6 +101,7 @@ */ static struct voice_translation RoadMapVoiceTranslate1[] = { {"Blvd", "boulevard"}, + {"Blvd", "boulevard"}, {"Cres", "crescent"}, {"Expy", "expressway"}, {"FMRd", "farm road"}, @@ -143,6 +145,11 @@ {"Sq", "square"}, {"St", "street"}, + {"Km", "kilometers"}, + {"Mi", "miles"}, + {"ft", "feet"}, + {"m", "meters"}, + {"N", "north"}, {"W", "west"}, {"S", "south"}, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-16 19:35:25
|
Revision: 2876 http://sourceforge.net/p/roadmap/code/2876 Author: pgf Date: 2015-06-16 19:35:23 +0000 (Tue, 16 Jun 2015) Log Message: ----------- roadgps: show more state helpful in diagnosing failure Modified Paths: -------------- trunk/roadmap/src/roadgps_screen.c Modified: trunk/roadmap/src/roadgps_screen.c =================================================================== --- trunk/roadmap/src/roadgps_screen.c 2015-06-16 19:35:20 UTC (rev 2875) +++ trunk/roadmap/src/roadgps_screen.c 2015-06-16 19:35:23 UTC (rev 2876) @@ -93,7 +93,16 @@ static RoadGpsObject *RoadGpsSatellites = NULL; static int RoadGpsSatelliteSize = 0; static int RoadGpsSatelliteCount = 0; +static int RoadGpsReception = GPS_RECEPTION_NA; +char *GPSReception[] = { + "Not Available", + "No Communication", + "None", + "Poor", + "Good", +}; + static RoadMapGpsPosition RoadGpsPosition; static RoadMapGpsPrecision RoadGpsPrecision; @@ -341,63 +350,72 @@ if (RoadGpsSatellites[i].status == 'A') satcount++; + fix = RoadGpsPrecision.dimension; + if (fix < 1) fix = 1; + if (fix > 3) fix = 3; - point.x = RoadGpsFrame.latitude_offset_x; - point.y = RoadGpsFrame.latitude_offset_y; - roadmap_canvas_select_pen (RoadGpsLabels); - roadmap_canvas_draw_string (&point, ROADMAP_CANVAS_LEFT, "Latitude:"); - point.y = point.y+RoadGpsFrame.label_height; + if (fix > 1) { + point.x = RoadGpsFrame.latitude_offset_x; + point.y = RoadGpsFrame.latitude_offset_y; + roadmap_canvas_select_pen (RoadGpsLabels); + roadmap_canvas_draw_string (&point, ROADMAP_CANVAS_LEFT, "Latitude:"); + point.y = point.y+RoadGpsFrame.label_height; - roadgps_screen_to_coord(data,1,RoadGpsPosition.latitude); - roadmap_canvas_select_pen (RoadGpsValues); - roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, data); + roadgps_screen_to_coord(data,1,RoadGpsPosition.latitude); + roadmap_canvas_select_pen (RoadGpsValues); + roadmap_canvas_draw_string + (&point, ROADMAP_CANVAS_LEFT, data); - point.x = RoadGpsFrame.longitude_offset_x; - point.y = RoadGpsFrame.longitude_offset_y; + point.x = RoadGpsFrame.longitude_offset_x; + point.y = RoadGpsFrame.longitude_offset_y; - roadmap_canvas_select_pen (RoadGpsLabels); - roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, "Longitude:"); - point.y = point.y+RoadGpsFrame.label_height; + roadmap_canvas_select_pen (RoadGpsLabels); + roadmap_canvas_draw_string + (&point, ROADMAP_CANVAS_LEFT, "Longitude:"); + point.y = point.y+RoadGpsFrame.label_height; - roadgps_screen_to_coord(data,0,RoadGpsPosition.longitude); - roadmap_canvas_select_pen (RoadGpsValues); - roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, data); + roadgps_screen_to_coord(data,0,RoadGpsPosition.longitude); + roadmap_canvas_select_pen (RoadGpsValues); + roadmap_canvas_draw_string + (&point, ROADMAP_CANVAS_LEFT, data); - point.y = point.y+RoadGpsFrame.label_height; - roadmap_canvas_select_pen (RoadGpsLabels); - roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, "Altitude:"); - sprintf(data,"%d%s",RoadGpsPosition.altitude,roadmap_math_distance_unit()); - point.y = point.y+RoadGpsFrame.label_height; - roadmap_canvas_select_pen (RoadGpsValues); - roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, data); + if (fix > 2) { + point.y = point.y+RoadGpsFrame.label_height; + roadmap_canvas_select_pen (RoadGpsLabels); + roadmap_canvas_draw_string + (&point, ROADMAP_CANVAS_LEFT, "Altitude:"); + sprintf(data,"%d%s",RoadGpsPosition.altitude,roadmap_math_distance_unit()); + point.y = point.y+RoadGpsFrame.label_height; + roadmap_canvas_select_pen (RoadGpsValues); + roadmap_canvas_draw_string + (&point, ROADMAP_CANVAS_LEFT, data); - point.y = point.y+RoadGpsFrame.label_height; - roadmap_canvas_select_pen (RoadGpsLabels); - roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, "Speed:"); - sprintf(data,"%d%s", - roadmap_math_knots_to_speed_unit(RoadGpsPosition.speed), - roadmap_math_speed_unit()); - point.y = point.y+RoadGpsFrame.label_height; - roadmap_canvas_select_pen (RoadGpsValues); - roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, data); + point.y = point.y+RoadGpsFrame.label_height; + roadmap_canvas_select_pen (RoadGpsLabels); + roadmap_canvas_draw_string + (&point, ROADMAP_CANVAS_LEFT, "Speed:"); + sprintf(data,"%d%s", + roadmap_math_knots_to_speed_unit(RoadGpsPosition.speed), + roadmap_math_speed_unit()); + point.y = point.y+RoadGpsFrame.label_height; + roadmap_canvas_select_pen (RoadGpsValues); + roadmap_canvas_draw_string + (&point, ROADMAP_CANVAS_LEFT, data); + } - point.x = RoadGpsFrame.centers[0].x-RoadGpsFrame.radius[0]; + } + point.x = RoadGpsFrame.centers[0].x; // -RoadGpsFrame.radius[0]; point.y = RoadGpsFrame.centers[0].y+RoadGpsFrame.radius[0]+ - RoadGpsFrame.label_height-10; + RoadGpsFrame.label_height-10; roadmap_canvas_select_pen (RoadGpsLabels); - fix = RoadGpsPrecision.dimension; - if (fix < 1) fix = 1; - else if (fix > 3) fix = 3; - sprintf(data,"%d active satellites, %s fix", satcount, fixes[fix-1]); - roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, data); + if (RoadGpsReception > GPS_RECEPTION_NO_COMM) { + sprintf(data,"%d active , %s fix", satcount, fixes[fix-1]); + } else if (RoadGpsReception == GPS_RECEPTION_NO_COMM) { + sprintf(data,"No data from GPS"); + } else { + sprintf(data,"No GPS"); + } + roadmap_canvas_draw_string (&point, ROADMAP_CANVAS_CENTER, data); if (RoadMapGpsReceivedTime != 0) { point.y = point.y+RoadGpsFrame.label_height; @@ -405,7 +423,7 @@ strftime(data, sizeof(data), " %Y/%m/%d %H:%M:%S", localtime(&RoadMapGpsReceivedTime)); roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, data); + (&point, ROADMAP_CANVAS_CENTER, data); } } @@ -540,6 +558,7 @@ const RoadMapGpsPrecision *dilution, const RoadMapGpsPosition *position) { + RoadGpsReception = reception; RoadGpsPosition.latitude = position->latitude; RoadGpsPosition.longitude = position->longitude; @@ -568,6 +587,8 @@ int i; + RoadGpsReception = reception; + if (RoadGpsSatelliteSize < count) { RoadGpsSatellites = (RoadGpsObject *) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-16 19:35:22
|
Revision: 2875 http://sourceforge.net/p/roadmap/code/2875 Author: pgf Date: 2015-06-16 19:35:20 +0000 (Tue, 16 Jun 2015) Log Message: ----------- roadmap_gps/gpsd3: make missing gps device detection work better can now detect a device disconnecing from the gpsd daemon. before we could only detect a disconnected daemon. Modified Paths: -------------- trunk/roadmap/src/roadmap.screenobjects trunk/roadmap/src/roadmap_gps.c trunk/roadmap/src/roadmap_gps.h trunk/roadmap/src/roadmap_gpsd3.c Modified: trunk/roadmap/src/roadmap.screenobjects =================================================================== --- trunk/roadmap/src/roadmap.screenobjects 2015-06-16 19:35:17 UTC (rev 2874) +++ trunk/roadmap/src/roadmap.screenobjects 2015-06-16 19:35:20 UTC (rev 2875) @@ -67,6 +67,7 @@ S get_GPS_reception P 20 100 E reception_na +E reception_none --- E reception_none %v/%s E reception_poor %v/%s E reception_good %v/%s Modified: trunk/roadmap/src/roadmap_gps.c =================================================================== --- trunk/roadmap/src/roadmap_gps.c 2015-06-16 19:35:17 UTC (rev 2874) +++ trunk/roadmap/src/roadmap_gps.c 2015-06-16 19:35:20 UTC (rev 2875) @@ -132,8 +132,6 @@ static void roadmap_gps_call_all_listeners (void); -static void roadmap_gps_got_data(void); - roadmap_gps_periodic_control RoadMapGpsPeriodicAdd = &roadmap_gps_no_periodic_control; @@ -167,9 +165,10 @@ int new_state; - if (RoadMapGpsLink.subsystem == ROADMAP_IO_INVALID || - RoadMapGpsLatestData == 0) { + if (RoadMapGpsLink.subsystem == ROADMAP_IO_INVALID) { new_state = GPS_RECEPTION_NA; + } else if (RoadMapGpsLatestData == 0) { + new_state = GPS_RECEPTION_NO_COMM; } else if (RoadMapGpsQuality.dimension == 2) { new_state = GPS_RECEPTION_POOR; } else if (RoadMapGpsQuality.dimension >= 3) { @@ -189,14 +188,8 @@ RoadMapGpsReception = new_state; - if (new_state <= GPS_RECEPTION_NONE) { - /* we want listeners to get at least one notification that - * gps has gone away. - */ - // perhaps this should happen later, after GPS Timeout has - // expired? - roadmap_gps_call_all_listeners (); - } + roadmap_gps_call_all_listeners (); + roadmap_gps_call_all_monitors (); roadmap_state_refresh (); } @@ -254,7 +247,7 @@ * @brief Record the time at which we got GPS data, so we know how old our latest data is. */ static void roadmap_gps_got_data(void) { - RoadMapGpsLatestData = time(NULL); + RoadMapGpsLatestData = time(NULL); } /** @@ -384,6 +377,7 @@ "bad datum '%s': 'NAD83' or 'WGS 84' is required", fields->pgrmm.datum); } + roadmap_gps_got_data(); } /** @@ -396,6 +390,7 @@ RoadMapGpsEstimatedError = roadmap_math_to_current_unit (fields->pgrme.horizontal, fields->pgrme.horizontal_unit); + roadmap_gps_got_data(); } /** @@ -466,6 +461,8 @@ char status = roadmap_gps_update_status (fields->rmc.status); + roadmap_gps_got_data(); + if (status == 'A') { RoadMapGpsReceivedTime = fields->rmc.fixtime; @@ -487,8 +484,6 @@ roadmap_gps_call_all_listeners(); } - - roadmap_gps_got_data(); } /** @@ -501,6 +496,8 @@ int i; + roadmap_gps_got_data(); + RoadMapGpsActiveSatelliteHash = 0; for (i = 0; i < ROADMAP_NMEA_MAX_SATELLITE; i += 1) { @@ -515,8 +512,6 @@ RoadMapGpsQuality.dilution_horizontal = fields->gsa.dilution_horizontal; RoadMapGpsQuality.dilution_vertical = fields->gsa.dilution_vertical; - roadmap_gps_got_data(); - } /** @@ -531,6 +526,8 @@ int id; int index; + roadmap_gps_got_data(); + for (i = 0, index = (fields->gsv.index - 1) * 4; i < 4 && index < fields->gsv.count; i += 1, index += 1) { @@ -572,8 +569,6 @@ RoadMapGpsActiveSatelliteCount = active_count; roadmap_gps_call_all_monitors (); } - - roadmap_gps_got_data(); } /** @@ -644,6 +639,8 @@ int speed, // knots int steering) { + roadmap_gps_got_data(); + status = roadmap_gps_update_status (status); if (status == 'A') { @@ -675,8 +672,6 @@ roadmap_gps_call_all_listeners(); } - - roadmap_gps_got_data(); } /** @@ -718,6 +713,8 @@ } else { + roadmap_gps_got_data(); + int index = sequence - 1; if (index == 0) { @@ -757,6 +754,7 @@ double horizontal, double vertical) { + roadmap_gps_got_data(); RoadMapGpsQuality.dimension = dimension; RoadMapGpsQuality.dilution_position = position; RoadMapGpsQuality.dilution_horizontal = horizontal; @@ -774,6 +772,8 @@ static void roadmap_gps_object_listener (RoadMapDynamicString id, const RoadMapGpsPosition *position) { + roadmap_gps_got_data(); + RoadMapGpsReceivedPosition = *position; (void)roadmap_gps_update_status ('A'); @@ -781,7 +781,6 @@ (*RoadMapGpsNextObjectListener) (id, position); - roadmap_gps_got_data(); } Modified: trunk/roadmap/src/roadmap_gps.h =================================================================== --- trunk/roadmap/src/roadmap_gps.h 2015-06-16 19:35:17 UTC (rev 2874) +++ trunk/roadmap/src/roadmap_gps.h 2015-06-16 19:35:20 UTC (rev 2875) @@ -31,6 +31,7 @@ #include "roadmap_io.h" enum {GPS_RECEPTION_NA = 0, + GPS_RECEPTION_NO_COMM, GPS_RECEPTION_NONE, GPS_RECEPTION_POOR, GPS_RECEPTION_GOOD Modified: trunk/roadmap/src/roadmap_gpsd3.c =================================================================== --- trunk/roadmap/src/roadmap_gpsd3.c 2015-06-16 19:35:17 UTC (rev 2874) +++ trunk/roadmap/src/roadmap_gpsd3.c 2015-06-16 19:35:20 UTC (rev 2875) @@ -242,6 +242,16 @@ return 1; #else + // fprintf(stderr, "%s\n", sentence); + if (!strncmp(sentence, "{\"class\":",9)) /* } */ { + // try to detect: {"class":"DEVICE","path":"/dev/ttyUSB1","activated":0} + roadmap_log (ROADMAP_DEBUG, "gpsd: found 'class'"); + if (strstr(sentence, "\"activated\":0}")) { + roadmap_log (ROADMAP_DEBUG, "gpsd: not online"); + roadmap_gps_satellites (-1, 0, 0, 0, 0, 0); + } + return 0; + } return roadmap_nmea_decode (user_context, decoder_context, sentence); #endif } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-16 19:35:19
|
Revision: 2874 http://sourceforge.net/p/roadmap/code/2874 Author: pgf Date: 2015-06-16 19:35:17 +0000 (Tue, 16 Jun 2015) Log Message: ----------- roadmap_gpsd3: libgps cleanup and fixes. but perhaps not worth it. Modified Paths: -------------- trunk/roadmap/src/roadmap_gpsd3.c Modified: trunk/roadmap/src/roadmap_gpsd3.c =================================================================== --- trunk/roadmap/src/roadmap_gpsd3.c 2015-06-16 19:35:14 UTC (rev 2873) +++ trunk/roadmap/src/roadmap_gpsd3.c 2015-06-16 19:35:17 UTC (rev 2874) @@ -46,10 +46,6 @@ #include "gps.h" #endif -static RoadMapGpsdNavigation RoadmapGpsd2NavigationListener = NULL; -static RoadMapGpsdSatellite RoadmapGpsd2SatelliteListener = NULL; -static RoadMapGpsdDilution RoadmapGpsd2DilutionListener = NULL; - RoadMapSocket gpsd3_socket; #ifdef ROADMAP_USES_LIBGPS #if GPSD_API_MAJOR_VERSION == 5 @@ -95,30 +91,9 @@ #endif /* defined(ROADMAP_USES_LIBGPS) && defined(GPSD_API_MAJOR_VERSION) */ } -void roadmap_gpsd3_subscribe_to_navigation (RoadMapGpsdNavigation navigation) { - - RoadmapGpsd2NavigationListener = navigation; -} - - -void roadmap_gpsd3_subscribe_to_satellites (RoadMapGpsdSatellite satellite) { - - RoadmapGpsd2SatelliteListener = satellite; -} - - -void roadmap_gpsd3_subscribe_to_dilution (RoadMapGpsdDilution dilution) { - - RoadmapGpsd2DilutionListener = dilution; -} - void roadmap_gpsd3_subscriptions(void) { -#ifdef ROADMAP_USES_LIBGPS - roadmap_gpsd3_subscribe_to_navigation (roadmap_gps_navigation); - roadmap_gpsd3_subscribe_to_satellites (roadmap_gps_satellites); - roadmap_gpsd3_subscribe_to_dilution (roadmap_gps_dilution); -#else +#ifndef ROADMAP_USES_LIBGPS roadmap_gps_nmea(); #endif } @@ -146,74 +121,125 @@ int gps_time = 0; - int i, j, s; - static bool used[MAXCHANNELS]; + int i, s; #define MAX_POSSIBLE_SATS (MAXCHANNELS - 2) if (gps_unpack(sentence, gpsdp) < 0) { roadmap_log(ROADMAP_ERROR, "gpsd error %d", errno); + // only roadmap_input can really detect socket errors. not clear + // what this return might be. + return 0; } - if (gpsdp->satellites_visible == 0) - return 0; // No data +#ifdef THIS_DONT_WORK + roadmap_log (ROADMAP_DEBUG, "gpsd set 0x%x online_set %d", + (unsigned int)gpsdp->set, gpsdp->set & ONLINE_SET); - status = (gpsdp->fix.mode >= MODE_2D) ? 'A' : 'V'; + roadmap_log (ROADMAP_DEBUG, "gpsd online %d status %d dev_act %f", + (int)gpsdp->online, gpsdp->status, gpsdp->dev.activated); - if (gpsdp->fix.mode >= MODE_2D) { - if (isnan(gpsdp->fix.longitude) == 0) { - longitude = 1000000 * gpsdp->fix.longitude; - } - if (isnan(gpsdp->fix.latitude) == 0) { - latitude = 1000000 * gpsdp->fix.latitude; - } - if (isnan(gpsdp->fix.speed) == 0) { - speed = gpsdp->fix.speed; - } - if (isnan(gpsdp->fix.altitude) == 0) { - altitude = gpsdp->fix.altitude; - } - if (isnan(gpsdp->fix.time) == 0) { - gps_time = gpsdp->fix.time; - } - if (isnan(gpsdp->fix.track) == 0) { - steering = gpsdp->fix.track; - } + // we get no reports at all while the gps is unplugged, ONLINE_SET + // never happens, and "online" is always 0. + if (!(gpsdp->set & ONLINE_SET)) + return 0; + if (!gpsdp->online) { + roadmap_gps_satellites (-1, 0, 0, 0, 0, 0); + roadmap_gps_navigation ('V', 0, 0, 0, 0, 0, 0); + roadmap_log (ROADMAP_WARNING, "gpsd: not online"); + return 0; // No data } +#endif - RoadmapGpsd2NavigationListener - (status, gps_time, latitude, longitude, altitude, speed, steering); + if (gpsdp->set & SATELLITE_SET) { + if (gpsdp->satellites_visible == 0) { + roadmap_gps_satellites (0, 0, 0, 0, 0, 0); + roadmap_gps_navigation ('V', 0, 0, 0, 0, 0, 0); + roadmap_log (ROADMAP_DEBUG, "gpsd: no satellites"); + gpsdp->set &= ~SATELLITE_SET; + return 0; // No data + } +#if GPSD_API_MAJOR_VERSION == 5 + static bool usedflags[MAXCHANNELS]; + int j; + /* See demo app cgps.c in gpsd source distribution */ + /* Must build bit vector of which satellites are used */ + for (i = 0; i < MAXCHANNELS; i++) { + usedflags[i] = false; + for (j = 0; j < gpsdp->satellites_used; j++) + if (gpsdp->used[j] == gpsdp->PRN[i]) + usedflags[i] = true; + } + + + for (i=0, s=1; i<MAX_POSSIBLE_SATS; i++) { + if (i < gpsdp->satellites_visible) { + roadmap_gps_satellites + (s, // sequence + gpsdp->PRN[i], // id + gpsdp->elevation[i], // elevation + gpsdp->azimuth[i], // azimuth + (int)gpsdp->ss[i], // strength + usedflags[i]); // active + s++; + } + } +#elif GPSD_API_MAJOR_VERSION == 6 + // for version 6, untested + for (i=0, s=1; i<MAX_POSSIBLE_SATS; i++) { + if (i < gpsdp->satellites_visible) { + roadmap_gps_satellites + (s, // sequence + gpsdp->skyview[i]PRN, // id + gpsdp->skyview[i]elevation, // elevation + gpsdp->skyview[i]azimuth, // azimuth + (int)gpsdp->skyview[i]ss, // strength + gpsdp->skyview[i].used); // active + s++; + } + } +#endif + + roadmap_gps_satellites (0, 0, 0, 0, 0, 0); - /* See demo app cgps.c in gpsd source distribution */ - /* Must build bit vector of which satellites are used */ - for (i = 0; i < MAXCHANNELS; i++) { - used[i] = false; - for (j = 0; j < gpsdp->satellites_used; j++) - if (gpsdp->used[j] == gpsdp->PRN[i]) - used[i] = true; + gpsdp->set &= ~SATELLITE_SET; } -#warning 'used' not used. seems fishy. + if (gpsdp->set & (LATLON_SET|SPEED_SET|ALTITUDE_SET|TIME_SET|TRACK_SET)) { + status = (gpsdp->fix.mode >= MODE_2D) ? 'A' : 'V'; - for (i=0, s=1; i<MAX_POSSIBLE_SATS; i++) { - if (gpsdp->used[i]) { - (*RoadmapGpsd2SatelliteListener) - (s, // sequence - gpsdp->PRN[i], // id - gpsdp->elevation[i], // elevation - gpsdp->azimuth[i], // azimuth - (int)gpsdp->ss[i], // strength - gpsdp->used[i]); // active - s++; - } - } - (*RoadmapGpsd2SatelliteListener) (0, 0, 0, 0, 0, 0); + if (gpsdp->fix.mode >= MODE_2D) { + if (isnan(gpsdp->fix.longitude) == 0) { + longitude = 1000000 * gpsdp->fix.longitude; + } + if (isnan(gpsdp->fix.latitude) == 0) { + latitude = 1000000 * gpsdp->fix.latitude; + } + if (isnan(gpsdp->fix.speed) == 0) { + speed = gpsdp->fix.speed; + } + if (isnan(gpsdp->fix.altitude) == 0) { + altitude = gpsdp->fix.altitude; + } + if (isnan(gpsdp->fix.time) == 0) { + gps_time = gpsdp->fix.time; + } + if (isnan(gpsdp->fix.track) == 0) { + steering = gpsdp->fix.track; + } + } + roadmap_gps_navigation + (status, gps_time, latitude, longitude, altitude, speed, steering); - /* Provide dilution */ - if (gpsdp->fix.mode >= MODE_NO_FIX) { - /* No conversion required */ - RoadmapGpsd2DilutionListener(gpsdp->fix.mode, gpsdp->fix.epx, gpsdp->fix.epy, gpsdp->fix.epv); + /* Provide dilution */ + if (gpsdp->fix.mode >= MODE_NO_FIX) { + /* No conversion required */ + roadmap_gps_dilution(gpsdp->fix.mode, gpsdp->fix.epx, gpsdp->fix.epy, gpsdp->fix.epv); + } + + gpsdp->set &= ~(LATLON_SET|SPEED_SET|ALTITUDE_SET|TIME_SET|TRACK_SET); } + return 1; #else return roadmap_nmea_decode (user_context, decoder_context, sentence); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-16 19:35:16
|
Revision: 2873 http://sourceforge.net/p/roadmap/code/2873 Author: pgf Date: 2015-06-16 19:35:14 +0000 (Tue, 16 Jun 2015) Log Message: ----------- roadmap_gps: try and propagate gps failures more quickly Modified Paths: -------------- trunk/roadmap/src/roadmap_gps.c Modified: trunk/roadmap/src/roadmap_gps.c =================================================================== --- trunk/roadmap/src/roadmap_gps.c 2015-06-16 19:35:11 UTC (rev 2872) +++ trunk/roadmap/src/roadmap_gps.c 2015-06-16 19:35:14 UTC (rev 2873) @@ -100,6 +100,9 @@ static void *RoadMapGpsLostFixMessage; static time_t RoadMapGPSLostFixTime; +static void roadmap_gps_call_all_monitors (void); +static void roadmap_gps_call_all_listeners (void); + /* Listeners information (navigation data) ----------------------------- */ static char RoadMapLastKnownStatus = 'A'; @@ -156,7 +159,8 @@ /** * @brief call listeners if we get a new state. - * State is derived from a few inputs, one of which is a heuristic about good reception. + * State is derived from a few inputs, one of which is a heuristic + * about good reception. * Currently this is the only place in RoadMap where a dilution value is used. */ static void roadmap_gps_update_reception (void) { @@ -166,7 +170,6 @@ if (RoadMapGpsLink.subsystem == ROADMAP_IO_INVALID || RoadMapGpsLatestData == 0) { new_state = GPS_RECEPTION_NA; - } else if (RoadMapGpsQuality.dimension == 2) { new_state = GPS_RECEPTION_POOR; } else if (RoadMapGpsQuality.dimension >= 3) { @@ -235,7 +238,10 @@ RoadMapGpsLostFixMessage = roadmap_messagebox ("GPS Error", "GPS lost satellite fix"); RoadMapGPSLostFixTime = time(NULL); - RoadMapGpsActiveSatelliteCount = 0; + // RoadMapGpsActiveSatelliteCount = 0; + RoadMapLastKnownStatus = 'V'; + RoadMapGpsLatestData = 0; + roadmap_gps_update_reception(); } } RoadMapLastKnownStatus = status; @@ -400,7 +406,10 @@ static void roadmap_gps_gga (void *context, const RoadMapNmeaFields *fields) { RoadMapGpsQuality.dilution_horizontal = fields->gga.dilution/100.0; - RoadMapGpsActiveSatelliteCount = fields->gga.count; + if (RoadMapGpsActiveSatelliteCount != fields->gga.count) { + RoadMapGpsActiveSatelliteCount = fields->gga.count; + roadmap_gps_call_all_monitors (); + } if (fields->gga.quality == ROADMAP_NMEA_QUALITY_INVALID) { @@ -692,12 +701,20 @@ int active) { static int active_count; + + if (sequence < 0) { + RoadMapGpsLatestData = 0; + roadmap_gps_update_reception(); + sequence = 0; + } + if (sequence == 0) { /* End of list: propagate the information. */ RoadMapGpsActiveSatelliteCount = active_count; roadmap_gps_call_all_monitors (); + active_count = 0; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-16 19:35:13
|
Revision: 2872 http://sourceforge.net/p/roadmap/code/2872 Author: pgf Date: 2015-06-16 19:35:11 +0000 (Tue, 16 Jun 2015) Log Message: ----------- sprites: add donut-shaped route sprites -- more visible? Modified Paths: -------------- trunk/roadmap/src/sprites Modified: trunk/roadmap/src/sprites =================================================================== --- trunk/roadmap/src/sprites 2015-06-16 19:35:08 UTC (rev 2871) +++ trunk/roadmap/src/sprites 2015-06-16 19:35:11 UTC (rev 2872) @@ -65,10 +65,10 @@ A GreenTrianglePointer S RoutePoint -A Circle-Pointer +A Donut-Circle-Pointer S SecondaryRoutePoint -A Small-Circle-Pointer +A Donut-Small-Circle-Pointer S PersonalLandmark A 5PointStar @@ -293,6 +293,19 @@ L 1,-16 -1,-16 L -1,-16 -1,-7 +S Donut-Circle-Pointer +F green 1 +D 0,0 7 +F white 1 +D 0,0 3 +F black 1 +C 0,0 7 +C 0,0 3 +C 0,0 1 +L 1,-7 1,-16 +L 1,-16 -1,-16 +L -1,-16 -1,-7 + S Small-Circle-Pointer F green 1 D 0,0 6 @@ -302,6 +315,18 @@ L 1,-16 -1,-16 L -1,-16 -1,-6 +S Donut-Small-Circle-Pointer +F green 1 +D 0,0 6 +F white 1 +D 0,0 2 +F black 1 +C 0,0 6 +C 0,0 2 +L 1,-6 1,-16 +L 1,-16 -1,-16 +L -1,-16 -1,-6 + S DottedSquare F black 1 L 9,9 9,-9 -9,-9 -9,9 9,9 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-16 19:35:10
|
Revision: 2871 http://sourceforge.net/p/roadmap/code/2871 Author: pgf Date: 2015-06-16 19:35:08 +0000 (Tue, 16 Jun 2015) Log Message: ----------- roadmap_trip: add control over line thickness for gpx route display Modified Paths: -------------- trunk/roadmap/src/roadmap_trip.c Modified: trunk/roadmap/src/roadmap_trip.c =================================================================== --- trunk/roadmap/src/roadmap_trip.c 2015-06-16 19:35:05 UTC (rev 2870) +++ trunk/roadmap/src/roadmap_trip.c 2015-06-16 19:35:08 UTC (rev 2871) @@ -81,6 +81,9 @@ static RoadMapConfigDescriptor RoadMapConfigTripRouteLineColor = ROADMAP_CONFIG_ITEM("Trip", "Route Connect Color"); +static RoadMapConfigDescriptor RoadMapConfigTripRouteLineThickness = + ROADMAP_CONFIG_ITEM("Trip", "Route Connect Thickness"); + static RoadMapConfigDescriptor RoadMapConfigFocusName = ROADMAP_CONFIG_ITEM("Focus", "Name"); @@ -2531,6 +2534,9 @@ RoadMapTripRouteLinesPen = roadmap_canvas_create_pen ("Map.RouteLines"); roadmap_canvas_set_foreground (roadmap_config_get (&RoadMapConfigTripRouteLineColor)); + roadmap_canvas_set_thickness + (roadmap_config_get_integer + (&RoadMapConfigTripRouteLineThickness)); } else { roadmap_canvas_select_pen (RoadMapTripRouteLinesPen); } @@ -3648,6 +3654,8 @@ ("preferences", &RoadMapConfigTripShowRouteLines, "yes", "no", NULL); roadmap_config_declare ("preferences", &RoadMapConfigTripRouteLineColor, "red"); + roadmap_config_declare + ("preferences", &RoadMapConfigTripRouteLineThickness, "2"); roadmap_config_declare_enumeration ("preferences", &RoadMapConfigBackupFiles , "yes", "no", NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-16 19:35:07
|
Revision: 2870 http://sourceforge.net/p/roadmap/code/2870 Author: pgf Date: 2015-06-16 19:35:05 +0000 (Tue, 16 Jun 2015) Log Message: ----------- roadmap_math_trip_set_distance: add greppable clues for %format usage Modified Paths: -------------- trunk/roadmap/src/roadmap_math.c Modified: trunk/roadmap/src/roadmap_math.c =================================================================== --- trunk/roadmap/src/roadmap_math.c 2015-06-16 19:35:00 UTC (rev 2869) +++ trunk/roadmap/src/roadmap_math.c 2015-06-16 19:35:05 UTC (rev 2870) @@ -1640,12 +1640,12 @@ distance_far = roadmap_math_to_trip_distance_tenths (distance); if (distance_far > 0) { - roadmap_message_set (which, "%d.%d %s", + roadmap_message_set (which, "%d.%d %s", // 'x', 'y', 'Y', 'D', 'W' distance_far/10, distance_far%10, roadmap_math_trip_unit ()); } else { - roadmap_message_set (which, "%d %s", + roadmap_message_set (which, "%d %s", // 'x', 'y', 'Y', 'D', 'W' distance, roadmap_math_distance_unit ()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-16 19:35:02
|
Revision: 2869 http://sourceforge.net/p/roadmap/code/2869 Author: pgf Date: 2015-06-16 19:35:00 +0000 (Tue, 16 Jun 2015) Log Message: ----------- Makefile: make uninstall more robust Modified Paths: -------------- trunk/roadmap/src/Makefile Modified: trunk/roadmap/src/Makefile =================================================================== --- trunk/roadmap/src/Makefile 2015-06-16 19:34:57 UTC (rev 2868) +++ trunk/roadmap/src/Makefile 2015-06-16 19:35:00 UTC (rev 2869) @@ -640,12 +640,12 @@ $@ uninstall: - cd $(pkgdatadir) && rm -rf $(PKGDATAFILES) default basemaps - cd $(pkgbindir) && rm -f $(BUILD) $(SCRIPTS) $(DRIVERS) + -test -d $(pkgdatadir) && cd $(pkgdatadir) && rm -rf $(PKGDATAFILES) default basemaps + -test -d $(pkgbindir) && cd $(pkgbindir) && rm -f $(BUILD) $(SCRIPTS) $(DRIVERS) -test -d $(menudir) && rm -f $(menudir)/roadmap $(MAKE) -C icons uninstall - cd $(desktopdir) && rm -f roadmap.desktop - cd $(man1dir) && rm -f $(MANPAGES) + -test -d $(desktopdir) && cd $(desktopdir) && rm -f roadmap.desktop + -test -d $(man1dir) && cd $(man1dir) && rm -f $(MANPAGES) for module in $(RDMODULES) ; \ do \ if [ -d $$module ] ; then \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-16 19:34:59
|
Revision: 2868 http://sourceforge.net/p/roadmap/code/2868 Author: pgf Date: 2015-06-16 19:34:57 +0000 (Tue, 16 Jun 2015) Log Message: ----------- map info: add fips list and centered quadtile file to logging Modified Paths: -------------- trunk/roadmap/src/roadmap_start.c Modified: trunk/roadmap/src/roadmap_start.c =================================================================== --- trunk/roadmap/src/roadmap_start.c 2015-06-13 20:23:04 UTC (rev 2867) +++ trunk/roadmap/src/roadmap_start.c 2015-06-16 19:34:57 UTC (rev 2868) @@ -309,7 +309,7 @@ roadmap_math_to_floatstring(clat, pos.latitude, MILLIONTHS); roadmap_math_to_floatstring(clon, pos.longitude, MILLIONTHS); - roadmap_log (ROADMAP_WARNING, "%s,%s %s x %s", clat, clon, + roadmap_log (ROADMAP_WARNING, "center: %s,%s %s x %s", clat, clon, roadmap_message_get('x'), roadmap_message_get('y')); roadmap_math_screen_edges (&screen); @@ -319,9 +319,42 @@ roadmap_math_to_floatstring(e, screen.east, MILLIONTHS); /* s, w, n, e */ - roadmap_log (ROADMAP_WARNING, "%s,%s:%s,%s", s, w, n, e); + roadmap_log (ROADMAP_WARNING, "edges %s,%s:%s,%s", s, w, n, e); + { + int fips, tileid, i, count, bits = 0, *fipslist = NULL; + char *ellipsis = ""; + char buf[200], *bp; + count = roadmap_locator_by_position (&pos, &fipslist); + if (count) { + if (count > 5) { + count = 5; + ellipsis = " ..."; + } + bp = buf; + bp += sprintf(bp, "fips: "); + for (i = count; i >= 0; i--) { + fips = fipslist[i]; + if (fips < 0) { // quadtile + bp += sprintf(bp, "0x%x%c", -fips, (i<count)?',':' '); + if (!bits) // assume all the same + bits = tileid2bits(-fips); + } else { + bp += sprintf(bp, "%d%c", -fips, (i<count)?',':' '); + } + } + bp += sprintf(bp, "%s", ellipsis); + roadmap_log (ROADMAP_WARNING, "%s", buf); + tileid = roadmap_osm_latlon2tileid(pos.latitude, pos.longitude, bits), + roadmap_log (ROADMAP_WARNING, "quadtile: %s", + roadmap_osm_filename(NULL, 1, tileid, ".rdm")); + } + free(fipslist); + } + + + snprintf(map_info, sizeof(map_info), "Map view area: %s wide by %s high\n" "Map center (lat,lon): %s, %s\n" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-13 20:23:06
|
Revision: 2867 http://sourceforge.net/p/roadmap/code/2867 Author: pgf Date: 2015-06-13 20:23:04 +0000 (Sat, 13 Jun 2015) Log Message: ----------- add ability to toggle POI display on/off layers can be assigned to groups. the UI can toggle layer visibility based on those groups. currently the UI only toggles group 1, and all POIs are assigned to group 1. Modified Paths: -------------- trunk/roadmap/src/default/All trunk/roadmap/src/roadmap_layer.c trunk/roadmap/src/roadmap_layer.h trunk/roadmap/src/roadmap_screen.c trunk/roadmap/src/roadmap_screen.h trunk/roadmap/src/roadmap_start.c Modified: trunk/roadmap/src/default/All =================================================================== --- trunk/roadmap/src/default/All 2015-06-13 20:23:00 UTC (rev 2866) +++ trunk/roadmap/src/default/All 2015-06-13 20:23:04 UTC (rev 2867) @@ -128,43 +128,52 @@ .Declutter: 450 .LabelDeclutter: 10 .LabelFontSize: 10 + .Group: 1 Cafe.Sprite: Cafe .Declutter: 450 .LabelDeclutter: 10 .LabelFontSize: 10 + .Group: 1 Fuel.Sprite: Fuel .Declutter: 1300 .LabelDeclutter: 10 .LabelFontSize: 10 + .Group: 1 Drinks.Sprite: Drinks .Declutter: 450 .LabelDeclutter: 10 .LabelFontSize: 10 + .Group: 1 ATM.Sprite: ATM .Declutter: 450 .LabelDeclutter: 10 .LabelFontSize: 10 + .Group: 1 Hotel.Sprite: Hotel .Declutter: 450 .LabelDeclutter: 10 .LabelFontSize: 10 + .Group: 1 Motel.Sprite: Motel .Declutter: 450 .LabelDeclutter: 10 .LabelFontSize: 10 + .Group: 1 Guesthouse.Sprite: Guesthouse .Declutter: 450 .LabelDeclutter: 10 .LabelFontSize: 10 + .Group: 1 Hostel.Sprite: Hostel .Declutter: 450 .LabelDeclutter: 10 .LabelFontSize: 10 + .Group: 1 Modified: trunk/roadmap/src/roadmap_layer.c =================================================================== --- trunk/roadmap/src/roadmap_layer.c 2015-06-13 20:23:00 UTC (rev 2866) +++ trunk/roadmap/src/roadmap_layer.c 2015-06-13 20:23:04 UTC (rev 2867) @@ -95,6 +95,7 @@ static char *RoadMapNavigationMode[ROADMAP_MAX_NAVIGATION_MODES]; static unsigned int RoadMapNavigationModeCount = 0; +static int RoadMapLayerGroupsHidden; /* ----------------------------------------------------------- */ /** @@ -165,6 +166,9 @@ RoadMapConfigDescriptor speed; /**< max speed */ RoadMapConfigDescriptor sprite; + RoadMapConfigDescriptor group; /**< group(s) this layer belongs to. bitmapped! */ + + } RoadMapLayer; static unsigned int RoadMapMaxUsedPen = 1; @@ -248,11 +252,25 @@ return class; } +void roadmap_layer_set_group_visibility(int group, int hide) +{ + if (hide) + RoadMapLayerGroupsHidden |= group; + else + RoadMapLayerGroupsHidden &= ~group; +} + static int roadmap_layer_is_visible (RoadMapLayer *layer) { - int d = roadmap_config_get_integer (&layer->declutter), - r = roadmap_math_declutter (d); + int d, r; + + d = roadmap_config_get_integer (&layer->group); + if (RoadMapLayerGroupsHidden & d) + return 0; + + d = roadmap_config_get_integer (&layer->declutter); + r = roadmap_math_declutter (d); return r; } @@ -881,6 +899,10 @@ layer->thickness.name = "Thickness"; roadmap_config_declare (class_config, &layer->thickness, "1"); + layer->group.category = layernames[i]; + layer->group.name = "Group"; + roadmap_config_declare (class_config, &layer->group, "0"); + layer->declutter.category = layernames[i]; layer->declutter.name = "Declutter"; roadmap_config_declare (class_config, &layer->declutter, "99999"); Modified: trunk/roadmap/src/roadmap_layer.h =================================================================== --- trunk/roadmap/src/roadmap_layer.h 2015-06-13 20:23:00 UTC (rev 2866) +++ trunk/roadmap/src/roadmap_layer.h 2015-06-13 20:23:04 UTC (rev 2867) @@ -87,6 +87,8 @@ int roadmap_layer_navigable (int mode, int *layers, int size); +void roadmap_layer_set_group_visibility(int group, int hide); + 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); Modified: trunk/roadmap/src/roadmap_screen.c =================================================================== --- trunk/roadmap/src/roadmap_screen.c 2015-06-13 20:23:00 UTC (rev 2866) +++ trunk/roadmap/src/roadmap_screen.c 2015-06-13 20:23:04 UTC (rev 2867) @@ -134,6 +134,7 @@ static int RoadMapScreenOrientationDynamic = 1; static int RoadMapScreen3dHorizon; static int RoadMapScreenLabels; +static int RoadMapScreenPOIs; static int RoadMapScreenRotation; static int RoadMapScreenWidth; static int RoadMapScreenHeight; @@ -2178,6 +2179,13 @@ roadmap_start_request_repaint_map(REPAINT_NOW); } +void roadmap_screen_toggle_POIs (void) { + + RoadMapScreenPOIs = ! RoadMapScreenPOIs; + roadmap_layer_set_group_visibility(1, RoadMapScreenPOIs ); + roadmap_start_request_repaint_map(REPAINT_NOW); +} + void roadmap_screen_toggle_orientation_mode (void) { RoadMapScreenOrientationDynamic = ! RoadMapScreenOrientationDynamic; Modified: trunk/roadmap/src/roadmap_screen.h =================================================================== --- trunk/roadmap/src/roadmap_screen.h 2015-06-13 20:23:00 UTC (rev 2866) +++ trunk/roadmap/src/roadmap_screen.h 2015-06-13 20:23:04 UTC (rev 2867) @@ -49,6 +49,7 @@ void roadmap_screen_move_left (void); void roadmap_screen_toggle_view_mode (void); +void roadmap_screen_toggle_POIs (void); void roadmap_screen_toggle_labels (void); void roadmap_screen_toggle_orientation_mode (void); void roadmap_screen_increase_horizon (void); Modified: trunk/roadmap/src/roadmap_start.c =================================================================== --- trunk/roadmap/src/roadmap_start.c 2015-06-13 20:23:00 UTC (rev 2866) +++ trunk/roadmap/src/roadmap_start.c 2015-06-13 20:23:04 UTC (rev 2867) @@ -726,6 +726,9 @@ {"togglelabels", "Show/Hide Street Labels", "Labels", NULL, "Show or Hide the names of streets", NULL, roadmap_screen_toggle_labels}, + {"togglepoi", "Show/Hide Points of Interest", "POIs", NULL, + "Show or Hide restaurants, hotels, etc.", NULL, roadmap_screen_toggle_POIs}, + {"toggleorientation", "Dynamic/Fixed Orientation", "", NULL, "Toggle orientation mode dynamic / fixed", NULL, roadmap_screen_toggle_orientation_mode}, @@ -968,6 +971,7 @@ "togglebasemap", "togglelabels", + "togglepoi", "toggleorientation", "toggleview", "increasehorizon", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-13 20:23:02
|
Revision: 2866 http://sourceforge.net/p/roadmap/code/2866 Author: pgf Date: 2015-06-13 20:23:00 +0000 (Sat, 13 Jun 2015) Log Message: ----------- buildmap_osm_text.c: add support for lodging places hotels are expressed two different ways in OSM. sometimes they're just places, i.e. nodes, with a name and a tourism tag. but often they're a way, with building and tourism tags. 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-06-13 20:22:57 UTC (rev 2865) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-06-13 20:23:00 UTC (rev 2866) @@ -82,14 +82,16 @@ int nWayNodes; /**< number of nodes known for this way */ int WayLayer; /**< the layer for this way */ - char *WayStreetName; /**< the street name */ + char *WayName; /**< the street name */ char *WayStreetRef; /**< street code, to be used when no name (e.g. motorway) */ int WayFlags; /**< properties of this way, from the table flags */ int WayIsOneWay; /**< is this way one direction only */ + int WayIsBuilding; /**< this way represents a building */ + char *WayTourism; /**< value of tourism tag, if any */ int WayAdminLevel; /**< boundaries */ - int WayTerritorial; /* is this a territorial boundary? */ + int WayTerritorial; /**< is this a territorial boundary? */ int WayCoast; /**< coastline */ int WayIsInteresting; /**< this way is interesting for RoadMap */ } wi; @@ -98,13 +100,12 @@ * @brief variables referring to the current node */ static struct NodeInfo { - nodeid_t NodeId; /**< which node */ + 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 *NodeName; /**< which town */ - char *NodePostalCode; /**< postal code */ + char *NodeName; /**< what's it's name? */ int NodeLon, /**< coordinates */ NodeLat; /**< coordinates */ int NodeFakeFips; /**< fake postal code */ @@ -174,8 +175,9 @@ static void buildmap_osm_text_reset_way(void) { - if (wi.WayStreetName) free(wi.WayStreetName); + if (wi.WayName) free(wi.WayName); if (wi.WayStreetRef) free(wi.WayStreetRef); + if (wi.WayTourism) free(wi.WayTourism); memset(&wi, 0, sizeof(wi)); } @@ -187,7 +189,6 @@ { if (ni.NodePlace) free(ni.NodePlace); if (ni.NodeName) free(ni.NodeName); - if (ni.NodePostalCode) free(ni.NodePostalCode); memset(&ni, 0, sizeof(ni)); } @@ -291,8 +292,7 @@ buildmap_verbose("finishing %f %f %s %s layer: %d", (float)ni.NodeLat/1000000.0, (float)ni.NodeLon/1000000.0, ni.NodePlace, ni.NodeName, ni.NodeLayer); - s = buildmap_dictionary_add (DictionaryCity, - (char *) ni.NodeName, strlen(ni.NodeName)); + s = str2dict (DictionaryCity, (char *) ni.NodeName); buildmap_place_add(s, ni.NodeLayer, point); } else { buildmap_verbose("dropping %s %s", ni.NodePlace, ni.NodeName); @@ -556,20 +556,21 @@ } int -buildmap_osm_get_layer(char *tag, char *value, int *flags, int *layer) +buildmap_osm_get_layer(int lookfor, char *tag, char *value, int *flags, int *layer) { - int i; - layer_info_t *list; + int i,j; + value_info_t *value_list; - for (i=1; list_info[i].osm_name != 0; i++) { - if (strcmp(tag, list_info[i].osm_name) == 0) { - list = list_info[i].list; - if (list) { - for (i=1; list[i].osm_name; i++) { - if (strcmp(value, list[i].osm_name) == 0) { - *flags = list[i].flags; - if (list[i].layerp) - *layer = *(list[i].layerp); + for (i=1; tag_info[i].osm_tname != 0; i++) { + if ((lookfor & tag_info[i].flags) && + strcmp(tag, tag_info[i].osm_tname) == 0) { + value_list = tag_info[i].value_list; + if (value_list) { + for (j=1; value_list[j].osm_vname; j++) { + if (strcmp(value, value_list[j].osm_vname) == 0) { + *flags = value_list[j].flags; + if (value_list[j].layerp) + *layer = *(value_list[j].layerp); return 1; } } @@ -601,7 +602,7 @@ // characters, e.g. "Cortina d'Ampezzo". but i assume that if // a placename actually contained a '"', then the XML escape // mechanisms would be used, and not single quotes. -// summary: stop parsing for 'string'. +// summary: stop parsing for 'string', just get "string". #ifdef BEFORE s = sscanf(data, "tag k=%*['\"]%[^\"']%*['\"] v=%*['\"]%[^\"']%*['\"]", tagk, tagv); @@ -612,34 +613,29 @@ if (s != 2) buildmap_fatal(0, "fail to scanf tag k and v (%s)", data); - if (strcmp(tagk, "place") == 0 || /* <tag k="place" v="town"/> */ - strcmp(tagk, "amenity") == 0) { /* <tag k="amenity" v="fuel"/> */ - if (ni.NodePlace) - free(ni.NodePlace); - ni.NodePlace = strdup(tagv); - if (catalog) { - saveInterestingNode(ni.NodeId); - buildmap_verbose("saving node %u info k %s v %s", - ni.NodeId, tagk, tagv); - } - if (!buildmap_osm_get_layer(tagk, tagv, - &ni.NodeFlags, &ni.NodeLayer)) { - buildmap_verbose("no layer found for node %u info k %s v %s", - ni.NodeId, tagk, tagv); - } - buildmap_verbose("layer for node %u info k %s v %s is %d", - ni.NodeId, tagk, tagv, ni.NodeLayer); - } else if (strcmp(tagk, "name") == 0) { + if (strcmp(tagk, "name") == 0) { /* <tag k="name" v="Herent"/> */ if (ni.NodeName) free(ni.NodeName); ni.NodeName = FromXmlAndDup(tagv); if (catalog) { saveInterestingNode(ni.NodeId); - // buildmap_verbose("saving node %u info k %s v %s", ni.NodeId, tagk, tagv); } } else { + if (!buildmap_osm_get_layer(PLACE, tagk, tagv, + &ni.NodeFlags, &ni.NodeLayer)) { + return; + } + if (ni.NodeFlags & PLACE) { + if (ni.NodePlace) + free(ni.NodePlace); + ni.NodePlace = strdup(tagv); + if (catalog) { + saveInterestingNode(ni.NodeId); + } + } else { buildmap_debug("dropping node %u info k %s v %s", ni.NodeId, tagk, tagv); + } } } @@ -676,9 +672,9 @@ /* street names */ if (strcasecmp(tag, "name") == 0) { - if (wi.WayStreetName) - free(wi.WayStreetName); - wi.WayStreetName = FromXmlAndDup(value); + if (wi.WayName) + free(wi.WayName); + wi.WayName = FromXmlAndDup(value); return; } @@ -689,23 +685,34 @@ return; } +#ifdef BUILDMAP_NAVIGATION_SUPPORT if (strcasecmp(tag, "oneway") == 0 && strcasecmp(value, "yes") == 0) { wi.WayIsOneWay = ROADMAP_LINE_DIRECTION_ONEWAY; return; } +#endif if (strcasecmp(tag, "building") == 0) { if (strcasecmp(value, "yes") == 0) { /* what else would the value be? */ - wi.WayIsInteresting = 0; + wi.WayIsBuilding = 1; } return; } - + + if (strcasecmp(tag, "tourism") == 0) { + if (wi.WayTourism) + free(wi.WayTourism); + wi.WayTourism = FromXmlAndDup(value); + return; + } + if (strcasecmp(tag, "admin_level") == 0) { wi.WayAdminLevel = atoi(value); + return; } else if (strcasecmp(tag, "border_type") == 0) { wi.WayTerritorial = !strcasecmp(value, "territorial"); + return; } else if (strcasecmp(tag, "natural") == 0 && strcasecmp(value, "coastline") == 0) { wi.WayCoast = 1; @@ -714,10 +721,20 @@ /* * Get layer info */ - buildmap_osm_get_layer(tag, value, &wi.WayFlags, &wi.WayLayer); + buildmap_osm_get_layer(ANY, tag, value, &wi.WayFlags, &wi.WayLayer); } +void +buildmap_osm_text_way_drop_uninteresting(void) +{ + if (wi.WayIsBuilding) { + if (!wi.WayTourism) { + wi.WayIsInteresting = 0; + } + } +} + /** * @brief We found an end tag for a way, so we must have read all * the required data. Process it. @@ -725,10 +742,10 @@ * @return error indication */ void -buildmap_osm_text_way_finish(char *data) +buildmap_osm_text_way_finish(void) { int from_point, to_point, line, street; - int fromlon, tolon, fromlat, tolat; + int fromlon, fromlat; RoadMapString rms_dirp, rms_dirs, rms_type, rms_name; int j; char compound_name[1024]; @@ -742,20 +759,22 @@ l_boundary = buildmap_layer_get("boundaries");; if (wi.WayId == 0) - buildmap_fatal(0, "Wasn't in a way (%s)", data); + buildmap_fatal(0, "Wasn't in a way"); if (wi.nWayNodes < 1) { buildmap_osm_text_reset_way(); return; } - from_point = buildmap_osm_text_point_get(WayNodes[0]); - to_point = buildmap_osm_text_point_get(WayNodes[wi.nWayNodes-1]); - fromlon = buildmap_point_get_longitude(from_point); - fromlat = buildmap_point_get_latitude(from_point); - tolon = buildmap_point_get_longitude(to_point); - tolat = buildmap_point_get_latitude(to_point); + if (wi.WayIsBuilding) { + if (wi.WayTourism) { + buildmap_osm_get_layer(PLACE, "tourism", wi.WayTourism, &wi.WayFlags, &wi.WayLayer); + } else { + buildmap_osm_text_reset_way(); + return; + } + } if (wi.WayLayer == 0) { /* if a way is both a coast and a boundary, treat it only as coast */ @@ -766,14 +785,18 @@ /* also ignore territorial (marine) borders */ if (wi.WayAdminLevel > 4 || wi.WayTerritorial) { wi.WayIsInteresting = 0; - } + } else if (wi.WayAdminLevel > 2) { - /* if we're not (roughly) in north america, - * discard state boundaries as well. */ - if ((wi.WayAdminLevel > 2) && - (fromlon > -32 || fromlat < 17)) { - /* east of the azores or south of mexico */ - wi.WayIsInteresting = 0; + from_point = buildmap_osm_text_point_get(WayNodes[0]); + fromlon = buildmap_point_get_longitude(from_point); + fromlat = buildmap_point_get_latitude(from_point); + + /* if we're not (roughly) in north america, + * discard state boundaries as well. */ + if (fromlon > -32 || fromlat < 17) { + /* east of the azores or south of mexico */ + wi.WayIsInteresting = 0; + } } wi.WayLayer = l_boundary; @@ -782,7 +805,7 @@ if ( !wi.WayIsInteresting || wi.WayLayer == 0) { wayid_t *wp; - buildmap_debug("discarding way %d, not interesting (%s)", wi.WayId, data); + buildmap_debug("discarding way %d, not interesting (%s)", wi.WayId, wi.WayName); wp = isWayInteresting(wi.WayId); if (wp) { WayTableCopy[wp-WayTable] = 0; @@ -798,7 +821,52 @@ rms_name = 0; - if ((wi.WayFlags & AREA) && (fromlon == tolon) && (fromlat == tolat)) { + if ((wi.WayFlags & PLACE) && wi.WayTourism) { + /* we're finishing a way, but the flags may say PLACE if + * we're treating a polygon as a place, for instance. find + * the center of the bounding box (which is good enough, for + * these purposes), and make it into a place. + */ + int minlat = 999999999, maxlat = -999999999; + int minlon = 999999999, maxlon = -999999999; + int point, lon, lat; + + for (j = 0; j < wi.nWayNodes; j++) { + point = buildmap_osm_text_point_get(WayNodes[j]); + lon = buildmap_point_get_longitude(point); + lat = buildmap_point_get_latitude(point); + + if (lat < minlat) minlat = lat; + if (lat > maxlat) maxlat = lat; + if (lon < minlon) minlon = lon; + if (lon > maxlon) maxlon = lon; + } + + lat = (maxlat + minlat) / 2; + lon = (maxlon + minlon) / 2; + + /* this code looks like buildmap_osm_text_node_finish() */ + point = buildmap_point_add(lon, lat); + buildmap_osm_text_point_add(ni.NodeId, point); + + if (wi.WayName && wi.WayTourism) { + if (wi.WayLayer) { + RoadMapString s; + buildmap_verbose("wayplace: finishing %f %f %s %s layer: %d", + (float)lat/1000000.0, (float)lon/1000000.0, + wi.WayTourism, wi.WayName, wi.WayLayer); + s = str2dict (DictionaryCity, (char *) wi.WayName); + buildmap_place_add(s, wi.WayLayer, point); + } else { + buildmap_verbose("dropping %s %s", wi.WayTourism, wi.WayName); + } + } + + + } else if ((wi.WayFlags & AREA) && + (WayNodes[0] == WayNodes[wi.nWayNodes-1])) { + /* see http://wiki.openstreetmap.org/wiki/The_Future_of_Areas + * for why the above conditions are simplistic */ static int polyid = 0; static int cenid = 0; @@ -809,7 +877,7 @@ cenid++; polyid++; - rms_name = str2dict(DictionaryStreet, wi.WayStreetName); + rms_name = str2dict(DictionaryStreet, wi.WayName); buildmap_polygon_add_landmark (nPolygons, wi.WayLayer, rms_name); buildmap_polygon_add(nPolygons, cenid, polyid); @@ -840,13 +908,9 @@ int *lonsbuf, *latsbuf; - /* Map begin and end points to internal point id */ - // from_point = buildmap_osm_text_point_get(WayNodes[0]); - // to_point = buildmap_osm_text_point_get(WayNodes[wi.nWayNodes-1]); - /* Street name */ buildmap_debug ("Way %d [%s] ref [%s]", wi.WayId, - wi.WayStreetName ? wi.WayStreetName : "", + wi.WayName ? wi.WayName : "", wi.WayStreetRef ? wi.WayStreetRef : ""); if (wi.WayStreetRef) { @@ -865,16 +929,20 @@ n = compound_name; *d = '\0'; - if (wi.WayStreetName) { - // sprintf(d, ", %s", wi.WayStreetName); - sprintf(d, "%s%s", ENDASHSEP, wi.WayStreetName); + if (wi.WayName) { + // sprintf(d, ", %s", wi.WayName); + sprintf(d, "%s%s", ENDASHSEP, wi.WayName); } } else { - n = wi.WayStreetName; + n = wi.WayName; } rms_name = str2dict(DictionaryStreet, n); LineId++; + /* Map begin and end points to internal point id */ + from_point = buildmap_osm_text_point_get(WayNodes[0]); + to_point = buildmap_osm_text_point_get(WayNodes[wi.nWayNodes-1]); + line = buildmap_line_add(LineId, wi.WayLayer, from_point, to_point, wi.WayIsOneWay); @@ -1267,6 +1335,8 @@ wi.WayIsInteresting = 0; } + buildmap_osm_text_way_drop_uninteresting(); + /* if the way is still flagged interesting, save it */ if (wi.WayId && wi.WayIsInteresting) saveInterestingWay(wi.WayId); @@ -1278,6 +1348,8 @@ if (wi.WayId) buildmap_osm_text_way_tag(p); + else + buildmap_osm_text_node_tag(p, 0); continue; } else if (strncasecmp(p, "/osm>", 5) == 0) { @@ -1488,7 +1560,7 @@ } else if (strncasecmp(p, "/way", 4) == 0) { if (wi.WayIsInteresting) - buildmap_osm_text_way_finish(p); + buildmap_osm_text_way_finish(); continue; } else if (strncasecmp(p, "nd", 2) == 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-13 20:22:59
|
Revision: 2865 http://sourceforge.net/p/roadmap/code/2865 Author: pgf Date: 2015-06-13 20:22:57 +0000 (Sat, 13 Jun 2015) Log Message: ----------- sprites: add lodging sprites Modified Paths: -------------- trunk/roadmap/src/sprites Modified: trunk/roadmap/src/sprites =================================================================== --- trunk/roadmap/src/sprites 2015-06-13 20:22:54 UTC (rev 2864) +++ trunk/roadmap/src/sprites 2015-06-13 20:22:57 UTC (rev 2865) @@ -127,6 +127,18 @@ S ATM A Money +S Hotel +A Bed + +S Motel +A BedAndWheel + +S GuestHouse +A BedAndWindow + +S Hostel +A TwoBeds + # The actual drawing sprites: S BlueDart @@ -584,3 +596,36 @@ F white 1 P -2,-1 -2,4 2,4 2,-1 +S Bed +F gray 2 +L -8,9 -8,5 8,5 8,9 +L -8,5 -8,-2 +P -6,3 -6,0 7,0 7,3 + +S BedAndWheel +F gray 2 +L -8,9 -8,5 8,5 8,9 +L -8,5 -8,-2 +P -6,3 -6,0 7,0 7,3 +C 0,9 4 +D 0,9 2 + +S BedAndWindow +F gray 2 +L -8,17 -8,13 8,13 8,17 +L -8,13 -8,6 +P -6,11 -6,8 7,8 7,11 +L -3,6 5,6 5,-2 -3,-2 -3,6 +L 1,6 1,-2 +L -3,2 5,2 + +S TwoBeds +F gray 2 +L -8,16 -8,12 8,12 8,16 8,3 -8,3 -8,-4 -8,12 +P -6,1 -6,-2 6,-2 6,1 +P -6,10 -6,7 6,7 6,10 + +S Hut +F gray 2 +L -5,4 -5,14 5,14 5,4 -5,4 +L -6,5 0,-2 6,5 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-13 20:22:56
|
Revision: 2864 http://sourceforge.net/p/roadmap/code/2864 Author: pgf Date: 2015-06-13 20:22:54 +0000 (Sat, 13 Jun 2015) Log Message: ----------- default/All: add lodging layers Modified Paths: -------------- trunk/roadmap/src/default/All Modified: trunk/roadmap/src/default/All =================================================================== --- trunk/roadmap/src/default/All 2015-06-13 20:22:51 UTC (rev 2863) +++ trunk/roadmap/src/default/All 2015-06-13 20:22:54 UTC (rev 2864) @@ -1,7 +1,7 @@ Class.Name: All Class.Lines: Freeways Ramps Highways Streets Trails Rivers Shore Railroads Boundaries Class.Polygons: Lakes Sea Parks Hospitals Airports Stations Schools Malls Nature Amenity -Class.Places: City Town Village Hamlet Suburbs Food Cafe Drinks Fuel ATM +Class.Places: City Town Village Hamlet Suburbs Food Cafe Drinks Fuel ATM Hotel Motel Guesthouse Hostel Class.NavigationModes: Car Bike Foot Boat Navigation.Car: Freeways Ramps Highways Streets Navigation.Bike: Streets Trails Shore Parks @@ -148,3 +148,23 @@ .Declutter: 450 .LabelDeclutter: 10 .LabelFontSize: 10 + +Hotel.Sprite: Hotel + .Declutter: 450 + .LabelDeclutter: 10 + .LabelFontSize: 10 + +Motel.Sprite: Motel + .Declutter: 450 + .LabelDeclutter: 10 + .LabelFontSize: 10 + +Guesthouse.Sprite: Guesthouse + .Declutter: 450 + .LabelDeclutter: 10 + .LabelFontSize: 10 + +Hostel.Sprite: Hostel + .Declutter: 450 + .LabelDeclutter: 10 + .LabelFontSize: 10 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-13 20:22:53
|
Revision: 2863 http://sourceforge.net/p/roadmap/code/2863 Author: pgf Date: 2015-06-13 20:22:51 +0000 (Sat, 13 Jun 2015) Log Message: ----------- buildmap_osm_layers.h: cleanup, some data structure renaming Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_layers.h Modified: trunk/roadmap/src/buildmap_osm_layers.h =================================================================== --- trunk/roadmap/src/buildmap_osm_layers.h 2015-06-13 20:22:48 UTC (rev 2862) +++ trunk/roadmap/src/buildmap_osm_layers.h 2015-06-13 20:22:51 UTC (rev 2863) @@ -21,20 +21,22 @@ */ -#define LINE 0 -#define AREA 1 -#define PLACE 2 +#define LINE 1 +#define AREA 2 +#define PLACE 4 +#define ANY 7 -typedef struct layer_info { - char *osm_name; +typedef struct { + char *osm_vname; int *layerp; int flags; -} layer_info_t; +} value_info_t; -typedef struct layer_info_sublist { - char *osm_name; - layer_info_t *list; -} layer_info_sublist_t; +typedef struct { + char *osm_tname; + value_info_t *value_list; + int flags; +} tag_info_t; /* declare storage for the layer indices */ @@ -58,7 +60,7 @@ BuildMapDictionary DictionaryCity; -layer_info_t highway_to_layer[] = { +value_info_t highway_to_layer[] = { { 0, NULL, 0 }, { "motorway", &Freeways, LINE }, { "motorway_link", &Freeways, LINE }, @@ -85,7 +87,7 @@ { 0, NULL, 0 }, }; -layer_info_t cycleway_to_layer[] = { +value_info_t cycleway_to_layer[] = { { 0, NULL, 0 }, { "lane", &Trails, LINE }, { "track", &Trails, LINE }, @@ -94,20 +96,20 @@ { 0, NULL, 0 }, }; -layer_info_t aeroway_to_layer[] = { +value_info_t aeroway_to_layer[] = { { 0, NULL, 0 }, { "runway", &Airports, AREA }, { "aerodrome", &Airports, AREA }, { 0, NULL, 0 }, }; -layer_info_t landuse_to_layer[] = { +value_info_t landuse_to_layer[] = { { 0, NULL, 0 }, { "reservoir", &Lakes, AREA }, { 0, NULL, 0 }, }; -layer_info_t waterway_to_layer[] = { +value_info_t waterway_to_layer[] = { { 0, NULL, 0 }, { "river", &Rivers, LINE }, { "canal", &Rivers, LINE }, @@ -128,7 +130,7 @@ { 0, NULL, 0 }, }; -layer_info_t railway_to_layer[] = { +value_info_t railway_to_layer[] = { { 0, NULL, 0 }, { "rail", &Railroads, LINE }, { "tram", &Railroads, LINE }, @@ -149,7 +151,7 @@ { 0, NULL, 0 }, }; -layer_info_t natural_to_layer[] = { +value_info_t natural_to_layer[] = { { 0, NULL, 0 }, { "coastline", &Shore, LINE }, { "water", &Lakes, AREA }, @@ -159,57 +161,55 @@ { 0, NULL, 0 }, }; -layer_info_t amenity_to_layer[] = { +value_info_t amenity_to_layer[] = { { 0, NULL, 0 }, { "hospital", &Hospitals, LINE }, { "pub", &Drinks, PLACE }, - { "parking", &Amenity, AREA }, - { "post_office", &Amenity, LINE }, + // { "parking", &Parking, AREA }, + // { "post_office", &Postoffice, LINE }, { "fuel", &Fuel, PLACE }, { "school", &Schools, AREA }, - { "supermarket", &Amenity, LINE }, - { "library", &Amenity, LINE }, - { "police", &Amenity, LINE }, - { "fire_station", &Amenity, LINE }, + // { "supermarket", NULL, LINE }, + // { "library", NULL, LINE }, + // { "police", &Police, LINE }, + // { "fire_station", NULL, LINE }, { "restaurant", &Food, PLACE }, { "fast_food", &Food, PLACE }, - { "place_of_worship", &Amenity, LINE }, + // { "place_of_worship", NULL, LINE }, { "cafe", &Cafe, PLACE }, - { "bicycle_parking", &Amenity, AREA }, - { "public_building", &Amenity, AREA }, + // { "bicycle_parking", NULL, AREA }, + // { "public_building", NULL, AREA }, { "grave_yard", &Parks, AREA }, { "university", &Schools, AREA }, { "college", &Schools, AREA }, - { "townhall", &Amenity, AREA }, + // { "townhall", NULL, AREA }, { "food_court", &Food, PLACE }, { "bbq", &Food, PLACE }, { "bar", &Drinks, PLACE }, { "biergarten", &Drinks, PLACE }, - { "ferry_terminal", &Amenity, AREA }, - { "car_sharing", &Amenity, AREA }, - { "taxi", &Amenity, AREA }, + // { "ferry_terminal", NULL, AREA }, + // { "car_sharing", NULL, AREA }, + // { "taxi", NULL, AREA }, { "atm", &ATM, PLACE }, - { "arts_centre", &Amenity, AREA }, - { "community_centre", &Amenity, AREA }, - { "social_centre", &Amenity, AREA }, - { "courthouse", &Amenity, LINE }, - { "crematorium", &Amenity, LINE }, - { "embassy", &Amenity, LINE }, - { "marketplace", &Amenity, AREA }, - { "prison", &Amenity, AREA }, - { "shelter", &Amenity, AREA }, - { "bicycle parking", &Amenity, AREA }, - { "public building", &Amenity, AREA }, + // { "arts_centre", NULL, AREA }, + // { "community_centre", NULL, AREA }, + // { "social_centre", NULL, AREA }, + // { "courthouse", NULL, LINE }, + // { "crematorium", NULL, LINE }, + // { "embassy", NULL, LINE }, + // { "marketplace", NULL, AREA }, + // { "prison", NULL, AREA }, + // { "shelter", NULL, AREA }, { 0, NULL, 0 }, }; -layer_info_t place_to_layer[] = { +value_info_t place_to_layer[] = { { 0, NULL, 0 }, - { "continent", NULL, LINE }, - { "country", NULL, LINE }, - { "state", NULL, LINE }, - { "region", NULL, LINE }, - { "county", NULL, LINE }, + // { "continent", NULL, LINE }, + // { "country", NULL, LINE }, + // { "state", NULL, LINE }, + // { "region", NULL, LINE }, + // { "county", NULL, LINE }, { "city", &City, PLACE }, { "town", &Town, PLACE }, { "village", &Village, PLACE }, @@ -218,38 +218,28 @@ { 0, NULL, 0 }, }; -layer_info_t leisure_to_layer[] = { +value_info_t leisure_to_layer[] = { { 0, NULL, 0 }, { "park", &Parks, AREA }, { "common", &Parks, AREA }, { "garden", &Parks, AREA }, { "nature_reserve", &Parks, AREA }, - { "pitch", &Amenity, AREA }, - { "track", &Amenity, AREA }, - { "marina", &Amenity, AREA }, - { "stadium", &Amenity, AREA }, { "golf_course", &Parks, AREA }, - { "sports_centre", &Amenity, AREA }, - { "sports centre", &Amenity, AREA }, { "dog_park", &Parks, AREA }, { "playground", &Parks, AREA }, - { "ice_rink", &Amenity, AREA }, - { "miniature_golf", &Amenity, AREA }, - { "dance", &Amenity, AREA }, - { "swimming_pool", &Amenity, AREA }, { "golf course", &Parks, AREA }, { 0, NULL, 0 }, }; -layer_info_t historic_to_layer[] = { +value_info_t historic_to_layer[] = { { 0, NULL, 0 }, { "castle", &Castle, PLACE }, - { "archaeological_site",NULL, AREA }, - { "ruins", NULL, AREA }, + // { "archaeological_site",NULL, AREA }, + // { "ruins", NULL, AREA }, { 0, NULL, 0 }, }; -layer_info_t tourism_to_layer[] = { +value_info_t tourism_to_layer[] = { { 0, NULL, 0 }, { "hotel", &Hotel, PLACE }, { "motel", &Motel, PLACE }, @@ -259,21 +249,24 @@ { 0, NULL, 0 }, }; -layer_info_sublist_t list_info[] = { - {0, NULL }, - {"highway", highway_to_layer }, - {"cycleway", cycleway_to_layer }, - {"waterway", waterway_to_layer }, - {"railway", railway_to_layer }, - {"leisure", leisure_to_layer }, - {"amenity", amenity_to_layer }, - {"tourism", tourism_to_layer }, - {"historic", historic_to_layer }, - {"landuse", landuse_to_layer }, - {"aeroway", aeroway_to_layer }, - {"natural", natural_to_layer }, - {"place", place_to_layer }, - { 0, NULL }, + +/* set the third column to a specific type only if that table + * contains _only_ that type */ +tag_info_t tag_info[] = { + {0, NULL, 0 }, + {"highway", highway_to_layer, ANY }, + {"cycleway", cycleway_to_layer, ANY }, + {"waterway", waterway_to_layer, ANY }, + {"railway", railway_to_layer, ANY }, + {"leisure", leisure_to_layer, ANY }, + {"amenity", amenity_to_layer, ANY }, + {"tourism", tourism_to_layer, PLACE }, + {"historic", historic_to_layer, PLACE }, + {"landuse", landuse_to_layer, ANY }, + {"aeroway", aeroway_to_layer, ANY }, + {"natural", natural_to_layer, ANY }, + {"place", place_to_layer, PLACE }, + { 0, NULL, 0 }, }; /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-13 20:22:50
|
Revision: 2862 http://sourceforge.net/p/roadmap/code/2862 Author: pgf Date: 2015-06-13 20:22:48 +0000 (Sat, 13 Jun 2015) Log Message: ----------- buildmap_osm: clean up layer management much easier to add a new layer now. there's still the huge problem that the class file Classes at map build time must exactly match the class file Classes at roadmap run time. this should be fixed someday. Modified Paths: -------------- trunk/roadmap/src/Makefile trunk/roadmap/src/buildmap_osm_main.c trunk/roadmap/src/buildmap_osm_text.c trunk/roadmap/src/buildmap_osm_text.h trunk/roadmap/src/config.mk trunk/roadmap/src/default/All Added Paths: ----------- trunk/roadmap/src/buildmap_osm_layer_list.h trunk/roadmap/src/buildmap_osm_layers.h Removed Paths: ------------- trunk/roadmap/src/buildmap_osm_common.c trunk/roadmap/src/buildmap_osm_common.h Modified: trunk/roadmap/src/Makefile =================================================================== --- trunk/roadmap/src/Makefile 2015-06-13 20:22:44 UTC (rev 2861) +++ trunk/roadmap/src/Makefile 2015-06-13 20:22:48 UTC (rev 2862) @@ -119,7 +119,6 @@ buildmap_layer.c \ buildmap_tiger.c \ buildmap_shapefile.c \ - buildmap_osm_common.c \ buildmap_osm_text.c \ buildmap_empty.c \ buildmap_place.c \ @@ -194,7 +193,8 @@ buildmap_line.h \ buildmap_metadata.h \ buildmap_opt.h \ - buildmap_osm_common.h \ + buildmap_osm_layers.h \ + buildmap_osm_layer_list.h \ buildmap_osm_text.h \ buildmap_place.h \ buildmap_point.h \ Deleted: trunk/roadmap/src/buildmap_osm_common.c =================================================================== --- trunk/roadmap/src/buildmap_osm_common.c 2015-06-13 20:22:44 UTC (rev 2861) +++ trunk/roadmap/src/buildmap_osm_common.c 2015-06-13 20:22:48 UTC (rev 2862) @@ -1,720 +0,0 @@ -/* - * LICENSE: - * - * Copyright (c) 2007 Paul Fox - * Copyright (c) 2008, 2010, 2011, Danny Backx - * - * This file is part of RoadMap. - * - * RoadMap is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * RoadMap is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with RoadMap; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/** - * @file - * @brief a module to convert OSM (OpenStreetMap) data into RoadMap maps. - * - * This file contains the static data. - * - * See http://wiki.openstreetmap.org/wiki/Map_Features - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <sys/mman.h> -#include <time.h> - - -#include "roadmap.h" -#include "roadmap_types.h" -#include "roadmap_math.h" -#include "roadmap_path.h" -#include "roadmap_file.h" -#include "roadmap_osm.h" - -#include "buildmap.h" -#include "buildmap_zip.h" -#include "buildmap_city.h" -#include "buildmap_square.h" -#include "buildmap_point.h" -#include "buildmap_line.h" -#include "buildmap_street.h" -#include "buildmap_range.h" -#include "buildmap_area.h" -#include "buildmap_shape.h" -#include "buildmap_polygon.h" - -#include "buildmap_layer.h" -#include "buildmap_osm_common.h" - -/* Road layers. */ - -int BuildMapLayerFreeway; -int BuildMapLayerRamp; -int BuildMapLayerMain; -int BuildMapLayerStreet; -int BuildMapLayerTrail; -int BuildMapLayerRail; - -/* Area layers. */ - -int BuildMapLayerPark; -int BuildMapLayerHospital; -int BuildMapLayerAirport; -int BuildMapLayerStation; -int BuildMapLayerMall; -int BuildMapLayerSchool; - -int BuildMapLayerNature; -int BuildMapLayerAmenity; -int BuildMapLayerCity; -int BuildMapLayerTown; -int BuildMapLayerVillage; -int BuildMapLayerHamlet; -int BuildMapLayerSuburbs; -int BuildMapLayerPeak; - -/* Water layers. */ - -int BuildMapLayerShoreline; -int BuildMapLayerRiver; -int BuildMapLayerCanal; -int BuildMapLayerLake; -int BuildMapLayerSea; - -int BuildMapLayerBoundary; - -int BuildMapLayerFood; -int BuildMapLayerCafe; -int BuildMapLayerDrinks; -int BuildMapLayerFuel; -int BuildMapLayerATM; - -int BuildMapLayerHotel; -int BuildMapLayerMotel ; -int BuildMapLayerGuestHouse; -int BuildMapLayerHostel; -int BuildMapLayerHut; - -/* These defines are simply shorthand notation, to make - * the tables below easier to manage - */ -#define FREEWAY &BuildMapLayerFreeway -#define RAMP &BuildMapLayerRamp -#define MAIN &BuildMapLayerMain -#define STREET &BuildMapLayerStreet -#define TRAIL &BuildMapLayerTrail -#define RAIL &BuildMapLayerRail - -#define PARK &BuildMapLayerPark -#define HOSPITAL &BuildMapLayerHospital -#define AIRPORT &BuildMapLayerAirport -#define STATION &BuildMapLayerStation -#define MALL &BuildMapLayerMall -#define SCHOOL &BuildMapLayerSchool - -#define SHORELINE &BuildMapLayerShoreline -#define RIVER &BuildMapLayerRiver -#define CANAL &BuildMapLayerCanal -#define LAKE &BuildMapLayerLake -#define SEA &BuildMapLayerSea - -#define NATURE &BuildMapLayerNature -#define PEAK &BuildMapLayerPeak -#define AMENITY &BuildMapLayerAmenity -#define BOUNDARY &BuildMapLayerBoundary - -#define CITY &BuildMapLayerCity -#define TOWN &BuildMapLayerTown -#define VILLAGE &BuildMapLayerVillage -#define HAMLET &BuildMapLayerHamlet -#define SUBURBS &BuildMapLayerSuburbs - -#define FOOD &BuildMapLayerFood -#define CAFE &BuildMapLayerCafe -#define DRINKS &BuildMapLayerDrinks -#define FUEL &BuildMapLayerFuel -#define ATM &BuildMapLayerATM - -#define HOTEL &BuildMapLayerHotel -#define MOTEL &BuildMapLayerMotel -#define GUEST_HOUSE &BuildMapLayerGuestHouse -#define HOSTEL &BuildMapLayerHostel -#define HUT &BuildMapLayerHut - -BuildMapDictionary DictionaryPrefix; -BuildMapDictionary DictionaryStreet; -BuildMapDictionary DictionaryType; -BuildMapDictionary DictionarySuffix; -BuildMapDictionary DictionaryCity; - -/** - * @brief initialize layers - */ -void buildmap_osm_common_find_layers (void) { - - BuildMapLayerFreeway = buildmap_layer_get ("freeways"); - BuildMapLayerRamp = buildmap_layer_get ("ramps"); - BuildMapLayerMain = buildmap_layer_get ("highways"); - BuildMapLayerStreet = buildmap_layer_get ("streets"); - BuildMapLayerTrail = buildmap_layer_get ("trails"); - BuildMapLayerRail = buildmap_layer_get ("railroads"); - - BuildMapLayerPark = buildmap_layer_get ("parks"); - BuildMapLayerHospital = buildmap_layer_get ("hospitals"); - BuildMapLayerAirport = buildmap_layer_get ("airports"); - BuildMapLayerStation = buildmap_layer_get ("stations"); - BuildMapLayerMall = buildmap_layer_get ("malls"); - BuildMapLayerSchool = buildmap_layer_get ("schools"); - - BuildMapLayerShoreline = buildmap_layer_get ("shore"); - BuildMapLayerRiver = buildmap_layer_get ("rivers"); - BuildMapLayerCanal = buildmap_layer_get ("canals"); - BuildMapLayerLake = buildmap_layer_get ("lakes"); - BuildMapLayerSea = buildmap_layer_get ("sea"); - - BuildMapLayerNature = buildmap_layer_get ("nature"); - BuildMapLayerPeak = buildmap_layer_get ("peak"); - BuildMapLayerAmenity = buildmap_layer_get ("amenity"); - BuildMapLayerBoundary = buildmap_layer_get ("boundaries"); - - 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"); - - BuildMapLayerFuel = buildmap_layer_get ("fuel"); - BuildMapLayerFood = buildmap_layer_get ("food"); - BuildMapLayerCafe = buildmap_layer_get ("cafe"); - BuildMapLayerDrinks = buildmap_layer_get ("drinks"); - BuildMapLayerATM = buildmap_layer_get ("atm"); - - BuildMapLayerHotel = buildmap_layer_get ("hotel"); - BuildMapLayerMotel = buildmap_layer_get ("motel"); - BuildMapLayerGuestHouse= buildmap_layer_get ("guesthouse"); - BuildMapLayerHostel = buildmap_layer_get ("hostel"); - BuildMapLayerHut = buildmap_layer_get ("hut"); -} - -char *stringtype[] = { - "name", - "name_left", - "name_right", - "name_other", - "int_name", - "nat_name", - "reg_name", - "loc_name", - "old_name", - "ref", - "int_ref", - "nat_ref", - "reg_ref", - "loc_ref", - "old_ref", - "ncn_ref", - "rcn_ref", - "lcn_ref", - "icao", - "iata", - "place_name", - "place_numbers", - "postal_code", - "is_in", - "note", - "description", - "image", - "source", - "source_ref", - "created_by", -}; - -char *datetype[] = { - "date_on", - "date_off", - "start_date", - "end_date", -}; - -#if NEEDED -char *numeric_type[] = { - "lanes", - "layer", - "ele", - "width", - "est_width", - "maxwidth", - "maxlength", - "maxspeed", - "minspeed", - "day_on", - "day_off", - "hour_on", - "hour_off", - "maxweight", - "maxheight", -}; -#endif - -layer_info_t highway_to_layer[] = { - { 0, NULL, 0 }, - { "motorway", FREEWAY, 0 }, /* 1 */ - { "motorway_link", FREEWAY, 0 }, /* 2 */ - { "trunk", FREEWAY, 0 }, /* 3 */ - { "trunk_link", FREEWAY, 0 }, /* 4 */ - { "primary", MAIN, 0 }, /* 5 */ - { "primary_link", MAIN, 0 }, /* 6 */ - { "secondary", STREET, 0 }, /* 7 */ - { "tertiary", STREET, 0 }, /* 8 */ - { "unclassified", STREET, 0 }, /* 9 */ - { "minor", STREET, 0 }, /* 10 */ - { "residential", STREET, 0 }, /* 11 */ - { "service", STREET, 0 }, /* 12 */ - { "track", TRAIL, 0 }, /* 13 */ - { "cycleway", TRAIL, 0 }, /* 14 */ - { "bridleway", TRAIL, 0 }, /* 15 */ - { "footway", TRAIL, 0 }, /* 16 */ - { "steps", TRAIL, 0 }, /* 17 */ - { "pedestrian", TRAIL, 0 }, /* 18 */ - { "pathway", TRAIL, 0 }, /* 19 */ - { "road", STREET, 0 }, /* 20 */ /* New - ok ? */ - { "secondary_link", STREET, 0 }, /* 21 */ /* New - ok ? */ - { "path", TRAIL, 0 }, /* 22 */ /* New - ok ? */ - { 0, NULL, 0 }, -}; - -layer_info_t cycleway_to_layer[] = { - { 0, NULL, 0 }, - { "lane", TRAIL, 0 }, /* 1 */ - { "track", TRAIL, 0 }, /* 2 */ - { "opposite_lane", TRAIL, 0 }, /* 3 */ - { "opposite_track", TRAIL, 0 }, /* 4 */ - { "opposite", NULL, 0 }, /* 5 */ - { 0, NULL, 0 }, -}; - -layer_info_t landuse_to_layer[] = { - { "reservoir", LAKE, AREA }, -}; - -layer_info_t waterway_to_layer[] = { - { 0, NULL, 0 }, - { "river", RIVER, 0 }, /* 1 */ - { "canal", RIVER, 0 }, /* 2 */ - { "stream", RIVER, 0 }, /* 3 */ - { "drain", RIVER, 0 }, /* 4 */ - { "dock", RIVER, 0 }, /* 5 */ - { "lock_gate", RIVER, 0 }, /* 6 */ - { "turning_point", RIVER, 0 }, /* 7 */ - { "aquaduct", RIVER, 0 }, /* 8 */ - { "boatyard", RIVER, 0 }, /* 9 */ - { "water_point", RIVER, 0 }, /* 10 */ - { "weir", RIVER, 0 }, /* 11 */ - { "dam", RIVER, 0 }, /* 12 */ - { "riverbank", RIVER, 0 }, /* 13 */ /* New - ok ? */ - { "ditch", RIVER, 0 }, /* 14 */ /* New - ok ? */ - { 0, NULL, 0 }, -}; - -layer_info_t abutters_to_layer[] = { - { 0, NULL, 0 }, - { "residential", NULL, 0 }, /* 1 */ - { "retail", NULL, 0 }, /* 2 */ - { "industrial", NULL, 0 }, /* 3 */ - { "commercial", NULL, 0 }, /* 4 */ - { "mixed", NULL, 0 }, /* 5 */ - { 0, NULL, 0 }, -}; - -layer_info_t railway_to_layer[] = { - { 0, NULL, 0 }, - { "rail", RAIL, 0 }, /* 1 */ - { "tram", RAIL, 0 }, /* 2 */ - { "light_rail", RAIL, 0 }, /* 3 */ - { "subway", RAIL, 0 }, /* 4 */ - { "station", NULL, 0 }, /* 5 */ - { "preserved", RAIL, 0 }, /* 6 */ - { "disused", RAIL, 0 }, /* 7 */ - { "abandoned", RAIL, 0 }, /* 8 */ - { "narrow_gauge", RAIL, 0 }, /* 9 */ - { "monorail", RAIL, 0 }, /* 10 */ - { "halt", RAIL, 0 }, /* 11 */ - { "tram_stop", RAIL, 0 }, /* 12 */ - { "viaduct", RAIL, 0 }, /* 13 */ - { "crossing", RAIL, 0 }, /* 14 */ - { "level_crossing", RAIL, 0 }, /* 15 */ - { "subway_entrance", RAIL, 0 }, /* 16 */ - { "turntable", RAIL, 0 }, /* 17 */ - { 0, NULL, 0 }, -}; - -layer_info_t natural_to_layer[] = { - { 0, NULL, 0 }, - { "coastline", SHORELINE, 0 }, /* 1 */ - { "water", LAKE, AREA }, /* 2 */ - { "wood", NATURE, AREA }, /* 3 */ - { "peak", PEAK, PLACE }, /* 4 */ - { "land", NULL, AREA }, /* 5 */ - { "bay", NULL, AREA }, /* 6 */ - { "beach", NULL, AREA }, /* 7 */ - { "cave_entrance", NULL, AREA }, /* 8 */ - { "cliff", NULL, AREA }, /* 9 */ - { "fell", NULL, AREA }, /* 10 */ - { "glacier", NULL, AREA }, /* 11 */ - { "heath", NULL, AREA }, /* 12 */ - { "marsh", NULL, AREA }, /* 13 */ - { "mud", NULL, AREA }, /* 14 */ - { "sand", NULL, AREA }, /* 15 */ - { "scree", NULL, AREA }, /* 16 */ - { "scrub", NULL, AREA }, /* 17 */ - { "sprint", NULL, AREA }, /* 18 */ - { "stone", NULL, AREA }, /* 19 */ - { "tree", NULL, AREA }, /* 20 */ - { "volcano", PEAK, PLACE }, /* 21 */ - { "wetland", NULL, AREA }, /* 22 */ - { 0, NULL, 0 }, -}; - -layer_info_t boundary_to_layer[] = { - { 0, NULL, 0 }, - { "administrative", NULL, 0 }, /* 1 */ - { "civil", NULL, AREA }, /* 2 */ - { "political", NULL, 0 }, /* 3 */ - { "national_park", NULL, AREA }, /* 4 */ - { "world_country", NULL, 0 }, /* 5 */ - { 0, NULL, 0 }, -}; - -layer_info_t amenity_to_layer[] = { - { 0, NULL, 0 }, - { "hospital", HOSPITAL, 0 }, /* 1 */ - { "pub", DRINKS, PLACE }, /* 2 */ - { "parking", AMENITY, AREA }, /* 3 */ - { "post_office", AMENITY, 0 }, /* 4 */ - { "fuel", FUEL, PLACE }, /* 5 */ - { "telephone", NULL, 0 }, /* 6 */ - { "toilets", NULL, 0 }, /* 7 */ - { "post_box", NULL, 0 }, /* 8 */ - { "school", SCHOOL, AREA }, /* 9 */ - { "supermarket", AMENITY, 0 }, /* 10 */ - { "library", AMENITY, 0 }, /* 11 */ - { "theatre", NULL, 0 }, /* 12 */ - { "cinema", NULL, 0 }, /* 13 */ - { "police", AMENITY, 0 }, /* 14 */ - { "fire_station", AMENITY, 0 }, /* 15 */ - { "restaurant", FOOD, PLACE }, /* 16 */ - { "fast_food", FOOD, PLACE }, /* 17 */ /* Changed */ - { "bus_station", NULL, 0 }, /* 18 */ - { "place_of_worship", AMENITY, 0 }, /* 19 */ - { "cafe", CAFE, PLACE }, /* 20 */ - { "bicycle_parking", AMENITY, AREA }, /* 21 */ - { "public_building", AMENITY, AREA }, /* 22 */ - { "grave_yard", PARK, AREA }, /* 23 */ - { "university", SCHOOL, AREA }, /* 24 */ - { "college", SCHOOL, AREA }, /* 25 */ - { "townhall", AMENITY, AREA }, /* 26 */ - { "food_court", FOOD, PLACE }, /* 27 */ - { "drinking_water", NULL, 0 }, /* 28 */ - { "bbq", FOOD, PLACE }, /* 28 */ - { "bar", DRINKS, PLACE }, /* 29 */ - { "biergarten", DRINKS, PLACE }, /* 30 */ - { "ice_cream", NULL, 0 }, /* 31 */ - { "kindergarten", NULL, 0 }, /* 32 */ - { "ice_cream", NULL, 0 }, /* 33 */ - { "ferry_terminal", AMENITY, AREA }, /* 34 */ - { "bicycle_rental", NULL, 0 }, /* 35 */ - { "car_rental", NULL, 0 }, /* 36 */ - { "car_sharing", AMENITY, AREA }, /* 37 */ - { "car_wash", NULL, 0 }, /* 38 */ - { "grit_bin", NULL, 0 }, /* 39 */ - { "taxi", AMENITY, AREA }, /* 40 */ - { "atm", ATM, PLACE }, /* 41 */ - { "bank", NULL, 0 }, /* 42 */ - { "bureau_de_change", NULL, 0 }, /* 43 */ - { "pharmacy", NULL, 0 }, /* 44 */ - { "baby_hatch", NULL, 0 }, /* 45 */ - { "dentist", NULL, 0 }, /* 46 */ - { "doctor", NULL, 0 }, /* 47 */ - { "social_facility", NULL, 0 }, /* 48 */ - { "veterinary", NULL, 0 }, /* 49 */ - { "architect_office", NULL, 0 }, /* 50 */ - { "arts_centre", AMENITY, AREA }, /* 51 */ - { "community_centre", AMENITY, AREA }, /* 52 */ - { "social_centre", AMENITY, AREA }, /* 53 */ - { "fountain", NULL, 0 }, /* 51 */ - { "nightclub", NULL, 0 }, /* 51 */ - { "stripclub", NULL, 0 }, /* 51 */ - { "studio", NULL, 0 }, /* 54 */ - { "bench", NULL, 0 }, /* 55 */ - { "brothel", NULL, 0 }, /* 56 */ - { "clock", NULL, 0 }, /* 57 */ - { "courthouse", AMENITY, 0 }, /* 58 */ - { "crematorium", AMENITY, 0 }, /* 59 */ - { "embassy", AMENITY, 0 }, /* 60 */ - { "hunting_stand", NULL, 0 }, /* 61 */ - { "marketplace", AMENITY, AREA }, /* 62 */ - { "prison", AMENITY, AREA }, /* 63 */ - { "recycling", NULL, 0 }, /* 64 */ - { "sauna", NULL, 0 }, /* 65 */ - { "shelter", AMENITY, AREA }, /* 66 */ - { "vending_machine", NULL, 0 }, /* 67 */ - { "waste_basket", NULL, 0 }, /* 68 */ - { "waste_disposal", NULL, 0 }, /* 69 */ - { "watering_place", NULL, 0 }, /* 70 */ - { "bicycle parking", AMENITY, AREA }, /* 71 */ - { "public building", AMENITY, AREA }, /* 72 */ - { 0, NULL, 0 }, -}; - -layer_info_t place_to_layer[] = { - { 0, NULL, 0 }, - { "continent", NULL, 0 }, /* 1 */ - { "country", NULL, 0 }, /* 2 */ - { "state", NULL, 0 }, /* 3 */ - { "region", NULL, 0 }, /* 4 */ - { "county", NULL, 0 }, /* 5 */ - { "city", CITY, PLACE }, /* 6 */ - { "town", TOWN, PLACE }, /* 7 */ - { "village", VILLAGE, PLACE }, /* 8 */ - { "hamlet", HAMLET, PLACE }, /* 9 */ - { "suburb", SUBURBS, PLACE }, /* 10 */ - { 0, NULL, 0 }, -}; - -layer_info_t leisure_to_layer[] = { - { 0, NULL, 0 }, - { "park", PARK, AREA }, /* 1 */ - { "common", PARK, AREA }, /* 2 */ - { "garden", PARK, AREA }, /* 3 */ - { "nature_reserve", PARK, AREA }, /* 4 */ - { "fishing", NULL, AREA }, /* 5 */ - { "slipway", NULL, 0 }, /* 6 */ - { "water_park", NULL, AREA }, /* 7 */ - { "pitch", AMENITY, AREA }, /* 8 */ - { "track", AMENITY, AREA }, /* 9 */ - { "marina", AMENITY, AREA }, /* 10 */ - { "stadium", AMENITY, AREA }, /* 11 */ - { "golf_course", PARK, AREA }, /* 12 */ - { "sports_centre", AMENITY, AREA }, /* 13 */ - { "sports centre", AMENITY, AREA }, /* 14 */ - { "dog_park", PARK, AREA }, /* 15 */ - { "playground", PARK, AREA }, /* 16 */ - { "ice_rink", AMENITY, AREA }, /* 17 */ - { "miniature_golf", AMENITY, AREA }, /* 18 */ - { "dance", AMENITY, AREA }, /* 19 */ - { "swimming_pool", AMENITY, AREA }, /* 20 */ - { "golf course", PARK, AREA }, /* 21 */ - { 0, NULL, 0 }, -}; - -layer_info_t historic_to_layer[] = { - { 0, NULL, 0 }, - { "castle", NULL, 0 }, /* 1 */ - { "monument", NULL, 0 }, /* 2 */ - { "museum", NULL, 0 }, /* 3 */ - { "archaeological_site",NULL, AREA }, /* 4 */ - { "icon", NULL, 0 }, /* 5 */ - { "ruins", NULL, AREA }, /* 6 */ - { 0, NULL, 0 }, -}; - -layer_info_t tourism_to_layer[] = { - { 0, NULL, 0 }, - { "hotel", HOTEL, PLACE }, /* 1 */ - { "motel", MOTEL, PLACE }, /* 2 */ - { "guest_house", GUEST_HOUSE, PLACE }, /* 3 */ - { "hostel", HOSTEL, PLACE }, /* 4 */ - { "alpine_hut", HUT, PLACE }, /* 5 */ - { 0, NULL, 0 }, -}; - -#if NEEDED -char *oneway_type[] = { - 0, - "no", /* 0 */ - "yes", /* 1 */ - "-1" /* 2 */ -}; -#endif - -layer_info_t office_to_layer[] = { - { 0, NULL, 0 }, - { "accountant", NULL, 0 }, - { "architect", NULL, 0 }, - { "company", NULL, 0 }, - { "employment_agency", NULL, 0 }, - { "estate_agent", NULL, 0 }, - { "government", NULL, 0 }, - { "insurance", NULL, 0 }, - { "it", NULL, 0 }, - { "lawyer", NULL, 0 }, - { "newspaper", NULL, 0 }, - { "ngo", NULL, 0 }, - { "quango", NULL, 0 }, - { "research", NULL, 0 }, - { "telecommunication", NULL, 0 }, - { "travel_agent", NULL, 0 }, - { 0, NULL, 0 }, -}; - -layer_info_t barrier_to_layer[] = { - { 0, NULL, 0 }, - { "hedge", NULL, 0 }, - { "fence", NULL, 0 }, - { "wall", NULL, 0 }, - { "ditch", NULL, 0 }, - { "retaining_wall", NULL, 0 }, - { "city_wall", NULL, 0 }, - { "bollard", NULL, 0 }, - { "cycle_barrier", NULL, 0 }, - { "block", NULL, 0 }, - { "cattle_grid", NULL, 0 }, - { "toll_booth", NULL, 0 }, - { "entrance", NULL, 0 }, - { "gate", NULL, 0 }, - { "lift_gate", NULL, 0 }, - { "stile", NULL, 0 }, - { "horse_stile", NULL, 0 }, - { "kissing_gate", NULL, 0 }, - { "sally_port", NULL, 0 }, - { "turnstile", NULL, 0 }, - { "kent_carriage_gap", NULL, 0 }, - { 0, NULL, 0 }, -}; - -layer_info_t craft_to_layer[] = { - { 0, NULL, 0 }, - { "agricultural_engines", NULL, 0 }, - { "basket_maker", NULL, 0 }, - { "beekeeper", NULL, 0 }, - { "blacksmith", NULL, 0 }, - { "boatbuilder", NULL, 0 }, - { "carpenter", NULL, 0 }, - { "carpet_layer", NULL, 0 }, - { "caterer", NULL, 0 }, - { "clockmaker", NULL, 0 }, - { "confectionery", NULL, 0 }, - { "electrician", NULL, 0 }, - { "gardener", NULL, 0 }, - { "handicraft", NULL, 0 }, - { "hvac", NULL, 0 }, - { "jeweller", NULL, 0 }, - { "locksmith", NULL, 0 }, - { "metal_construction", NULL, 0 }, - { "optician", NULL, 0 }, - { "painter", NULL, 0 }, - { "photographer", NULL, 0 }, - { "photographic_laboratory", NULL, 0 }, - { "plasterer", NULL, 0 }, - { "plumber", NULL, 0 }, - { "pottery", NULL, 0 }, - { "roofer", NULL, 0 }, - { "shoemaker", NULL, 0 }, - { "scaffolder", NULL, 0 }, - { "stonemason", NULL, 0 }, - { "sweep", NULL, 0 }, - { "tailor", NULL, 0 }, - { "tiler", NULL, 0 }, - { "sailmaker", NULL, 0 }, - { "rigger", NULL, 0 }, - { "saddler", NULL, 0 }, - { "sculptor", NULL, 0 }, - { "upholsterer", NULL, 0 }, - { 0, NULL, 0 }, -}; - -layer_info_t emergency_to_layer[] = { - { 0, NULL, 0 }, - { "ambulance_station", NULL, AREA }, - { "fire_extinguisher", NULL, 0 }, - { "fire_flapper", NULL, 0 }, - { "fire_hose", NULL, 0 }, - { "fire_hydrant", NULL, 0 }, - { "phone", NULL, 0 }, - { "ses_station", NULL, 0 }, - { "siren", NULL, 0 }, - { 0, NULL, 0 }, -}; - -layer_info_t geological_to_layer[] = { - { 0, NULL, 0 }, - { "palaeontological_site", NULL, 0 }, - { 0, NULL, 0 }, -}; - -layer_info_sublist_t list_info[] = { - {0, NULL, NULL }, - {"highway", highway_to_layer, NULL }, - {"cycleway", cycleway_to_layer, NULL }, - {"tracktype", NULL, TRAIL }, - {"waterway", waterway_to_layer, RIVER }, - {"railway", railway_to_layer, NULL }, - {"aeroway", NULL, NULL }, - {"aerialway", NULL, NULL }, - {"power", NULL, NULL }, - {"man_made", NULL, NULL }, - {"leisure", leisure_to_layer, NULL }, - {"amenity", amenity_to_layer, NULL }, - {"shop", NULL, NULL }, - {"tourism", tourism_to_layer, NULL }, - {"historic", historic_to_layer, NULL }, - {"landuse", landuse_to_layer, NULL }, - {"military", NULL, NULL }, - {"natural", natural_to_layer, NULL }, - {"route", NULL, NULL }, - {"boundary", boundary_to_layer, NULL }, - {"sport", NULL, NULL }, - {"abutters", abutters_to_layer, NULL }, - {"fenced", NULL, NULL }, - {"lit", NULL, NULL }, - {"area", NULL, NULL }, - {"bridge", NULL, MAIN }, - {"cutting", NULL, NULL }, - {"embankment", NULL, NULL }, - {"surface", NULL, NULL }, - {"access", NULL, NULL }, - {"bicycle", NULL, NULL }, - {"foot", NULL, NULL }, - {"goods", NULL, NULL }, - {"hgv", NULL, NULL }, - {"horse", NULL, NULL }, - {"motorcycle", NULL, NULL }, - {"motorcar", NULL, NULL }, - {"psv", NULL, NULL }, - {"motorboat", NULL, NULL }, - {"boat", NULL, NULL }, - {"oneway", NULL, NULL }, - {"noexit", NULL, NULL }, - {"toll", NULL, NULL }, - {"place", place_to_layer, NULL }, - {"lock", NULL, NULL }, - {"attraction", NULL, NULL }, - {"wheelchair", NULL, NULL }, - {"junction", NULL, NULL }, - {"office", office_to_layer, NULL }, - {"barrier", barrier_to_layer, NULL }, - {"craft", craft_to_layer, NULL }, - {"emergency", emergency_to_layer, NULL }, - {"geological", geological_to_layer, NULL }, - { 0, NULL, 0 }, -}; - Deleted: trunk/roadmap/src/buildmap_osm_common.h =================================================================== --- trunk/roadmap/src/buildmap_osm_common.h 2015-06-13 20:22:44 UTC (rev 2861) +++ trunk/roadmap/src/buildmap_osm_common.h 2015-06-13 20:22:48 UTC (rev 2862) @@ -1,156 +0,0 @@ -/* - * LICENSE: - * - * Copyright 2007 Stephen Woodbridge - * - * This file is part of RoadMap. - * - * RoadMap is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * RoadMap is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with RoadMap; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/** - * @file - * @brief include file for the static data of buildmap_osm - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <sys/mman.h> -#include <time.h> - - -#include "roadmap.h" -#include "roadmap_types.h" -#include "roadmap_math.h" -#include "roadmap_path.h" -#include "roadmap_file.h" -#include "roadmap_osm.h" - -#include "buildmap.h" -#include "buildmap_zip.h" -#include "buildmap_city.h" -#include "buildmap_square.h" -#include "buildmap_point.h" -#include "buildmap_line.h" -#include "buildmap_street.h" -#include "buildmap_range.h" -#include "buildmap_area.h" -#include "buildmap_shape.h" -#include "buildmap_polygon.h" - -#include "buildmap_layer.h" - -#define AREA 1 -#define PLACE 2 - -typedef struct layer_info { - char *name; - int *layerp; - int flags; -} layer_info_t; - -typedef struct layer_info_sublist { - char *name; - layer_info_t *list; - int *layerp; -} layer_info_sublist_t; - -/* Road layers. */ - -extern int BuildMapLayerFreeway; -extern int BuildMapLayerRamp; -extern int BuildMapLayerMain; -extern int BuildMapLayerStreet; -extern int BuildMapLayerTrail; -extern int BuildMapLayerRail; - -/* Area layers. */ - -extern int BuildMapLayerPark; -extern int BuildMapLayerHospital; -extern int BuildMapLayerAirport; -extern int BuildMapLayerStation; -extern int BuildMapLayerMall; -extern int BuildMapLayerSchool; - -/* Water layers. */ - -extern int BuildMapLayerShoreline; -extern int BuildMapLayerRiver; -extern int BuildMapLayerCanal; -extern int BuildMapLayerLake; -extern int BuildMapLayerSea; - -extern int BuildMapLayerFood; -extern int BuildMapLayerCafe; -extern int BuildMapLayerDrinks; -extern int BuildMapLayerFuel; -extern int BuildMapLayerATM; - -extern int BuildMapLayerBoundary; - -#if 0 -#define FREEWAY &BuildMapLayerFreeway -#define RAMP &BuildMapLayerRamp -#define MAIN &BuildMapLayerMain -#define STREET &BuildMapLayerStreet -#define TRAIL &BuildMapLayerTrail -#define RAIL &BuildMapLayerRail - -#define PARK &BuildMapLayerPark -#define HOSPITAL &BuildMapLayerHospital -#define AIRPORT &BuildMapLayerAirport -#define STATION &BuildMapLayerStation -#define MALL &BuildMapLayerMall - -#define SHORELINE &BuildMapLayerShoreline -#define RIVER &BuildMapLayerRiver -#define CANAL &BuildMapLayerCanal -#define LAKE &BuildMapLayerLake -#define SEA &BuildMapLayerSea -#define BOUNDARY &BuildMapLayerBoundary -#endif - -extern BuildMapDictionary DictionaryPrefix; -extern BuildMapDictionary DictionaryStreet; -extern BuildMapDictionary DictionaryType; -extern BuildMapDictionary DictionarySuffix; -extern BuildMapDictionary DictionaryCity; - -/** - * @brief initialize layers - */ -extern void buildmap_osm_common_find_layers (void); -extern char *stringtype[]; -extern char *datetype[]; -extern layer_info_t highway_to_layer[]; -extern layer_info_t cycleway_to_layer[]; -extern layer_info_t waterway_to_layer[]; -extern layer_info_t abutters_to_layer[]; -extern layer_info_t railway_to_layer[]; -extern layer_info_t natural_to_layer[]; -extern layer_info_t boundary_to_layer[]; -extern layer_info_t amenity_to_layer[]; -extern layer_info_t place_to_layer[]; -extern layer_info_t leisure_to_layer[]; -extern layer_info_t historic_to_layer[]; -extern layer_info_sublist_t list_info[]; Added: trunk/roadmap/src/buildmap_osm_layer_list.h =================================================================== --- trunk/roadmap/src/buildmap_osm_layer_list.h (rev 0) +++ trunk/roadmap/src/buildmap_osm_layer_list.h 2015-06-13 20:22:48 UTC (rev 2862) @@ -0,0 +1,53 @@ + +/* The names of the layers listed here are used for several purposes, + * depending on how the layer_define() macro is defined on entry. These + * names are roadmap names, not OSM names. They should match the names + * of the layers as they would be found in the class file (default/All) + */ + +layer_define( Freeways ) +// layer_define( Ramps ) +layer_define( Highways ) +layer_define( Streets ) +layer_define( Trails ) +layer_define( Railroads ) + +layer_define( Parks ) +layer_define( Hospitals ) +layer_define( Airports ) +// layer_define( Stations ) +// layer_define( Malls ) +layer_define( Schools ) + +layer_define( Shore ) +layer_define( Rivers ) +// layer_define( Canals ) +layer_define( Lakes ) +// layer_define( Sea ) + +layer_define( Nature ) +layer_define( Peak ) +layer_define( Amenity ) +// layer_define( Boundaries ) + +layer_define( City ) +layer_define( Town ) +layer_define( Village ) +layer_define( Hamlet ) +layer_define( Suburbs ) + +layer_define( Fuel ) +layer_define( Food ) +layer_define( Cafe ) +layer_define( Drinks ) +layer_define( ATM ) + +layer_define( Castle ) + +layer_define( Hotel ) +layer_define( Motel ) +layer_define( Guesthouse ) +layer_define( Hostel ) +layer_define( Hut ) + +#undef layer_define Added: trunk/roadmap/src/buildmap_osm_layers.h =================================================================== --- trunk/roadmap/src/buildmap_osm_layers.h (rev 0) +++ trunk/roadmap/src/buildmap_osm_layers.h 2015-06-13 20:22:48 UTC (rev 2862) @@ -0,0 +1,289 @@ +/* + * LICENSE: + * + * Copyright 2007 Stephen Woodbridge, 2015, Paul Fox + * + * This file is part of RoadMap. + * + * RoadMap is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * RoadMap is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with RoadMap; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#define LINE 0 +#define AREA 1 +#define PLACE 2 + +typedef struct layer_info { + char *osm_name; + int *layerp; + int flags; +} layer_info_t; + +typedef struct layer_info_sublist { + char *osm_name; + layer_info_t *list; +} layer_info_sublist_t; + + +/* declare storage for the layer indices */ +#define layer_define(name) static int name; +#include "buildmap_osm_layer_list.h" + +/* declare index/name table */ +struct layer_index_name { + int *layer; + char *name; +} layer_index_name[] = { +#define layer_define(name) { &name, #name }, +#include "buildmap_osm_layer_list.h" +}; + + +BuildMapDictionary DictionaryPrefix; +BuildMapDictionary DictionaryStreet; +BuildMapDictionary DictionaryType; +BuildMapDictionary DictionarySuffix; +BuildMapDictionary DictionaryCity; + + +layer_info_t highway_to_layer[] = { + { 0, NULL, 0 }, + { "motorway", &Freeways, LINE }, + { "motorway_link", &Freeways, LINE }, + { "trunk", &Freeways, LINE }, + { "trunk_link", &Freeways, LINE }, + { "primary", &Highways, LINE }, + { "primary_link", &Highways, LINE }, + { "secondary", &Streets, LINE }, + { "tertiary", &Streets, LINE }, + { "unclassified", &Streets, LINE }, + { "minor", &Streets, LINE }, + { "residential", &Streets, LINE }, + { "service", &Streets, LINE }, + { "track", &Trails, LINE }, + { "cycleway", &Trails, LINE }, + { "bridleway", &Trails, LINE }, + { "footway", &Trails, LINE }, + { "steps", &Trails, LINE }, + { "pedestrian", &Trails, LINE }, + { "pathway", &Trails, LINE }, + { "road", &Streets, LINE }, + { "secondary_link", &Streets, LINE }, + { "path", &Trails, LINE }, + { 0, NULL, 0 }, +}; + +layer_info_t cycleway_to_layer[] = { + { 0, NULL, 0 }, + { "lane", &Trails, LINE }, + { "track", &Trails, LINE }, + { "opposite_lane", &Trails, LINE }, + { "opposite_track", &Trails, LINE }, + { 0, NULL, 0 }, +}; + +layer_info_t aeroway_to_layer[] = { + { 0, NULL, 0 }, + { "runway", &Airports, AREA }, + { "aerodrome", &Airports, AREA }, + { 0, NULL, 0 }, +}; + +layer_info_t landuse_to_layer[] = { + { 0, NULL, 0 }, + { "reservoir", &Lakes, AREA }, + { 0, NULL, 0 }, +}; + +layer_info_t waterway_to_layer[] = { + { 0, NULL, 0 }, + { "river", &Rivers, LINE }, + { "canal", &Rivers, LINE }, + { "stream", &Rivers, LINE }, +#if 0 + { "drain", &Rivers, LINE }, + { "dock", &Rivers, LINE }, + { "lock_gate", &Rivers, LINE }, + { "turning_point", &Rivers, LINE }, + { "aquaduct", &Rivers, LINE }, + { "boatyard", &Rivers, LINE }, + { "water_point", &Rivers, LINE }, + { "weir", &Rivers, LINE }, + { "dam", &Rivers, LINE }, + { "riverbank", &Rivers, LINE }, + { "ditch", &Rivers, LINE }, +#endif + { 0, NULL, 0 }, +}; + +layer_info_t railway_to_layer[] = { + { 0, NULL, 0 }, + { "rail", &Railroads, LINE }, + { "tram", &Railroads, LINE }, + { "light_rail", &Railroads, LINE }, + { "subway", &Railroads, LINE }, + { "preserved", &Railroads, LINE }, + { "disused", &Railroads, LINE }, + { "abandoned", &Railroads, LINE }, + { "narrow_gauge", &Railroads, LINE }, + { "monorail", &Railroads, LINE }, + { "halt", &Railroads, LINE }, + { "tram_stop", &Railroads, LINE }, + { "viaduct", &Railroads, LINE }, + { "crossing", &Railroads, LINE }, + { "level_crossing", &Railroads, LINE }, + { "subway_entrance", &Railroads, LINE }, + { "turntable", &Railroads, LINE }, + { 0, NULL, 0 }, +}; + +layer_info_t natural_to_layer[] = { + { 0, NULL, 0 }, + { "coastline", &Shore, LINE }, + { "water", &Lakes, AREA }, + { "wood", &Nature, AREA }, + { "peak", &Peak, PLACE }, + { "volcano", &Peak, PLACE }, + { 0, NULL, 0 }, +}; + +layer_info_t amenity_to_layer[] = { + { 0, NULL, 0 }, + { "hospital", &Hospitals, LINE }, + { "pub", &Drinks, PLACE }, + { "parking", &Amenity, AREA }, + { "post_office", &Amenity, LINE }, + { "fuel", &Fuel, PLACE }, + { "school", &Schools, AREA }, + { "supermarket", &Amenity, LINE }, + { "library", &Amenity, LINE }, + { "police", &Amenity, LINE }, + { "fire_station", &Amenity, LINE }, + { "restaurant", &Food, PLACE }, + { "fast_food", &Food, PLACE }, + { "place_of_worship", &Amenity, LINE }, + { "cafe", &Cafe, PLACE }, + { "bicycle_parking", &Amenity, AREA }, + { "public_building", &Amenity, AREA }, + { "grave_yard", &Parks, AREA }, + { "university", &Schools, AREA }, + { "college", &Schools, AREA }, + { "townhall", &Amenity, AREA }, + { "food_court", &Food, PLACE }, + { "bbq", &Food, PLACE }, + { "bar", &Drinks, PLACE }, + { "biergarten", &Drinks, PLACE }, + { "ferry_terminal", &Amenity, AREA }, + { "car_sharing", &Amenity, AREA }, + { "taxi", &Amenity, AREA }, + { "atm", &ATM, PLACE }, + { "arts_centre", &Amenity, AREA }, + { "community_centre", &Amenity, AREA }, + { "social_centre", &Amenity, AREA }, + { "courthouse", &Amenity, LINE }, + { "crematorium", &Amenity, LINE }, + { "embassy", &Amenity, LINE }, + { "marketplace", &Amenity, AREA }, + { "prison", &Amenity, AREA }, + { "shelter", &Amenity, AREA }, + { "bicycle parking", &Amenity, AREA }, + { "public building", &Amenity, AREA }, + { 0, NULL, 0 }, +}; + +layer_info_t place_to_layer[] = { + { 0, NULL, 0 }, + { "continent", NULL, LINE }, + { "country", NULL, LINE }, + { "state", NULL, LINE }, + { "region", NULL, LINE }, + { "county", NULL, LINE }, + { "city", &City, PLACE }, + { "town", &Town, PLACE }, + { "village", &Village, PLACE }, + { "hamlet", &Hamlet, PLACE }, + { "suburb", &Suburbs, PLACE }, + { 0, NULL, 0 }, +}; + +layer_info_t leisure_to_layer[] = { + { 0, NULL, 0 }, + { "park", &Parks, AREA }, + { "common", &Parks, AREA }, + { "garden", &Parks, AREA }, + { "nature_reserve", &Parks, AREA }, + { "pitch", &Amenity, AREA }, + { "track", &Amenity, AREA }, + { "marina", &Amenity, AREA }, + { "stadium", &Amenity, AREA }, + { "golf_course", &Parks, AREA }, + { "sports_centre", &Amenity, AREA }, + { "sports centre", &Amenity, AREA }, + { "dog_park", &Parks, AREA }, + { "playground", &Parks, AREA }, + { "ice_rink", &Amenity, AREA }, + { "miniature_golf", &Amenity, AREA }, + { "dance", &Amenity, AREA }, + { "swimming_pool", &Amenity, AREA }, + { "golf course", &Parks, AREA }, + { 0, NULL, 0 }, +}; + +layer_info_t historic_to_layer[] = { + { 0, NULL, 0 }, + { "castle", &Castle, PLACE }, + { "archaeological_site",NULL, AREA }, + { "ruins", NULL, AREA }, + { 0, NULL, 0 }, +}; + +layer_info_t tourism_to_layer[] = { + { 0, NULL, 0 }, + { "hotel", &Hotel, PLACE }, + { "motel", &Motel, PLACE }, + { "guest_house", &Guesthouse, PLACE }, + { "hostel", &Hostel, PLACE }, + { "alpine_hut", &Hut, PLACE }, + { 0, NULL, 0 }, +}; + +layer_info_sublist_t list_info[] = { + {0, NULL }, + {"highway", highway_to_layer }, + {"cycleway", cycleway_to_layer }, + {"waterway", waterway_to_layer }, + {"railway", railway_to_layer }, + {"leisure", leisure_to_layer }, + {"amenity", amenity_to_layer }, + {"tourism", tourism_to_layer }, + {"historic", historic_to_layer }, + {"landuse", landuse_to_layer }, + {"aeroway", aeroway_to_layer }, + {"natural", natural_to_layer }, + {"place", place_to_layer }, + { 0, NULL }, +}; + +/** + * @brief initialize layers + */ +void buildmap_osm_common_find_layers (void) { + /* fetch the layer indices from the class file */ +#define layer_define( name ) \ + name = buildmap_layer_get(#name); +#include "buildmap_osm_layer_list.h" + +} + Modified: trunk/roadmap/src/buildmap_osm_main.c =================================================================== --- trunk/roadmap/src/buildmap_osm_main.c 2015-06-13 20:22:44 UTC (rev 2861) +++ trunk/roadmap/src/buildmap_osm_main.c 2015-06-13 20:22:48 UTC (rev 2862) @@ -46,7 +46,6 @@ #include "buildmap_opt.h" #include "buildmap_metadata.h" #include "buildmap_layer.h" -#include "buildmap_osm_common.h" #include "buildmap_osm_text.h" #include "roadmap_osm.h" @@ -313,7 +312,6 @@ buildmap_metadata_add_attribute ("Class", "Name", "All"); buildmap_metadata_add_attribute ("Data", "Source", "OSM"); - buildmap_osm_common_find_layers(); buildmap_debug("reading file %s", fn); buildmap_osm_text_read(fn, 0, country_num, division_num); Modified: trunk/roadmap/src/buildmap_osm_text.c =================================================================== --- trunk/roadmap/src/buildmap_osm_text.c 2015-06-13 20:22:44 UTC (rev 2861) +++ trunk/roadmap/src/buildmap_osm_text.c 2015-06-13 20:22:48 UTC (rev 2862) @@ -64,9 +64,10 @@ #include "buildmap_polygon.h" #include "buildmap_layer.h" -#include "buildmap_osm_common.h" #include "buildmap_osm_text.h" +#include "buildmap_osm_layers.h" + extern char *BuildMapResult; /* OSM has over 2G nodes already -- enough to overflow a 32 bit signed int */ @@ -560,12 +561,12 @@ int i; layer_info_t *list; - for (i=1; list_info[i].name != 0; i++) { - if (strcmp(tag, list_info[i].name) == 0) { + for (i=1; list_info[i].osm_name != 0; i++) { + if (strcmp(tag, list_info[i].osm_name) == 0) { list = list_info[i].list; if (list) { - for (i=1; list[i].name; i++) { - if (strcmp(value, list[i].name) == 0) { + for (i=1; list[i].osm_name; i++) { + if (strcmp(value, list[i].osm_name) == 0) { *flags = list[i].flags; if (list[i].layerp) *layer = *(list[i].layerp); Modified: trunk/roadmap/src/buildmap_osm_text.h =================================================================== --- trunk/roadmap/src/buildmap_osm_text.h 2015-06-13 20:22:44 UTC (rev 2861) +++ trunk/roadmap/src/buildmap_osm_text.h 2015-06-13 20:22:48 UTC (rev 2862) @@ -28,6 +28,5 @@ #define LINELEN 2048 -void buildmap_osm_text_find_layers (void); void buildmap_osm_text_read(char *filename, int tileid, int country_num, int division_num); void buildmap_osm_text_save_wayids(const char *path, const char *outfile); Modified: trunk/roadmap/src/config.mk =================================================================== --- trunk/roadmap/src/config.mk 2015-06-13 20:22:44 UTC (rev 2861) +++ trunk/roadmap/src/config.mk 2015-06-13 20:22:48 UTC (rev 2862) @@ -129,6 +129,7 @@ # support when building the rdm format of the maps. Users in # other areas will likely be building maps from other sources, # and will probably need shapefile support. +# Building maps from OpenStreetMap does not require shapefile support. SHAPEFILES = NO # SHAPEFILES = YES Modified: trunk/roadmap/src/default/All =================================================================== --- trunk/roadmap/src/default/All 2015-06-13 20:22:44 UTC (rev 2861) +++ trunk/roadmap/src/default/All 2015-06-13 20:22:48 UTC (rev 2862) @@ -68,7 +68,7 @@ .Thickness: 1 .Speed: 1 Airports.Color: grey - .Declutter: 300 + .Declutter: 600 .Thickness: 1 .Speed: 1 Stations.Color: grey This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-13 20:22:46
|
Revision: 2861 http://sourceforge.net/p/roadmap/code/2861 Author: pgf Date: 2015-06-13 20:22:44 +0000 (Sat, 13 Jun 2015) Log Message: ----------- buildmap_osm_common: add accomodations: hotels, etc Modified Paths: -------------- trunk/roadmap/src/buildmap_osm_common.c Modified: trunk/roadmap/src/buildmap_osm_common.c =================================================================== --- trunk/roadmap/src/buildmap_osm_common.c 2015-06-10 19:23:46 UTC (rev 2860) +++ trunk/roadmap/src/buildmap_osm_common.c 2015-06-13 20:22:44 UTC (rev 2861) @@ -108,6 +108,12 @@ int BuildMapLayerFuel; int BuildMapLayerATM; +int BuildMapLayerHotel; +int BuildMapLayerMotel ; +int BuildMapLayerGuestHouse; +int BuildMapLayerHostel; +int BuildMapLayerHut; + /* These defines are simply shorthand notation, to make * the tables below easier to manage */ @@ -148,6 +154,12 @@ #define FUEL &BuildMapLayerFuel #define ATM &BuildMapLayerATM +#define HOTEL &BuildMapLayerHotel +#define MOTEL &BuildMapLayerMotel +#define GUEST_HOUSE &BuildMapLayerGuestHouse +#define HOSTEL &BuildMapLayerHostel +#define HUT &BuildMapLayerHut + BuildMapDictionary DictionaryPrefix; BuildMapDictionary DictionaryStreet; BuildMapDictionary DictionaryType; @@ -195,6 +207,12 @@ BuildMapLayerCafe = buildmap_layer_get ("cafe"); BuildMapLayerDrinks = buildmap_layer_get ("drinks"); BuildMapLayerATM = buildmap_layer_get ("atm"); + + BuildMapLayerHotel = buildmap_layer_get ("hotel"); + BuildMapLayerMotel = buildmap_layer_get ("motel"); + BuildMapLayerGuestHouse= buildmap_layer_get ("guesthouse"); + BuildMapLayerHostel = buildmap_layer_get ("hostel"); + BuildMapLayerHut = buildmap_layer_get ("hut"); } char *stringtype[] = { @@ -519,6 +537,16 @@ { 0, NULL, 0 }, }; +layer_info_t tourism_to_layer[] = { + { 0, NULL, 0 }, + { "hotel", HOTEL, PLACE }, /* 1 */ + { "motel", MOTEL, PLACE }, /* 2 */ + { "guest_house", GUEST_HOUSE, PLACE }, /* 3 */ + { "hostel", HOSTEL, PLACE }, /* 4 */ + { "alpine_hut", HUT, PLACE }, /* 5 */ + { 0, NULL, 0 }, +}; + #if NEEDED char *oneway_type[] = { 0, @@ -647,7 +675,7 @@ {"leisure", leisure_to_layer, NULL }, {"amenity", amenity_to_layer, NULL }, {"shop", NULL, NULL }, - {"tourism", NULL, NULL }, + {"tourism", tourism_to_layer, NULL }, {"historic", historic_to_layer, NULL }, {"landuse", landuse_to_layer, NULL }, {"military", NULL, NULL }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-10 19:23:48
|
Revision: 2860 http://sourceforge.net/p/roadmap/code/2860 Author: pgf Date: 2015-06-10 19:23:46 +0000 (Wed, 10 Jun 2015) Log Message: ----------- roadmap_screen: remove dangling reference to obsolete header Modified Paths: -------------- trunk/roadmap/src/roadmap_screen.c Modified: trunk/roadmap/src/roadmap_screen.c =================================================================== --- trunk/roadmap/src/roadmap_screen.c 2015-06-10 19:19:34 UTC (rev 2859) +++ trunk/roadmap/src/roadmap_screen.c 2015-06-10 19:23:46 UTC (rev 2860) @@ -61,7 +61,6 @@ #include "roadmap_pointer.h" #include "roadmap_display.h" #include "roadmap_label.h" -#include "roadmap_linefont.h" #include "roadmap_plugin.h" #include "roadmap_factory.h" #include "roadmap_time.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-10 19:19:36
|
Revision: 2859 http://sourceforge.net/p/roadmap/code/2859 Author: pgf Date: 2015-06-10 19:19:34 +0000 (Wed, 10 Jun 2015) Log Message: ----------- sprites: thicken the landmark 5-point star Modified Paths: -------------- trunk/roadmap/src/sprites Modified: trunk/roadmap/src/sprites =================================================================== --- trunk/roadmap/src/sprites 2015-06-10 19:19:31 UTC (rev 2858) +++ trunk/roadmap/src/sprites 2015-06-10 19:19:34 UTC (rev 2859) @@ -245,7 +245,7 @@ L 0,-3 0,3 S 5PointStar -F darkred 1 +F darkred 2 L 0,-9 5,7 L 5,7 -8,-3 L -8,-3 8,-3 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-10 19:19:33
|
Revision: 2858 http://sourceforge.net/p/roadmap/code/2858 Author: pgf Date: 2015-06-10 19:19:31 +0000 (Wed, 10 Jun 2015) Log Message: ----------- roadmap_landmark: fix pen handling, add declutter level for labels Modified Paths: -------------- trunk/roadmap/src/roadmap_landmark.c Modified: trunk/roadmap/src/roadmap_landmark.c =================================================================== --- trunk/roadmap/src/roadmap_landmark.c 2015-06-10 19:19:28 UTC (rev 2857) +++ trunk/roadmap/src/roadmap_landmark.c 2015-06-10 19:19:31 UTC (rev 2858) @@ -45,10 +45,13 @@ static RoadMapConfigDescriptor RoadMapConfigLandmarkName = ROADMAP_CONFIG_ITEM ("Landmarks", "Name"); -static RoadMapConfigDescriptor RoadMapConfigLandmarksColor = +static RoadMapConfigDescriptor RoadMapConfigLandmarkColor = ROADMAP_CONFIG_ITEM ("Landmarks", "Color"); -static RoadMapConfigDescriptor RoadMapConfigLandmarkSize = +static RoadMapConfigDescriptor RoadMapConfigLandmarkDeclutter = + ROADMAP_CONFIG_ITEM ("Landmarks", "Declutter"); + +static RoadMapConfigDescriptor RoadMapConfigLandmarkFontSize = ROADMAP_CONFIG_ITEM ("Landmarks", "Font Size"); static RoadMapConfigDescriptor RoadMapConfigBackupFiles = @@ -61,6 +64,7 @@ static int RoadMapLandmarkFontSize; +static int RoadMapLandmarkDeclutter; void roadmap_landmark_draw_waypoint (const waypoint *waypointp, @@ -87,11 +91,9 @@ roadmap_sprite_draw (sprite, &guipoint, 0); } - if (pen) { + if (pen && roadmap_math_declutter(RoadMapLandmarkDeclutter )) { + roadmap_canvas_select_pen (pen); - if (sprite) - guipoint.y += 15; /* space for sprite */ - /* FIXME -- We should do label collision detection, which * means joining in the fun in roadmap_label_add() and * roadmap_label_draw_cache(). Landmark labels should @@ -99,8 +101,7 @@ * should probably be drawn last, however, so that their * labels come out on "top" of other map features. */ - roadmap_label_draw_text(waypointp->shortname, - &guipoint, 0, 0, pen); + roadmap_label_draw_text(waypointp->shortname, &guipoint, 0, 0, pen); } } @@ -124,9 +125,6 @@ if (pen) { roadmap_canvas_select_pen (pen); - if (sprite) - guipoint.y += 15; /* space for sprite */ - /* FIXME -- We should do label collision detection, which * means joining in the fun in roadmap_label_add() and * roadmap_label_draw_cache(). Landmark labels should @@ -134,8 +132,7 @@ * should probably be drawn last, however, so that their * labels come out on "top" of other map features. */ - roadmap_label_draw_text(weepointp->name, - &guipoint, 0, 0, pen); + roadmap_label_draw_text(weepointp->name, &guipoint, 0, 0, pen); } } @@ -146,9 +143,6 @@ void roadmap_landmark_display (void) { - RoadMapLandmarkFontSize = - roadmap_config_get_integer (&RoadMapConfigLandmarkSize); - waypt_iterator (&RoadMapLandmarkHead, roadmap_landmark_draw); } @@ -291,9 +285,17 @@ RoadMapList tmp_waypoint_list; int defaulted, ret; + RoadMapLandmarkFontSize = + roadmap_config_get_integer (&RoadMapConfigLandmarkFontSize); + RoadMapLandmarkDeclutter = + roadmap_config_get_integer (&RoadMapConfigLandmarkDeclutter); + RoadMapLandmarksPen = roadmap_canvas_create_pen ("landmarks.labels"); roadmap_canvas_set_foreground - (roadmap_config_get (&RoadMapConfigLandmarksColor)); + (roadmap_config_get (&RoadMapConfigLandmarkColor)); + roadmap_canvas_set_label_font_size(RoadMapLandmarkFontSize); + roadmap_canvas_set_label_font_color + (roadmap_config_get (&RoadMapConfigLandmarkColor)); roadmap_canvas_set_thickness (2); @@ -332,12 +334,15 @@ ("preferences", &RoadMapConfigLandmarkName, ""); roadmap_config_declare - ("preferences", &RoadMapConfigLandmarksColor, "darkred"); + ("preferences", &RoadMapConfigLandmarkColor, "darkred"); - roadmap_config_declare - ("preferences", &RoadMapConfigLandmarkSize, "18"); + roadmap_config_declare + ("preferences", &RoadMapConfigLandmarkDeclutter, "99999"); + roadmap_config_declare + ("preferences", &RoadMapConfigLandmarkFontSize, "18"); + ROADMAP_LIST_INIT(&RoadMapLandmarkHead); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-10 19:19:30
|
Revision: 2857 http://sourceforge.net/p/roadmap/code/2857 Author: pgf Date: 2015-06-10 19:19:28 +0000 (Wed, 10 Jun 2015) Log Message: ----------- roadmap_sprite: fix pen handling: use a separate text pen per sprite Modified Paths: -------------- trunk/roadmap/src/roadmap_sprite.c Modified: trunk/roadmap/src/roadmap_sprite.c =================================================================== --- trunk/roadmap/src/roadmap_sprite.c 2015-06-10 19:19:25 UTC (rev 2856) +++ trunk/roadmap/src/roadmap_sprite.c 2015-06-10 19:19:28 UTC (rev 2857) @@ -41,6 +41,8 @@ #include "roadmap_screen.h" #include "roadmap_label.h" +#define DEFAULT_SPRITE_TEXTSIZE 10 + static int RoadMapSpriteFastDraw; static RoadMapConfigDescriptor RoadMapConfigSpritePercent = @@ -97,6 +99,7 @@ RoadMapGuiRect text_bbox; RoadmapSpriteDrawingSequence textseq; int textsize; + RoadMapPen textpen; RoadMapGuiPoint textcenter[1]; struct roadmap_sprite_record *next; @@ -185,6 +188,7 @@ snprintf (pen, sizeof(pen), "%s.%d.%s", sprite->name, t, color); sprite->drawing.planes.last->pen = roadmap_canvas_create_pen (pen); + roadmap_canvas_set_label_font_size(sprite->textsize); roadmap_canvas_set_foreground (color); roadmap_canvas_set_thickness (t); @@ -368,9 +372,7 @@ max_width = tot_height = 0; for (i = 0; i < count; i++) { - roadmap_canvas_set_label_font_size(sprite->textsize); - roadmap_canvas_get_text_extents - (textseq->obj.strings[i], + roadmap_canvas_get_text_extents (textseq->obj.strings[i], &width, &ascent, &descent, NULL); if (width > max_width) max_width = width; tot_height += ascent + descent + 2; @@ -440,6 +442,7 @@ sprite->name = strdup (argv[1]); sprite->scale = 100; sprite->drawing.planes.first.pen = roadmap_canvas_create_pen ("Black"); + roadmap_canvas_set_label_font_size(DEFAULT_SPRITE_TEXTSIZE); sprite->next = RoadMapSpriteList; RoadMapSpriteList = sprite; @@ -577,6 +580,8 @@ break; } sprite->scale = atoi(argv[1]); + // perhaps need to scale the fontsize here? + // roadmap_canvas_set_label_font_size(sprite->textsize * scale / 100); break; case 'L': @@ -629,12 +634,18 @@ sprite->name); } else { int size; + char pen[256]; roadmap_sprite_decode_point (sprite->textcenter, argv[1]); - size = (argc < 3) ? 18 : atoi(argv[2]); + snprintf (pen, sizeof(pen), "%s.text", sprite->name); + sprite->textpen = roadmap_canvas_create_pen (pen); + + size = (argc < 3) ? DEFAULT_SPRITE_TEXTSIZE : atoi(argv[2]); sprite->textsize = size; + roadmap_canvas_set_label_font_size(sprite->textsize); + if (argc < 4) { roadmap_sprite_decode_text (sprite, &sprite->textseq, NULL, NULL); @@ -834,9 +845,11 @@ textseq = NULL; + if (text) { - roadmap_sprite_decode_text (sprite, textsequence, text, text_bbox); - if (textsequence->object_count != 0) + roadmap_canvas_select_pen (sprite->textpen); + roadmap_sprite_decode_text (sprite, textsequence, text, text_bbox); + if (textsequence->object_count != 0) textseq = textsequence; } else if (sprite->textseq.object_count) { textseq = &sprite->textseq; @@ -932,7 +945,7 @@ t = textseq->obj.strings[i]; if (t != NULL) { - roadmap_canvas_set_label_font_size(sprite->textsize * scale / 100); + roadmap_canvas_select_pen (sprite->textpen); roadmap_canvas_draw_string (&RoadMapSpritePoints[i], ROADMAP_CANVAS_CENTER, t); @@ -949,8 +962,10 @@ free (textsequence->obj.strings); free (textsequence->points); } +#if 0 // i think we did this scaling above? if (text_bbox && text_bbox != &sprite->text_bbox) roadmap_sprite_scale_bbox(text_bbox, text_bbox, scale); +#endif roadmap_canvas_select_pen (prevpen); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-10 19:19:27
|
Revision: 2856 http://sourceforge.net/p/roadmap/code/2856 Author: pgf Date: 2015-06-10 19:19:25 +0000 (Wed, 10 Jun 2015) Log Message: ----------- roadgps_screen, roadmap_display: handle pen font sizes properly Modified Paths: -------------- trunk/roadmap/src/roadgps_screen.c trunk/roadmap/src/roadmap_display.c Modified: trunk/roadmap/src/roadgps_screen.c =================================================================== --- trunk/roadmap/src/roadgps_screen.c 2015-06-10 19:19:21 UTC (rev 2855) +++ trunk/roadmap/src/roadgps_screen.c 2015-06-10 19:19:25 UTC (rev 2856) @@ -268,7 +268,6 @@ roadmap_canvas_select_pen (reverse ? RoadGpsInactiveLabels : RoadGpsActiveLabels); - roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string (&satellite->position, ROADMAP_CANVAS_CENTER, satellite->label); @@ -297,7 +296,6 @@ roadmap_canvas_select_pen (filled ? RoadGpsActiveLabels : RoadGpsInactiveLabels); - roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string (&position, ROADMAP_CANVAS_CENTER, RoadGpsSatellites[satellite].label); @@ -347,13 +345,11 @@ point.x = RoadGpsFrame.latitude_offset_x; point.y = RoadGpsFrame.latitude_offset_y; roadmap_canvas_select_pen (RoadGpsLabels); - roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string (&point, ROADMAP_CANVAS_LEFT, "Latitude:"); point.y = point.y+RoadGpsFrame.label_height; roadgps_screen_to_coord(data,1,RoadGpsPosition.latitude); roadmap_canvas_select_pen (RoadGpsValues); - roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string (&point, ROADMAP_CANVAS_LEFT, data); @@ -361,20 +357,17 @@ point.y = RoadGpsFrame.longitude_offset_y; roadmap_canvas_select_pen (RoadGpsLabels); - roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string (&point, ROADMAP_CANVAS_LEFT, "Longitude:"); point.y = point.y+RoadGpsFrame.label_height; roadgps_screen_to_coord(data,0,RoadGpsPosition.longitude); roadmap_canvas_select_pen (RoadGpsValues); - roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string (&point, ROADMAP_CANVAS_LEFT, data); point.y = point.y+RoadGpsFrame.label_height; roadmap_canvas_select_pen (RoadGpsLabels); - roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string (&point, ROADMAP_CANVAS_LEFT, "Altitude:"); sprintf(data,"%d%s",RoadGpsPosition.altitude,roadmap_math_distance_unit()); @@ -385,7 +378,6 @@ point.y = point.y+RoadGpsFrame.label_height; roadmap_canvas_select_pen (RoadGpsLabels); - roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string (&point, ROADMAP_CANVAS_LEFT, "Speed:"); sprintf(data,"%d%s", @@ -393,7 +385,6 @@ roadmap_math_speed_unit()); point.y = point.y+RoadGpsFrame.label_height; roadmap_canvas_select_pen (RoadGpsValues); - roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string (&point, ROADMAP_CANVAS_LEFT, data); @@ -405,14 +396,12 @@ if (fix < 1) fix = 1; else if (fix > 3) fix = 3; sprintf(data,"%d active satellites, %s fix", satcount, fixes[fix-1]); - roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string (&point, ROADMAP_CANVAS_LEFT, data); if (RoadMapGpsReceivedTime != 0) { point.y = point.y+RoadGpsFrame.label_height; roadmap_canvas_select_pen (RoadGpsLabels); - roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); strftime(data, sizeof(data), " %Y/%m/%d %H:%M:%S", localtime(&RoadMapGpsReceivedTime)); roadmap_canvas_draw_string @@ -624,7 +613,6 @@ canvas_width = roadmap_canvas_width(); canvas_height = roadmap_canvas_height(); - roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_get_text_extents ("09", &text_width, &text_ascent, &text_descent, NULL); @@ -698,6 +686,8 @@ if (! Initialized) { + RoadMapGPSFontSize = roadmap_config_get_integer(&RoadMapConfigGPSFontSize); + RoadGpsEraser = roadmap_canvas_create_pen ("eraser"); roadmap_canvas_set_thickness (2); roadmap_canvas_set_foreground @@ -707,6 +697,7 @@ roadmap_canvas_set_thickness (2); roadmap_canvas_set_foreground (roadmap_config_get (&RoadMapConfigGPSForeground)); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); RoadGpsFramePen = roadmap_canvas_create_pen ("gps/frame"); roadmap_canvas_set_thickness (2); @@ -746,24 +737,26 @@ roadmap_canvas_set_thickness (2); roadmap_canvas_set_foreground (roadmap_config_get (&RoadMapConfigGPSActiveLabels)); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); RoadGpsInactiveLabels = roadmap_canvas_create_pen ("gps/inactivelabels"); roadmap_canvas_set_thickness (2); roadmap_canvas_set_foreground (roadmap_config_get (&RoadMapConfigGPSInactiveLabels)); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); RoadGpsLabels = roadmap_canvas_create_pen ("gps/labels"); roadmap_canvas_set_thickness (2); roadmap_canvas_set_foreground (roadmap_config_get (&RoadMapConfigGPSLabels)); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); RoadGpsValues = roadmap_canvas_create_pen ("gps/values"); roadmap_canvas_set_thickness (3); roadmap_canvas_set_foreground (roadmap_config_get (&RoadMapConfigGPSValues)); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); - RoadMapGPSFontSize = - roadmap_config_get_integer (&RoadMapConfigGPSFontSize); } roadgps_screen_format_frame (); Modified: trunk/roadmap/src/roadmap_display.c =================================================================== --- trunk/roadmap/src/roadmap_display.c 2015-06-10 19:19:21 UTC (rev 2855) +++ trunk/roadmap/src/roadmap_display.c 2015-06-10 19:19:25 UTC (rev 2856) @@ -79,9 +79,9 @@ ROADMAP_CONFIG_ITEM("Display", "Font Size"); -static RoadMapPen RoadMapMessageContour; -static RoadMapPen RoadMapConsoleBackground; -static RoadMapPen RoadMapConsoleForeground; +static RoadMapPen RoadMapMessageContourPen; +static RoadMapPen RoadMapConsoleBackgroundPen; +static RoadMapPen RoadMapConsoleForegroundPen; static int RoadMapDisplayFontSize; @@ -167,8 +167,7 @@ if (sizeof(pen_name) < strlen(descriptor->category) + strlen(descriptor->name) + 2) { - roadmap_log(ROADMAP_FATAL, - "not enough space for pen name %s.%s\n", + roadmap_log(ROADMAP_FATAL, "not enough space for pen name %s.%s\n", descriptor->category, descriptor->name); } @@ -178,11 +177,12 @@ pen = roadmap_canvas_create_pen (pen_name); roadmap_canvas_set_foreground (color); + roadmap_canvas_set_label_font_size(RoadMapDisplayFontSize); return pen; } - return RoadMapMessageContour; + return RoadMapMessageContourPen; } static int RoadMapDisplayPensCreated = 0; @@ -195,13 +195,13 @@ RoadMapDisplayPensCreated = 1; - RoadMapMessageContour = roadmap_canvas_create_pen ("message.contour"); + RoadMapMessageContourPen = roadmap_canvas_create_pen ("message.contour"); roadmap_canvas_set_foreground ("black"); - RoadMapConsoleBackground = + RoadMapConsoleBackgroundPen = roadmap_display_new_pen (&RoadMapConfigConsoleBackground); - RoadMapConsoleForeground = + RoadMapConsoleForegroundPen = roadmap_display_new_pen (&RoadMapConfigConsoleForeground); for (sign = RoadMapStreetSign; sign->title != NULL; ++sign) { @@ -246,7 +246,6 @@ saved = *p1; *p1 = 0; - roadmap_canvas_set_label_font_size(RoadMapDisplayFontSize); roadmap_canvas_draw_string (position, ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP, text_line); @@ -257,7 +256,6 @@ } - roadmap_canvas_set_label_font_size(RoadMapDisplayFontSize); roadmap_canvas_draw_string (position, ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP, text_line); @@ -292,6 +290,7 @@ } +// "signs" are the dynamic boxes with long pointers to waypoints static void roadmap_display_sign (RoadMapSign *sign) { RoadMapGuiPoint points[7]; @@ -304,7 +303,7 @@ roadmap_log_push ("roadmap_display_sign"); - roadmap_canvas_set_label_font_size(RoadMapDisplayFontSize); + roadmap_canvas_select_pen (RoadMapConsoleForegroundPen); roadmap_canvas_get_text_extents (sign->content, &width, &ascent, &descent, NULL); @@ -438,7 +437,7 @@ roadmap_canvas_select_pen (sign->background); roadmap_canvas_draw_multiple_polygons (1, &count, points, 1, 0); - roadmap_canvas_select_pen (RoadMapMessageContour); + roadmap_canvas_select_pen (RoadMapMessageContourPen); roadmap_canvas_draw_multiple_polygons (1, &count, points, 0, 0); roadmap_canvas_select_pen (sign->foreground); @@ -611,6 +610,7 @@ } } +// "console boxes" are the boxes of info in the screen corners static void roadmap_display_console_box (int corner, RoadMapConfigDescriptor *item) { @@ -632,7 +632,7 @@ return; } - roadmap_canvas_set_label_font_size(RoadMapDisplayFontSize); + roadmap_canvas_select_pen (RoadMapConsoleForegroundPen); roadmap_canvas_get_text_extents (text, &width, &ascent, &descent, NULL); @@ -668,16 +668,15 @@ count = 4; - roadmap_canvas_select_pen (RoadMapConsoleBackground); + roadmap_canvas_select_pen (RoadMapConsoleBackgroundPen); roadmap_canvas_draw_multiple_polygons (1, &count, frame, 1, 0); - roadmap_canvas_select_pen (RoadMapConsoleForeground); + roadmap_canvas_select_pen (RoadMapConsoleForegroundPen); roadmap_canvas_draw_multiple_polygons (1, &count, frame, 0, 0); frame[0].x += 3; frame[0].y += 3; - roadmap_canvas_set_label_font_size(RoadMapDisplayFontSize); roadmap_canvas_draw_string(frame, ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP, text); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2015-06-10 19:19:24
|
Revision: 2855 http://sourceforge.net/p/roadmap/code/2855 Author: pgf Date: 2015-06-10 19:19:21 +0000 (Wed, 10 Jun 2015) Log Message: ----------- clean up management of text size with "new" roadmap_canvas_set_label_font_size(), the "size" parameter passed around to text_extents() and draw_string() routines is superfluous. in addition, with font size and angle control now available for for gtk2 with and without agg, and for qt4, there's no need for the funky roadmap_linefont.c code (the old hershey fonts). that also means the roadmap_screen...text() wrappers can go away. the android platform, in particular, may need work to function properly after this change. i can't build it. Modified Paths: -------------- trunk/roadmap/src/Makefile trunk/roadmap/src/agg_support/roadmap_canvas.cpp trunk/roadmap/src/android/roadmap_canvas.c trunk/roadmap/src/gtk/roadmap_canvas.c trunk/roadmap/src/gtk2/roadmap_canvas.c trunk/roadmap/src/navigate/navigate_bar.c trunk/roadmap/src/qt/roadmap_canvas.cc trunk/roadmap/src/qt4/roadmap_canvas.cc trunk/roadmap/src/roadgps_screen.c trunk/roadmap/src/roadmap_canvas.h trunk/roadmap/src/roadmap_display.c trunk/roadmap/src/roadmap_label.c trunk/roadmap/src/roadmap_screen.c trunk/roadmap/src/roadmap_screen.h trunk/roadmap/src/roadmap_sprite.c trunk/roadmap/src/win32/roadmap_canvas.c Removed Paths: ------------- trunk/roadmap/src/roadmap_linefont.c trunk/roadmap/src/roadmap_linefont.h Modified: trunk/roadmap/src/Makefile =================================================================== --- trunk/roadmap/src/Makefile 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/Makefile 2015-06-10 19:19:21 UTC (rev 2855) @@ -46,7 +46,6 @@ roadmap_sunrise.c \ roadmap_state.c \ roadmap_gpx.c \ - roadmap_linefont.c \ roadmap_lang.c \ roadmap_iso.c # roadmap_turns.c @@ -258,7 +257,6 @@ roadmap_layer.h \ roadmap_library.h \ roadmap_line.h \ - roadmap_linefont.h \ roadmap_list.h \ roadmap_locator.h \ roadmap_main.h \ Modified: trunk/roadmap/src/agg_support/roadmap_canvas.cpp =================================================================== --- trunk/roadmap/src/agg_support/roadmap_canvas.cpp 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/agg_support/roadmap_canvas.cpp 2015-06-10 19:19:21 UTC (rev 2855) @@ -149,14 +149,13 @@ static void roadmap_canvas_draw_string_worker (RoadMapGuiPoint *start, RoadMapGuiPoint *center, int width, - int size, int angle, const char *text); void roadmap_canvas_get_text_extents - (const char *text, int size, int *width, + (const char *text, int *width, int *ascent, int *descent, int *can_tilt) { - size = CurrentPen->size; + int size = CurrentPen->size; *ascent = 0; *descent = 0; if (can_tilt) *can_tilt = 1; @@ -341,7 +340,7 @@ RoadMapGuiPoint start[1]; roadmap_canvas_get_text_extents - (text, size, &text_width, &text_ascent, &text_descent, NULL); + (text, &text_width, &text_ascent, &text_descent, NULL); start->x = position->x; start->y = position->y; @@ -357,24 +356,23 @@ else /* TOP */ start->y += text_ascent; - roadmap_canvas_draw_string_worker (start, position, 0, size, 0, text); + roadmap_canvas_draw_string_worker (start, position, 0, 0, text); } void roadmap_canvas_draw_string_angle - ( RoadMapGuiPoint *center, - int size, int theta, const char *text) { + ( RoadMapGuiPoint *center, int theta, const char *text) { int text_width; int text_ascent; int text_descent; RoadMapGuiPoint start[1]; roadmap_canvas_get_text_extents - (text, size, &text_width, &text_ascent, &text_descent, NULL); + (text, &text_width, &text_ascent, &text_descent, NULL); start->x = center->x - text_width/2; start->y = center->y - text_descent; - roadmap_canvas_draw_string_worker (start, center, text_width, size, theta, text); + roadmap_canvas_draw_string_worker (start, center, text_width, theta, text); } @@ -647,7 +645,6 @@ static void roadmap_canvas_draw_string_worker (RoadMapGuiPoint *start, RoadMapGuiPoint *center, int width, - int size, int angle, const char *text) { Modified: trunk/roadmap/src/android/roadmap_canvas.c =================================================================== --- trunk/roadmap/src/android/roadmap_canvas.c 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/android/roadmap_canvas.c 2015-06-10 19:19:21 UTC (rev 2855) @@ -139,7 +139,7 @@ * @param descent * @param can_tilt */ -void roadmap_canvas_get_text_extents (const char *text, int size, int *width, +void roadmap_canvas_get_text_extents (const char *text, int *width, int *ascent, int *descent, int *can_tilt) { jclass cls = TheClass(); @@ -147,6 +147,8 @@ jstring js = (*RoadMapJniEnv)->NewStringUTF(RoadMapJniEnv, text); int r; + int size = CurrentPen->size; + r = (*RoadMapJniEnv)->CallIntMethod(RoadMapJniEnv, PanelThiz, mid, js, size); if (width) *width = r; @@ -307,9 +309,10 @@ } void roadmap_canvas_draw_string_angle (RoadMapGuiPoint *position, - int size, int angle, const char *text) { + +#warning need to set size jstring js; jclass cls = TheClass(); jmethodID mid = TheMethod(cls, "DrawStringAngle", "(IIIILjava/lang/String;)V"); Modified: trunk/roadmap/src/gtk/roadmap_canvas.c =================================================================== --- trunk/roadmap/src/gtk/roadmap_canvas.c 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/gtk/roadmap_canvas.c 2015-06-10 19:19:21 UTC (rev 2855) @@ -82,7 +82,7 @@ void roadmap_canvas_get_text_extents - (const char *text, int size, int *width, + (const char *text, int *width, int *ascent, int *descent, int *can_tilt) { static int RoadMapCanvasAscent = 0; @@ -231,7 +231,7 @@ void roadmap_canvas_draw_string (RoadMapGuiPoint *position, - int corner, int size, const char *text) { + int corner, const char *text) { int text_width; int text_ascent; @@ -239,7 +239,7 @@ RoadMapGuiPoint start[1]; roadmap_canvas_get_text_extents - (text, size, &text_width, &text_ascent, &text_descent, NULL); + (text, &text_width, &text_ascent, &text_descent, NULL); start->x = position->x; start->y = position->y; @@ -261,13 +261,12 @@ } void roadmap_canvas_draw_string_angle ( RoadMapGuiPoint *center, - int size, int angle, const char *text) { /* no angle possible */ roadmap_canvas_draw_string (center, ROADMAP_CANVAS_CENTER_X|ROADMAP_CANVAS_BOTTOM, - size, text); + text); } Modified: trunk/roadmap/src/gtk2/roadmap_canvas.c =================================================================== --- trunk/roadmap/src/gtk2/roadmap_canvas.c 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/gtk2/roadmap_canvas.c 2015-06-10 19:19:21 UTC (rev 2855) @@ -113,10 +113,10 @@ void roadmap_canvas_get_text_extents - (const char *text, int size, int *width, + (const char *text, int *width, int *ascent, int *descent, int *can_tilt) { - size = CurrentPen->size; + int size = CurrentPen->size; PangoRectangle rectangle; PangoFontDescription *desc; char fontname[50]; @@ -288,7 +288,7 @@ } void roadmap_canvas_draw_string (RoadMapGuiPoint *position, - int corner, int size, const char *text) { + int corner, const char *text) { int text_width; int text_ascent; @@ -296,7 +296,7 @@ RoadMapGuiPoint start[1]; roadmap_canvas_get_text_extents - (text, size, &text_width, &text_ascent, &text_descent, NULL); + (text, &text_width, &text_ascent, &text_descent, NULL); start->x = position->x; start->y = position->y; @@ -321,7 +321,7 @@ void roadmap_canvas_draw_string_angle(RoadMapGuiPoint *position, - int size, int angle, const char *text) + int angle, const char *text) { int text_width; int text_height; @@ -335,7 +335,7 @@ roadmap_canvas_get_text_extents - (text, size, &text_width, &text_ascent, &text_descent, NULL); + (text, &text_width, &text_ascent, &text_descent, NULL); text_height = (text_ascent + text_descent); angle = -angle; Modified: trunk/roadmap/src/navigate/navigate_bar.c =================================================================== --- trunk/roadmap/src/navigate/navigate_bar.c 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/navigate/navigate_bar.c 2015-06-10 19:19:21 UTC (rev 2855) @@ -89,6 +89,7 @@ * @param size * @return */ +#if 0 static int navigate_bar_align_text (char *text, char **line1, char **line2, int size) { @@ -156,6 +157,7 @@ return -1; } +#endif /** * @brief called from a plugin handler Modified: trunk/roadmap/src/qt/roadmap_canvas.cc =================================================================== --- trunk/roadmap/src/qt/roadmap_canvas.cc 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/qt/roadmap_canvas.cc 2015-06-10 19:19:21 UTC (rev 2855) @@ -83,7 +83,7 @@ } } -void roadmap_canvas_get_text_extents(const char *text, int size, +void roadmap_canvas_get_text_extents(const char *text, int *width, int *ascent, int *descent, int *can_tilt) { roadMapCanvas->getTextExtents(text, width, ascent, descent, can_tilt); @@ -148,7 +148,6 @@ } void roadmap_canvas_draw_string_angle (RoadMapGuiPoint *position, - int size, int angle, const char *text) { roadMapCanvas->drawStringAngle(position, 0, text, angle); Modified: trunk/roadmap/src/qt4/roadmap_canvas.cc =================================================================== --- trunk/roadmap/src/qt4/roadmap_canvas.cc 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/qt4/roadmap_canvas.cc 2015-06-10 19:19:21 UTC (rev 2855) @@ -82,7 +82,7 @@ } } -void roadmap_canvas_get_text_extents(const char *text, int size, +void roadmap_canvas_get_text_extents(const char *text, int *width, int *ascent, int *descent, int *can_tilt) { roadMapCanvas->getTextExtents(text, width, ascent, descent, can_tilt); @@ -276,7 +276,6 @@ } void roadmap_canvas_draw_string_angle (RoadMapGuiPoint *position, - int size, int angle, const char *text) { Modified: trunk/roadmap/src/roadgps_screen.c =================================================================== --- trunk/roadmap/src/roadgps_screen.c 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/roadgps_screen.c 2015-06-10 19:19:21 UTC (rev 2855) @@ -268,9 +268,10 @@ roadmap_canvas_select_pen (reverse ? RoadGpsInactiveLabels : RoadGpsActiveLabels); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string (&satellite->position, ROADMAP_CANVAS_CENTER, - RoadMapGPSFontSize, satellite->label); + satellite->label); } @@ -296,9 +297,10 @@ roadmap_canvas_select_pen (filled ? RoadGpsActiveLabels : RoadGpsInactiveLabels); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string (&position, ROADMAP_CANVAS_CENTER, - RoadMapGPSFontSize, RoadGpsSatellites[satellite].label); + RoadGpsSatellites[satellite].label); if (RoadGpsSatellites[satellite].strength == 0) return; @@ -345,49 +347,55 @@ point.x = RoadGpsFrame.latitude_offset_x; point.y = RoadGpsFrame.latitude_offset_y; roadmap_canvas_select_pen (RoadGpsLabels); - roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, RoadMapGPSFontSize, "Latitude:"); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); + roadmap_canvas_draw_string (&point, ROADMAP_CANVAS_LEFT, "Latitude:"); point.y = point.y+RoadGpsFrame.label_height; roadgps_screen_to_coord(data,1,RoadGpsPosition.latitude); roadmap_canvas_select_pen (RoadGpsValues); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, RoadMapGPSFontSize, data); + (&point, ROADMAP_CANVAS_LEFT, data); point.x = RoadGpsFrame.longitude_offset_x; point.y = RoadGpsFrame.longitude_offset_y; roadmap_canvas_select_pen (RoadGpsLabels); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, RoadMapGPSFontSize, "Longitude:"); + (&point, ROADMAP_CANVAS_LEFT, "Longitude:"); point.y = point.y+RoadGpsFrame.label_height; roadgps_screen_to_coord(data,0,RoadGpsPosition.longitude); roadmap_canvas_select_pen (RoadGpsValues); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, RoadMapGPSFontSize, data); + (&point, ROADMAP_CANVAS_LEFT, data); point.y = point.y+RoadGpsFrame.label_height; roadmap_canvas_select_pen (RoadGpsLabels); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, RoadMapGPSFontSize, "Altitude:"); + (&point, ROADMAP_CANVAS_LEFT, "Altitude:"); sprintf(data,"%d%s",RoadGpsPosition.altitude,roadmap_math_distance_unit()); point.y = point.y+RoadGpsFrame.label_height; roadmap_canvas_select_pen (RoadGpsValues); roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, RoadMapGPSFontSize, data); + (&point, ROADMAP_CANVAS_LEFT, data); point.y = point.y+RoadGpsFrame.label_height; roadmap_canvas_select_pen (RoadGpsLabels); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, RoadMapGPSFontSize, "Speed:"); + (&point, ROADMAP_CANVAS_LEFT, "Speed:"); sprintf(data,"%d%s", roadmap_math_knots_to_speed_unit(RoadGpsPosition.speed), roadmap_math_speed_unit()); point.y = point.y+RoadGpsFrame.label_height; roadmap_canvas_select_pen (RoadGpsValues); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, RoadMapGPSFontSize, data); + (&point, ROADMAP_CANVAS_LEFT, data); point.x = RoadGpsFrame.centers[0].x-RoadGpsFrame.radius[0]; point.y = RoadGpsFrame.centers[0].y+RoadGpsFrame.radius[0]+ @@ -397,16 +405,18 @@ if (fix < 1) fix = 1; else if (fix > 3) fix = 3; sprintf(data,"%d active satellites, %s fix", satcount, fixes[fix-1]); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, RoadMapGPSFontSize, data); + (&point, ROADMAP_CANVAS_LEFT, data); if (RoadMapGpsReceivedTime != 0) { point.y = point.y+RoadGpsFrame.label_height; roadmap_canvas_select_pen (RoadGpsLabels); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); strftime(data, sizeof(data), " %Y/%m/%d %H:%M:%S", localtime(&RoadMapGpsReceivedTime)); roadmap_canvas_draw_string - (&point, ROADMAP_CANVAS_LEFT, RoadMapGPSFontSize, data); + (&point, ROADMAP_CANVAS_LEFT, data); } } @@ -614,8 +624,9 @@ canvas_width = roadmap_canvas_width(); canvas_height = roadmap_canvas_height(); + roadmap_canvas_set_label_font_size(RoadMapGPSFontSize); roadmap_canvas_get_text_extents - ("09", RoadMapGPSFontSize, &text_width, + ("09", &text_width, &text_ascent, &text_descent, NULL); text_height = text_ascent + text_descent + 2; Modified: trunk/roadmap/src/roadmap_canvas.h =================================================================== --- trunk/roadmap/src/roadmap_canvas.h 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/roadmap_canvas.h 2015-06-10 19:19:21 UTC (rev 2855) @@ -69,7 +69,7 @@ * according to the current font. */ void roadmap_canvas_get_text_extents - (const char *text, int size, int *width, + (const char *text, int *width, int *ascent, int *descent, int *can_tilt); @@ -147,11 +147,9 @@ void roadmap_canvas_draw_string (RoadMapGuiPoint *position, int corner, - int size, const char *text); void roadmap_canvas_draw_string_angle ( RoadMapGuiPoint *center, - int size, int angle, const char *text); Modified: trunk/roadmap/src/roadmap_display.c =================================================================== --- trunk/roadmap/src/roadmap_display.c 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/roadmap_display.c 2015-06-10 19:19:21 UTC (rev 2855) @@ -246,9 +246,10 @@ saved = *p1; *p1 = 0; - roadmap_screen_text (ROADMAP_TEXT_SIGNS, position, + roadmap_canvas_set_label_font_size(RoadMapDisplayFontSize); + roadmap_canvas_draw_string (position, ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP, - RoadMapDisplayFontSize, text_line); + text_line); *p1 = saved; text_line = p1; @@ -256,9 +257,10 @@ } - roadmap_screen_text (ROADMAP_TEXT_SIGNS, position, + roadmap_canvas_set_label_font_size(RoadMapDisplayFontSize); + roadmap_canvas_draw_string (position, ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP, - RoadMapDisplayFontSize, text_line); + text_line); } /** @@ -302,8 +304,9 @@ roadmap_log_push ("roadmap_display_sign"); - roadmap_screen_text_extents - (ROADMAP_TEXT_SIGNS, sign->content, RoadMapDisplayFontSize, NULL, + roadmap_canvas_set_label_font_size(RoadMapDisplayFontSize); + roadmap_canvas_get_text_extents + (sign->content, &width, &ascent, &descent, NULL); width += 8; /* Keep some room around the text. */ @@ -629,8 +632,9 @@ return; } - roadmap_screen_text_extents - (ROADMAP_TEXT_SIGNS, text, RoadMapDisplayFontSize, NULL, + roadmap_canvas_set_label_font_size(RoadMapDisplayFontSize); + roadmap_canvas_get_text_extents + (text, &width, &ascent, &descent, NULL); canvas_width = roadmap_canvas_width(); @@ -673,9 +677,10 @@ frame[0].x += 3; frame[0].y += 3; - roadmap_screen_text(ROADMAP_TEXT_SIGNS, frame, + roadmap_canvas_set_label_font_size(RoadMapDisplayFontSize); + roadmap_canvas_draw_string(frame, ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP, - RoadMapDisplayFontSize, text); + text); } Modified: trunk/roadmap/src/roadmap_label.c =================================================================== --- trunk/roadmap/src/roadmap_label.c 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/roadmap_label.c 2015-06-10 19:19:21 UTC (rev 2855) @@ -90,9 +90,6 @@ static RoadMapConfigDescriptor RoadMapConfigLabelsColor = ROADMAP_CONFIG_ITEM("Labels", "Color"); -static RoadMapConfigDescriptor RoadMapConfigLabelSize = - ROADMAP_CONFIG_ITEM("Labels", "Font Size"); - /* this is fairly arbitrary */ #define MAX_LABELS 8192 @@ -140,8 +137,6 @@ static int RoadMapLabelMinFeatSizeSq; -static int RoadMapLabelFontSize; - /* doesn't check for one completely inside the other -- just intersection */ static int poly_overlap (roadmap_label *c1, roadmap_label *c2) { @@ -238,7 +233,6 @@ RoadMapGuiPoint *pos, int doing_angles, int angle, RoadMapPen pen) { - int size = RoadMapLabelFontSize; if (pen!=0) roadmap_canvas_select_pen (pen); @@ -246,11 +240,11 @@ roadmap_canvas_select_pen (RoadMapLabelPen); if (doing_angles) { - roadmap_screen_text_angle - (ROADMAP_TEXT_LABELS, pos, angle, size, text); + roadmap_canvas_draw_string_angle + (pos, angle, text); } else { - roadmap_screen_text - (ROADMAP_TEXT_LABELS, pos, ROADMAP_CANVAS_CENTER_BOTTOM, size, text); + roadmap_canvas_draw_string + (pos, ROADMAP_CANVAS_CENTER_BOTTOM, text); } } @@ -280,8 +274,6 @@ roadmap_math_get_context (&last_center, &RoadMapLabelCurrentZoom, NULL); - RoadMapLabelFontSize = roadmap_config_get_integer (&RoadMapConfigLabelSize); - } int roadmap_label_add_worker (int is_line, const RoadMapGuiPoint *point, @@ -535,9 +527,10 @@ if (cPtr->bbox.minx > cPtr->bbox.maxx) { - roadmap_screen_text_extents - (ROADMAP_TEXT_LABELS, cPtr->text, - RoadMapLabelFontSize , cPtr->pen, + if (cPtr->pen) + roadmap_canvas_select_pen(cPtr->pen); + roadmap_canvas_get_text_extents + (cPtr->text, &width, &ascent, &descent, &can_tilt); angles = angles && can_tilt; @@ -736,9 +729,6 @@ roadmap_config_declare ("preferences", &RoadMapConfigLabelsColor, "#000000"); - roadmap_config_declare - ("preferences", &RoadMapConfigLabelSize, "16"); - ROADMAP_LIST_INIT(&RoadMapLabelCache); ROADMAP_LIST_INIT(&RoadMapLabelSpares); Deleted: trunk/roadmap/src/roadmap_linefont.c =================================================================== --- trunk/roadmap/src/roadmap_linefont.c 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/roadmap_linefont.c 2015-06-10 19:19:21 UTC (rev 2855) @@ -1,548 +0,0 @@ -/* roadmap_linefont.c - draw text on a map. - * - * LICENSE: - * - * Copyright 2006 Paul G. Fox - * - * This file is part of RoadMap. - * - * RoadMap is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * RoadMap is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with RoadMap; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Some of the platforms on which RoadMap runs do not have font support - * sophisticated enough to render angled or scaled text. (The GTK-1.2 - * desktop is one of these, some builds of QT are another.) This file - * provides a fallback mechanism for drawing text on a map image, for - * those platforms. - * - * The code in this file borrows heavily from the Xrotfont package - * posted to Usenet in 1992 by Alan Richardson. His implementation - * was based in turn on an earlier work distributed with the Hershey - * fonts themselves. Credits as listed in Alan Richardson's compilation - * are copied here. Additional original use restrictions appear - * at bottom of this file. - * - * - * ****************************************************************** - * - * hersheytext.c - routines to facilitate the loading and - * painting of hershey fonts - * - * Functions: hersheytext() - * load_hershey_font() - * scanint() - * - * Date: 8/5/92 - * - * Copyright (c) 1992 Alan Richardson - * - * ***************************************************************** - * - * The code in this file is based heavily on the program "hershey.c", - * distributed with the Hershey fonts. The credits for that program ... - * - * Translated by Pete Holzmann - * Octopus Enterprises - * 19611 La Mar Court - * Cupertino, CA 95014 - * - * Original... - * .. By James Hurt when with - * .. Deere and Company - * .. John Deere Road - * .. Moline, IL 61265 - * - * .. now with Cognition, Inc. - * .. 900 Technology Park Drive - * .. Billerica, MA 01821 - * - * - * - * - */ - -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "roadmap.h" -#include "roadmap_types.h" -#include "roadmap_gui.h" -#include "roadmap_math.h" - -#include "roadmap_canvas.h" -#include "roadmap_linefont.h" - -#define MAXCHARS 100 -#define MAXPOINTS 256 - - -/* hershey font stuff ... */ -typedef struct { - // "pt" is a pointer to a set of x/y pairs. we used to define it - // as a pointer to an array of two element structs, but that - // gives alignment warnings which could be real errors on some - // architectures. - const unsigned char *pt; -#define X 0 -#define Y 1 - unsigned char npnt; - unsigned char minx, maxx; -} hershey_char; - -typedef struct hershey_font { - hershey_char hc[MAXCHARS]; - unsigned short nchars; - unsigned char miny, maxy; -} hershey_font; - -static hershey_font hf[1]; - -static const unsigned char *fontp; - -const unsigned char romans_font[]; - -/* This font only supports US ASCII. Map accented isolatin chars - * to the nearest ASCII equivalent. - */ -static char isoconv_chars[] = - "AAAAAAECEEEEIIIIDNoooooxOUUUUYPBaaaaaaeceeeeiiiionooooo/ouuuuypy"; -#define ISOCONV_MIN 192 - -static int -isoconv(char c) -{ - unsigned char uc = (unsigned char)c; - if (uc >= ISOCONV_MIN) - return isoconv_chars[uc - ISOCONV_MIN]; - else - return c; -} - -/* this function scans an integer, using n characters of the input stream, - ignoring newlines ... */ - -static int -scanint(int n) -{ - char buf[20]; - int i, c; - - for (i = 0; i < n; i++) { - while ((c = *fontp++) == '\n'); /* discard spare newlines */ - if (c == '\0') - return (-1); - buf[i] = c; - } - - buf[i] = 0; - return (atoi(buf)); -} - - -/* this loads font information from a file into memory */ -static void -roadmap_load_hershey_font(void) -{ - int np; - int i, j; - - - /* point to hershey font data ... data has already been - * sorted into ASCII order. - * (Note: RoadMap only supports "Roman Simplex") - */ - fontp = romans_font; - - /* loop through the characters in the file ... */ - for (j = 0; j < MAXCHARS; j++) { - /* read character number and data ... */ - if (scanint(5) < 1) { - break; - } else { - /* get the number of vertices in this figure ... */ - np = scanint(3); - - /* index directly into the ASCII font data */ - hf->hc[j].pt = fontp; - fontp += np * 2; // 2 bytes (i.e., x and y) per point - - if (np > MAXPOINTS) { - roadmap_log(ROADMAP_WARNING, - "Too many points in hershey character, truncated"); - np = MAXPOINTS; - } - - hf->hc[j].npnt = np; - - } - } - - if (j >= MAXCHARS) { - roadmap_log(ROADMAP_WARNING, - "Too many characters in line font, font truncated"); - j = MAXCHARS - 1; - } - hf->nchars = j; - - /* determine the size of each character ... */ - - /* initialise ... */ - hf->miny = 255; - hf->maxy = 0; - - /* loop through each character ... */ - for (j = 1; j < hf->nchars; j++) { - hf->hc[j].minx = 255; - hf->hc[j].maxx = 0; - for (i = 1; i < hf->hc[j].npnt; i++) { - if (hf->hc[j].pt[i * 2 + X] != ' ') { - if (hf->hc[j].pt[i * 2 + X] < hf->hc[j].minx) - hf->hc[j].minx = hf->hc[j].pt[i * 2 + X]; - if (hf->hc[j].pt[i * 2 + X] > hf->hc[j].maxx) - hf->hc[j].maxx = hf->hc[j].pt[i * 2 + X]; - if (hf->hc[j].pt[i * 2 + Y] < hf->miny) - hf->miny = hf->hc[j].pt[i * 2 + Y]; - if (hf->hc[j].pt[i * 2 + Y] > hf->maxy) - hf->maxy = hf->hc[j].pt[i * 2 + Y]; - } - } - } - - /* do the space character by hand ... same width as 't' */ - hf->hc[0].minx = hf->hc['t' - ' '].minx; - hf->hc[0].maxx = hf->hc['t' - ' '].maxx; - - /* a little offset for a nice appearance ... */ - for (j = 0; j < hf->nchars; j++) { - hf->hc[j].minx -= 3; - hf->hc[j].maxx += 3; - } -} - -void roadmap_linefont_extents - (const char *text, int size, - int *width, int *ascent, int *descent, int *can_tilt) { - - int len, scale; - const char *t; - unsigned int k; - - if (fontp == 0) { - roadmap_load_hershey_font(); - } - - scale = 1024 * size / (hf->maxy - hf->miny); - - /* find the length of the string in pixels ... */ - len = 2; - - for (t = text; *t; t++) { - - k = isoconv(*t) - ' '; - if (k < hf->nchars) { - len += hf->hc[k].maxx - hf->hc[k].minx; - } - } - *width = scale * len / 1024; - *ascent = 0; /* hershey baseline is at top of text */ - *descent = scale * (hf->maxy - hf->miny)/ 1024; - - if (can_tilt) *can_tilt = 1; - -} - - -/* render a string to the screen ... */ -void roadmap_linefont_text_worker - ( RoadMapGuiPoint *start, RoadMapGuiPoint *center, - int size, int theta, const char *text) { - - RoadMapGuiPoint *p, points[MAXPOINTS]; - int i, xp, yp, count; - long scale; - const char *t; - unsigned int k; - - roadmap_canvas_set_thickness (2); - - if (fontp == 0) { - roadmap_load_hershey_font(); - } - - // debugging aids: - // roadmap_sprite_draw ("SmallRedDot" , start, 0); - // roadmap_sprite_draw ("PurpleCross" , center, 0); - - /* scale factor ... */ - scale = 1024 * size / (hf->maxy - hf->miny); - - xp = start->x; - yp = start->y; - - p = points; - count = 0; - /* loop through each character in the string ... */ - for (t = text; *t; t++) { - - k = isoconv(*t) - ' '; - if (k >= hf->nchars) { - continue; - } - - /* loop through each vertex ... */ - for (i = 1; i < hf->hc[k].npnt; i++) { - if (hf->hc[k].pt[i * 2 + X] == ' ') { - if (count) { - roadmap_canvas_draw_multiple_lines (1, &count, points, 1); - p = points; - count = 0; - } - } else { - p->x = xp + scale * (hf->hc[k].pt[i * 2 + X] - hf->hc[k].minx) / 1024; - p->y = yp + scale * (hf->hc[k].pt[i * 2 + Y] - hf->miny) / 1024; - - p->x = p->x - center->x; - p->y = center->y - p->y; - - roadmap_math_rotate_point (p, center, theta); - - p++; - count++; - - } - } - if (count) { - roadmap_canvas_draw_multiple_lines (1, &count, points, 1); - p = points; - count = 0; - } - - /* advance the starting coordinate ... */ - xp += ((scale * (hf->hc[k].maxx - hf->hc[k].minx)) + 511) / 1024; - - } -} - -void roadmap_linefont_text_angle - ( RoadMapGuiPoint *center, - int size, int theta, const char *text) { - int text_width; - int text_ascent; - int text_descent; - RoadMapGuiPoint start[1]; - - roadmap_linefont_extents - (text, size, &text_width, &text_ascent, &text_descent, NULL); - - start->x = center->x - text_width/2; - start->y = center->y - (text_ascent + text_descent); - - roadmap_linefont_text_worker (start, center, size, theta, text); -} - -void roadmap_linefont_text - ( RoadMapGuiPoint *position, int corner, int size, const char *text) { - int text_width; - int text_ascent; - int text_descent; - RoadMapGuiPoint start[1]; - - roadmap_linefont_extents - (text, size, &text_width, &text_ascent, &text_descent, NULL); - - start->x = position->x; - start->y = position->y; - if (corner & ROADMAP_CANVAS_RIGHT) - start->x -= text_width; - else if (corner & ROADMAP_CANVAS_CENTER_X) - start->x -= text_width / 2; - - if (corner & ROADMAP_CANVAS_BOTTOM) - start->y -= text_descent; - else if (corner & ROADMAP_CANVAS_CENTER_Y) - start->y -= text_descent + ((text_descent + text_ascent) / 2); - else /* TOP */ - start->y += text_ascent; - - roadmap_linefont_text_worker (start, position, size, 0, text); -} - - -/* This string is simply an in-line version of the file "romans", - * the Roman-Simplex font distributed on Usenet with Alan - * Richardson's Xrotfont package. To inline another such font, - * simply quote each line, escape all '\' characters, and join - * lines that are clearly continuations lines. (The data in - * this array is used directly by the code above, after some - * initial pointers are set up into the array.) - * - */ -const unsigned char romans_font[] = - " 699 1JZ\n" - " 714 9MWRFRT RRYQZR[SZRY\n" - " 717 6JZNFNM RVFVM\n" - " 733 12H]SBLb RYBRb RLOZO RKUYU\n" - " 719 27H\\PBP_ RTBT_ RYIWGTFPFMGKIKKLMMNOOUQWRXSYUYXWZT[P[MZKX\n" - " 2271 32F^[FI[ RNFPHPJOLMMKMIKIIJGLFNFPGSHVHYG[F RWTUUTWTYV[X[ZZ[X[VYTWT\n" - " 734 35E_\\O\\N[MZMYNXPVUTXRZP[L[JZIYHWHUISJRQNRMSKSIRGPFNGMIMKNNPQUXWZY[[[\\Z\\Y\n" - " 731 8MWRHQGRFSGSIRKQL\n" - " 721 11KYVBTDRGPKOPOTPYR]T`Vb\n" - " 722 11KYNBPDRGTKUPUTTYR]P`Nb\n" - " 2219 9JZRFRR RMIWO RWIMO\n" - " 725 6E_RIR[ RIR[R\n" - " 711 9MWSZR[QZRYSZS\\R^Q_\n" - " 724 3E_IR[R\n" - " 710 6MWRYQZR[SZRY\n" - " 720 3G][BIb\n" - " 700 18H\\QFNGLJKOKRLWNZQ[S[VZXWYRYOXJVGSFQF\n" - " 701 5H\\NJPISFS[\n" - " 702 15H\\LKLJMHNGPFTFVGWHXJXLWNUQK[Y[\n" - " 703 16H\\MFXFRNUNWOXPYSYUXXVZS[P[MZLYKW\n" - " 704 7H\\UFKTZT RUFU[\n" - " 705 18H\\WFMFLOMNPMSMVNXPYSYUXXVZS[P[MZLYKW\n" - " 706 24H\\XIWGTFRFOGMJLOLTMXOZR[S[VZXXYUYTXQVOSNRNOOMQLT\n" - " 707 6H\\YFO[ RKFYF\n" - " 708 30H\\PFMGLILKMMONSOVPXRYTYWXYWZT[P[MZLYKWKTLRNPQOUNWMXKXIWGTFPF\n" - " 709 24H\\XMWPURRSQSNRLPKMKLLINGQFRFUGWIXMXRWWUZR[P[MZLX\n" - " 712 12MWRMQNROSNRM RRYQZR[SZRY\n" - " 713 15MWRMQNROSNRM RSZR[QZRYSZS\\R^Q_\n" - " 2241 4F^ZIJRZ[\n" - " 726 6E_IO[O RIU[U\n" - " 2242 4F^JIZRJ[\n" - " 715 21I[LKLJMHNGPFTFVGWHXJXLWNVORQRT RRYQZR[SZRY\n" - " 2273 56E`WNVLTKQKOLNMMPMSNUPVSVUUVS RQKOMNPNSOUPV RWKVSVUXVZV\\T]Q]O\\L[JYHWGTFQFNGLHJJILHOHRIUJWLYNZQ[T[WZYYZX RXKWSWUXV\n" - " 501 9I[RFJ[ RRFZ[ RMTWT\n" - " 502 24G\\KFK[ RKFTFWGXHYJYLXNWOTP RKPTPWQXRYTYWXYWZT[K[\n" - " 503 19H]ZKYIWGUFQFOGMILKKNKSLVMXOZQ[U[WZYXZV\n" - " 504 16G\\KFK[ RKFRFUGWIXKYNYSXVWXUZR[K[\n" - " 505 12H[LFL[ RLFYF RLPTP RL[Y[\n" - " 506 9HZLFL[ RLFYF RLPTP\n" - " 507 23H]ZKYIWGUFQFOGMILKKNKSLVMXOZQ[U[WZYXZVZS RUSZS\n" - " 508 9G]KFK[ RYFY[ RKPYP\n" - " 509 3NVRFR[\n" - " 510 11JZVFVVUYTZR[P[NZMYLVLT\n" - " 511 9G\\KFK[ RYFKT RPOY[\n" - " 512 6HYLFL[ RL[X[\n" - " 513 12F^JFJ[ RJFR[ RZFR[ RZFZ[\n" - " 514 9G]KFK[ RKFY[ RYFY[\n" - " 515 22G]PFNGLIKKJNJSKVLXNZP[T[VZXXYVZSZNYKXIVGTFPF\n" - " 516 14G\\KFK[ RKFTFWGXHYJYMXOWPTQKQ\n" - " 517 25G]PFNGLIKKJNJSKVLXNZP[T[VZXXYVZSZNYKXIVGTFPF RSWY]\n" - " 518 17G\\KFK[ RKFTFWGXHYJYLXNWOTPKP RRPY[\n" - " 519 21H\\YIWGTFPFMGKIKKLMMNOOUQWRXSYUYXWZT[P[MZKX\n" - " 520 6JZRFR[ RKFYF\n" - " 521 11G]KFKULXNZQ[S[VZXXYUYF\n" - " 522 6I[JFR[ RZFR[\n" - " 523 12F^HFM[ RRFM[ RRFW[ R\\FW[\n" - " 524 6H\\KFY[ RYFK[\n" - " 525 7I[JFRPR[ RZFRP\n" - " 526 9H\\YFK[ RKFYF RK[Y[\n" - " 2223 12KYOBOb RPBPb ROBVB RObVb\n" - " 804 3KYKFY^\n" - " 2224 12KYTBTb RUBUb RNBUB RNbUb\n" - " 2262 11JZPLRITL RMORJWO RRJR[\n" - " 999 3JZJ]Z]\n" - " 730 8MWSFRGQIQKRLSKRJ\n" - " 601 18I\\XMX[ RXPVNTMQMONMPLSLUMXOZQ[T[VZXX\n" - " 602 18H[LFL[ RLPNNPMSMUNWPXSXUWXUZS[P[NZLX\n" - " 603 15I[XPVNTMQMONMPLSLUMXOZQ[T[VZXX\n" - " 604 18I\\XFX[ RXPVNTMQMONMPLSLUMXOZQ[T[VZXX\n" - " 605 18I[LSXSXQWOVNTMQMONMPLSLUMXOZQ[T[VZXX\n" - " 606 9MYWFUFSGRJR[ ROMVM\n" - " 607 23I\\XMX]W`VaTbQbOa RXPVNTMQMONMPLSLUMXOZQ[T[VZXX\n" - " 608 11I\\MFM[ RMQPNRMUMWNXQX[\n" - " 609 9NVQFRGSFREQF RRMR[\n" - " 610 12MWRFSGTFSERF RSMS^RaPbNb\n" - " 611 9IZMFM[ RWMMW RQSX[\n" - " 612 3NVRFR[\n" - " 613 19CaGMG[ RGQJNLMOMQNRQR[ RRQUNWMZM\\N]Q][\n" - " 614 11I\\MMM[ RMQPNRMUMWNXQX[\n" - " 615 18I\\QMONMPLSLUMXOZQ[T[VZXXYUYSXPVNTMQM\n" - " 616 18H[LMLb RLPNNPMSMUNWPXSXUWXUZS[P[NZLX\n" - " 617 18I\\XMXb RXPVNTMQMONMPLSLUMXOZQ[T[VZXX\n" - " 618 9KXOMO[ ROSPPRNTMWM\n" - " 619 18J[XPWNTMQMNNMPNRPSUTWUXWXXWZT[Q[NZMX\n" - " 620 9MYRFRWSZU[W[ ROMVM\n" - " 621 11I\\MMMWNZP[S[UZXW RXMX[\n" - " 622 6JZLMR[ RXMR[\n" - " 623 12G]JMN[ RRMN[ RRMV[ RZMV[\n" - " 624 6J[MMX[ RXMM[\n" - " 625 10JZLMR[ RXMR[P_NaLbKb\n" - " 626 9J[XMM[ RMMXM RM[X[\n" - " 2225 40KYTBRCQDPFPHQJRKSMSOQQ RRCQEQGRISJTLTNSPORSTTVTXSZR[Q]Q_Ra RQSSUSWRYQZP\\P^Q`RaTb\n" - " 723 3NVRBRb\n" - " 2226 40KYPBRCSDTFTHSJRKQMQOSQ RRCSESGRIQJPLPNQPURQTPVPXQZR[S]S_Ra RSSQUQWRYSZT\\T^S`RaPb\n\n" - " 2246 24F^IUISJPLONOPPTSVTXTZS[Q RISJQLPNPPQTTVUXUZT[Q[O\n" - " 718 14KYQFOGNINKOMQNSNUMVKVIUGSFQF\n"; - - -/* - -original restriction text from mod.sources posting of the fonts follows: - -----quote begins--- - -Mod.sources: Volume 4, Issue 42 -Submitted by: pyramid!octopus!pete (Pete Holzmann) - -This is part 1 of five parts of the first Usenet distribution of -the Hershey Fonts. See the README file for more details. - -Peter Holzmann, Octopus Enterprises -USPS: 19611 La Mar Court, Cupertino, CA 95014 -UUCP: {hplabs!hpdsd,pyramid}!octopus!pete -Phone: 408/996-7746 - -This distribution is made possible through the collective encouragement -of the Usenet Font Consortium, a mailing list that sprang to life to get -this accomplished and that will now most likely disappear into the mists -of time... Thanks are especially due to Jim Hurt, who provided the packed -font data for the distribution, along with a lot of other help. - -This file describes the Hershey Fonts in general, along with a description of -the other files in this distribution and a simple re-distribution restriction. - -USE RESTRICTION: - This distribution of the Hershey Fonts may be used by anyone for - any purpose, commercial or otherwise, providing that: - 1. The following acknowledgements must be distributed with - the font data: - - The Hershey Fonts were originally created by Dr. - A. V. Hershey while working at the U. S. - National Bureau of Standards. - - The format of the Font data in this distribution - was originally created by - James Hurt - Cognition, Inc. - 900 Technology Park Drive - Billerica, MA 01821 - (mit-eddie!ci-dandelion!hurt) - 2. The font data in this distribution may be converted into - any other format *EXCEPT* the format distributed by - the U.S. NTIS (which organization holds the rights - to the distribution and use of the font data in that - particular format). Not that anybody would really - *want* to use their format... each point is described - in eight bytes as "xxx yyy:", where xxx and yyy are - the coordinate values as ASCII numbers. - -----quote ends--- - -[ the original text continues, but describes files and formats -not present here. -pgf ] - - */ - Deleted: trunk/roadmap/src/roadmap_linefont.h =================================================================== --- trunk/roadmap/src/roadmap_linefont.h 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/roadmap_linefont.h 2015-06-10 19:19:21 UTC (rev 2855) @@ -1,33 +0,0 @@ -/* roadmap_linefont.h - draw text on a map. - * - * LICENSE: - * - * Copyright 2006 Paul G. Fox - * - * This file is part of RoadMap. - * - * RoadMap is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * RoadMap is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with RoadMap; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -void roadmap_linefont_extents - (const char *text, int size, - int *width, int *ascent, int *descent, int *can_tilt); - -void roadmap_linefont_text - ( RoadMapGuiPoint *center, int where, int size, const char *text); - -void roadmap_linefont_text_angle - ( RoadMapGuiPoint *center, - int size, int theta, const char *text); Modified: trunk/roadmap/src/roadmap_screen.c =================================================================== --- trunk/roadmap/src/roadmap_screen.c 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/roadmap_screen.c 2015-06-10 19:19:21 UTC (rev 2855) @@ -139,8 +139,6 @@ static int RoadMapScreenWidth; static int RoadMapScreenHeight; -static int RoadMapLineFontSelect; - static int RoadMapScreenDeltaX; static int RoadMapScreenDeltaY; @@ -192,37 +190,6 @@ /** * @brief */ -static void roadmap_screen_setfont(void) { - - const char *p; - int labels_was = (RoadMapLineFontSelect & ROADMAP_TEXT_LABELS); - - RoadMapLineFontSelect = 0; - p = roadmap_config_get(&RoadMapConfigLinefontSelector); - if (p == NULL) { - RoadMapLineFontSelect |= ROADMAP_TEXT_LABELS; - } else { - if (*p == 'l') { // "labels" - RoadMapLineFontSelect |= ROADMAP_TEXT_LABELS; - } else if (*p == 's') { // "signs" - RoadMapLineFontSelect |= ROADMAP_TEXT_SIGNS; - } else if (*p == 'a') { // "all" - RoadMapLineFontSelect |= ROADMAP_TEXT_SIGNS|ROADMAP_TEXT_LABELS; - } - } - - /* If the LABELS bit changes here, reset the cache in - * roadmap_label.c: the font has changed, and therefore the - * dimensions and bounding boxes. - */ - if (labels_was != (RoadMapLineFontSelect & ROADMAP_TEXT_LABELS)) { - roadmap_label_cache_invalidate(); - } -} - -/** - * @brief - */ static void roadmap_screen_start_progress () { RoadMapScreenProgressDelay = @@ -1560,8 +1527,6 @@ if (!RoadMapScreenDragging) roadmap_screen_set_cursor (ROADMAP_CURSOR_WAIT_WITH_DELAY); - roadmap_screen_setfont(); - roadmap_log_push ("roadmap_screen_repaint"); /* Clean the drawing buffer. */ @@ -2320,52 +2285,9 @@ } } - -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 { - roadmap_canvas_draw_string ( center, where, size, text); - } -} - -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 { - roadmap_canvas_draw_string_angle ( center, size, theta, text); - // roadmap_sprite_draw ("PurpleCross", center, 0); - } -} - /** * @brief initialize - * @param id - * @param text - * @param size - * @param width - * @param ascent - * @param descent - * @param can_tilt */ -void roadmap_screen_text_extents (int id, const char *text, int size, - RoadMapPen pen, int *width, int *ascent, int *descent, int *can_tilt) { - if ((RoadMapLineFontSelect & id) != 0) { - roadmap_linefont_extents - (text, size, width, ascent, descent, can_tilt); - } else { - if (pen) roadmap_canvas_select_pen(pen); - roadmap_canvas_get_text_extents - (text, size, width, ascent, descent, can_tilt); - } -} - -/** - * @brief initialize - */ void roadmap_screen_state_refresh(void) { roadmap_start_request_repaint_map(REPAINT_MAYBE); } @@ -2470,8 +2392,6 @@ RoadMapScreenWidth = 0; RoadMapScreenHeight = 0; - RoadMapLineFontSelect = 0; - RoadMapScreenDeltaX = 0; RoadMapScreenDeltaY = 0; Modified: trunk/roadmap/src/roadmap_screen.h =================================================================== --- trunk/roadmap/src/roadmap_screen.h 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/roadmap_screen.h 2015-06-10 19:19:21 UTC (rev 2855) @@ -76,14 +76,7 @@ #define ROADMAP_TEXT_SIGNS 0x01 #define ROADMAP_TEXT_LABELS 0x02 -void roadmap_screen_text - (int id, RoadMapGuiPoint *center, int where, int size, const char *text); -void roadmap_screen_text_angle - (int id, RoadMapGuiPoint *center, - int theta, int size, const char *text); -void roadmap_screen_text_extents - (int id, const char *text, int size, RoadMapPen pen, - int *width, int *ascent, int *descent, int *can_tilt); + void roadmap_screen_shutdown (void); #ifdef ROADMAP_DBG_TIME Modified: trunk/roadmap/src/roadmap_sprite.c =================================================================== --- trunk/roadmap/src/roadmap_sprite.c 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/roadmap_sprite.c 2015-06-10 19:19:21 UTC (rev 2855) @@ -368,9 +368,10 @@ max_width = tot_height = 0; for (i = 0; i < count; i++) { - roadmap_screen_text_extents - (ROADMAP_TEXT_LABELS, textseq->obj.strings[i], - sprite->textsize, NULL, &width, &ascent, &descent, NULL); + roadmap_canvas_set_label_font_size(sprite->textsize); + roadmap_canvas_get_text_extents + (textseq->obj.strings[i], + &width, &ascent, &descent, NULL); if (width > max_width) max_width = width; tot_height += ascent + descent + 2; } @@ -931,10 +932,10 @@ t = textseq->obj.strings[i]; if (t != NULL) { - roadmap_screen_text - (ROADMAP_TEXT_LABELS, &RoadMapSpritePoints[i], - ROADMAP_CANVAS_CENTER, - sprite->textsize * scale / 100, t); + roadmap_canvas_set_label_font_size(sprite->textsize * scale / 100); + roadmap_canvas_draw_string + (&RoadMapSpritePoints[i], + ROADMAP_CANVAS_CENTER, t); } } } Modified: trunk/roadmap/src/win32/roadmap_canvas.c =================================================================== --- trunk/roadmap/src/win32/roadmap_canvas.c 2015-06-10 19:19:17 UTC (rev 2854) +++ trunk/roadmap/src/win32/roadmap_canvas.c 2015-06-10 19:19:21 UTC (rev 2855) @@ -84,7 +84,7 @@ } -void roadmap_canvas_get_text_extents (const char *text, int size, +void roadmap_canvas_get_text_extents (const char *text, int *width, int *ascent, int *descent, int *can_tilt) { TEXTMETRIC metric; @@ -235,7 +235,6 @@ void roadmap_canvas_draw_string (RoadMapGuiPoint *position, int corner, - int size, const char *text) { int x; @@ -248,7 +247,7 @@ LPWSTR text_unicode; roadmap_canvas_get_text_extents - (text, -1, &text_width, &text_ascent, &text_descent, NULL); + (text, &text_width, &text_ascent, &text_descent, NULL); text_height = text_ascent + text_descent; @@ -278,11 +277,10 @@ } void roadmap_canvas_draw_string_angle (RoadMapGuiPoint *center, - int size, int angle, const char *text) { /* no angle possible, currently. at least try and center the text */ - roadmap_canvas_draw_string (center, ROADMAP_CANVAS_CENTER, size, text); + roadmap_canvas_draw_string (center, ROADMAP_CANVAS_CENTER, text); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |