You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(92) |
Dec
(141) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(126) |
Feb
(72) |
Mar
(31) |
Apr
(200) |
May
(81) |
Jun
(130) |
Jul
(112) |
Aug
(134) |
Sep
(76) |
Oct
(89) |
Nov
(153) |
Dec
(9) |
2007 |
Jan
(59) |
Feb
(82) |
Mar
(50) |
Apr
(20) |
May
(9) |
Jun
(81) |
Jul
(41) |
Aug
(109) |
Sep
(91) |
Oct
(87) |
Nov
(33) |
Dec
(60) |
2008 |
Jan
(21) |
Feb
(15) |
Mar
(38) |
Apr
(75) |
May
(59) |
Jun
(46) |
Jul
(30) |
Aug
(20) |
Sep
(35) |
Oct
(32) |
Nov
(34) |
Dec
(19) |
2009 |
Jan
(29) |
Feb
(71) |
Mar
(54) |
Apr
(17) |
May
(4) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(58) |
Sep
(7) |
Oct
(7) |
Nov
(12) |
Dec
(18) |
2011 |
Jan
(17) |
Feb
(29) |
Mar
(11) |
Apr
(5) |
May
(1) |
Jun
|
Jul
|
Aug
(11) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(87) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(44) |
Jun
(79) |
Jul
(16) |
Aug
(31) |
Sep
|
Oct
(51) |
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Pascal F M. <pas...@us...> - 2005-12-08 07:17:32
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4266 Modified Files: roadmap_landmark.c Log Message: Should not be an error if I have no landmark file Index: roadmap_landmark.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_landmark.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_landmark.c 7 Dec 2005 14:06:03 -0000 1.1 --- roadmap_landmark.c 8 Dec 2005 07:17:22 -0000 1.2 *************** *** 172,175 **** --- 172,176 ---- const char *name; + const char *path = roadmap_path_trips(); queue tmp_waypoint_list; int ret; *************** *** 177,184 **** name = roadmap_config_get (&RoadMapConfigLandmarkName); QUEUE_INIT(&tmp_waypoint_list); ! ret = roadmap_gpx_read_waypoints(roadmap_path_trips(), name, ! &tmp_waypoint_list); if (ret == 0) { --- 178,190 ---- name = roadmap_config_get (&RoadMapConfigLandmarkName); + if (name[0] == 0) { + /* Load the default file, if it exists. */ + name = "landmarks.gpx"; + if (! roadmap_file_exists (path, name)) return; /* Not an error. */ + } + QUEUE_INIT(&tmp_waypoint_list); ! ret = roadmap_gpx_read_waypoints(path, name, &tmp_waypoint_list); if (ret == 0) { *************** *** 200,204 **** roadmap_config_declare ! ("preferences", &RoadMapConfigLandmarkName, "landmarks.gpx"); QUEUE_INIT(&RoadMapLandmarkHead); --- 206,210 ---- roadmap_config_declare ! ("preferences", &RoadMapConfigLandmarkName, ""); QUEUE_INIT(&RoadMapLandmarkHead); |
From: Pascal F M. <pas...@us...> - 2005-12-08 06:58:27
|
Update of /cvsroot/roadmap/roadmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv909 Modified Files: mktarball Log Message: Forgot one more PocketPC file Index: mktarball =================================================================== RCS file: /cvsroot/roadmap/roadmap/mktarball,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** mktarball 18 Nov 2005 20:06:26 -0000 1.23 --- mktarball 8 Dec 2005 06:58:17 -0000 1.24 *************** *** 41,44 **** --- 41,45 ---- ${ROADMAP}/src/unix/*.[ch] ${ROADMAP}/src/win32/*.[ch] + ${ROADMAP}/src/win32/*.cpp ${ROADMAP}/src/win32/roadmap.rc ${ROADMAP}/src/ipkg/mkipkg |
From: Paul F. <pg...@us...> - 2005-12-07 18:58:42
|
Update of /cvsroot/roadmap/roadmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9415 Modified Files: README Log Message: documentation changes for new trip features. Index: README =================================================================== RCS file: /cvsroot/roadmap/roadmap/README,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** README 6 Dec 2005 16:02:10 -0000 1.84 --- README 7 Dec 2005 18:58:29 -0000 1.85 *************** *** 499,503 **** [MODE=DEBUG|PROFILE] Compiles RoadMap in debug mode. The PROFILE option ! aslo generate the necessary information & code for profiling. [SQL=SQLITE] Use the sqlite library. This option has no practical effect --- 499,503 ---- [MODE=DEBUG|PROFILE] Compiles RoadMap in debug mode. The PROFILE option ! also generates the necessary information & code for profiling. [SQL=SQLITE] Use the sqlite library. This option has no practical effect *************** *** 843,847 **** (see the section "Managing Trips" below), show a specific location, track the GPS position with the north shown up, track the GPS position with the ! direction of movement shown up. When RoadMap is in GPS tracking mode, the map view will reflect the --- 843,847 ---- (see the section "Managing Trips" below), show a specific location, track the GPS position with the north shown up, track the GPS position with the ! direction of movement shown up, etc. When RoadMap is in GPS tracking mode, the map view will reflect the *************** *** 877,881 **** * USING THE {MOUSE} OR PEN ! RoadMap use mostly one mouse button (the left button on a 3 buttons mouse). This is because RoadMap is designed for a PDA, where pens are used. --- 877,881 ---- * USING THE {MOUSE} OR PEN ! RoadMap uses mostly one mouse button (the left button on a 3 button mouse). This is because RoadMap is designed for a PDA, where pens are used. *************** *** 917,921 **** will be provided only once. As voice messages tend to take a significant time to be produced, RoadMap memorizes the latest message requested while ! the current message was produced and will 'air" it after the current message has been completed. Only one message is stored that way, the last requested one: any message generated in between is ignored. --- 917,921 ---- will be provided only once. As voice messages tend to take a significant time to be produced, RoadMap memorizes the latest message requested while ! the current message was produced and will "air" it after the current message has been completed. Only one message is stored that way, the last requested one: any message generated in between is ignored. *************** *** 1003,1006 **** --- 1003,1008 ---- S | Start tracking the current trip. *-----------------*-----------------------------------------------------* + T | Toggle display of the current track. + *-----------------*-----------------------------------------------------* U | Center the map on the GPS position (north up). *-----------------*-----------------------------------------------------* *************** *** 1116,1123 **** * WAYPOINTS AND ADDRESSES ! RoadMap manages four types of points: a location point (selected using a street address or the mouse), the GPS position (updated automatically ! if a GPS fix is available), a destination point, and an arbitrary number ! of user-defined waypoints. One can select which one of these locations serves as the center of --- 1118,1125 ---- * WAYPOINTS AND ADDRESSES ! RoadMap manages several types of points: a location point (selected using a street address or the mouse), the GPS position (updated automatically ! if a GPS fix is available), and an arbitrary number of user-defined ! waypoints, which may appear as part of a route or a track. One can select which one of these locations serves as the center of *************** *** 1127,1133 **** The location point is really a buffer for the selection of a street block. Once selected, the point can be defined as a (new) waypoint or ! as the destination. Thus the definition of a destination or waypoint ! is a two step procedure: (1) select a location, and (2) set the selected ! point as a waypoint or the destination point (in the Trip menu). The location point can be entered in one of three ways: --- 1129,1136 ---- The location point is really a buffer for the selection of a street block. Once selected, the point can be defined as a (new) waypoint or ! as the destination, by using it to establish a new trip. Thus the ! definition of a destination or waypoint is a two step procedure: (1) ! select a location, and (2) use the selected point to create a waypoint or ! a new route (in the Trip menu). The location point can be entered in one of three ways: *************** *** 1278,1331 **** * MANAGING {TRIPS} ! A trip is made of one destination point and many user-defined waypoints. ! The purpose of a RoadMap trip is to describe a real-life trip and to ! provide the user information about the trip progress. ! ! RoadMap supports an infinite number of trips: each trip context is saved ! in a trip file. One trip at a time can be edited or activated. A saved ! trip can be reloaded from the trip file, of course. each trip support an ! infinite number of waypoints. The last trip created or loaded will be reloaded the next time RoadMap starts. ! A trip must have been loaded before it can be edited. There are three trip ! edition actions available in the "Trips" menu: set the destination point, ! add a waypoint or remove a waypoint. The destination point is defined ! using a street address by selecting the "Set Destination.." entry. A ! waypoint is added by highlighting a location on the map and then selecting ! the "Add as Waypoint" entry. Waypoints can be deleted by selecting the ! "Delete Waypoints.." entry, then selecting a specific waypoint and hitting ! the "Delete" button. ! A trip that has been created or loaded can then be activated. Activating ! a trip defines the departure point (the current GPS location) and ! enable the "trip display" mode, i.e. some trip information displayed on ! top of the map. These trip displays include an arrow beside the GPS ! location symbol to indicate the direction of the next waypoint (if any) ! or else of the destination, as well as user configurable messages, such ! as distance information, at the corners of the map. (see CONFIGURATION ! for more information about these user configurable messages). ! When a trip is active, RoadMap tracks the GPS position in realtime and ! updates its map accordingly. The GPS position can be shown in two modes: ! either North up or GPS direction up depending on the "Display.Rotate" ! preference item. In the second case, the map is rotated according to ! the direction information received from the GPS. This dynamic rotation ! is in addition to the map manual rotation. ! A trip can be stopped at any time and then resumed. Resuming a trip ! does not modify the departure point. The trip can also be resumed in ! reverse mode: in that case the departure point and the destination ! point switch roles. Note that this does not modify the trip, only the ! way RoadMap uses the trip information. The reverse mode makes it ! possible to use the same RoadMap trip on the way back. ! When starting a trip, the map can rotate to match the orientation ! of the vehicule. This display mode is the most convenient as it matches ! the driver's or passenger's view. It is however possible to switch the ! display in the "North Up" mode by changing the preference item ! "Display.Rotate" to "no". * DRIVERS --- 1281,1545 ---- * MANAGING {TRIPS} ! RoadMap supports an infinite number of trips: each trip context is ! saved in a trip file. One trip at a time can be edited or activated. A ! saved trip can be reloaded from the trip file, of course. The last trip created or loaded will be reloaded the next time RoadMap starts. + + A trip is a (usually small, but unlimited) collection of landmarks, + routes, and tracks which (usually) have some relationship to one + another. + + Routes are sequences of waypoints that (usually!) lead you somewhere you + want to go. Tracks are sequences of recorded waypoints that show you + where you've been. Although one doesn't usually do so, a track can be + followed just as a route can be followed. + + Trip landmarks are waypoints that aren't in a route or a track. They're + just (presumably) interesting all by themselves. (The trip's landmarks + are distinct from another set of landmarks known as your "Personal + Landmarks". The "personal landmarks" are displayed on the map no matter + which trip is loaded.) Landmarks and waypoints are sometimes just + referred to as "Places". + + One end of a route is the starting point, and the other is the + destination. Comments attached to the route's waypoints are used to + give directions from one waypoint to the next. Routes can be reversed, + in order to traverse them backwards (but the comments don't get + rewritten). Reversing a route will not change the trip file -- the + reversal is completely internal to RoadMap. + + When you load a trip (or when you start RoadMap, and the last trip you + used is automatically re-loaded), you'll be presented with a menu of + routes to choose from. (That is, if the trip contains more than one. + If there's only one, it will be selected automatically.) + + While you might choose to name your trips with a ".gpx" suffix, as a + reminder of what format they're stored in, this is entirely optional. + File suffix doesn't matter. ! ---- ! Note that although tracks and routes are conceptually ! separate, either type can be selected at this point, and ! any of the operations under the "Routes" menu can be ! applied to either. ! ---- ! One of the buttons in this "Manage Routes" dialog is "None", which is a ! quick way of not selecting any route at all. ! Creating a route: ! If you're starting a "fresh" trip, you'll likely start by creating a ! route. Choose a place that will be part of the route -- a waypoint, ! a landmark, a street address, a geographic location -- and then use ! the "Create New Route" menu entry to begin constructing your route. ! This will create an unnamed route with only one waypoint -- your ! destination. ! A route with only one waypoint isn't very interesting, so you'll ! want to select more points along the route. To select a new place, ! you can a) click (or tap) on the street where you wish to go, b) use ! the "Find" menu items "Address...", "Intersection...", or ! "Position..." to locate it, or c) choose another, previously created ! place from the route, the trip landmarks, or the personal landmarks. ! After locating your new waypoint, use the "Add as waypoint" menu ! item to add each to the route. You'll have choices of where to add ! (at the beginning, at the end, or as a midpoint of the nearest route ! segment), as well as a chance to add it as a landmark, to either the ! trip's list, or your personal list. Continue adding waypoints to ! your route. ! ---- ! Note that waypoints are always copied. So if you choose an ! existing waypoint or landmark to use as a route waypoint, you'll ! end up with a new waypoint, not just a second reference to an ! existing waypoint. ! ---- ! You can give your new route points names as you go, or wait until ! later and use the "Route Waypoints..." menu item to go back to the ! list, and select the ones you wish to rename or to which you wish to ! add comments. Waypoint deletion is done here as well. ! ! Your route doesn't yet have a name. That's fine -- routes and ! tracks can be unnamed. If there's only one route in a trip file, ! it's no big deal, but if there's more than one, you might want to ! give them names to help keep them straight. You do this (you can ! also add descriptive text) from the "Manage Current Routes" menu ! item. This is also where you'd select a different route to work ! with. If your trip has tracks, they'll appear hear as well. Be ! careful with delete! There's no undo command. Note that in ! addition to having no name, multiple routes can have the same name. ! This will not confuse RoadMap, though it may confuse the user. ! ! Converting a track to a route: ! ! Another, perhaps less convenient, method of creating a route, is to ! base it on a track that you (or someone else) has already travelled. ! While it's possible to simply select a track and follow it as one ! would follow a route, there are usually too many trackpoints showing ! up and obscuring the actual roads. It's better to create a route ! from the track using the "Simplify Route" command. (Remember that ! all of the route commands apply to tracks as well.) If ! simplification was successful (i.e., if any waypoints could be ! eliminated) a new route will be created and selected. It will be ! named after the original, with "Simple ..." prepended to to the ! original name. (If it had a name -- otherwise the result is unnamed ! as well.) ! ! Importing a route: ! ! One advantage of using the popular GPX format is that routes ! and landmarks can be obtained from other sources. Not only are ! some GPS management programs converting to use GPX directly, but ! there are many "<something-else>-to-GPX" conversion programs ! available. There are many such programs listed at: ! {{http://www.topografix.com/gpx_resources.asp}} ! ! One of the best, and most complete, of these conversion programs ! is gpsbabel, available here: ! {{http://www.gpsbabel.org/}} ! ! There's also an online front-end to gpsbabel, here: ! {{http://www.gpsvisualizer.com/gpsbabel/}} ! ! Gpsbabel will convert from most popular GPS data formats, and ! can talk directly to many GPS devices without involving their ! vendor's "support software" at all. [ RoadMap is particularly ! indebted to gpsbabel, since much of the code which supports ! RoadMap's GPX input and output came directly from gpsbabel. ] ! ! One handy source of route and waypoint data these days is Google ! Maps. Google directions and waypoints can be converted directly to ! GPX format by the GMapToGPX bookmarklet: ! {{http://www.elsewhere.org/GMapToGPX/}} ! ! gpsbabel can do this too, somewhat more indirectly -- the following ! script shows how: ! -------- ! #!/bin/sh ! ! function usage() ! { ! echo usage: $0 "from address" "to address" >&2 ! exit 1 ! } + if [ $# != 2 ] + then + usage + fi + + from="$1" + to="$2" + + # the gpsbabel line simplifies: the "error=xxx" value is in miles, + # and signifies how far any single point must be from the straight + # line connecting its neighbors in order to not be discarded. + wget -O - "http://maps.google.com/maps?q=$from to $to&output=js" \ + 2>/dev/null | + sed -e 's/<b>//g' -e 's/<\/b>//g' | + gpsbabel -r -i google -f - -x simplify,error=0.05 -o gpx -F - + -------- + + The above script shows how one might use gpsbabel to simplify + a route or track rather than doing it with the Simplify command + inside RoadMap. Using gpsbabel might give better results, since + it currently uses a different (and more expensive) algorithm + than does RoadMap. + + Once you have a have a data in GPX format, it's simply a matter + of loading that that data with "Open Trip", or merging it into + another of your existing trips with "Merge Trip". + + Quick Destination: + + Sometimes one doesn't really want to follow a route at all -- all + you want to do is set a goal, and be kept informed of how far away + it is, and in which direction. That's what the "Quick Destination" + menu entry is for. Select where you want to go (a waypoint, a + street address, an intersection, or latitude/longitude spot), and as + you move around, the display will show continously display the + distance and direction to that point. + + Following a route: + + A route that has been created or loaded can then be activated. + Activating a route defines the departure point (the current GPS + location) and enables the "trip display" mode: extra status + information will appear on the map. This will include an arrow + beside the GPS location symbol to indicate the direction of the next + waypoint, as well as user configurable messages, such as distance + information, the directions to the next waypoint (if any are present + in the waypoint's comments), its distance, etc. The messages will + disply at the corners of the map. (see CONFIGURATION for more + information about these user configurable messages). + + If the route's waypoint contains comments (from the "<cmt>" element + of the GPX file), these will be displayed as directions which + should be followed when that waypoint is reached. The directions + displayed will be from the next waypoint which has directions, i.e. + there may intervening waypoints that do not have comments. + + A waypoint is "attained" by entering within its "vicinity". This + radius is set in the user's' trip preferences (125 ft, by default). + When entering the vicinity circle, the GPS directional arrow will + immediately begin pointing at the next waypoint in the list. + On-screen directions will not be updated (i.e., to describe the next + turn, rather than the current turn) until one leaves the waypoint + vicinity. In addition, RoadMap honors a larger circle, at twice the + size of the waypoint vicinity. If one enters this circle and then + leaves it (without ever entering the inner "vicinity-sized" circle), + then Roadmap will see if the next route segment is closer than the + last route segment, and if so will assume that the user is on track + to the next. The directional pointer and on-screen directions will + be updated, even though the waypoint was never "quite" attained. + This helps accomodate small map errors, or large roundabout or + interchange intersections where the actual waypoint may be + unreachable. + + A route can be stopped at any time and then resumed. When a route is + resumed, the waypoint chosen as the "next" to be visited is chosen + by searching for the route segment that is closest (in geometrical + terms) to the GPS location. The route can also be resumed in reverse + mode: in that case the departure point and the destination point + switch roles. The reverse mode makes it possible to use the same + RoadMap route on the way back, though as noted previously, any + comments on the waypoints that give directions will be unchanged. + This can be a bit confusing sometimes! + + When a route is active, RoadMap tracks the GPS position in realtime + and updates the map accordingly. The GPS position can be shown in + two modes: either North up or GPS direction up depending on the + "Display.Rotate" preference item. In the second case, the map is + rotated according to the direction information received from the + GPS, and is convenient as it matches the driver's or passenger's + view. (This dynamic rotation is in addition to the map manual + rotation.) Some people find it disconcerting, however, and will wish + to retain "North up" mode. + + * CURRENT TRACK + + Unless specifically disabled in preferences, the GPS track followed + by the user will be continuously recorded by RoadMap. By default + this "breadcrumb trail" will be displayed on the map, but this can + be suppressed with the "Show/Hide Track" toggle command. + + The frequency at which points for the track are recorded is + determined by several settings in preferences: + + * If "Time" is chosen, then track points will be saved + periodically every so many seconds (as long as the GPS + has moved at least a little bit). + + * If "Distance" is chosen, then a new track point will be saved + whenever the configured distance from the previously saved + trackpoint has been exceeded. + + * IF "Deviation" is chosen, then a new track point will only be + saved if the new point is the configured distance "off track" + from the preceding path of travel. This minimizes the points + saved, since straight line travel is represented by very few + points. [ Currently unimplemented. ] * DRIVERS *************** *** 1556,1560 **** | C: | the name of the city for the selected or current street. *-----+-----------------------------------------------------------------+ ! | D: | Distance to the destination time (set only when a trip is active). *-----+-----------------------------------------------------------------+ | E: | Next sunset time (evening), undefined in night time. --- 1770,1774 ---- | C: | the name of the city for the selected or current street. *-----+-----------------------------------------------------------------+ ! | D: | Distance to the destination (set only when a trip is active). *-----+-----------------------------------------------------------------+ | E: | Next sunset time (evening), undefined in night time. *************** *** 1574,1577 **** --- 1788,1797 ---- | W: | Distance to the next waypoint (set only when a trip is active). *-----+-----------------------------------------------------------------+ + | X: | Directions to be followed when the next waypoint (with + | | directions) is reached. (set only when a trip is active). + *-----+-----------------------------------------------------------------+ + | Y: | Distance to the next waypoint which includes directions, unless + | | the GPS is "at" that waypoint. (set only when a trip is active). + *-----+-----------------------------------------------------------------+ | #: | the street number range to the selected or current street block. *-----+-----------------------------------------------------------------+ *************** *** 1581,1584 **** --- 1801,1805 ---- Example: "%D (%W)" shows the distance to the destination point, followed by the distance to the next waypoint (in parenthesis). + A message is evaluated, and displayed, only when all referenced macros *************** *** 1594,1597 **** --- 1815,1822 ---- active), then no display is shown and/or no sound is produced. + Likewise, "In %Y, %X|%X" will say something like "In 0.5 miles, Turn + Right", unless you're already at the point at which you should turn + right. Then it will just say "Turn Right". + Another typical example is "sunset: %E|sunrise: %M", which shows the next sunset (in daylight time) or sunrise (in night time). *************** *** 2346,2355 **** The coordinates are pixel positions, relative to the sprites "hot point". ! A S command must appear before any alias or drawing command. A sprite cannot contain both an alias command and drawing commands. In addition, if an alias command is present, it is the only command defining ! this sprite (i.e. an alias sprite is only made of the two S and A ! commands). For example: ---- --- 2571,2580 ---- The coordinates are pixel positions, relative to the sprites "hot point". ! An S command must appear before any alias or drawing command. A sprite cannot contain both an alias command and drawing commands. In addition, if an alias command is present, it is the only command defining ! this sprite (i.e. an alias sprite is defined by just one S and one A ! command). For example: ---- *************** *** 2373,2400 **** One reason for using alias sprites is to make it simpler to redefine sprites known to RoadMap (such as "Direction" or "Destination"). The ! alias mechanism has a neglictible fix cost at runtime: using multiple alias levels will have no practical impact on RoadMap performances. * TRIP FILES ! ! A trip file contains the information relative to one trip. it uses ! a CSV format where each record describes a point and contains four ! fields: type, name, longitude, latitude. ! The type field is either "Destination" or "Waypoint". ! The name field is the name of the waypoint (the name of the destination ! is always "Destination"). ! The following trip file example defines a trip from the Golden Gate's ! bridge to 1, Market St, in san Francisco, California: +------------------------------------------------------- ! Destination,Destination,-122394181,37794928 ! Waypoint,1000 - 1098 The Embarcadero San Francisco,-122401781,37803934 ! Waypoint,100 - 198 Richardson Ave San Francisco,-122446481,37799826 +------------------------------------------------------- TOOLS --- 2598,2749 ---- One reason for using alias sprites is to make it simpler to redefine sprites known to RoadMap (such as "Direction" or "Destination"). The ! alias mechanism has a negligible fixed cost at runtime: using multiple alias levels will have no practical impact on RoadMap performances. * TRIP FILES ! ! RoadMap trip data is stored in GPX format. More about the widely-used ! GPX data format can be found at: ! ! {{http://www.topografix.com/gpx.asp}} ! ! The main thing to know about this format is that a GPX file ! may contain one or more "routes", one or more "tracks", and ! one or more "landmarks". ! Routes and tracks are very similar: it's most useful to ! think of a route as "where you want to go", and a track as ! "where you've been". Routes are usually composed, either ! manually or using navigation software. Tracks are usually ! recorded, by making a note of one's GPS location ! periodically. (By the way, tracks don't get included into ! trip files automatically. If you wish to store your tracks ! along with your routes for a given trip, you'll need to save ! copies of your current track and them to the trip.) ! ! Routes and tracks are both composed of "waypoints". To ! reduce confusion, RoadMap tries to use the term "waypoint" ! to _only_ refer to points which are contained in routes and ! tracks. Points unassociated with a specific route or track ! are called "landmarks". If you read the GPX documentation ! you'll find that these points are usually all called ! waypoints. ! ! Waypoints simply represent a place, along with some other ! information about that place. For instance, a waypoint in a ! route might have a name, and it might also have a comment ! attached to it which says which way to turn when this ! waypoint is reached. A waypoint in a track might only ! contain its location and the time at which you were there. ! The landmarks in the trip file might represent places of ! interest which, while not really part of a route, are ! related to the trip somehow. ! Here are some more details regarding how RoadMap uses the GPX ! format. ! Waypoints (and landmarks): ! ! <name> is used directly if available. ! ! If no name is available, a shortened version of the <cmt> ! or <description> element will be used instead. If ! neither of these elements is available, a name will be ! generated. ! ! In addition, if no <cmt> is available, the <description> ! element will be used as a description. ! ! The <sym> element will be used as the sprite name, if it ! is set, otherwise fixed RoadMap defaults will be used for ! the spritename, depending on what sort of waypoint it is. ! ! When generating a waypoint while recording a track, ! RoadMap will set the <ele>, <speed>, <course>, and <time> ! elements, as well as the "lat" and "lon" attributes. All ! of this data comes directly from the GPS. The <name> and ! <sym> elements are left unset. ! ! Routes and Tracks: ! ! The <name> and <desc> elements will be used and set. For ! tracks, the <trkseg> level of the hierarchy is ignored -- ! all track segments are treated as one. ! ! The following trip file example contains just one route, ! which goes from the Golden Gate's bridge to 1 Market St, in ! san Francisco, California. It also contains the locations ! of some nearby pizza parlors: +------------------------------------------------------- ! ! <?xml version="1.0"?> ! <gpx version="1.1"> ! <rte> ! <name>198 Richardson Ave to 1 Market St</name> ! <rtept lat="37.8003" lon="-122.44703"> ! <cmt>Head southeast from Richardson Ave</cmt> ! </rtept> ! <rtept lat="37.79879" lon="-122.4446"> ! <cmt>Bear left at Lombard St</cmt> ! </rtept> ! <rtept lat="37.79901" lon="-122.44265"> ! <cmt>Turn right at Divisadero St</cmt> ! </rtept> ! <rtept lat="37.78336" lon="-122.43948"> ! <cmt>Turn left at Geary Blvd</cmt> ! </rtept> ! <rtept lat="37.78529" lon="-122.42467"> ! <cmt>Bear right at Ofarrell St</cmt> ! </rtept> ! <rtept lat="37.78678" lon="-122.40458"> ! <cmt>Turn left at Market St</cmt> ! </rtept> ! <rtept lat="37.79444" lon="-122.39487"> ! <cmt>Arrive at destination</cmt> ! </rtept> ! </rte> ! <wpt lat="37.792612" lon="-122.393843"> ! <name>Village Pizzeria</name> ! </wpt> ! <wpt lat="37.793392" lon="-122.397554"> ! <name>Parkway Pizza</name> ! </wpt> ! <wpt lat="37.789001" lon="-122.394843"> ! <name>Dogzilla Cafe</name> ! </wpt> ! </gpx> ! +------------------------------------------------------- + In addition to the trip files, there are two other important + files which are also stored in GPX format. + + The "Current Track" file contains waypoints representing + where you've been -- a "breadcrumb trail", if you will. + This file (called "current_track.gpx" by default) will + only contain a single track when written. When read + (on startup, to restore previous state), only the first + track in the file will be read. All other routes or + tracks and waypoints will be ignored (and likely lost, + when the current track is saved at the end of the + session). + + The "Personal Landmarks" files, called "landmarks.gpx" by + default, contains landmarks (waypoints) which you might + want to keep handy no matter what trip file you have + loaded. Examples might include your home, your office, + your hairdress, etc. When writing this file, only the + personal landmarks are written. When reading, only the + unassociated waypoints are read -- any routes or tracks + in the file are ignored. + + [Note that since these files are in GPX format, they can also + be manually opened as trips. In this case, the landmarks associated + with the "Personal Landmarks" file will appear as "Trip Landmarks" + for that trip, and the track in "Current Track" will appear as + the only unnamed track in that trip.] + TOOLS *************** *** 2419,2427 **** +------------------------------------------------------- - Accuracy.Confidence: 25 - Accuracy.GPS Position: 300 Accuracy.GPS Speed: 4 ! Accuracy.Mouse: 20 Accuracy.Street: 150 Approach.Background: yellow Approach.Foreground: black --- 2768,2776 ---- +------------------------------------------------------- Accuracy.GPS Speed: 4 ! Accuracy.Confidence: 25 Accuracy.Street: 150 + Accuracy.Mouse: 20 + Accuracy.Minimum Drag: 5 Approach.Background: yellow Approach.Foreground: black *************** *** 2435,2439 **** Display.Bottom Left: %S Display.Bottom Right: %D (%W)|%D ! Display.Top Right: ETA: %A|%T Display.Duration: 10 Display.Rotate: yes --- 2784,2788 ---- Display.Bottom Left: %S Display.Bottom Right: %D (%W)|%D ! Display.Top Right: In %Y, %X|%X Display.Duration: 10 Display.Rotate: yes *************** *** 2464,2468 **** Voice.Current Street: flite -t 'On %N' Voice.Next Intersection: flite -t 'Next intersection: %N' ! Voice.Selected Street: flite -t '%N' +------------------------------------------------------- --- 2813,2817 ---- Voice.Current Street: flite -t 'On %N' Voice.Next Intersection: flite -t 'Next intersection: %N' ! Voice.Selected Street: flite -t 'Selected %N' +------------------------------------------------------- *************** *** 2471,2491 **** +------------------------------------------------------- - Locations.Location: -122394181,37794928 - Locations.GPS: -122394181,37794928 - Locations.Trip: default - General.Zoom: 0 - Navigation.Enable: yes - Delta.X: 0 - Delta.Y: 0 Delta.Rotate: 0 ! GPS.Position: 0,0 ! GPS.Direction: 0 ! Address.Position: 0,0 ! Selection.Position: 0,0 ! Hold.Position: 0,0 Hold.Direction: 0 ! Focus.Rotate: 1 ! Focus.Name: GPS ! Trip.Name: default +------------------------------------------------------- --- 2820,2836 ---- +------------------------------------------------------- Delta.Rotate: 0 ! Delta.Y: 0 ! Delta.X: 0 ! Focus.Rotate: 0 ! Focus.Name: Address ! Trip.Name: default.gpx Hold.Direction: 0 ! Hold.Position: 0,0 ! Selection.Position: -122394181,37794928 ! Address.Position: -122394181,37794928 ! GPS.Direction: 0 ! GPS.Position: 0,0 ! General.Zoom: 150 +------------------------------------------------------- |
From: Paul F. <pg...@us...> - 2005-12-07 18:57:52
|
Update of /cvsroot/roadmap/roadmap/src/gtk2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8864/gtk2 Modified Files: Makefile Log Message: changes to support full-featured "trips", based on gpx-format routes and waypoints. Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk2/Makefile,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Makefile 6 Dec 2005 23:19:40 -0000 1.22 --- Makefile 7 Dec 2005 18:57:36 -0000 1.23 *************** *** 14,18 **** WARNFLAGS = -W -Wall -Wno-unused-parameter ! RDMLIBS= ../libroadmap.a libgtkroadmap.a ../unix/libosroadmap.a ../libroadmap.a --- 14,18 ---- WARNFLAGS = -W -Wall -Wno-unused-parameter ! RDMLIBS= ../libroadmap.a libgtkroadmap.a ../unix/libosroadmap.a ../gpx/libgpx.a ../libroadmap.a *************** *** 46,50 **** CFLAGS = $(STDCFLAGS) $(GPECFLAGS) $(GUICFLAGS) -I.. -I/usr/local/include ! LIBS = -L/usr/local/lib $(RDMLIBS) $(GPELDFLAGS) $(GUILDFLAGS) -lm # --- RoadMap sources & targets ----------------------------------- --- 46,50 ---- CFLAGS = $(STDCFLAGS) $(GPECFLAGS) $(GUICFLAGS) -I.. -I/usr/local/include ! LIBS = -L/usr/local/lib $(RDMLIBS) $(GPELDFLAGS) $(GUILDFLAGS) -lexpat -lm # --- RoadMap sources & targets ----------------------------------- |
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8864 Modified Files: Makefile roadmap_display.c roadmap_screen.c roadmap_start.c roadmap_trip.c roadmap_trip.h session sprites Log Message: changes to support full-featured "trips", based on gpx-format routes and waypoints. Index: roadmap_display.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_display.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** roadmap_display.c 27 Nov 2005 06:04:37 -0000 1.22 --- roadmap_display.c 7 Dec 2005 18:57:35 -0000 1.23 *************** *** 696,700 **** ("preferences", &RoadMapConfigDisplayBottomLeft, "%S"); roadmap_config_declare ! ("preferences", &RoadMapConfigDisplayTopRight, "ETA: %A|%T"); roadmap_config_declare --- 696,700 ---- ("preferences", &RoadMapConfigDisplayBottomLeft, "%S"); roadmap_config_declare ! ("preferences", &RoadMapConfigDisplayTopRight, "In %Y, %X|%X"); roadmap_config_declare Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/Makefile,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** Makefile 27 Nov 2005 05:58:02 -0000 1.69 --- Makefile 7 Dec 2005 18:57:35 -0000 1.70 *************** *** 98,104 **** LDFLAGS=$(MODELDFLAGS) $(SQLLDFLAGS) $(SHAPELDFLAGS) ! RDMLIBS=libroadmap.a unix/libosroadmap.a ! LIBS=$(RDMLIBS) -lpopt -lm ! # --- RoadMap sources & targets -------------------------------------------- --- 98,103 ---- LDFLAGS=$(MODELDFLAGS) $(SQLLDFLAGS) $(SHAPELDFLAGS) ! RDMLIBS=libroadmap.a unix/libosroadmap.a gpx/libgpx.a ! LIBS=$(RDMLIBS) -lpopt -lexpat -lm # --- RoadMap sources & targets -------------------------------------------- *************** *** 136,140 **** roadmap_driver.c \ roadmap_adjust.c \ ! roadmap_sunrise.c RMLIBOBJS=$(RMLIBSRCS:.c=.o) --- 135,140 ---- roadmap_driver.c \ roadmap_adjust.c \ ! roadmap_sunrise.c \ ! roadmap_gpx.c RMLIBOBJS=$(RMLIBSRCS:.c=.o) *************** *** 144,147 **** --- 144,149 ---- roadmap_object.c \ roadmap_trip.c \ + roadmap_track.c \ + roadmap_landmark.c \ roadmap_layer.c \ roadmap_fuzzy.c \ *************** *** 235,239 **** # --- Conventional targets ---------------------------------------- ! .PHONY: all gtk gtk2 qt rebuild build everything clean strip install uninstall unix all: everything --- 237,242 ---- # --- Conventional targets ---------------------------------------- ! .PHONY: all gtk gtk2 qt rebuild build everything \ ! clean strip install uninstall unix gpx all: everything *************** *** 257,261 **** fi ! runtime: unix $(RUNTIME) $(DRIVERS) for module in $(RDMODULES) ; \ do \ --- 260,269 ---- fi ! gpx: ! if [ -d gpx ] ; then \ ! $(MAKE) -C gpx RANLIB=$(RANLIB) "CFLAGS=$(CFLAGS) -I.." ; \ ! fi ! ! runtime: unix gpx $(RUNTIME) $(DRIVERS) for module in $(RDMODULES) ; \ do \ *************** *** 293,296 **** --- 301,305 ---- done if [ -d unix ] ; then $(MAKE) -C unix clean ; fi + if [ -d gpx ] ; then $(MAKE) -C gpx clean ; fi Index: roadmap_trip.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_trip.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** roadmap_trip.c 27 Nov 2005 06:00:28 -0000 1.41 --- roadmap_trip.c 7 Dec 2005 18:57:35 -0000 1.42 *************** *** 3,7 **** * LICENSE: * ! * Copyright 2002 Pascal F. Martin * * This file is part of RoadMap. --- 3,7 ---- * LICENSE: * ! * Copyright 2002,2005 Pascal F. Martin, Paul G. Fox * [...3233 lines suppressed...] ! roadmap_trip_route_convert_worker (RoadMapCurrentRoute, namep); ! } ! void roadmap_trip_track_convert (void) { ! char name[40]; ! time_t now; ! ! ! time(&now); ! strftime(name, sizeof(name), "Trail-%Y-%m-%d-%H:%M:%S", ! localtime(&now)); ! ! roadmap_trip_route_convert_worker (RoadMapTrack, name); } Index: session =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/session,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** session 28 Nov 2004 05:03:40 -0000 1.1 --- session 7 Dec 2005 18:57:35 -0000 1.2 *************** *** 1,9 **** - Location.Position: -122394181,37794928 Delta.Rotate: 0 Delta.Y: 0 ! Delta.X: -268 Focus.Rotate: 0 Focus.Name: Address ! Trip.Name: default Hold.Direction: 0 Hold.Position: 0,0 --- 1,8 ---- Delta.Rotate: 0 Delta.Y: 0 ! Delta.X: 0 Focus.Rotate: 0 Focus.Name: Address ! Trip.Name: default.gpx Hold.Direction: 0 Hold.Position: 0,0 Index: roadmap_trip.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_trip.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** roadmap_trip.h 23 Oct 2005 07:33:08 -0000 1.18 --- roadmap_trip.h 7 Dec 2005 18:57:35 -0000 1.19 *************** *** 31,48 **** void roadmap_trip_set_point (const char *name, RoadMapPosition *position); ! void roadmap_trip_set_waypoint (const char *name, RoadMapPosition *position); ! void roadmap_trip_set_gps (const RoadMapGpsPosition *gps_position); void roadmap_trip_copy_focus (const char *name); ! void roadmap_trip_set_selection_as (const char *name); ! ! void roadmap_trip_remove_point (const char *name); void roadmap_trip_restore_focus (void); void roadmap_trip_set_focus (const char *name); ! void roadmap_trip_set_focus_waypoint (const char *name); int roadmap_trip_is_focus_changed (void); --- 31,52 ---- void roadmap_trip_set_point (const char *name, RoadMapPosition *position); ! void roadmap_trip_add_waypoint ! (const char *name, RoadMapPosition *position, int where); ! void roadmap_trip_create_selection_waypoint(void); ! void roadmap_trip_create_gps_waypoint(void); ! void roadmap_trip_set_gps ! (int gps_time, const RoadMapGpsPosition *gps_position); void roadmap_trip_copy_focus (const char *name); ! void roadmap_trip_route_waypoint_manage_dialog(void); ! void roadmap_trip_trip_waypoint_manage_dialog(void); ! void roadmap_trip_personal_waypoint_manage_dialog(void); void roadmap_trip_restore_focus (void); void roadmap_trip_set_focus (const char *name); ! // void roadmap_trip_set_focus_waypoint (const char *name); int roadmap_trip_is_focus_changed (void); *************** *** 55,64 **** const RoadMapPosition *roadmap_trip_get_focus_position (void); - void roadmap_trip_start (void); - void roadmap_trip_resume (void); - void roadmap_trip_stop (void); - void roadmap_trip_reverse (void); - void roadmap_trip_return (void); void roadmap_trip_format_messages (void); --- 59,70 ---- const RoadMapPosition *roadmap_trip_get_focus_position (void); + void roadmap_trip_route_start (void); + void roadmap_trip_route_resume (void); + void roadmap_trip_route_stop (void); + void roadmap_trip_route_reverse (void); + void roadmap_trip_route_return (void); + void roadmap_trip_new_route (void); + void roadmap_trip_set_as_destination (void); void roadmap_trip_format_messages (void); *************** *** 68,71 **** --- 74,78 ---- void roadmap_trip_initialize (void); + void roadmap_trip_clear (void); const char *roadmap_trip_current (void); *************** *** 74,78 **** * open a dialog to let the user enter one), or an explicit name. */ ! int roadmap_trip_load (const char *name, int silent); void roadmap_trip_save (const char *name, int force); --- 81,85 ---- * open a dialog to let the user enter one), or an explicit name. */ ! int roadmap_trip_load (const char *name, int silent, int merge); void roadmap_trip_save (const char *name, int force); *************** *** 81,84 **** --- 88,94 ---- void roadmap_trip_route_manage_dialog (void); + void roadmap_trip_track_convert (void); + void roadmap_trip_route_convert (void); + #endif // INCLUDE__ROADMAP_TRIP__H Index: sprites =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/sprites,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sprites 23 Oct 2005 20:42:24 -0000 1.8 --- sprites 7 Dec 2005 18:57:35 -0000 1.9 *************** *** 9,12 **** --- 9,14 ---- # D <x>,<y> <radius>: defines a disk (i.e. a filled circle). # the coordinates x and y are relative to the sprite's hot point. + # positive x and y values are towards the south-east, and the natural + # "direction" for the sprite is north (e.g., for an arrow). # *************** *** 28,32 **** S Destination ! A RedDot S Waypoint --- 30,34 ---- S Destination ! A RedDotCircle S Waypoint *************** *** 34,38 **** S Start ! A GreenTriangle S Highlight --- 36,52 ---- S Start ! A GreenTrianglePointer ! ! S RoutePoint ! A Circle-Pointer ! ! S SecondaryRoutePoint ! A Small-Circle-Pointer ! ! S PersonalLandmark ! A 5PointStar ! ! S TripLandmark ! A GreenSquare S Highlight *************** *** 42,53 **** A RedDisk - S Anonymous - A GreenDot - S Track ! A PurpleDot ! S RouteMarker ! A Circle S Departure --- 56,64 ---- A RedDisk S Track ! A PurpleCross ! S BreadCrumb ! A PurpleDot S Departure *************** *** 90,98 **** L -5,-20 0,-35 5,-20 -5,-20 ! S RedDot F red 1 D 0,0 5 F black 1 C 0,0 5 S GreenDot --- 101,119 ---- L -5,-20 0,-35 5,-20 -5,-20 ! S RedDotCircle F red 1 D 0,0 5 F black 1 C 0,0 5 + C 0,0 7 + + S GreenTrianglePointer + F green 2 + P 0,-9 -8,4 8,4 0,-9 + F black 1 + L 0,-9 -8,4 8,4 0,-9 + L 1,-8 1,-16 + L 1,-16 -1,-16 + L -1,-16 -1,-8 S GreenDot *************** *** 102,106 **** C 0,0 5 ! S PurpleDot F purple 2 L -4,0 4,0 --- 123,133 ---- C 0,0 5 ! S GreenSquare ! F black 1 ! L 5,5 5,-5 -5,-5 -5,5 5,5 ! F green 1 ! P 4,4 4,-4 -4,-4 -4,4 4,4 ! ! S PurpleCross F purple 2 L -4,0 4,0 *************** *** 109,117 **** L 0,-4 0,4 ! S GreenTriangle ! F green 2 ! P 0,-9 -8,4 8,4 0,-9 ! F black 1 ! L 0,-9 -8,4 8,4 0,-9 S YellowDot --- 136,150 ---- L 0,-4 0,4 ! S PurpleDot ! F purple 1 ! D 0,0 3 ! ! S 5PointStar ! F darkred 1 ! L 0,-9 5,7 ! L 5,7 -8,-3 ! L -8,-3 8,-3 ! L 8,-3 -5,7 ! L -5,7 0,-9 S YellowDot *************** *** 129,132 **** --- 162,184 ---- C 0,0 7 + S Circle-Pointer + F green 1 + D 0,0 7 + F black 1 + C 0,0 7 + 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 + F black 1 + C 0,0 6 + L 1,-6 1,-16 + L 1,-16 -1,-16 + L -1,-16 -1,-6 + S DottedSquare F black 1 Index: roadmap_screen.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_screen.c,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** roadmap_screen.c 27 Nov 2005 06:07:59 -0000 1.58 --- roadmap_screen.c 7 Dec 2005 18:57:35 -0000 1.59 *************** *** 48,52 **** --- 48,55 ---- #include "roadmap_sprite.h" #include "roadmap_object.h" + #include "roadmap_gpx.h" #include "roadmap_trip.h" + #include "roadmap_track.h" + #include "roadmap_landmark.h" #include "roadmap_canvas.h" #include "roadmap_pointer.h" *************** *** 1054,1058 **** --- 1057,1063 ---- roadmap_sprite_draw ("Compass", &CompassPoint, 0); + roadmap_landmark_display (); roadmap_trip_display (); + roadmap_track_display (); roadmap_display_signs (); } *************** *** 1218,1222 **** roadmap_screen_repaint (); ! } else if (refresh || roadmap_trip_is_refresh_needed()) { roadmap_screen_repaint (); --- 1223,1230 ---- roadmap_screen_repaint (); ! } else if (refresh || ! roadmap_trip_is_refresh_needed() || ! roadmap_landmark_is_refresh_needed() || ! roadmap_track_is_refresh_needed() ) { roadmap_screen_repaint (); Index: roadmap_start.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_start.c,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** roadmap_start.c 2 Dec 2005 22:54:47 -0000 1.88 --- roadmap_start.c 7 Dec 2005 18:57:35 -0000 1.89 *************** *** 54,58 **** --- 54,61 ---- #include "roadmap_crossing.h" #include "roadmap_sprite.h" + #include "roadmap_gpx.h" #include "roadmap_trip.h" + #include "roadmap_track.h" + #include "roadmap_landmark.h" #include "roadmap_adjust.h" #include "roadmap_screen.h" *************** *** 175,179 **** static void roadmap_start_open_trip (void) { ! roadmap_trip_load (NULL, 0); } --- 178,187 ---- static void roadmap_start_open_trip (void) { ! roadmap_trip_load (NULL, 0, 0); ! } ! ! static void roadmap_start_merge_trip (void) { ! ! roadmap_trip_load (NULL, 0, 1); } *************** *** 188,230 **** } ! static void roadmap_start_trip (void) { ! roadmap_trip_start (); } ! static void roadmap_start_trip_resume (void) { ! roadmap_trip_resume (); } ! static void roadmap_start_trip_reverse (void) { ! roadmap_trip_reverse (); } ! static void roadmap_start_trip_return (void) { ! roadmap_trip_return (); } ! static void roadmap_start_set_destination (void) { ! roadmap_trip_set_selection_as ("Destination"); ! roadmap_screen_refresh(); } ! static void roadmap_start_set_waypoint (void) { ! ! const char *id = roadmap_display_get_id ("Selected Street"); ! if (id != NULL) { ! roadmap_trip_set_selection_as (id); ! roadmap_screen_refresh(); ! } } ! static void roadmap_start_delete_waypoint (void) { ! ! roadmap_trip_remove_point (NULL); } --- 196,234 ---- } ! static void roadmap_start_route (void) { ! roadmap_trip_route_start (); } ! static void roadmap_start_route_resume (void) { ! roadmap_trip_route_resume (); } ! static void roadmap_start_route_reverse (void) { ! roadmap_trip_route_reverse (); } ! static void roadmap_start_route_return (void) { ! roadmap_trip_route_return (); } ! static void roadmap_start_create_route (void) { ! roadmap_trip_new_route (); } ! static void roadmap_start_create_waypoint (void) { ! roadmap_trip_create_selection_waypoint (); ! roadmap_screen_refresh(); } ! static void roadmap_start_create_gps_waypoint (void) { ! ! roadmap_trip_create_gps_waypoint (); ! roadmap_screen_refresh(); } *************** *** 357,371 **** "Show the current destination point", roadmap_start_show_destination}, ! {"startpoint", "Start", "Start", NULL, "Show the current route starting point", roadmap_start_show_start}, {"departure", "Departure", "Dep", NULL, ! "Show the trips' departure point", roadmap_start_show_departure}, {"gps", "GPS Position", "GPS", "G", ! "Center the map on the current GPS position", roadmap_start_show_gps}, {"location", "Location", "L", NULL, ! "Center the map on the last selected location", roadmap_start_show_location}, --- 361,375 ---- "Show the current destination point", roadmap_start_show_destination}, ! {"startpoint", "Route Start", "Start", NULL, "Show the current route starting point", roadmap_start_show_start}, {"departure", "Departure", "Dep", NULL, ! "Show the route's point of departure", roadmap_start_show_departure}, {"gps", "GPS Position", "GPS", "G", ! "Show the current GPS position", roadmap_start_show_gps}, {"location", "Location", "L", NULL, ! "Show the last selected address, crossroads, or position", roadmap_start_show_location}, *************** *** 386,389 **** --- 390,396 ---- "Open an existing trip", roadmap_start_open_trip}, + {"mergetrip", "Merge Trip", "Merge", "M", + "Merge a trip with the current trip", roadmap_start_merge_trip}, + {"savetrip", "Save Trip", "Save", "S", "Save the current trip", roadmap_start_save_trip}, *************** *** 397,429 **** roadmap_start_save_trip_as}, ! {"starttrip", "Start Trip", "Start", NULL, ! "Start tracking the current trip", roadmap_start_trip}, ! {"stoptrip", "Stop Trip", "Stop", NULL, ! "Stop tracking the current trip", roadmap_trip_stop}, ! {"resumetrip", "Resume Trip", "Resume", NULL, ! "Resume the trip", roadmap_start_trip_resume}, ! {"returntrip", "Return Trip", "Return", NULL, ! "Start the trip back to the departure point", ! roadmap_start_trip_return}, ! {"reversetrip", "Reverse Trip", "Reverse", NULL, ! "Reverse the route and resume the trip", ! roadmap_start_trip_reverse}, ! {"setasdestination", "Set as Destination", NULL, NULL, ! "Set the selected street block as the trip's destination", ! roadmap_start_set_destination}, ! {"manageroutes", "Manage Routes...", "Manage", NULL, ! "Select or delete routes", roadmap_trip_route_manage_dialog}, ! {"addaswaypoint", "Add as Waypoint", "Waypoint", "W", ! "Set the selected street block as waypoint", roadmap_start_set_waypoint}, ! {"deletewaypoints", "Delete Waypoints...", "Delete...", NULL, ! "Delete selected waypoints", roadmap_start_delete_waypoint}, {"full", "Full Screen", "Full", "F", --- 404,469 ---- roadmap_start_save_trip_as}, ! {"starttrip", "Start Route", "Start", NULL, ! "Start following the current route", roadmap_start_route}, ! {"stoptrip", "Stop Route", "Stop", NULL, ! "Stop following the current route", roadmap_trip_route_stop}, ! {"tracktoggle", "Show/Hide Track", "Track", NULL, ! "Show or Hide the GPS breadcrumb track", roadmap_track_toggle_display}, ! {"tracksave", "Save Track", "Save Track", NULL, ! "Save the current GPS breadcrumb track", roadmap_track_save}, ! {"trackclear", "Clear Track", "Clear Track", NULL, ! "Clear the current GPS breadcrumb track", roadmap_track_clear}, ! {"tracktoroute", "Convert Track", NULL, NULL, ! "Convert the current GPS track to a new route", ! roadmap_trip_track_convert }, ! {"resumeroute", "Resume Route", "Resume", NULL, ! "Resume following (resync with) the current route", ! roadmap_start_route_resume}, ! {"returnroute", "Return Route", "Return", NULL, ! "Start the route back to the departure point", ! roadmap_start_route_return}, ! {"reverseroute", "Reverse Route", "Reverse", NULL, ! "Reverse the current route", ! roadmap_start_route_reverse}, ! ! {"simplifyroute", "Simplify Route", NULL, NULL, ! "Create simplified version of current route", roadmap_trip_route_convert }, ! ! {"createroute", "Create new route", NULL, NULL, ! "Start new route using last selected street or place", ! roadmap_start_create_route}, ! ! {"setasdestination", "Quick destination", NULL, NULL, ! "Show distance and direction to the last selected street or place", ! roadmap_trip_set_as_destination}, ! ! {"manageroutes", "Manage Current Routes...", "Manage", NULL, ! "Select, rename, or delete routes", roadmap_trip_route_manage_dialog}, ! ! {"gpsaswaypoint", "GPS as new place...", "GPS Place", "GW", ! "Create new place using current GPS position", roadmap_start_create_gps_waypoint}, ! ! {"addaswaypoint", "Add as new place...", "Place", "W", ! "Create new place using last selected street or place", roadmap_start_create_waypoint}, ! ! {"editroutewaypoints", "Route Waypoints...", NULL, NULL, ! "Edit current route's waypoints", roadmap_trip_route_waypoint_manage_dialog }, ! ! {"edittripwaypoints", "Trip Landmarks...", NULL, NULL, ! "Edit landmarks associated with this trip", roadmap_trip_trip_waypoint_manage_dialog }, ! ! {"editpersonalwaypoints", "Personal Landmarks...", NULL, NULL, ! "Edit personal landmarks", roadmap_trip_personal_waypoint_manage_dialog }, ! ! {"mergepersonalwaypoints", "Load More Personal Landmarks...", NULL, NULL, ! "Merge personal landmarks from file", roadmap_landmark_merge }, {"full", "Full Screen", "Full", "F", *************** *** 444,447 **** --- 484,488 ---- "preferences", "gpsconsole", + "savescreenshot", RoadMapFactorySeparator, *************** *** 494,498 **** --- 535,541 ---- RoadMapFactorySeparator, + "startpoint", "destination", + "departure", "gps", *************** *** 503,506 **** --- 546,556 ---- "deletemaps", + ROADMAP_MENU "Track", + + "tracksave", + "trackclear", + "tracktoroute", + "tracktoggle", + ROADMAP_MENU "Trip", *************** *** 508,529 **** "newtrip", "opentrip", "savetrip", "savetripas", - "savescreenshot", ! RoadMapFactorySeparator, "starttrip", "stoptrip", ! "resumetrip", ! "resumetripnorthup", ! "returntrip", ! RoadMapFactorySeparator, - "setasdestination", "addaswaypoint", ! "deletewaypoints", ! ROADMAP_MENU "Help", --- 558,583 ---- "newtrip", "opentrip", + "mergetrip", "savetrip", "savetripas", ! ROADMAP_MENU "Routes", + "manageroutes", "starttrip", "stoptrip", ! "resumeroute", ! "reverseroute", ! "simplifyroute", ! "createroute", ! "setasdestination", ! ROADMAP_MENU "Places", "addaswaypoint", ! "editroutewaypoints", ! "edittripwaypoints", ! "editpersonalwaypoints", ! "mergepersonalwaypoints", ROADMAP_MENU "Help", *************** *** 589,593 **** "-" ROADMAP_MAPPED_TO "zoomout", "A" ROADMAP_MAPPED_TO "address", ! "B" ROADMAP_MAPPED_TO "returntrip", /* C Unused. */ "D" ROADMAP_MAPPED_TO "destination", --- 643,647 ---- "-" ROADMAP_MAPPED_TO "zoomout", "A" ROADMAP_MAPPED_TO "address", ! "B" ROADMAP_MAPPED_TO "returnroute", /* C Unused. */ "D" ROADMAP_MAPPED_TO "destination", *************** *** 607,611 **** "R" ROADMAP_MAPPED_TO "zoom1", "S" ROADMAP_MAPPED_TO "starttrip", ! /* T Unused. */ "U" ROADMAP_MAPPED_TO "gpsnorthup", /* V Unused. */ --- 661,665 ---- "R" ROADMAP_MAPPED_TO "zoom1", "S" ROADMAP_MAPPED_TO "starttrip", ! "T" ROADMAP_MAPPED_TO "tracktoggle", "U" ROADMAP_MAPPED_TO "gpsnorthup", /* V Unused. */ *************** *** 654,658 **** roadmap_object_move (RoadMapStartGpsID, gps_position); ! roadmap_trip_set_gps (gps_position); roadmap_log_reset_stack (); --- 708,712 ---- roadmap_object_move (RoadMapStartGpsID, gps_position); ! roadmap_trip_set_gps (gps_time, gps_position); roadmap_log_reset_stack (); *************** *** 915,918 **** --- 969,974 ---- roadmap_history_load (); + + roadmap_track_autoload (); roadmap_driver_activate (); *************** *** 928,932 **** if ((roadmap_trip_current() == NULL) || ! (! roadmap_trip_load (roadmap_trip_current(), 1))) { roadmap_start_create_trip (); } --- 984,988 ---- if ((roadmap_trip_current() == NULL) || ! (! roadmap_trip_load (roadmap_trip_current(), 1, 0))) { roadmap_start_create_trip (); } *************** *** 947,950 **** roadmap_history_save(); roadmap_config_save (0); ! roadmap_start_save_trip (); } --- 1003,1008 ---- roadmap_history_save(); roadmap_config_save (0); ! roadmap_track_autosave (); ! roadmap_landmark_save (); ! roadmap_trip_save (roadmap_trip_current(), 0); } |
From: Paul F. <pg...@us...> - 2005-12-07 18:57:50
|
Update of /cvsroot/roadmap/roadmap/src/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8864/qt Modified Files: Makefile Log Message: changes to support full-featured "trips", based on gpx-format routes and waypoints. Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/Makefile,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Makefile 5 Nov 2005 08:50:48 -0000 1.19 --- Makefile 7 Dec 2005 18:57:36 -0000 1.20 *************** *** 46,51 **** endif ! RDMLIBS= ../libroadmap.a libqtroadmap.a ../unix/libosroadmap.a ../libroadmap.a ! LIBS=$(RDMLIBS) $(GUILDFLAGS) -lm --- 46,51 ---- endif ! RDMLIBS= ../libroadmap.a libqtroadmap.a ../unix/libosroadmap.a ../gpx/libgpx.a ../libroadmap.a ! LIBS=$(RDMLIBS) $(GUILDFLAGS) -lexpat -lm |
From: Paul F. <pg...@us...> - 2005-12-07 18:57:49
|
Update of /cvsroot/roadmap/roadmap/src/gtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8864/gtk Modified Files: Makefile Log Message: changes to support full-featured "trips", based on gpx-format routes and waypoints. Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk/Makefile,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Makefile 6 Dec 2005 23:19:39 -0000 1.17 --- Makefile 7 Dec 2005 18:57:35 -0000 1.18 *************** *** 18,22 **** ! RDMLIBS= ../libroadmap.a libgtkroadmap.a ../unix/libosroadmap.a ../libroadmap.a HOST=`uname -s` --- 18,22 ---- ! RDMLIBS= ../libroadmap.a libgtkroadmap.a ../unix/libosroadmap.a ../gpx/libgpx.a ../libroadmap.a HOST=`uname -s` *************** *** 28,32 **** CFLAGS=$(STDCFLAGS) $(GUICFLAGS) -I.. -I/usr/local/include ! LIBS= -L/usr/local/libs $(RDMLIBS) $(GUILDFLAGS) -lm # --- RoadMap sources & targets -------------------------------------------- --- 28,32 ---- CFLAGS=$(STDCFLAGS) $(GUICFLAGS) -I.. -I/usr/local/include ! LIBS= -L/usr/local/libs $(RDMLIBS) $(GUILDFLAGS) -lexpat -lm # --- RoadMap sources & targets -------------------------------------------- |
From: Paul F. <pg...@us...> - 2005-12-07 17:19:41
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14531 Modified Files: roadmap_track.c Log Message: add missing parameter to gps listener. pretty serious error for just a warning... Index: roadmap_track.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_track.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_track.c 7 Dec 2005 14:06:03 -0000 1.1 --- roadmap_track.c 7 Dec 2005 17:19:31 -0000 1.2 *************** *** 130,133 **** --- 130,134 ---- static void roadmap_track_gps_update (int gps_time, + const RoadMapGpsPrecision *dilution, const RoadMapGpsPosition *gps_position) { |
From: Paul F. <pg...@us...> - 2005-12-07 14:21:26
|
Update of /cvsroot/roadmap/roadmap/src/gpx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5631 Added Files: Makefile README defs.h formspec.c gbtypes.h gpx.c mkshort.c queue.c queue.h route.c util.c vmem.c waypt.c xmltag.c Log Message: GPX format file i/o, and route/track/waypoint support. most of this code is from the gpsbabel project. see the README. --- NEW FILE: gpx.c --- /* Access GPX data files. Copyright (C) 2002, 2003, 2004, 2005 Robert Lipe, rob...@us... Modified for use with RoadMap, Paul Fox, 2005 This program 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. This program 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 this program; if not, write to the Free Software [...1567 lines suppressed...] gpx_write_postfix(ofd); mkshort_del_handle(&mkshort_handle); return 1; } #if NEEDED static void gpx_exit(void) { if ( xsi_schema_loc ) { xfree(xsi_schema_loc); xsi_schema_loc = NULL; } } #endif --- NEW FILE: xmltag.c --- /* Functions to deal with xml_tags Copyright (C) 2005 Ron Parker and Robert Lipe. Modified for use with RoadMap, Paul Fox, 2005 This program 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. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ #include <stddef.h> #include <stdio.h> #include <string.h> #include "defs.h" void free_xml_tag( xml_tag *tag ) { xml_tag *next = NULL; char **ap; while ( tag ) { if (tag->cdata) { xfree(tag->cdata); } if (tag->child) { free_gpx_extras(tag->child); } if (tag->parentcdata) { xfree(tag->parentcdata); } if (tag->tagname) { xfree(tag->tagname); } if (tag->attributes) { ap = tag->attributes; while (*ap) xfree(*ap++); xfree(tag->attributes); } next = tag->sibling; xfree(tag); tag = next; } } #if NEEDED /* only needed by waypt_dupe() */ void copy_xml_tag( xml_tag **copy, xml_tag *src, xml_tag *parent ) { xml_tag *res = NULL; char **ap = NULL; char **ap2 = NULL; int count = 0; if ( !src ) { *copy = NULL; return; } res = xcalloc( 1, sizeof(xml_tag)); *copy = res; memcpy( res, src, sizeof(xml_tag)); res->tagname = xstrdup( src->tagname ); res->cdata = xstrdup( src->cdata ); res->parentcdata = xstrdup( src->parentcdata ); if ( src->attributes ) { ap = src->attributes; while ( *ap ) { count++; ap++; } res->attributes = (char **)xcalloc( count+1, sizeof(char *)); ap = src->attributes; ap2 = res->attributes; while (*ap) { *ap2 = xstrdup(*ap); ap++; ap2++; } } res->parent = parent; copy_xml_tag( &(res->sibling), src->sibling, parent ); copy_xml_tag( &(res->child), src->child, res ); } fs_xml *fs_xml_alloc( long type ); void fs_xml_copy( void **copy, void *source ) { fs_xml *src = (fs_xml *)source; if ( !source ) { *copy = NULL; return; } *copy = (void *)fs_xml_alloc( src->fs.type ); memcpy( *copy, source, sizeof(fs_xml) ); copy_xml_tag( &(((fs_xml *)(*copy))->tag), src->tag, NULL ); } #endif void fs_xml_destroy( void *fs ) { fs_xml *xml = (fs_xml *)fs; if ( xml ) { free_xml_tag( xml->tag ); } xfree( fs ); } fs_xml *fs_xml_alloc( long type ) { fs_xml *result = NULL; result = (fs_xml *)xcalloc( 1, sizeof(fs_xml)); result->fs.type = type; #if NEEDED /* only needed by waypt_dupe() */ result->fs.copy = fs_xml_copy; #else result->fs.copy = 0; #endif result->fs.destroy = fs_xml_destroy; return result; } --- NEW FILE: waypt.c --- /* Perform various operations on waypoints. Copyright (C) 2002-2005 Robert Lipe, rob...@us... Modified for use with RoadMap, Paul Fox, 2005 This program 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. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ #include <stdio.h> #include "defs.h" waypoint * waypt_dupe(const waypoint *wpt) { /* * This and waypt_free should be closely synced. */ waypoint * tmp; tmp = waypt_new(); memcpy(tmp, wpt, sizeof(waypoint)); if (wpt->shortname) { tmp->shortname = xstrdup(wpt->shortname); tmp->wpt_flags.shortname_is_synthetic = wpt->wpt_flags.shortname_is_synthetic; } if (wpt->description) tmp->description = xstrdup(wpt->description); if (wpt->notes) tmp->notes = xstrdup(wpt->notes); if (wpt->url) tmp->url = xstrdup(wpt->url); if (wpt->url_link_text) tmp->url_link_text = xstrdup(wpt->url_link_text); if (wpt->icon_descr && wpt->wpt_flags.icon_descr_is_dynamic) tmp->icon_descr = xstrdup(wpt->icon_descr); if (wpt->gc_data.desc_short.utfstring) { tmp->gc_data.desc_short.utfstring = xstrdup(wpt->gc_data.desc_short.utfstring); } if (wpt->gc_data.desc_long.utfstring) { tmp->gc_data.desc_long.utfstring = xstrdup(wpt->gc_data.desc_long.utfstring); } if (wpt->gc_data.placer) { tmp->gc_data.placer = xstrdup(wpt->gc_data.placer); } if (wpt->gc_data.hint) { tmp->gc_data.hint = xstrdup(wpt->gc_data.hint); } /* * It's important that this duplicated waypoint not appear * on the master Q. */ tmp->Q.next = tmp->Q.prev = NULL; tmp->fs = fs_chain_copy( wpt->fs ); return tmp; } void waypt_add(queue *q, waypoint *wpt) { static int waypt_index; ENQUEUE_TAIL(q, &wpt->Q); waypt_index++; /* * Some input may not have one or more of these types so we * try to be sure that we have these fields even if just by * copying them from elsewhere. */ if (wpt->shortname == NULL) { if (wpt->description) { wpt->shortname = xstrdup(wpt->description); } else if (wpt->notes) { wpt->shortname = xstrdup(wpt->notes); } else { /* Last ditch: make up a name */ char cbuf[10]; snprintf(cbuf, sizeof(cbuf), "WPT%03d", waypt_index); wpt->shortname = xstrdup(cbuf); } } if (wpt->description == NULL || strlen(wpt->description) == 0) { if (wpt->description) xfree(wpt->description); if (wpt->notes != NULL) { wpt->description = xstrdup(wpt->notes); } } } void waypt_del(waypoint *wpt) { dequeue(&wpt->Q); } /* * A constructor for a single waypoint. */ waypoint * waypt_new(void) { waypoint *wpt; wpt = (waypoint *) xcalloc(sizeof (*wpt), 1); wpt->altitude = unknown_alt; wpt->course = -999.0; wpt->speed = -999.0; wpt->fix = fix_unknown; wpt->sat = -1; return wpt; } void waypt_iterator(queue *q, waypt_cb cb) { queue *elem, *tmp; waypoint *waypointp; QUEUE_FOR_EACH(q, elem, tmp) { waypointp = (waypoint *) elem; (*cb) (waypointp); } } void waypt_init_bounds(bounds *bounds) { /* Set data out of bounds so that even one waypoint will reset */ bounds->max_lat = -500000000; bounds->max_lon = -500000000; bounds->min_lat = 500000000; bounds->min_lon = 500000000; } int waypt_bounds_valid(bounds *bounds) { /* Returns true if bb has any 'real' data in it */ return bounds->max_lat > -360; } /* * Recompund bounding box based on new position point. */ void waypt_add_to_bounds(bounds *bounds, const waypoint *waypointp) { if (waypointp->pos.latitude > bounds->max_lat) bounds->max_lat = waypointp->pos.latitude; if (waypointp->pos.longitude > bounds->max_lon) bounds->max_lon = waypointp->pos.longitude; if (waypointp->pos.latitude < bounds->min_lat) bounds->min_lat = waypointp->pos.latitude; if (waypointp->pos.longitude < bounds->min_lon) bounds->min_lon = waypointp->pos.longitude; } /* * Makes another pass over the data to compute bounding * box data and populates bounding box information. */ void waypt_compute_bounds(queue *q, bounds *bounds) { queue *elem, *tmp; waypoint *waypointp; /* Set data out of bounds so that even one waypoint will reset */ bounds->max_lat = -9999; bounds->max_lon = -9999; bounds->min_lat = 9999; bounds->min_lon = 9999; QUEUE_FOR_EACH(q, elem, tmp) { waypointp = (waypoint *) elem; if (waypointp->pos.latitude > bounds->max_lat) bounds->max_lat = waypointp->pos.latitude; if (waypointp->pos.longitude > bounds->max_lon) bounds->max_lon = waypointp->pos.longitude; if (waypointp->pos.latitude < bounds->min_lat) bounds->min_lat = waypointp->pos.latitude; if (waypointp->pos.longitude < bounds->min_lon) bounds->min_lon = waypointp->pos.longitude; } } waypoint * waypt_find_waypt_by_name(queue *q, const char *name) { queue *elem, *tmp; waypoint *waypointp; QUEUE_FOR_EACH(q, elem, tmp) { waypointp = (waypoint *) elem; if (0 == strcmp(waypointp->shortname, name)) { return waypointp; } } return NULL; } void waypt_free( waypoint *wpt ) { /* * This and waypt_dupe should be closely synced. */ if (wpt->shortname) { xfree(wpt->shortname); } if (wpt->description) { xfree(wpt->description); } if (wpt->notes) { xfree(wpt->notes); } if (wpt->url) { xfree(wpt->url); } if (wpt->url_link_text) { xfree(wpt->url_link_text); } if (wpt->icon_descr && wpt->wpt_flags.icon_descr_is_dynamic) { xfree((char *)(void *)wpt->icon_descr); } if (wpt->gc_data.desc_short.utfstring) { xfree(wpt->gc_data.desc_short.utfstring); } if (wpt->gc_data.desc_long.utfstring) { xfree(wpt->gc_data.desc_long.utfstring); } if (wpt->gc_data.placer) { xfree(wpt->gc_data.placer); } if (wpt->gc_data.hint) { xfree (wpt->gc_data.hint); } fs_chain_destroy( wpt->fs ); xfree(wpt); } void waypt_flush_queue( queue *head ) { queue *elem, *tmp; QUEUE_FOR_EACH(head, elem, tmp) { waypoint *q = (waypoint *) dequeue(elem); waypt_free(q); } } --- NEW FILE: Makefile --- # --- Tool specific options ------------------------------------------------ RANLIB = ranlib HOST=`uname -s` ifeq ($(HOST),Darwin) ARFLAGS="r" else ARFLAGS="rf" endif # WARNFLAGS = -g WARNFLAGS = -O2 MODECFLAGS= $(WARNFLAGS) -ffast-math -fomit-frame-pointer $(OPTIONS) CFLAGS = $(MODECFLAGS) $(STDCFLAGS) # --- RoadMap sources & targets -------------------------------------------- OSLIBSRCS=\ gpx.c \ xmltag.c \ waypt.c \ route.c \ util.c \ queue.c \ mkshort.c \ formspec.c \ vmem.c OSLIBOBJS=$(OSLIBSRCS:.c=.o) # --- Conventional targets ---------------------------------------- all: runtime build: runtime: libgpx.a clean: cleanone cleanone: rm -f *.o *.a *.da install: uninstall: # --- The real targets -------------------------------------------- libgpx.a: $(OSLIBOBJS) $(AR) $(ARFLAGS) libgpx.a $(OSLIBOBJS) $(RANLIB) libgpx.a --- NEW FILE: route.c --- /* Copyright (C) 2002 Robert Lipe, rob...@us... Modified for use with RoadMap, Paul Fox, 2005 This program 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. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ #include <stdio.h> #include "defs.h" route_head * route_head_alloc(void) { route_head *rte_head; rte_head = (route_head *) xcalloc(sizeof (*rte_head), 1); QUEUE_INIT(&rte_head->Q); QUEUE_INIT(&rte_head->waypoint_list); return rte_head; } void route_add(queue *rq, route_head *rte) { ENQUEUE_TAIL(rq, &rte->Q); } void route_del(route_head *rte) { dequeue( &rte->Q ); route_free( rte ); } route_head * route_find_route_by_name(queue *routes, const char *name) { queue *elem, *tmp; route_head *rte; QUEUE_FOR_EACH(routes, elem, tmp) { rte = (route_head *) elem; if (0 == strcmp(rte->rte_name, name)) { return rte; } } return NULL; } void route_add_wpt(route_head *rte, waypoint *next, waypoint *wpt, int after) { static int rte_waypt_index; if (after) ENQUEUE_AFTER(&next->Q, &wpt->Q); else ENQUEUE_BEFORE(&next->Q, &wpt->Q); rte->rte_waypt_ct++; /* waypoints in this route */ rte_waypt_index++; /* total waypoints in all routes */ if (wpt->shortname == NULL) { char tmpnam[10]; snprintf(tmpnam, sizeof(tmpnam), "RPT%03d",rte_waypt_index); wpt->shortname = xstrdup(tmpnam); wpt->wpt_flags.shortname_is_synthetic = 1; } } void route_add_wpt_tail(route_head *rte, waypoint *wpt) { /* add at end of list */ route_add_wpt(rte, (waypoint *)&rte->waypoint_list, wpt, 0); } waypoint * route_find_waypt_by_name( route_head *rh, const char *name ) { queue *elem, *tmp; QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) { waypoint *waypointp = (waypoint *) elem; if (0 == strcmp(waypointp->shortname, name)) { return waypointp; } } return NULL; } void route_del_wpt( route_head *rte, waypoint *wpt) { dequeue( &wpt->Q ); waypt_free( wpt ); rte->rte_waypt_ct--; } void route_free(route_head *rte) { if ( rte->rte_name ) { xfree(rte->rte_name); } if ( rte->rte_desc ) { xfree(rte->rte_desc); } waypt_flush_queue(&rte->waypoint_list); if ( rte->fs ) { fs_chain_destroy( rte->fs ); } xfree(rte); } void route_waypt_iterator (const route_head *rh, waypt_cb cb ) { queue *elem, *tmp; if (!cb) { return; } QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) { waypoint *waypointp; waypointp = (waypoint *) elem; (*cb)(waypointp); } } void route_reverse(const route_head *rte_hd) { /* Cast away const-ness */ route_head *rh = (route_head *) rte_hd; queue *elem, *tmp; QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) { ENQUEUE_HEAD(&rh->waypoint_list, dequeue(elem)); } } void route_iterator(queue *qh, route_hdr rh, route_trl rt, waypt_cb wc) { queue *elem, *tmp; QUEUE_FOR_EACH(qh, elem, tmp) { const route_head *rhp; rhp = (route_head *) elem; if (rh) (*rh)(rhp); route_waypt_iterator(rhp, wc); if (rt) (*rt)(rhp); } } void route_flush_queue(queue *head) { queue *elem, *tmp; queue *q; QUEUE_FOR_EACH(head, elem, tmp) { q = dequeue(elem); route_free((route_head *) q); } } --- NEW FILE: defs.h --- /* Copyright (C) 2002, 2003, 2004, 2005 Robert Lipe, rob...@us... Modified for use with RoadMap, Paul Fox, 2005 This program 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. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ #ifndef gpsbabel_defs_h_included #define gpsbabel_defs_h_included #include <time.h> #include <stdlib.h> #include <math.h> #include <stdio.h> #include <string.h> #include <stdarg.h> #include <stddef.h> #include "queue.h" #include "gbtypes.h" /* * Snprintf is in SUS (so it's in most UNIX-like substance) and it's in * C99 (albeit with slightly different semantics) but it isn't in C89. * This tweaks allows us to use snprintf on the holdout. */ #if __WIN32__ # define snprintf _snprintf # define vsnprintf _vsnprintf #endif /* Turn off numeric conversion warning */ #if __WIN32__ #pragma warning(disable:4244) #endif /* * Toss in some GNU C-specific voodoo for checking. */ #if __GNUC__ # define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, (x), (y)))) # define NORETURN void __attribute__ ((__noreturn__)) #else # define PRINTFLIKE(x,y) # define NORETURN void #endif /* * Common definitions. There should be no protocol or file-specific * data in this file. */ typedef enum { fix_unknown=-1, fix_none=0, fix_2d=1, fix_3d, fix_dgps, fix_pps } fix_type; /* Short or Long XML Times */ #define XML_SHORT_TIME 1 #define XML_LONG_TIME 2 /* * Extended data if waypoint happens to represent a geocache. This is * totally voluntary data... */ typedef enum { gt_unknown = 0 , gt_traditional, gt_multi, gt_virtual, gt_letterbox, gt_event, gt_suprise, gt_webcam, gt_earth, gt_locationless, gt_benchmark, /* Extension to Groundspeak for GSAK */ gt_cito } geocache_type; typedef enum { gc_unknown = 0, gc_micro, gc_other, gc_regular, gc_large, gc_virtual, gc_small } geocache_container; typedef struct { int is_html; char *utfstring; } utf_string; typedef struct { int id; /* The decimal cache number */ geocache_type type:5; geocache_container container:4; unsigned int diff:6; /* (multiplied by ten internally) */ unsigned int terr:6; /* (likewise) */ time_t exported; time_t last_found; char *placer; /* Placer name */ char *hint; /* all these UTF8, XML entities removed, May be not HTML. */ utf_string desc_short; utf_string desc_long; } geocache_data ; typedef struct xml_tag { char *tagname; char *cdata; int cdatalen; char *parentcdata; int parentcdatalen; char **attributes; struct xml_tag *parent; struct xml_tag *sibling; struct xml_tag *child; } xml_tag ; typedef void (*fs_destroy)(void *); typedef void (*fs_copy)(void **, void *); typedef struct format_specific_data { long type; struct format_specific_data *next; fs_destroy destroy; fs_copy copy; } format_specific_data; format_specific_data *fs_chain_copy( format_specific_data *source ); void fs_chain_destroy( format_specific_data *chain ); format_specific_data *fs_chain_find( format_specific_data *chain, long type ); void fs_chain_add( format_specific_data **chain, format_specific_data *data ); typedef struct fs_xml { format_specific_data fs; xml_tag *tag; } fs_xml; fs_xml *fs_xml_alloc( long type ); /* we only have one type of data, so only the first of these is * relevant */ #define FS_GPX 0x67707800L #define FS_AN1W 0x616e3177L #define FS_AN1L 0x616e316cL #define FS_AN1V 0x616e3176L /* * Misc bitfields inside struct waypoint; */ typedef struct { unsigned int icon_descr_is_dynamic:1; unsigned int shortname_is_synthetic:1; } wp_flags; /* this simply avoids everything in the gpx directory needing to * include roadmap_types.h */ #ifndef ROADMAP typedef struct { int longitude; int latitude; } RoadMapPosition; #endif /* * This is a waypoint, as stored in the GPSR. It tries to not * cater to any specific model or protocol. Anything that needs to * be truncated, edited, or otherwise trimmed should be done on the * way to the target. */ typedef struct { queue Q; /* Master waypoint q. Not for use by modules. */ /* * RoadMap's representation of lat/long position. */ RoadMapPosition pos; double altitude; /* Meters. */ #if NEEDED /* * The "thickness" of a waypoint; adds an element of 3D. Can be * used to construct rudimentary polygons for, say, airspace * definitions. The units are meters. */ double depth; /* * An alarm trigger value that can be considered to be a circle * surrounding a waypoint (or cylinder if depth is also defined). * The units are meters. */ double proximity; #endif /* shortname is a waypoint name as stored in receiver. It should * strive to be, well, short, and unique. Enforcing length and * character restrictions is the job of the output. A typical * minimum length for shortname is 6 characters for NMEA units, * 8 for Magellan and 10 for Vista. These are only guidelines. */ char *shortname; /* * description is typically a human readable description of the * waypoint. It may be used as a comment field in some receivers. * These are probably under 40 bytes, but that's only a guideline. */ char *description; /* * notes are relatively long - over 100 characters - prose associated * with the above. Unlike shortname and description, these are never * used to compute anything else and are strictly "passed through". * Few formats support this. */ char *notes; char *url; char *url_link_text; wp_flags wpt_flags; const char *icon_descr; time_t creation_time; /* standardized in UTC/GMT */ #if NEEDED int centiseconds; /* Optional hundredths of a second. */ /* * route priority is for use by the simplify filter. If we have * some reason to believe that the route point is more important, * we can give it a higher (numerically; 0 is the lowest) priority. * This causes it to be removed last. * This is currently used by the saroute input filter to give named * waypoints (representing turns) a higher priority. * This is also used by the google input filter because they were * nice enough to use exactly the same priority scheme. */ int route_priority; #endif /* Optional dilution of precision: positional, horizontal, veritcal. * 1 <= dop <= 50 */ float hdop; float vdop; float pdop; float course; /* Optional: degrees true */ float speed; /* Optional: meters per second. */ fix_type fix; /* Optional: 3d, 2d, etc. */ int sat; /* Optional: number of sats used for fix */ #if NEEDED int heartrate; /* Beats per minute: likely to get moved to fs. */ #endif geocache_data gc_data; format_specific_data *fs; #if NEEDED void *extra_data; /* Extra data added by, say, a filter. */ #endif } waypoint; typedef struct { queue Q; /* Link onto parent list. */ queue waypoint_list; /* List of child waypoints */ char *rte_name; char *rte_desc; int rte_num; int rte_waypt_ct; /* # waypoints in waypoint list */ int rte_is_track; /* set externally */ format_specific_data *fs; } route_head; /* * Bounding box information. */ typedef struct { int max_lat; int max_lon; int min_lat; int min_lon; } bounds; typedef void (*waypt_cb) (const waypoint *); typedef void (*route_hdr)(const route_head *); typedef void (*route_trl)(const route_head *); void waypt_add (queue *q, waypoint *); waypoint * waypt_dupe (const waypoint *); waypoint * waypt_new(void); void waypt_del (waypoint *); void waypt_free (waypoint *); void waypt_iterator(queue *, waypt_cb); void waypt_init_bounds(bounds *bounds); int waypt_bounds_valid(bounds *bounds); void waypt_add_to_bounds(bounds *bounds, const waypoint *waypointp); void waypt_compute_bounds(queue *q, bounds *); void waypt_flush_queue(queue *); unsigned int waypt_count(void); void set_waypt_count(unsigned int nc); void set_waypt_head(queue *wh); void free_gpx_extras (xml_tag * tag); void xcsv_setup_internal_style(const char *style_buf); void xcsv_read_internal_style(const char *style_buf); waypoint * waypt_find_waypt_by_name(queue *q, const char *name); void waypt_backup(unsigned int *count, queue **head_bak); void waypt_restore(unsigned int count, queue *head_bak); route_head *route_head_alloc(void); void route_add_wpt(route_head *rte, waypoint *next, waypoint *wpt, int after); void route_add_wpt_tail(route_head *rte, waypoint *wpt); void route_del_wpt(route_head *rte, waypoint *wpt); void route_add(queue *q, route_head *rte); void route_del(route_head *rte); void route_reverse(const route_head *rte_hd); waypoint * route_find_waypt_by_name(route_head *rh, const char *name); void route_waypt_iterator(const route_head *rte, waypt_cb); void route_iterator(queue *qh, route_hdr rh, route_trl rt, waypt_cb wc); void route_free (route_head *); void route_flush_queue( queue *); route_head * route_find_route_by_name(queue *routes, const char *name); unsigned int route_count(void); unsigned int track_count(void); void route_backup(unsigned int *count, queue **head_bak); void route_restore(unsigned int count, queue *head_bak); void track_backup(unsigned int *count, queue **head_bak); void track_restore(unsigned int count, queue *head_bak); /* * All shortname functions take a shortname handle as the first arg. * This is an opaque pointer. Callers must not fondle the contents of it. */ typedef struct short_handle * short_handle; #ifndef DEBUG_MEM char *mkshort (short_handle, const char *); void *mkshort_new_handle(void); #else char *MKSHORT(short_handle, const char *, DEBUG_PARAMS); void *MKSHORT_NEW_HANDLE(DEBUG_PARAMS); #define mkshort( a, b) MKSHORT(a,b,__FILE__, __LINE__) #define mkshort_new_handle() MKSHORT_NEW_HANDLE(__FILE__,__LINE__) #endif char *mkshort_from_wpt(short_handle h, const waypoint *wpt); void mkshort_del_handle(short_handle *h); void setshort_length(short_handle, int n); void setshort_badchars(short_handle, const char *); void setshort_goodchars(short_handle, const char *); void setshort_mustupper(short_handle, int n); void setshort_mustuniq(short_handle, int n); void setshort_whitespace_ok(short_handle, int n); void setshort_repeating_whitespace_ok(short_handle, int n); void setshort_defname(short_handle, const char *s); /* * Vmem flags values. */ #define VMFL_NOZERO (1 << 0) typedef struct vmem { void *mem; /* visible memory object */ size_t size; /* allocated size of object */ } vmem_t; vmem_t vmem_alloc(size_t, int flags); void vmem_free(vmem_t*); void vmem_realloc(vmem_t*, size_t); #define ARGTYPE_UNKNOWN 0x00000000 #define ARGTYPE_INT 0x00000001 #define ARGTYPE_FLOAT 0x00000002 #define ARGTYPE_STRING 0x00000003 #define ARGTYPE_BOOL 0x00000004 #define ARGTYPE_FILE 0x00000005 #define ARGTYPE_OUTFILE 0x00000006 /* REQUIRED means that the option is required to be set. * See also BEGIN/END_REQ */ #define ARGTYPE_REQUIRED 0x40000000 /* HIDDEN means that the option does not appear in help texts. Useful * for debugging or testing options */ #define ARGTYPE_HIDDEN 0x20000000 /* BEGIN/END_EXCL mark the beginning and end of an exclusive range of * options. No more than one of the options in the range may be selected * or set. If exactly one must be set, use with BEGIN/END_REQ * Both of these flags set is just like neither set, so avoid doing that. */ #define ARGTYPE_BEGIN_EXCL 0x10000000 #define ARGTYPE_END_EXCL 0x08000000 /* BEGIN/END_REQ mark the beginning and end of a required range of * options. One or more of the options in the range MUST be selected or set. * If exactly one must be set, use with BEGIN/END_EXCL * Both of these flags set is synonymous with REQUIRED, so use that instead * for "groups" of exactly one option. */ #define ARGTYPE_BEGIN_REQ 0x04000000 #define ARGTYPE_END_REQ 0x02000000 #define ARGTYPE_TYPEMASK 0x00000fff #define ARGTYPE_FLAGMASK 0xfffff000 typedef struct arglist { char *argstring; char **argval; char *helpstring; char *defaultvalue; gbuint32 argtype; char *minvalue; /* minimum value for numeric options */ char *maxvalue; /* maximum value for numeric options */ } arglist_t; NORETURN fatal(const char *, ...) PRINTFLIKE(1, 2); void warning(const char *, ...) PRINTFLIKE(1, 2); int gpx_write( FILE *ofd, queue *w, queue *r, queue *t); int gpx_read(FILE *ifile, queue *w, queue *r, queue *t); time_t xml_parse_time( const char *cdatastr ); void write_xml_entity(FILE *ofd, const char *indent, const char *tag, const char *value); void xml_fill_in_time(char *time_string, const time_t timep, int long_or_short); void xml_write_time(FILE *ofd, const time_t timep, const char *indent, char *elname); void write_optional_xml_entity(FILE *ofd, const char *indent, const char *tag, const char *value); void *xcalloc(size_t nmemb, size_t size); void *xmalloc(size_t size); void *xrealloc(void *p, size_t s); void xfree(void *mem); char *xstrdup(const char *s); char *xstrndup(const char *s, size_t n); char *xstrndupt(const char *s, size_t n); char *xstrappend(char *src, const char *addon); void rtrim(char *s); time_t mkgmtime(struct tm *t); time_t current_time(void); char * xml_entitize(const char * str); /* * Character encoding transformations. */ #define CET_NOT_CONVERTABLE_DEFAULT '$' #define CET_CHARSET_ASCII "US-ASCII" #define CET_CHARSET_UTF8 "UTF-8" #define CET_CHARSET_MS_ANSI "MS-ANSI" #define CET_CHARSET_LATIN1 "ISO-8859-1" #define str_utf8_to_cp1252(str) cet_str_utf8_to_cp1252((str)) #define str_cp1252_to_utf8(str) cet_str_cp1252_to_utf8((str)) #define str_utf8_to_iso8859_1(str) cet_str_utf8_to_iso8859_1((str)) #define str_iso8859_1_to_utf8(str) cet_str_iso8859_1_to_utf8((str)) /* * A constant for unknown altitude. It's tempting to just use zero * but that's not very nice for the folks near sea level. */ #define unknown_alt -99999999.0 #endif /* gpsbabel_defs_h_included */ --- NEW FILE: util.c --- /* Misc utilities. Copyright (C) 2002-2005 Robert Lipe, rob...@us... Modified for use with RoadMap, Paul Fox, 2005 This program 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. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ #include "defs.h" #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <errno.h> void * xmalloc(size_t size) { void *obj = malloc(size); if (!obj) { fatal("gpsbabel: Unable to allocate %d bytes of memory.\n", size); } return obj; } void * xcalloc(size_t nmemb, size_t size) { void *obj = calloc(nmemb, size); if (!obj) { fatal("gpsbabel: Unable to allocate %d bytes of memory.\n", size); } return obj; } void xfree( void *mem ) { free(mem); } char * xstrdup(const char *s) { char *o = s ? strdup(s) : strdup(""); if (!o) { fatal("gpsbabel: Unable to allocate %d bytes of memory.\n", strlen(s)); } return o; } /* * Duplicate at most sz bytes in str. */ char * xstrndup(const char *str, size_t sz) { size_t newlen; char *newstr; newlen = strlen(str); if (newlen > sz) { newlen = sz; } newstr = (char *) xmalloc(newlen + 1); memcpy(newstr, str, newlen); newstr[newlen] = 0; return newstr; } /* * Lazily trim whitespace (though not from allocated version) * while copying. */ char * xstrndupt(const char *str, size_t sz) { size_t newlen; char *newstr; newlen = strlen(str); if (newlen > sz) { newlen = sz; } newstr = (char *) xmalloc(newlen + 1); memcpy(newstr, str, newlen); newstr[newlen] = '\0'; rtrim(newstr); return newstr; } void * xrealloc(void *p, size_t s) { char *o = (char *) realloc(p,s); if (!o) { fatal("gpsbabel: Unable to realloc %d bytes of memory.\n", s); } return o; } /* * For an allocated string, realloc it and append 's' */ char * xstrappend(char *src, const char *newd) { size_t newsz; if (!src) { return xstrdup(newd); } newsz = strlen(src) + strlen(newd) + 1; src = xrealloc(src, newsz); strcat(src, newd); return src; } void rtrim(char *s) { char *t = s; if (!s || !*s) { return; } while (*s) { s++; } s--; while ((s >= t) && isspace (*s)) { *s = 0; s--; } } void printposn(const int c, int is_lat) { char d; if (is_lat) { if (c < 0) d = 'S'; else d = 'N'; } else { if (c < 0) d = 'W'; else d = 'E'; } printf("%f%c ", (double)abs(c)/1000000.0, d); } /* mkgmtime -- convert tm struct in UTC to time_t works just like mktime but without all the mucking around with timezones and daylight savings obsoletes get_tz_offset() Borrowed from lynx GPL source code http://lynx.isc.org/release/lynx2-8-5/src/mktime.c Written by Philippe De Muyter <ph...@ma...>. */ time_t mkgmtime(struct tm *t) { short month, year; time_t result; static int m_to_d[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; month = t->tm_mon; year = t->tm_year + month / 12 + 1900; month %= 12; if (month < 0) { year -= 1; month += 12; } result = (year - 1970) * 365 + m_to_d[month]; if (month <= 1) year -= 1; result += (year - 1968) / 4; result -= (year - 1900) / 100; result += (year - 1600) / 400; result += t->tm_mday; result -= 1; result *= 24; result += t->tm_hour; result *= 60; result += t->tm_min; result *= 60; result += t->tm_sec; return(result); } /* * A wrapper for time(2) that allows us to "freeze" time for testing. */ time_t current_time(void) { if (getenv("GPSBABEL_FREEZE_TIME")) { return 0; } return time(NULL); } typedef struct { const char * text; const char * entity; int not_html; } entity_types; static entity_types stdentities[] = { { "&", "&", 0 }, { "'", "'", 1 }, { "<", "<", 0 }, { ">", ">", 0 }, { "\"", """, 0 }, { NULL, NULL, 0 } }; void utf8_to_int( const char *cp, int *bytes, int *value ) { if ( (*cp & 0xe0) == 0xc0 ) { if ( (*(cp+1) & 0xc0) != 0x80 ) goto dodefault; *bytes = 2; *value = ((*cp & 0x1f) << 6) | (*(cp+1) & 0x3f); } else if ( (*cp & 0xf0) == 0xe0 ) { if ( (*(cp+1) & 0xc0) != 0x80 ) goto dodefault; if ( (*(cp+2) & 0xc0) != 0x80 ) goto dodefault; *bytes = 3; *value = ((*cp & 0x0f) << 12) | ((*(cp+1) & 0x3f) << 6) | (*(cp+2) & 0x3f); } else if ( (*cp & 0xf8) == 0xf0 ) { if ( (*(cp+1) & 0xc0) != 0x80 ) goto dodefault; if ( (*(cp+2) & 0xc0) != 0x80 ) goto dodefault; if ( (*(cp+3) & 0xc0) != 0x80 ) goto dodefault; *bytes = 4; *value = ((*cp & 0x07) << 18) | ((*(cp+1) & 0x3f) << 12) | ((*(cp+2) & 0x3f) << 6) | (*(cp+3) & 0x3f); } else if ( (*cp & 0xfc) == 0xf8 ) { if ( (*(cp+1) & 0xc0) != 0x80 ) goto dodefault; if ( (*(cp+2) & 0xc0) != 0x80 ) goto dodefault; if ( (*(cp+3) & 0xc0) != 0x80 ) goto dodefault; if ( (*(cp+4) & 0xc0) != 0x80 ) goto dodefault; *bytes = 5; *value = ((*cp & 0x03) << 24) | ((*(cp+1) & 0x3f) << 18) | ((*(cp+2) & 0x3f) << 12) | ((*(cp+3) & 0x3f) << 6) | (*(cp+4) & 0x3f); } else if ( (*cp & 0xfe) == 0xfc ) { if ( (*(cp+1) & 0xc0) != 0x80 ) goto dodefault; if ( (*(cp+2) & 0xc0) != 0x80 ) goto dodefault; if ( (*(cp+3) & 0xc0) != 0x80 ) goto dodefault; if ( (*(cp+4) & 0xc0) != 0x80 ) goto dodefault; if ( (*(cp+5) & 0xc0) != 0x80 ) goto dodefault; *bytes = 6; *value = ((*cp & 0x01) << 30) | ((*(cp+1) & 0x3f) << 24) | ((*(cp+2) & 0x3f) << 18) | ((*(cp+3) & 0x3f) << 12) | ((*(cp+4) & 0x3f) << 6) | (*(cp+5) & 0x3f); } else { dodefault: *bytes = 1; *value = (unsigned char)*cp; } } static char * entitize(const char * str, int is_html) { int elen, ecount, nsecount; entity_types *ep; const char * cp; char * p, * tmp, * xstr; char tmpsub[20]; int bytes = 0; int value = 0; ep = stdentities; elen = ecount = nsecount = 0; /* figure # of entity replacements and additional size. */ while (ep->text) { cp = str; while ((cp = strstr(cp, ep->text)) != NULL) { elen += strlen(ep->entity) - strlen(ep->text); ecount++; cp += strlen(ep->text); } ep++; } /* figure the same for other than standard entities (i.e. anything * that isn't in the range U+0000 to U+007F */ for ( cp = str; *cp; cp++ ) { if ( *cp & 0x80 ) { utf8_to_int( cp, &bytes, &value ); cp += bytes-1; elen += sprintf( tmpsub, "&#x%x;", value ) - bytes; nsecount++; } } /* enough space for the whole string plus entity replacements, if any */ tmp = xcalloc((strlen(str) + elen + 1), 1); strcpy(tmp, str); /* no entity replacements */ if (ecount == 0 && nsecount == 0) return (tmp); if ( ecount != 0 ) { for (ep = stdentities; ep->text; ep++) { p = tmp; if (is_html && ep->not_html) { continue; } while ((p = strstr(p, ep->text)) != NULL) { elen = strlen(ep->entity); xstr = xstrdup(p + strlen(ep->text)); strcpy(p, ep->entity); strcpy(p + elen, xstr); xfree(xstr); p += elen; } } } if ( nsecount != 0 ) { p = tmp; while (*p) { if ( *p & 0x80 ) { utf8_to_int( p, &bytes, &value ); if ( p[bytes] ) { xstr = xstrdup( p + bytes ); } else { xstr = NULL; } sprintf( p, "&#x%x;", value ); p = p+strlen(p); if ( xstr ) { strcpy( p, xstr ); xfree(xstr); } } else { p++; } } } return (tmp); } /* * Public callers for the above to hide the absence of &apos from HTML */ char * xml_entitize(const char * str) { return entitize(str, 0); } void write_xml_entity(FILE *ofd, const char *indent, const char *tag, const char *value) { char *tmp_ent = xml_entitize(value); fprintf(ofd, "%s<%s>%s</%s>\n", indent, tag, tmp_ent, tag); xfree(tmp_ent); } void write_optional_xml_entity(FILE *ofd, const char *indent, const char *tag, const char *value) { if (value && *value) write_xml_entity(ofd, indent, tag, value); } void xml_fill_in_time(char *time_string, const time_t timep, int long_or_short) { struct tm *tm = gmtime(&timep); char *format; if (!tm) return; if (long_or_short == XML_LONG_TIME) format = "%02d-%02d-%02dT%02d:%02d:%02dZ"; else format = "%02d%02d%02dT%02d%02d%02dZ"; sprintf(time_string, format, tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); } void xml_write_time(FILE *ofd, const time_t timep, const char *indent, char *elname) { char time_string[64]; xml_fill_in_time(time_string, timep, XML_LONG_TIME); fprintf(ofd, "%s<%s>%s</%s>\n", indent, elname, time_string, elname ); } --- NEW FILE: formspec.c --- /* Functions to manage the format_specific_data chain Copyright (C) 2005 Ron Parker and Robert Lipe. This program 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. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ #include <stddef.h> #include <stdio.h> #include <string.h> #include "defs.h" format_specific_data *fs_chain_copy( format_specific_data *source ) { format_specific_data *result = NULL; format_specific_data **copy = &result; while ( source ) { source->copy( (void **)copy, (void *)source ); copy = &((*copy)->next); source = source->next; } return result; } void fs_chain_destroy( format_specific_data *chain ) { format_specific_data *cur = chain; format_specific_data *next = NULL; while ( cur ) { next = cur->next; cur->destroy( cur ); cur = next; } } format_specific_data *fs_chain_find( format_specific_data *chain, long type ) { format_specific_data *cur = chain; while ( cur ) { if (cur->type == type ) { return cur; } cur = cur->next; } return NULL; } void fs_chain_add( format_specific_data **chain, format_specific_data *data ) { data->next = *chain; *chain = data; } --- NEW FILE: vmem.c --- /* vmem utilities. Manipulate allocated object optimized for long-term persistence over raw speed. Copyright (C) 2003 Robert Lipe, rob...@us... This program 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. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ #include "defs.h" #include <stdlib.h> vmem_t vmem_alloc(size_t size, int flags) { vmem_t vm; /* * By default, zero the allocated thingy. */ if (flags & VMFL_NOZERO) vm.mem = xmalloc(size); else vm.mem = xcalloc(size, 1); vm.size = size; return vm; } void vmem_free(vmem_t *vm) { if (vm->mem) xfree(vm->mem); vm->mem = NULL; vm->size = 0; return; } /* * We never shrink a vmem object on the premise that over time, object * will only grow for a while then reach a steady state. */ void vmem_realloc(vmem_t *vm, size_t size) { /* * Reallocate only if we must. */ if (size > vm->size) { vm->mem = xrealloc(vm->mem, size); vm->size = size; } return; } --- NEW FILE: queue.c --- /* Generic queue utilities. Copyright (C) 2002 Robert Lipe, rob...@us... Modified for use with RoadMap, Paul Fox, 2005 This program 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. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ #include "queue.h" void enqueue(queue *new_el, queue *old) { new_el->next = old->next; new_el->prev = old; old->next->prev = new_el; old->next = new_el; } queue * dequeue(queue *element) { queue *prev = element->prev; queue *next = element->next; next->prev = prev; prev->next = next; return element; } int queue_count(queue *q) { queue *e; int i = 0; for (e = QUEUE_FIRST(q); e != q; e = QUEUE_NEXT(e)) i++; return i; } --- NEW FILE: README --- The files in this gpx subdirectory are derived from the code for the excellent GPS data translation and filtering program called GPSBabel, available at http://www.gpsbabel.org. The starting point for the code here was at roughly their release level 1.2.8. The changes made here were to allow more flexible access to the route and waypoint data structures, and to reduce the codesize as a benefit of only supporting GPX format. (The other big difference between this and the current gpsbabel code is the absence here of the more sophisticated foreign character set translation that gpsbabel has in their cet subdirectory -- we use the more primitive 1.2.7 character translation.) Paul Fox November, 2005 --- NEW FILE: mkshort.c --- /* Generate unique short names. Copyright (C) 2003, 2004, 2005 Robert Lipe, rob...@us... Modified for use with RoadMap, Paul Fox, 2005 This program 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. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ #include <string.h> #include <ctype.h> #include <stdlib.h> #include "defs.h" static const char vowels[] = "aeiouAEIOU"; #define DEFAULT_TARGET_LEN 8 #define DEFAULT_BADCHARS "\"$.,'!-" /* * Hash table tunings. The reality is that our hash doesn't have to be * terribly complex; our strings are short (typically 8-20 bytes) and the * string hash mixes things up enough that strcmp can generally bail on the * first byte or two for a mismatch. */ #define PRIME 37 typedef struct { unsigned int target_len; char *badchars; char *goodchars; char *defname; queue namelist[PRIME]; /* Various internal flags at end to allow alignment flexibility. */ unsigned int mustupper:1; unsigned int whitespaceok:1; unsigned int repeating_whitespaceok:1; unsigned int must_uniq:1; } mkshort_handle; typedef struct { queue list; char *orig_shortname; int conflictctr; } uniq_shortname; /* * We hash all strings as upper case. */ unsigned int hash_string(const char *key) { unsigned int hash = 0; while (*key) { hash = ((hash<<5) ^ (hash>>27)) ^ toupper(*key++); } hash = hash % PRIME; return hash; } void * #ifdef DEBUG_MEM MKSHORT_NEW_HANDLE(DEBUG_PARAMS) #else mkshort_new_handle() #endif { int i; mkshort_handle *h = xcalloc(sizeof *h, 1); for (i = 0; i < PRIME; i++) QUEUE_INIT(&h->namelist[i]); h->whitespaceok = 1; h->badchars = DEFAULT_BADCHARS; h->target_len = DEFAULT_TARGET_LEN; h->must_uniq = 1; h->defname = xstrdup("WPT"); return h; } static int is_unique(mkshort_handle *h, char *name) { queue *e, *t; int hash; hash = hash_string(name); QUEUE_FOR_EACH(&h->namelist[hash], e, t) { uniq_shortname *z = (uniq_shortname *) e; if (0 == strcasecmp(z->orig_shortname, name)) { return 0; } } return 1; } static void add_to_hashlist(mkshort_handle *h, char *name) { int hash = hash_string(name); uniq_shortname *s = xcalloc(1, sizeof (uniq_shortname)); s->orig_shortname = xstrdup(name); ENQUEUE_TAIL(&h->namelist[hash], &s->list); } char * mkshort_add_to_list(mkshort_handle *h, char *name) { while (!is_unique(h, name)) { int dl; char tbuf[10]; size_t l = strlen(name); int hash = hash_string(name); uniq_shortname *s = (uniq_shortname *) h->namelist[hash].next; s->conflictctr++; dl = sprintf(tbuf, ".%d", s->conflictctr); if (l + dl < h->target_len) { name = xrealloc(name, l + dl + 1); strcat(name, tbuf); } else { strcpy(&name[l-dl], tbuf); } } add_to_hashlist(h, name); return name; } void mkshort_del_handle(short_handle *h) { mkshort_handle *hdr = (mkshort_handle*) *h; int i; if (!h || !hdr) return; for (i = 0; i < PRIME; i++) { queue *e, *t; QUEUE_FOR_EACH(&hdr->namelist[i], e, t) { uniq_shortname *s = (uniq_shortname *) e; dequeue(e); xfree(s->orig_shortname); xfree(s); } } setshort_badchars(*h, NULL); setshort_goodchars(*h, NULL); if (hdr->defname) { xfree(hdr->defname); } xfree(hdr); *h = NULL; } /* * This is the stuff that makes me ashamed to be a C programmer... */ static char * delete_last_vowel(int start, char *istring, int *replaced) { int l; /* * Basically impelement strrchr. */ *replaced = 0; for (l = strlen(istring); l > start; l--) { if (strchr(vowels, istring[l-1])) { char *ostring; /* If vowel is the first letter of a word, keep it.*/ if (istring[l-2] == ' ') continue; ostring = xstrdup(istring); strncpy(&ostring[l-1], &istring[l], 1+strlen(istring)-l); ostring[strlen(istring)-1] = 0; *replaced = 1; strcpy( istring, ostring ); xfree(ostring); break; } } return istring; } /* * Externally callable function to set the max length of the * strings returned by mkshort(). 0 resets to default. */ void setshort_length(short_handle h, int l) { mkshort_handle *hdl = (mkshort_handle *) h; if (l == 0) { hdl->target_len = DEFAULT_TARGET_LEN; } else { hdl->target_len = l; } } /* * Call with L nonzero if whitespace in the generated shortname is wanted. */ void setshort_whitespace_ok(short_handle h, int l) { mkshort_handle *hdl = (mkshort_handle *) h; hdl->whitespaceok = l; } /* * Call with L nonzero if multiple consecutive whitespace in the * generated shortname is wanted. */ void setshort_repeating_whitespace_ok(short_handle h, int l) { mkshort_handle *hdl = (mkshort_handle *) h; hdl->repeating_whitespaceok = l; } /* * Set default name given to a waypoint if no valid is possible * becuase it was filtered by charsets or null or whatever. */ void setshort_defname(short_handle h, const char *s) { mkshort_handle *hdl = (mkshort_handle *) h; if (s == NULL) { fatal("setshort_defname called without a valid name."); } if (hdl->defname != NULL) xfree(hdl->defname); hdl->defname = xstrdup(s); } /* * Externally callable function to set the string of characters * that must never appear in a string returned by mkshort. NULL * resets to default. */ void setshort_badchars(short_handle h, const char *s) { mkshort_handle *hdl =... [truncated message content] |
From: Paul F. <pg...@us...> - 2005-12-07 14:15:03
|
Update of /cvsroot/roadmap/roadmap/src/gpx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4236/gpx Log Message: Directory /cvsroot/roadmap/roadmap/src/gpx added to the repository |
From: Paul F. <pg...@us...> - 2005-12-07 14:06:19
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031 Added Files: roadmap_gpx.c roadmap_gpx.h roadmap_landmark.c roadmap_landmark.h roadmap_track.c roadmap_track.h Log Message: new files. roadmap_landmark.c/h -- manage "personal waypoints" -- those unattached to a trip. roadmap_track.c/h -- manage the breadcrumb trail -- simplistic recording of where one has gone. roadmap_gpx.c/h -- interface to the guts of the gpx subdirectory, which manages GPX file I/O, and provides the linked list and data structure support used for routes and tracks. --- NEW FILE: roadmap_landmark.c --- /* roadmap_landmark.c - Personal waypoints * * LICENSE: * * Copyright 2005 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 */ #include "roadmap.h" #include "roadmap_types.h" #include "roadmap_config.h" #include "roadmap_fileselection.h" #include "roadmap_gps.h" #include "roadmap_math.h" #include "roadmap_screen.h" #include "roadmap_sprite.h" #include "roadmap_path.h" #include "roadmap_gpx.h" #include "roadmap_landmark.h" queue RoadMapLandmarkHead; static int RoadMapLandmarkModified; static int RoadMapLandmarkRefresh; static RoadMapConfigDescriptor RoadMapConfigLandmarkName = ROADMAP_CONFIG_ITEM ("Landmarks", "Name"); static void roadmap_landmark_draw(const waypoint *waypointp) { RoadMapGuiPoint guipoint; const char *sprite; if (waypointp->icon_descr == NULL) { sprite = "PersonalLandmark"; } else { sprite = waypointp->icon_descr; } if (roadmap_math_point_is_visible (&waypointp->pos)) { roadmap_math_coordinate (&waypointp->pos, &guipoint); roadmap_math_rotate_coordinates (1, &guipoint); roadmap_sprite_draw (sprite, &guipoint, 0); } } void roadmap_landmark_display (void) { waypt_iterator (&RoadMapLandmarkHead, roadmap_landmark_draw); } int roadmap_landmark_count() { return queue_count(&RoadMapLandmarkHead); } void roadmap_landmark_add(waypoint *waypointp) { waypt_add(&RoadMapLandmarkHead, waypointp); RoadMapLandmarkModified = 1; RoadMapLandmarkRefresh = 1; roadmap_screen_refresh (); } void roadmap_landmark_remove(waypoint *waypointp) { waypt_del (waypointp); waypt_free (waypointp); RoadMapLandmarkModified = 1; RoadMapLandmarkRefresh = 1; roadmap_screen_refresh (); } queue * roadmap_landmark_list(void) { // hack -- if roadmap_trip asked for the list, it's possible // someone is doing an edit. we don't get informed of the actual // edit, which is done generically. RoadMapLandmarkModified = 1; return &RoadMapLandmarkHead; } int roadmap_landmark_is_refresh_needed (void) { if (RoadMapLandmarkRefresh) { RoadMapLandmarkRefresh = 0; return 1; } return 0; } void roadmap_landmark_save(void) { const char *name; if (!RoadMapLandmarkModified) return; name = roadmap_config_get (&RoadMapConfigLandmarkName); roadmap_gpx_write_waypoints(roadmap_path_trips(), name, &RoadMapLandmarkHead); RoadMapLandmarkModified = 0; } static void roadmap_landmark_merge_file(const char *name) { const char *trip_path = NULL; queue tmp_waypoint_list; int ret; if (! roadmap_path_is_full_path (name)) trip_path = roadmap_path_trips (); QUEUE_INIT(&tmp_waypoint_list); ret = roadmap_gpx_read_waypoints(trip_path, name, &tmp_waypoint_list); if (ret == 0) { waypt_flush_queue (&tmp_waypoint_list); return; } QUEUE_SPLICE(&RoadMapLandmarkHead, &tmp_waypoint_list); RoadMapLandmarkModified = 1; RoadMapLandmarkRefresh = 1; } static void roadmap_landmark_merge_dialog_ok (const char *filename, const char *mode) { roadmap_landmark_merge_file (filename); } static void roadmap_landmark_merge_dialog (const char *mode) { roadmap_fileselection_new ("RoadMap Merge Landmarks", NULL, roadmap_path_trips (), mode, roadmap_landmark_merge_dialog_ok); } void roadmap_landmark_merge(void) { roadmap_landmark_merge_dialog ("r"); } void roadmap_landmark_load(void) { const char *name; queue tmp_waypoint_list; int ret; name = roadmap_config_get (&RoadMapConfigLandmarkName); QUEUE_INIT(&tmp_waypoint_list); ret = roadmap_gpx_read_waypoints(roadmap_path_trips(), name, &tmp_waypoint_list); if (ret == 0) { waypt_flush_queue (&tmp_waypoint_list); return; } waypt_flush_queue (&RoadMapLandmarkHead); QUEUE_MOVE(&RoadMapLandmarkHead, &tmp_waypoint_list); RoadMapLandmarkModified = 0; RoadMapLandmarkRefresh = 1; } void roadmap_landmark_initialize(void) { roadmap_config_declare ("preferences", &RoadMapConfigLandmarkName, "landmarks.gpx"); QUEUE_INIT(&RoadMapLandmarkHead); roadmap_landmark_load(); } --- NEW FILE: roadmap_landmark.h --- /* roadmap_landmark.h - Personal waypoints. * * LICENSE: * * Copyright 2005 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 */ #ifndef INCLUDE__ROADMAP_LANDMARK__H #define INCLUDE__ROADMAP_LANDMARK__H void roadmap_landmark_display (void); void roadmap_landmark_initialize (void); void roadmap_landmark_save (void); void roadmap_landmark_load(void); void roadmap_landmark_merge(void); int roadmap_landmark_count(); void roadmap_landmark_add(waypoint *waypointp); void roadmap_landmark_remove(waypoint *waypointp); queue * roadmap_landmark_list(void); int roadmap_landmark_is_refresh_needed (void); #endif // INCLUDE__ROADMAP_LANDMARK__H --- NEW FILE: roadmap_track.h --- /* roadmap_track.h - Keep track of where we've been. * * LICENSE: * * Copyright 2005 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 */ #ifndef INCLUDE__ROADMAP_TRACK__H #define INCLUDE__ROADMAP_TRACK__H void roadmap_track_display (void); void roadmap_track_clear (void); void roadmap_track_initialize (void); void roadmap_track_save (void); void roadmap_track_autosave (void); void roadmap_track_autoload(void); void roadmap_track_toggle_display(void); int roadmap_track_is_refresh_needed (void); #endif // INCLUDE__ROADMAP_TRACK__H --- NEW FILE: roadmap_gpx.h --- /* roadmap_gpx.c - stubs, shims, and other interfaces to the GPX library * * LICENSE: * * Copyright 2005 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 */ # include <expat.h> #define ROADMAP 1 # include "gpx/defs.h" int roadmap_gpx_read_file (const char *path, const char *name, queue *w, queue *r, queue *t); int roadmap_gpx_read_waypoints (const char *path, const char *name, queue *waypoints); int roadmap_gpx_read_one_track ( const char *path, const char *name, route_head **track); int roadmap_gpx_read_one_route ( const char *path, const char *name, route_head **route); int roadmap_gpx_write_file (const char *path, const char *name, queue *w, queue *r, queue *t); int roadmap_gpx_write_waypoints (const char *path, const char *name, queue *waypoints); int roadmap_gpx_write_track (const char *path, const char *name, route_head *track); int roadmap_gpx_write_route (const char *path, const char *name, route_head *route); --- NEW FILE: roadmap_track.c --- /* roadmap_track.c - Keep track of where we've been. * * LICENSE: * * Copyright 2005 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 */ #include "roadmap.h" #include "roadmap_types.h" #include "roadmap_config.h" #include "roadmap_gps.h" #include "roadmap_math.h" #include "roadmap_screen.h" #include "roadmap_sprite.h" #include "roadmap_path.h" #include "roadmap_gpx.h" #include "roadmap_track.h" route_head *RoadMapTrack = NULL; static int RoadMapTrackModified; static RoadMapGpsPosition RoadMapLastTrackPosition; static int RoadMapLastTrackTime; static int RoadMapTrackDisplay; static int RoadMapTrackRefresh; typedef enum { RoadMapTrackPolicyOff, RoadMapTrackPolicyTime, RoadMapTrackPolicyDistance, RoadMapTrackPolicyDeviation } RoadMapTrackPolicy; static RoadMapConfigDescriptor RoadMapConfigPolicyString = ROADMAP_CONFIG_ITEM("Track", "Policy"); static RoadMapConfigDescriptor RoadMapConfigTimeInterval = ROADMAP_CONFIG_ITEM("Track", "Time Delta"); static RoadMapConfigDescriptor RoadMapConfigDistanceInterval = ROADMAP_CONFIG_ITEM("Track", "Distance Delta"); static RoadMapConfigDescriptor RoadMapConfigDisplayString = ROADMAP_CONFIG_ITEM("Track", "Initial Display"); static RoadMapConfigDescriptor RoadMapConfigLength = ROADMAP_CONFIG_ITEM("Track", "Length"); static RoadMapConfigDescriptor RoadMapConfigTrackName = ROADMAP_CONFIG_ITEM ("Track", "Name"); static void roadmap_track_add_trackpoint ( int gps_time, const RoadMapGpsPosition *gps_position) { int maxtrack; waypoint *w; w = waypt_new (); w->shortname = NULL; w->icon_descr = NULL; w->pos.latitude = gps_position->latitude; w->pos.longitude = gps_position->longitude; /* Change whatever we have to meters. */ w->altitude = roadmap_math_to_cm (gps_position->altitude) / 100.0; /* We have knots, but want meters per second. */ w->speed = gps_position->speed / 1.94384449; w->course = gps_position->steering; w->creation_time = gps_time; route_add_wpt_tail (RoadMapTrack, w); maxtrack = roadmap_config_get_integer (&RoadMapConfigLength); while (RoadMapTrack->rte_waypt_ct > maxtrack) { w = (waypoint *) QUEUE_NEXT (&RoadMapTrack->waypoint_list); route_del_wpt ( RoadMapTrack, w); } RoadMapLastTrackPosition = *gps_position; RoadMapLastTrackTime = gps_time; RoadMapTrackModified = 1; } static RoadMapTrackPolicy roadmap_track_policy(void) { const char *policy = roadmap_config_get (&RoadMapConfigPolicyString); switch (policy[0]) { case 'o': case 'O': return RoadMapTrackPolicyOff; case 'T': case 't': return RoadMapTrackPolicyTime; case 'D': case 'd': switch(policy[1]) { case 'I': case 'i': return RoadMapTrackPolicyDistance; case 'E': case 'e': return RoadMapTrackPolicyDeviation; } } roadmap_log (ROADMAP_FATAL, "Invalid track policy %s", policy); return RoadMapTrackPolicyOff; } static void roadmap_track_gps_update (int gps_time, const RoadMapGpsPosition *gps_position) { int need_point = 0; int distance; RoadMapTrackPolicy policy; RoadMapPosition gpspos, lastpos; policy = roadmap_track_policy(); if (policy == RoadMapTrackPolicyOff) return; if ( QUEUE_EMPTY(&RoadMapTrack->waypoint_list) ) { roadmap_track_add_trackpoint(gps_time, gps_position); return; } if (gps_position->speed == 0) return; if ((RoadMapLastTrackPosition.latitude == gps_position->latitude) && (RoadMapLastTrackPosition.longitude == gps_position->longitude)) { return; } gpspos.latitude = gps_position->latitude; gpspos.longitude = gps_position->longitude; lastpos.latitude = RoadMapLastTrackPosition.latitude; lastpos.longitude = RoadMapLastTrackPosition.longitude; distance = roadmap_math_distance ( &lastpos, &gpspos); switch(policy) { case RoadMapTrackPolicyOff: return; case RoadMapTrackPolicyTime: need_point = ((distance > 10) && (roadmap_config_get_integer (&RoadMapConfigTimeInterval) < (gps_time - RoadMapLastTrackTime))); break; case RoadMapTrackPolicyDistance: need_point = ( distance > roadmap_config_get_integer (&RoadMapConfigDistanceInterval) ); break; case RoadMapTrackPolicyDeviation: #if LATER // FIXME -- This calculation should determine the answer // to this question: "How far am I from the point at // which I would have been if I'd travelled in a straight // line determined by my previous two trackpoints, and is // that distance larger than the configured interval?" // // also need to be sure the "final" point is recorded need_point = (roadmap_config_get_integer (&RoadMapConfigDistanceInterval) < roadmap_math_distance ( &gpspos, roadmap_track_projected (distance, &lastpos))); #else need_point = 0; #endif break; } if (need_point) { roadmap_track_add_trackpoint(gps_time, gps_position); RoadMapTrackRefresh = 1; } } static void roadmap_track_waypoint_draw (const waypoint *waypointp) { RoadMapGuiPoint guipoint; if (roadmap_math_point_is_visible (&waypointp->pos)) { roadmap_math_coordinate (&waypointp->pos, &guipoint); roadmap_math_rotate_coordinates (1, &guipoint); roadmap_sprite_draw ("BreadCrumb", &guipoint, 0); } } void roadmap_track_display (void) { if (RoadMapTrackDisplay) { route_waypt_iterator (RoadMapTrack, roadmap_track_waypoint_draw); } } void roadmap_track_toggle_display(void) { RoadMapTrackDisplay = ! RoadMapTrackDisplay; RoadMapTrackRefresh = 1; roadmap_screen_refresh(); } int roadmap_track_is_refresh_needed (void) { if (RoadMapTrackRefresh) { RoadMapTrackRefresh = 0; return 1; } return 0; } void roadmap_track_clear (void) { route_free(RoadMapTrack); RoadMapTrack = route_head_alloc(); RoadMapTrackRefresh = 1; RoadMapTrackModified = 1; roadmap_screen_refresh(); } void roadmap_track_save(void) { char name[40]; time_t now; time(&now); strftime(name, sizeof(name), "Track-%Y-%m-%d-%H:%M:%S.gpx", localtime(&now)); roadmap_gpx_write_track(roadmap_path_trips(), name, RoadMapTrack); RoadMapTrackModified = 0; } void roadmap_track_autosave(void) { const char *name; if (!RoadMapTrackModified) return; name = roadmap_config_get (&RoadMapConfigTrackName); roadmap_gpx_write_track(roadmap_path_trips(), name, RoadMapTrack); RoadMapTrackModified = 0; } void roadmap_track_autoload(void) { const char *name; name = roadmap_config_get (&RoadMapConfigTrackName); roadmap_gpx_read_one_track(roadmap_path_trips(), name, &RoadMapTrack); RoadMapTrackModified = 0; } void roadmap_track_initialize(void) { /* We have to declare both the time and distance intervals, * though only one is used at a time. */ roadmap_config_declare ("preferences", &RoadMapConfigTimeInterval, "15"); roadmap_config_declare_distance ("preferences", &RoadMapConfigDistanceInterval, "100 m"); roadmap_config_declare_enumeration ("preferences", &RoadMapConfigPolicyString, "off", "deviation", "distance", "time", NULL); roadmap_config_declare ("preferences", &RoadMapConfigLength, "1000"); roadmap_config_declare ("preferences", &RoadMapConfigTrackName, "current_track.gpx"); roadmap_config_declare_enumeration ("preferences", &RoadMapConfigDisplayString, "on", "off", NULL); RoadMapTrack = route_head_alloc(); roadmap_gps_register_listener(roadmap_track_gps_update); RoadMapTrackDisplay = roadmap_config_match (&RoadMapConfigDisplayString, "on"); } --- NEW FILE: roadmap_gpx.c --- /* roadmap_gpx.c - stubs, shims, and other interfaces to the GPX library * * LICENSE: * * Copyright 2002 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 * */ #include <expat.h> #include "roadmap.h" #include "roadmap_trip.h" #include "roadmap_path.h" #define ROADMAP 1 #include "gpx/defs.h" void fatal (const char *fmt, ...) { char buf[256]; va_list ap; va_start (ap, fmt); vsnprintf (buf, sizeof (buf), fmt, ap); va_end (ap); roadmap_log (ROADMAP_ERROR, "%s", buf); exit (1); } void warning (const char *fmt, ...) { char buf[256]; va_list ap; va_start (ap, fmt); vsnprintf (buf, sizeof (buf), fmt, ap); va_end (ap); roadmap_log (ROADMAP_WARNING, "%s", buf); } void gpx_rd_cleanup(void); void gpx_rd_prepare(void); int roadmap_gpx_read_file(const char *path, const char *name, queue *w, queue *r, queue *t) { queue *elem, *tmp; FILE *ifile; int ret; ifile = roadmap_file_fopen (path, name, "r"); if (!ifile) return 0; ret = gpx_read(ifile, w, r, t); if (t) { QUEUE_FOR_EACH (t, elem, tmp) { route_head *th = (route_head *) elem; th->rte_is_track = 1; } } fclose(ifile); return ret; } int roadmap_gpx_read_waypoints (const char *path, const char *name, queue *waypoints) { int ret; ret = roadmap_gpx_read_file(path, name, waypoints, NULL, NULL); return ret; } int roadmap_gpx_read_one_track( const char *path, const char *name, route_head **track) { int ret; queue tracklist; route_head *trk; QUEUE_INIT(&tracklist); ret = roadmap_gpx_read_file(path, name, NULL, NULL, &tracklist); if (!ret || QUEUE_EMPTY(&tracklist)) return 0; trk = (route_head *)QUEUE_FIRST(&tracklist); dequeue(&trk->Q); QUEUE_INIT(&trk->Q); /* In case we read more than one track from the file. */ route_flush_queue(&tracklist); if (*track) route_free(*track); *track = trk; return ret; } int roadmap_gpx_read_one_route( const char *path, const char *name, route_head **route) { int ret; queue routelist; route_head *rte; QUEUE_INIT(&routelist); ret = roadmap_gpx_read_file(path, name, NULL, &routelist, NULL); if (!ret || QUEUE_EMPTY(&routelist)) return 0; rte = (route_head *)QUEUE_FIRST(&routelist); dequeue(&rte->Q); QUEUE_INIT(&rte->Q); /* In case we read more than one route from the file. */ route_flush_queue(&routelist); if (*route) route_free(*route); *route = rte; return ret; } int roadmap_gpx_write_file(const char *path, const char *name, queue *w, queue *r, queue *t) { FILE *fp; int ret; fp = roadmap_file_fopen (path, name, "w"); if (!fp) return 0; ret = gpx_write(fp, w, r, t); if (fclose(fp) != 0) ret = 0; return ret; } int roadmap_gpx_write_waypoints(const char *path, const char *name, queue *waypoints) { FILE *fp; int ret; fp = roadmap_file_fopen (path, name, "w"); if (!fp) return 0; ret = gpx_write(fp, waypoints, NULL, NULL); if (fclose(fp) != 0) ret = 0; return ret; } int roadmap_gpx_write_route(const char *path, const char *name, route_head *route) { FILE *fp; int ret; queue route_head; QUEUE_INIT(&route_head); ENQUEUE_TAIL(&route_head, &route->Q); fp = roadmap_file_fopen (path, name, "w"); if (!fp) return 0; ret = gpx_write(fp, NULL, &route_head, NULL); if (fclose(fp) != 0) ret = 0; return ret; } int roadmap_gpx_write_track(const char *path, const char *name, route_head *track) { FILE *fp; int ret; queue track_head; QUEUE_INIT(&track_head); ENQUEUE_TAIL(&track_head, &track->Q); fp = roadmap_file_fopen (path, name, "w"); if (!fp) return 0; ret = gpx_write(fp, NULL, NULL, &track_head); if (fclose(fp) != 0) ret = 0; return ret; } |
From: Paul F. <pg...@us...> - 2005-12-07 13:22:04
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23931 Modified Files: roadmap_math.h Log Message: add back missing declaration Index: roadmap_math.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_math.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** roadmap_math.h 7 Dec 2005 00:54:59 -0000 1.22 --- roadmap_math.h 7 Dec 2005 13:21:52 -0000 1.23 *************** *** 87,90 **** --- 87,91 ---- int roadmap_math_distance_convert (const char *string, int *explicit); + int roadmap_math_to_trip_distance (int distance); int roadmap_math_to_trip_distance_tenths (int distance); |
From: Paul F. <pg...@us...> - 2005-12-07 01:07:46
|
Update of /cvsroot/roadmap/roadmap/src/gtk2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25002/gtk2 Modified Files: roadmap_dialog.c Log Message: when bringing up a list dialog (roadmap_dialog_show_list()), don't make a default initial selection. this usually causes a map redraw, which a) is costly, and delays the dialog on a slow system, and b) means that simply bringing up the dialog has changed the user's map location, even if they decide to cancel. Index: roadmap_dialog.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk2/roadmap_dialog.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** roadmap_dialog.c 3 Dec 2005 03:26:40 -0000 1.15 --- roadmap_dialog.c 7 Dec 2005 01:07:32 -0000 1.16 *************** *** 553,560 **** RM_LIST_WAYPOINT_NAME, labels[i], -1); - if (i == 0) { - gtk_tree_selection_select_iter - (gtk_tree_view_get_selection(GTK_TREE_VIEW (child->w)), &iterator); - } } child->choice = choice; --- 553,556 ---- |
From: Paul F. <pg...@us...> - 2005-12-07 01:07:46
|
Update of /cvsroot/roadmap/roadmap/src/gtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25002/gtk Modified Files: roadmap_dialog.c Log Message: when bringing up a list dialog (roadmap_dialog_show_list()), don't make a default initial selection. this usually causes a map redraw, which a) is costly, and delays the dialog on a slow system, and b) means that simply bringing up the dialog has changed the user's map location, even if they decide to cancel. Index: roadmap_dialog.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk/roadmap_dialog.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** roadmap_dialog.c 3 Dec 2005 03:27:02 -0000 1.10 --- roadmap_dialog.c 7 Dec 2005 01:07:32 -0000 1.11 *************** *** 472,476 **** child->value = choice[0].value; - gtk_list_select_item (GTK_LIST(child->w), 0); } --- 472,475 ---- |
From: Paul F. <pg...@us...> - 2005-12-07 00:55:10
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21428 Modified Files: roadmap_math.c roadmap_math.h roadmap_street.c Log Message: added roadmap_math_to_trip_distance_tenths() to support better distance granularity in UI. gave roadmap_math_get_distance_from_segment() the ability to report which of the two endpoints, or the segment itself, was closest. Index: roadmap_street.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_street.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** roadmap_street.c 27 Nov 2005 06:50:18 -0000 1.18 --- roadmap_street.c 7 Dec 2005 00:54:59 -0000 1.19 *************** *** 839,843 **** current.distance = roadmap_math_get_distance_from_segment ! (position, ¤t.from, ¤t.to, ¤t.intersection); if (current.distance < smallest_distance) { --- 839,844 ---- current.distance = roadmap_math_get_distance_from_segment ! (position, ¤t.from, ¤t.to, ! ¤t.intersection, NULL); if (current.distance < smallest_distance) { *************** *** 856,860 **** current.distance = roadmap_math_get_distance_from_segment ! (position, ¤t.to, ¤t.from, ¤t.intersection); if (current.distance < smallest_distance) { --- 857,862 ---- current.distance = roadmap_math_get_distance_from_segment ! (position, ¤t.to, ¤t.from, ! ¤t.intersection, NULL); if (current.distance < smallest_distance) { *************** *** 880,884 **** roadmap_math_get_distance_from_segment (position, &neighbour->from, &neighbour->to, ! &neighbour->intersection); roadmap_plugin_set_line (&neighbour->line, --- 882,886 ---- roadmap_math_get_distance_from_segment (position, &neighbour->from, &neighbour->to, ! &neighbour->intersection, NULL); roadmap_plugin_set_line (&neighbour->line, Index: roadmap_math.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_math.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** roadmap_math.h 27 Nov 2005 06:06:28 -0000 1.21 --- roadmap_math.h 7 Dec 2005 00:54:59 -0000 1.22 *************** *** 87,91 **** int roadmap_math_distance_convert (const char *string, int *explicit); ! int roadmap_math_to_trip_distance (int distance); int roadmap_math_to_speed_unit (int knots); --- 87,91 ---- int roadmap_math_distance_convert (const char *string, int *explicit); ! int roadmap_math_to_trip_distance_tenths (int distance); int roadmap_math_to_speed_unit (int knots); *************** *** 99,103 **** const RoadMapPosition *position1, const RoadMapPosition *position2, ! RoadMapPosition *intersection); int roadmap_math_intersection (RoadMapPosition *from1, --- 99,104 ---- const RoadMapPosition *position1, const RoadMapPosition *position2, ! RoadMapPosition *intersection, ! int *which); int roadmap_math_intersection (RoadMapPosition *from1, Index: roadmap_math.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_math.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** roadmap_math.c 27 Nov 2005 06:06:11 -0000 1.27 --- roadmap_math.c 7 Dec 2005 00:54:59 -0000 1.28 *************** *** 1022,1025 **** --- 1022,1030 ---- } + int roadmap_math_to_trip_distance_tenths (int distance) { + + return (10 * distance) / RoadMapContext.units->to_trip_unit; + } + int roadmap_math_get_distance_from_segment *************** *** 1027,1031 **** const RoadMapPosition *position1, const RoadMapPosition *position2, ! RoadMapPosition *intersection) { int distance; --- 1032,1037 ---- const RoadMapPosition *position1, const RoadMapPosition *position2, ! RoadMapPosition *intersection, ! int *which) { int distance; *************** *** 1063,1068 **** y3 = 0.0; ! intersection->longitude = ! (position1->longitude + position2->longitude) / 2; } else { --- 1069,1076 ---- y3 = 0.0; ! if (intersection != NULL) { ! intersection->longitude = ! (position1->longitude + position2->longitude) / 2; ! } } else { *************** *** 1078,1085 **** y3 = b / ((a * a) + 1.0); ! intersection->longitude = ! position1->longitude ! + (int)(((x1 - x3) ! * (position2->longitude - position1->longitude)) / (x1 - x2)); } --- 1086,1095 ---- y3 = b / ((a * a) + 1.0); ! if (intersection != NULL) { ! intersection->longitude = ! position1->longitude + (int)(((x1 - x3) ! * (position2->longitude - position1->longitude)) ! / (x1 - x2)); ! } } *************** *** 1090,1106 **** /* The intersection point is in the segment. */ ! if ((y1 - y2 > -1.0) && (y1 - y2 < 1.0)) { ! intersection->latitude = ! (position1->latitude + position2->latitude) / 2; ! } else { ! intersection->latitude = ! position1->latitude ! + (int)(((y1 - y3) ! * (position2->latitude - position1->latitude)) / (y1 - y2)); } return (int) sqrt ((x3 * x3) + (y3 * y3)); } --- 1100,1120 ---- /* The intersection point is in the segment. */ ! if (intersection != NULL) { ! if ((y1 - y2 > -1.0) && (y1 - y2 < 1.0)) { ! intersection->latitude = ! (position1->latitude + position2->latitude) / 2; ! } else { ! intersection->latitude = ! position1->latitude + (int)(((y1 - y3) ! * (position2->latitude - position1->latitude)) ! / (y1 - y2)); ! } } + if (which != NULL) *which = 0; /* neither endpoint is closest */ + return (int) sqrt ((x3 * x3) + (y3 * y3)); } *************** *** 1113,1121 **** if (distance < minimum) { ! *intersection = *position2; return distance; } ! *intersection = *position1; return minimum; } --- 1127,1142 ---- if (distance < minimum) { ! ! if (intersection != NULL) *intersection = *position2; ! ! if (which != NULL) *which = 2; /* endpoint 2 is closest */ ! return distance; } ! if (intersection != NULL) *intersection = *position1; ! ! if (which != NULL) *which = 1; /* endpoint 1 is closest */ ! return minimum; } |
From: Paul F. <pg...@us...> - 2005-12-07 00:05:37
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9108 Modified Files: roadmap_factory.c Log Message: add logging to catch invalid action names. (user-supplied names are caught elsewhere -- these checks catch the internally specified default lists that are declared in roadmap_start.c.) Index: roadmap_factory.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_factory.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** roadmap_factory.c 19 Nov 2005 21:01:42 -0000 1.19 --- roadmap_factory.c 7 Dec 2005 00:05:29 -0000 1.20 *************** *** 438,441 **** --- 438,443 ---- this_action->tip, this_action->callback); + } else { + roadmap_log (ROADMAP_ERROR, "invalid action name '%s'", item); } } *************** *** 471,474 **** --- 473,478 ---- this_action->tip, this_action->callback); + } else { + roadmap_log (ROADMAP_ERROR, "invalid action name '%s'", item); } } |
From: Paul F. <pg...@us...> - 2005-12-06 23:19:51
|
Update of /cvsroot/roadmap/roadmap/src/gtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31396/src/gtk Modified Files: Makefile roadmap_main.c Added Files: roadmap_signals.c Log Message: in the gtk versions, catch unix signals which should cause termination, and inject a message into a pipe which is being monitored by the gtk framework. allows for graceful exit on system shutdown, for instance. --- NEW FILE: roadmap_signals.c --- /* * This code appears, in its original form, as a sample program written * by Hendrik Tews, as a demonstration of how to catch signals in an * addendum he wrote for the gtk+ 2.0 tutorial. His original page is * here: http://wwwtcs.inf.tu-dresden.de/~tews/Gtk/a2955.html * * Adapted (backported to gtk 1.2) for RoadMap by Paul Fox. */ /* set up for catching signals */ #include <stdio.h> /* for printf and friends */ #include <stdlib.h> /* for exit */ #include <unistd.h> /* for write, pipe */ #include <fcntl.h> /* for fcntl, O_NONBLOCK */ #include <signal.h> /* for signal */ #include <gtk/gtk.h> /* well guess for what ... */ void roadmap_main_exit (void); /* * Unix signals that are caught are written to a pipe. The pipe connects * the unix signal handler with GTK's event loop. The array signal_pipe will * hold the file descriptors for the two ends of the pipe (index 0 for * reading, 1 for writing). * As reaction to a unix signal we change the text of a label, hence the * label must be global. */ int signal_pipe[2]; /* * The unix signal handler. * Write any unix signal into the pipe. The writing end of the pipe is in * non-blocking mode. If it is full (which can only happen when the * event loop stops working) signals will be dropped. */ void roadmap_signal_handler(int signal) { if(write(signal_pipe[1], &signal, sizeof(int)) != sizeof(int)) { fprintf(stderr, "unix signal %d lost\n", signal); } } /* * The event loop callback that handles the unix signals. Must be a GIOFunc. * The source is the reading end of our pipe, cond is one of * G_IO_IN or G_IO_PRI (I don't know what could lead to G_IO_PRI) * the pointer d is always NULL */ static gboolean roadmap_deliver_signal (GIOChannel *source, GIOCondition cond, gpointer d) { /* * There is no g_io_channel_read or g_io_channel_read_int, so we read * char's and use a union to recover the unix signal number. */ union { gchar chars[sizeof(int)]; int signal; } buf; GIOError status; /* save the reading status */ gsize bytes_read; /* save the number of chars read */ /* * Read from the pipe as long as data is available. The reading end is * also in non-blocking mode, so if we have consumed all unix signals, * the read returns G_IO_STATUS_AGAIN. */ while((status = g_io_channel_read(source, buf.chars, sizeof(int), &bytes_read)) == G_IO_ERROR_NONE && bytes_read > 0) { if(bytes_read == 0) break; /* * There might be some problem resulting in too few char's read. * Check it. */ if(bytes_read != sizeof(int)){ fprintf(stderr, "lost data in signal pipe (expected %d, received %d)\n", sizeof(int), bytes_read); continue; /* discard the garbage and keep fingers crossed */ } roadmap_main_exit(); break; } if (status == G_IO_ERROR_AGAIN || status == G_IO_ERROR_NONE){ return (TRUE); /* keep the event source */ } /* * Reading from the pipe has not returned with normal status. Check for * potential errors and return from the callback. */ fprintf(stderr, "signal pipe has been closed\n"); return (FALSE); /* don't keep the event source */ } void roadmap_signals_init(void) { /* * In order to register the reading end of the pipe with the event loop * we must convert it into a GIOChannel. */ GIOChannel *g_signal_in; long fd_flags; /* used to change the pipe into non-blocking mode */ /* * Set the unix signal handling up. * First create a pipe. */ if(pipe(signal_pipe)) { perror("pipe"); exit(1); } /* * put the write end of the pipe into nonblocking mode, * need to read the flags first, otherwise we would clear other flags too. */ fd_flags = fcntl(signal_pipe[1], F_GETFL); if(fd_flags == -1) { perror("read descriptor flags"); exit(1); } if(fcntl(signal_pipe[1], F_SETFL, fd_flags | O_NONBLOCK) == -1) { perror("write descriptor flags"); exit(1); } /* Install the unix signal handler roadmap_signal_handler for * the signals of interest */ signal(SIGHUP, roadmap_signal_handler); signal(SIGINT, roadmap_signal_handler); signal(SIGQUIT, roadmap_signal_handler); signal(SIGTERM, roadmap_signal_handler); /* convert the reading end of the pipe into a GIOChannel */ g_signal_in = g_io_channel_unix_new (signal_pipe[0]); /* register the reading end with the event loop */ g_io_add_watch (g_signal_in, G_IO_IN | G_IO_PRI, roadmap_deliver_signal, NULL); } Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk/Makefile,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Makefile 5 Nov 2005 08:50:00 -0000 1.16 --- Makefile 6 Dec 2005 23:19:39 -0000 1.17 *************** *** 36,39 **** --- 36,40 ---- roadmap_dialog.c \ roadmap_fileselection.c \ + roadmap_signals.c \ roadmap_canvas.c Index: roadmap_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk/roadmap_main.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** roadmap_main.c 3 Dec 2005 03:49:50 -0000 1.15 --- roadmap_main.c 6 Dec 2005 23:19:39 -0000 1.16 *************** *** 503,506 **** --- 503,507 ---- } + void roadmap_signals_init(void); int main (int argc, char **argv) { *************** *** 515,518 **** --- 516,521 ---- } + roadmap_signals_init(); + roadmap_start (argc, argv); |
From: Paul F. <pg...@us...> - 2005-12-06 23:19:47
|
Update of /cvsroot/roadmap/roadmap/src/gtk2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31396/src/gtk2 Modified Files: Makefile roadmap_main.c Added Files: roadmap_signals.c Log Message: in the gtk versions, catch unix signals which should cause termination, and inject a message into a pipe which is being monitored by the gtk framework. allows for graceful exit on system shutdown, for instance. --- NEW FILE: roadmap_signals.c --- /* * This code appears, in its original form, as a sample program written * by Hendrik Tews, as a demonstration of how to catch signals in an * addendum he wrote for the gtk+ 2.0 tutorial. His original page is * here: http://wwwtcs.inf.tu-dresden.de/~tews/Gtk/a2955.html * * Adapted (with minimal changes) for RoadMap by Paul Fox. */ /* set up for catching signals */ #include <stdio.h> /* for printf and friends */ #include <stdlib.h> /* for exit */ #include <unistd.h> /* for write, pipe */ #include <fcntl.h> /* for fcntl, O_NONBLOCK */ #include <signal.h> /* for signal */ #include <gtk/gtk.h> /* well guess for what ... */ void roadmap_main_exit (void); /* * Unix signals that are caught are written to a pipe. The pipe connects * the unix signal handler with GTK's event loop. The array signal_pipe will * hold the file descriptors for the two ends of the pipe (index 0 for * reading, 1 for writing). * As reaction to a unix signal we change the text of a label, hence the * label must be global. */ int signal_pipe[2]; /* * The unix signal handler. * Write any unix signal into the pipe. The writing end of the pipe is in * non-blocking mode. If it is full (which can only happen when the * event loop stops working) signals will be dropped. */ void roadmap_signal_handler(int signal) { if(write(signal_pipe[1], &signal, sizeof(int)) != sizeof(int)) { fprintf(stderr, "unix signal %d lost\n", signal); } } /* * The event loop callback that handles the unix signals. Must be a GIOFunc. * The source is the reading end of our pipe, cond is one of * G_IO_IN or G_IO_PRI (I don't know what could lead to G_IO_PRI) * the pointer d is always NULL */ static gboolean roadmap_deliver_signal (GIOChannel *source, GIOCondition cond, gpointer d) { GError *error = NULL; /* for error handling */ /* * There is no g_io_channel_read or g_io_channel_read_int, so we read * char's and use a union to recover the unix signal number. */ union { gchar chars[sizeof(int)]; int signal; } buf; GIOStatus status; /* save the reading status */ gsize bytes_read; /* save the number of chars read */ /* * Read from the pipe as long as data is available. The reading end is * also in non-blocking mode, so if we have consumed all unix signals, * the read returns G_IO_STATUS_AGAIN. */ while((status = g_io_channel_read_chars(source, buf.chars, sizeof(int), &bytes_read, &error)) == G_IO_STATUS_NORMAL) { g_assert(error == NULL); /* no error if reading returns normal */ /* * There might be some problem resulting in too few char's read. * Check it. */ if(bytes_read != sizeof(int)){ fprintf(stderr, "lost data in signal pipe (expected %d, received %d)\n", sizeof(int), bytes_read); continue; /* discard the garbage and keep fingers crossed */ } roadmap_main_exit(); } /* * Reading from the pipe has not returned with normal status. Check for * potential errors and return from the callback. */ if(error != NULL) { fprintf(stderr, "reading signal pipe failed: %s\n", error->message); exit(1); } if(status == G_IO_STATUS_EOF) { fprintf(stderr, "signal pipe has been closed\n"); exit(1); } g_assert(status == G_IO_STATUS_AGAIN); return (TRUE); /* keep the event source */ } void roadmap_signals_init(void) { /* * In order to register the reading end of the pipe with the event loop * we must convert it into a GIOChannel. */ GIOChannel *g_signal_in; GError *error = NULL; /* handle errors */ long fd_flags; /* used to change the pipe into non-blocking mode */ /* * Set the unix signal handling up. * First create a pipe. */ if(pipe(signal_pipe)) { perror("pipe"); exit(1); } /* * put the write end of the pipe into nonblocking mode, * need to read the flags first, otherwise we would clear other flags too. */ fd_flags = fcntl(signal_pipe[1], F_GETFL); if(fd_flags == -1) { perror("read descriptor flags"); exit(1); } if(fcntl(signal_pipe[1], F_SETFL, fd_flags | O_NONBLOCK) == -1) { perror("write descriptor flags"); exit(1); } /* Install the unix signal handler roadmap_signal_handler for * the signals of interest */ signal(SIGHUP, roadmap_signal_handler); signal(SIGINT, roadmap_signal_handler); signal(SIGQUIT, roadmap_signal_handler); signal(SIGTERM, roadmap_signal_handler); /* convert the reading end of the pipe into a GIOChannel */ g_signal_in = g_io_channel_unix_new(signal_pipe[0]); /* * we only read raw binary data from the pipe, * therefore clear any encoding on the channel */ g_io_channel_set_encoding(g_signal_in, NULL, &error); if(error != NULL) { /* handle potential errors */ fprintf(stderr, "g_io_channel_set_encoding failed %s\n", error->message); exit(1); } /* put the reading end also into non-blocking mode */ g_io_channel_set_flags (g_signal_in, g_io_channel_get_flags(g_signal_in) | G_IO_FLAG_NONBLOCK, &error); if(error != NULL) { /* read errors */ fprintf(stderr, "g_io_set_flags failed %s\n", error->message); exit(1); } /* register the reading end with the event loop */ g_io_add_watch(g_signal_in, G_IO_IN | G_IO_PRI, roadmap_deliver_signal, NULL); } Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk2/Makefile,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Makefile 5 Nov 2005 08:50:20 -0000 1.21 --- Makefile 6 Dec 2005 23:19:40 -0000 1.22 *************** *** 54,57 **** --- 54,58 ---- roadmap_dialog.c \ roadmap_fileselection.c \ + roadmap_signals.c \ roadmap_canvas.c Index: roadmap_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk2/roadmap_main.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** roadmap_main.c 3 Dec 2005 03:50:12 -0000 1.22 --- roadmap_main.c 6 Dec 2005 23:19:40 -0000 1.23 *************** *** 600,603 **** --- 600,604 ---- } + void roadmap_signals_init(void); int main (int argc, char **argv) { *************** *** 619,622 **** --- 620,625 ---- } + roadmap_signals_init(); + roadmap_start (argc, argv); |
From: Paul F. <pg...@us...> - 2005-12-06 16:02:22
|
Update of /cvsroot/roadmap/roadmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26705 Modified Files: README Log Message: remove tabs, and add caveat regarding using direct tty access. Index: README =================================================================== RCS file: /cvsroot/roadmap/roadmap/README,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** README 6 Dec 2005 15:41:00 -0000 1.83 --- README 6 Dec 2005 16:02:10 -0000 1.84 *************** *** 1915,1928 **** <<Comment:>> The gpsd protocol (gpsd://<hostname>[:<port>]) uses ! the NMEA raw mode of gpsd, while the gpsd2 protocol ! (gpsd2://<hostname>[:<port>]) uses the gpsd native protocol. ! The object protocol (object:<id>) makes it possible to use ! an internal RoadMap object as GPS source (so that a driver ! can feed the GPS position to RoadMap). The file protocol ! (file://<path>) is also possible, for debug. If gpsd is not ! available, one can use a GPS source connected directly to a ! serial port. (tty://<device-path>[:baudrate]) An example ! would be "tty://dev/ttyS0". 4800 baud is the NMEA standard, ! but a different speed can be given: "tty://dev/ttyS0:19200". [GPS.Color] The color used for the current GPS position symbol. --- 1915,1932 ---- <<Comment:>> The gpsd protocol (gpsd://<hostname>[:<port>]) uses ! the NMEA raw mode of gpsd, while the gpsd2 protocol ! (gpsd2://<hostname>[:<port>]) uses the gpsd native protocol. ! The object protocol (object:<id>) makes it possible to use ! an internal RoadMap object as GPS source (so that a driver ! can feed the GPS position to RoadMap). The file protocol ! (file://<path>) is also possible, for debug. If gpsd is not ! available, one can use a GPS source connected directly to a ! serial port. (tty://<device-path>[:baudrate]) An example ! would be "tty://dev/ttyS0". 4800 baud is the NMEA standard, ! but a different speed can be given: "tty://dev/ttyS0:19200". ! (Note that using direct tty access prevents one from running ! both RoadMap and RoadGps at the same time, since there is no ! mechanism in place to allow sharing the serial port. Using ! gpsd is recommended.) [GPS.Color] The color used for the current GPS position symbol. |
From: Paul F. <pg...@us...> - 2005-12-06 15:41:12
|
Update of /cvsroot/roadmap/roadmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22523 Modified Files: README Log Message: finished implementation of direct unix tty device access to GPS devices Index: README =================================================================== RCS file: /cvsroot/roadmap/roadmap/README,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** README 20 Nov 2005 00:30:43 -0000 1.82 --- README 6 Dec 2005 15:41:00 -0000 1.83 *************** *** 1915,1924 **** <<Comment:>> The gpsd protocol (gpsd://<hostname>[:<port>]) uses ! the NMEA raw mode of gpsd, while the gpsd2 protocol ! (gpsd2://<hostname>[:<port>]) uses the gpsd native protocol. ! The object protocol (object:<id>) makes it possible to use ! an internal RoadMap object as GPS source (so that a driver ! can feed the GPS position to RoadMap). ! The file protocol (file://<path>) is also possible, for debug. [GPS.Color] The color used for the current GPS position symbol. --- 1915,1928 ---- <<Comment:>> The gpsd protocol (gpsd://<hostname>[:<port>]) uses ! the NMEA raw mode of gpsd, while the gpsd2 protocol ! (gpsd2://<hostname>[:<port>]) uses the gpsd native protocol. ! The object protocol (object:<id>) makes it possible to use ! an internal RoadMap object as GPS source (so that a driver ! can feed the GPS position to RoadMap). The file protocol ! (file://<path>) is also possible, for debug. If gpsd is not ! available, one can use a GPS source connected directly to a ! serial port. (tty://<device-path>[:baudrate]) An example ! would be "tty://dev/ttyS0". 4800 baud is the NMEA standard, ! but a different speed can be given: "tty://dev/ttyS0:19200". [GPS.Color] The color used for the current GPS position symbol. |
From: Paul F. <pg...@us...> - 2005-12-06 15:41:10
|
Update of /cvsroot/roadmap/roadmap/src/unix In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22523/src/unix Modified Files: roadmap_serial.c Log Message: finished implementation of direct unix tty device access to GPS devices Index: roadmap_serial.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/unix/roadmap_serial.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** roadmap_serial.c 8 Jul 2005 04:13:26 -0000 1.2 --- roadmap_serial.c 6 Dec 2005 15:41:00 -0000 1.3 *************** *** 3,7 **** * LICENSE: * ! * Copyright 2002 Pascal F. Martin * * This file is part of RoadMap. --- 3,7 ---- * LICENSE: * ! * Copyright 2005 Paul Fox * * This file is part of RoadMap. *************** *** 25,50 **** * * This module hides the OS specific API to access a serial device. - * NOT IMPLEMENTED YET. */ #include "roadmap.h" #include "roadmap_serial.h" RoadMapSerial roadmap_serial_open (const char *name, const char *mode, int speed) { ! roadmap_log (ROADMAP_ERROR, "tty support not yet implemented"); ! return -1; } int roadmap_serial_read (RoadMapSerial serial, void *data, int size) { ! return -1; } int roadmap_serial_write (RoadMapSerial serial, const void *data, int length) { ! return -1; } ! void roadmap_serial_close (RoadMapSerial serial) { } --- 25,214 ---- * * This module hides the OS specific API to access a serial device. */ + #include <unistd.h> + #include <sys/types.h> + #include <sys/stat.h> + #include <fcntl.h> + #include <termios.h> + #include <stdio.h> + #include "roadmap.h" #include "roadmap_serial.h" + /* + * mapping of system baudrate tokens to bits/sec values. + */ + static struct { + speed_t token; + int integer; + } RoadMapSerialBauds[] = { + #ifdef B460800 + {B460800, 460800}, + #endif + #ifdef B230400 + {B230400, 230400}, + #endif + #ifdef B115200 + {B115200, 115200}, + #endif + #ifdef B57600 + {B57600, 57600}, + #endif + #ifdef B38400 + {B38400, 38400}, + #endif + {B19200, 19200}, + {B9600, 9600}, + {B4800, 4800}, + {B2400, 2400}, + {B1200, 1200}, + {B600, 600}, + {B300, 300}, + {B110, 110}, + }; + + #define NUMBAUDS (sizeof(RoadMapSerialBauds)/sizeof(RoadMapSerialBauds[0])) + + static struct termios RoadMapSerialOldParameters, RoadMapSerialNewParameters; + + /* + * convert a baudrate, given in bits/sec, + * to an index in the table. + */ + static int roadmap_serial_rate2index(int rate) { + unsigned int i = 0; + while (i < NUMBAUDS && rate < RoadMapSerialBauds[i].integer) + i++; + + /* they're all too fast, return the slowest */ + if (i == NUMBAUDS) + return NUMBAUDS - 1; + + return i; + } + + /* + * return the actual baudrate corresponding to an index + * (e.g., for printing) + */ + int roadmap_serial_index2rate(int bindex) { + return RoadMapSerialBauds[bindex].integer; + } + + /* + * return the token corresponding to an index + */ + speed_t roadmap_serial_index2token(int bindex) { + return RoadMapSerialBauds[bindex].token; + } + + int setup_tty(int tty, int speed) { + + int s; + struct termios *newsb = &RoadMapSerialNewParameters; + int bindex = roadmap_serial_rate2index(speed); + + s = tcgetattr(tty, &RoadMapSerialOldParameters); + if (s < 0) { + return -1; + } + + *newsb = RoadMapSerialOldParameters; + + #ifndef VDISABLE + # ifdef _POSIX_VDISABLE + # define VDISABLE _POSIX_VDISABLE + # else + # define VDISABLE '\0' + # endif + #endif + + newsb->c_oflag = 0; /* no output flags at all */ + + newsb->c_lflag = ICANON; + + newsb->c_cflag &= ~PARENB; /* disable parity, both in and out */ + newsb->c_cflag |= CLOCAL|CS8|CREAD; /* one stop bit on transmit */ + /* no modem control, 8bit chars, */ + /* receiver enabled, */ + + newsb->c_iflag = IGNBRK | IGNPAR; /* ignore break, ignore parity errors */ + + newsb->c_cc[VEOL] = VDISABLE; + newsb->c_cc[VEOF] = VDISABLE; + #ifdef VSWTCH + newsb->c_cc[VSWTCH] = VDISABLE; + #endif + newsb->c_cc[VSUSP] = VDISABLE; + #if defined (VDSUSP) && defined(NCCS) && VDSUSP < NCCS + newsb->c_cc[VDSUSP] = VDISABLE; + #endif + newsb->c_cc[VSTART] = VDISABLE; + newsb->c_cc[VSTOP] = VDISABLE; + + s = cfsetospeed (newsb, RoadMapSerialBauds[bindex].token); + if (s < 0) { + return -1; + } + s = cfsetispeed (newsb, RoadMapSerialBauds[bindex].token); + if (s < 0) { + return -1; + } + s = tcsetattr(tty, TCSAFLUSH, newsb); + if (s < 0) { + return -1; + } + s = tcflush(tty, TCIOFLUSH); + if (s < 0) { + return -1; + } + + { char buf[10]; + int n; + while ((n = read(tty, buf, 10)) > 0) + fprintf(stderr, "got %d\n", n); + } + return 0; + } + RoadMapSerial roadmap_serial_open (const char *name, const char *mode, int speed) { ! int ttyfd; ! ! ttyfd = open(name, O_RDWR|O_NONBLOCK); ! if (ttyfd < 0) { ! return -1; ! } ! ! if (setup_tty(ttyfd, speed) < 0) { ! close(ttyfd); ! return -1; ! } ! ! /* turn off non-blocking */ ! fcntl(ttyfd, F_SETFL, 0); ! ! return (RoadMapSerial)ttyfd; } int roadmap_serial_read (RoadMapSerial serial, void *data, int size) { ! ! return read ((int)serial, data, (size_t)size); ! } int roadmap_serial_write (RoadMapSerial serial, const void *data, int length) { ! ! return read ((int)serial, (void *)data, (size_t)length); ! } ! void roadmap_serial_close (RoadMapSerial serial) { ! ! if (ROADMAP_SERIAL_IS_VALID(serial)) close(serial); ! ! } |
From: Pascal F M. <pas...@us...> - 2005-12-03 03:50:19
|
Update of /cvsroot/roadmap/roadmap/src/gtk2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13940 Modified Files: roadmap_main.c Log Message: Fix a crash when closing the main window Index: roadmap_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk2/roadmap_main.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** roadmap_main.c 18 Nov 2005 20:17:46 -0000 1.21 --- roadmap_main.c 3 Dec 2005 03:50:12 -0000 1.22 *************** *** 133,137 **** ! static void roadmap_main_close (GtkWidget *widget, gpointer data) { roadmap_main_exit (); --- 133,139 ---- ! static void roadmap_main_close (GtkWidget *widget, ! GdkEvent *event, ! gpointer data) { roadmap_main_exit (); *************** *** 231,236 **** roadmap_main_set_window_size (RoadMapMainWindow, width, height); ! g_signal_connect (RoadMapMainWindow, "destroy", ! (GCallback)gtk_widget_destroyed, RoadMapMainWindow); --- 233,238 ---- roadmap_main_set_window_size (RoadMapMainWindow, width, height); ! g_signal_connect (RoadMapMainWindow, "destroy_event", ! (GCallback)roadmap_main_close, RoadMapMainWindow); |
From: Pascal F M. <pas...@us...> - 2005-12-03 03:49:59
|
Update of /cvsroot/roadmap/roadmap/src/gtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13812 Modified Files: roadmap_main.c Log Message: Fix a crash when closing the main window Index: roadmap_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk/roadmap_main.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** roadmap_main.c 18 Nov 2005 20:16:56 -0000 1.14 --- roadmap_main.c 3 Dec 2005 03:49:50 -0000 1.15 *************** *** 70,74 **** ! static void roadmap_main_close (GtkWidget *widget, gpointer data) { roadmap_main_exit (); --- 70,76 ---- ! static void roadmap_main_close (GtkWidget *widget, ! GdkEvent *event, ! gpointer data) { roadmap_main_exit (); *************** *** 156,161 **** roadmap_main_set_window_size (RoadMapMainWindow, width, height); ! gtk_signal_connect (GTK_OBJECT(RoadMapMainWindow), "destroy", ! GTK_SIGNAL_FUNC(gtk_widget_destroyed), RoadMapMainWindow); --- 158,163 ---- roadmap_main_set_window_size (RoadMapMainWindow, width, height); ! gtk_signal_connect (GTK_OBJECT(RoadMapMainWindow), "destroy_event", ! GTK_SIGNAL_FUNC(roadmap_main_close), RoadMapMainWindow); |
From: Pascal F M. <pas...@us...> - 2005-12-03 03:28:49
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10919 Modified Files: roadmap_preferences.c Log Message: Fix selection from combo box (Paul and I) Index: roadmap_preferences.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_preferences.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** roadmap_preferences.c 13 Nov 2005 07:18:55 -0000 1.8 --- roadmap_preferences.c 3 Dec 2005 03:28:39 -0000 1.9 *************** *** 35,38 **** --- 35,39 ---- #include "roadmap_config.h" #include "roadmap_dialog.h" + #include "roadmap_screen.h" #include "roadmap_preferences.h" *************** *** 95,99 **** } ! roadmap_preferences_cancel (name, data); } --- 96,101 ---- } ! roadmap_dialog_hide (name); ! roadmap_screen_redraw (); } *************** *** 161,164 **** --- 163,168 ---- while (cursor->reference != NULL) { + int current = 0; + value = roadmap_config_get (cursor); roadmap_preferences_new_item (context, cursor); *************** *** 168,173 **** case ROADMAP_CONFIG_ENUM: ! count = 1; ! values[0] = (char *)value; /* Always make the original value appear first. */ for (enumeration = roadmap_config_get_enumeration (cursor); --- 172,176 ---- case ROADMAP_CONFIG_ENUM: ! count = 0; for (enumeration = roadmap_config_get_enumeration (cursor); *************** *** 175,192 **** enumeration = roadmap_config_get_enumeration_next (enumeration)) { ! values[count] = roadmap_config_get_enumeration_value (enumeration); ! if (strcmp (values[count], value) != 0) { ! if (count >= 256) { ! roadmap_log (ROADMAP_FATAL, ! "too many values for item %s.%s", ! cursor->category, cursor->name); ! } ! count += 1; } } ! roadmap_dialog_new_choice ! (cursor->category, cursor->name, count, values, (void **)values, NULL); break; --- 178,201 ---- enumeration = roadmap_config_get_enumeration_next (enumeration)) { ! if (count >= (int)(sizeof(values) / sizeof(char *))) { ! roadmap_log (ROADMAP_FATAL, ! "too many values for item %s.%s", ! cursor->category, cursor->name); ! } ! values[count] = roadmap_config_get_enumeration_value (enumeration); ! if (strcasecmp (values[count], value) == 0) { ! current = count; } + count += 1; } ! roadmap_dialog_new_choice (cursor->category, ! cursor->name, ! count, ! current, ! values, ! (void **)values, ! NULL); break; |
From: Pascal F M. <pas...@us...> - 2005-12-03 03:27:29
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10756 Modified Files: roadmap_dialog.h Log Message: Fix selection from combo box (Paul and I) Index: roadmap_dialog.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_dialog.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** roadmap_dialog.h 4 Aug 2003 08:26:36 -0000 1.3 --- roadmap_dialog.h 3 Dec 2005 03:27:21 -0000 1.4 *************** *** 88,91 **** --- 88,92 ---- const char *name, int count, + int current, char **labels, void **values, |