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: Danny B. <dan...@us...> - 2009-02-19 18:47:50
|
Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv16281 Modified Files: roadmap_trip.c Log Message: Make stripping the directory name for the window title more consistent. Is this the right way, or is it preferable to move this into roadmap_main_title ? Index: roadmap_trip.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_trip.c,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** roadmap_trip.c 16 Feb 2009 16:11:47 -0000 1.106 --- roadmap_trip.c 19 Feb 2009 18:47:42 -0000 1.107 *************** *** 2604,2608 **** filename = roadmap_trip_path_relative_to_trips(filename); roadmap_config_set (&RoadMapConfigTripName, filename); ! roadmap_main_title(TRIP_TITLE_FMT, filename); RoadMapTripUntitled = 0; } --- 2604,2608 ---- filename = roadmap_trip_path_relative_to_trips(filename); roadmap_config_set (&RoadMapConfigTripName, filename); ! roadmap_main_title(TRIP_TITLE_FMT, roadmap_path_skip_directories(filename)); RoadMapTripUntitled = 0; } *************** *** 2786,2790 **** route_waypt_iterator (RoadMapCurrentRoute, roadmap_tripdb_waypoint_iter); ! roadmap_main_title(TRIP_TITLE_FMT, roadmap_trip_current()); roadmap_trip_refresh (); --- 2786,2791 ---- route_waypt_iterator (RoadMapCurrentRoute, roadmap_tripdb_waypoint_iter); ! roadmap_main_title(TRIP_TITLE_FMT, ! roadmap_path_skip_directories(roadmap_trip_current())); roadmap_trip_refresh (); *************** *** 2865,2869 **** if (roadmap_trip_save_file (name)) { roadmap_config_set (&RoadMapConfigTripName, name); ! roadmap_main_title(TRIP_TITLE_FMT, name); RoadMapTripUntitled = 0; } --- 2866,2870 ---- if (roadmap_trip_save_file (name)) { roadmap_config_set (&RoadMapConfigTripName, name); ! roadmap_main_title(TRIP_TITLE_FMT, roadmap_path_skip_directories(name)); RoadMapTripUntitled = 0; } |
|
From: Paul F. <pg...@us...> - 2009-02-19 18:15:38
|
Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv22200 Modified Files: roadmap_sprite.c Log Message: correct the "no sprites" warning, and change some tabs to spaces Index: roadmap_sprite.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_sprite.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** roadmap_sprite.c 16 Nov 2008 16:45:53 -0000 1.21 --- roadmap_sprite.c 19 Feb 2009 18:15:29 -0000 1.22 *************** *** 120,127 **** { roadmap_log(ROADMAP_WARNING, ! "%s, line %d: %s", ! RoadMapSpriteFile, ! RoadMapSpriteLine, ! msg); } --- 120,127 ---- { roadmap_log(ROADMAP_WARNING, ! "%s, line %d: %s", ! RoadMapSpriteFile, ! RoadMapSpriteLine, ! msg); } *************** *** 678,684 **** while (!feof(file)) { if (fgets (line, sizeof(line), file) == NULL) ! break; if (roadmap_sprite_load_line (line) == 0) ! break; RoadMapSpriteLine++; } --- 678,684 ---- while (!feof(file)) { if (fgets (line, sizeof(line), file) == NULL) ! break; if (roadmap_sprite_load_line (line) == 0) ! break; RoadMapSpriteLine++; } *************** *** 817,822 **** if (sprite == NULL || sprite->alias_name != NULL) { ! roadmap_log (ROADMAP_WARNING, "roadmap_sprite_draw_with_text(%s): NULL", name); ! return; } --- 817,822 ---- if (sprite == NULL || sprite->alias_name != NULL) { ! roadmap_log (ROADMAP_WARNING, "roadmap_sprite_draw_with_text(%s): NULL", name); ! return; } *************** *** 976,980 **** --- 976,986 ---- roadmap_sprite_load_file (cursor); } + + if (RoadMapSpriteList == NULL) { + roadmap_log (ROADMAP_WARNING, + "roadmap_sprite_load: no sprites found"); + } + /* ensure there's at least a "default" sprite */ RoadMapSpriteDefault = roadmap_sprite_search ("Default"); *************** *** 987,992 **** char hardcoded3[] = "P -4,-4 4,-4 4,4 -4,4"; - roadmap_log (ROADMAP_WARNING, "roadmap_sprite_load: no sprites found, just a default"); - roadmap_sprite_load_line (hardcoded1); roadmap_sprite_load_line (hardcoded2); --- 993,996 ---- *************** *** 1005,1009 **** for (sprite = RoadMapSpriteList; sprite != NULL; sprite = sprite->next) { if (sprite->alias_name != NULL) ! continue; max_point_count = roadmap_sprite_maxpoint (sprite); --- 1009,1013 ---- for (sprite = RoadMapSpriteList; sprite != NULL; sprite = sprite->next) { if (sprite->alias_name != NULL) ! continue; max_point_count = roadmap_sprite_maxpoint (sprite); |
|
From: Paul F. <pg...@us...> - 2009-02-18 04:10:08
|
Update of /cvsroot/roadmap/roadmap/sugar In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28476 Modified Files: mk_activity Log Message: copy the right icon Index: mk_activity =================================================================== RCS file: /cvsroot/roadmap/roadmap/sugar/mk_activity,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mk_activity 18 Feb 2009 04:08:18 -0000 1.9 --- mk_activity 18 Feb 2009 04:10:02 -0000 1.10 *************** *** 59,63 **** $ACT/activity ! cp $STUFF/RM-foldedmap.sugar.svg \ $ACT/activity/RoadMap.svg --- 59,63 ---- $ACT/activity ! cp $STUFF/RoadMap.svg \ $ACT/activity/RoadMap.svg |
|
From: Paul F. <pg...@us...> - 2009-02-18 04:08:24
|
Update of /cvsroot/roadmap/roadmap/sugar In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28370 Modified Files: mk_activity Log Message: update to match new doc layout in main source tree Index: mk_activity =================================================================== RCS file: /cvsroot/roadmap/roadmap/sugar/mk_activity,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mk_activity 16 Sep 2008 15:57:11 -0000 1.8 --- mk_activity 18 Feb 2009 04:08:18 -0000 1.9 *************** *** 7,11 **** # this could all be made _way_ better. volunteers? -pgf ! set -e test "$1" = clean && clean=clean --- 7,11 ---- # this could all be made _way_ better. volunteers? -pgf ! set -ex test "$1" = clean && clean=clean *************** *** 15,23 **** ACTNAME=RoadMap.activity ACT=./tmp/$ACTNAME RMROOT=./tmp/roadmap_root STUFF=./activity rm -rf ./tmp - mkdir -p ./tmp mkdir -p $ACT/{bin,activity,lib,docs,maps} --- 15,23 ---- ACTNAME=RoadMap.activity ACT=./tmp/$ACTNAME + MAPS=./tmp/RoadMap.maps RMROOT=./tmp/roadmap_root STUFF=./activity rm -rf ./tmp mkdir -p $ACT/{bin,activity,lib,docs,maps} *************** *** 57,63 **** cp $STUFF/activity.info \ $STUFF/permissions.info \ - $STUFF/RoadMap.svg \ $ACT/activity cp $STUFF/config/roadmap.screenobjects \ $STUFF/config/sprites \ --- 57,65 ---- cp $STUFF/activity.info \ $STUFF/permissions.info \ $ACT/activity + cp $STUFF/RM-foldedmap.sugar.svg \ + $ACT/activity/RoadMap.svg + cp $STUFF/config/roadmap.screenobjects \ $STUFF/config/sprites \ *************** *** 76,80 **** # provide some maps, which must already be installed on the build system ! mkdir -p tmp/RoadMap.maps if [ -d /usr/local/share/roadmap/maps ] then --- 78,82 ---- # provide some maps, which must already be installed on the build system ! mkdir -p $MAPS if [ -d /usr/local/share/roadmap/maps ] then *************** *** 86,94 **** do test -d /usr/local/share/roadmap/maps/$state && \ ! ln -s /usr/local/share/roadmap/maps/$state tmp/RoadMap.maps done else # in case we're building the bundle on the XO itself (unlikely) ln -s /home/olpc/Activities/RoadMap.activity/maps/{SB,usdir.rdm} $ACT/maps ! ln -s /media/disk/RoadMap.maps/{ma,nh,vt} tmp/RoadMap.maps fi --- 88,96 ---- do test -d /usr/local/share/roadmap/maps/$state && \ ! ln -s /usr/local/share/roadmap/maps/$state $MAPS done else # in case we're building the bundle on the XO itself (unlikely) ln -s /home/olpc/Activities/RoadMap.activity/maps/{SB,usdir.rdm} $ACT/maps ! ln -s /media/disk/RoadMap.maps/{ma,nh,vt} $MAPS fi *************** *** 135,139 **** # and finally, copy in docs and licenses ! cp $TOP/COPYING $TOP/INSTALL $TOP/README README.xo_laptop $ACT/docs test -f $SRC/manual.html && cp $SRC/manual.html $ACT/docs --- 137,143 ---- # and finally, copy in docs and licenses ! cp $TOP/COPYING $TOP/README README.xo_laptop $ACT/docs ! cp -a $TOP/doc $ACT/docs ! rm -r $ACT/docs/doc/CVS test -f $SRC/manual.html && cp $SRC/manual.html $ACT/docs *************** *** 147,149 **** --- 151,154 ---- zip -r ../RoadMap-$version.xo $ACTNAME + exit |
|
From: Paul F. <pg...@us...> - 2009-02-18 04:07:41
|
Update of /cvsroot/roadmap/roadmap/sugar/activity In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28329 Modified Files: RoadMap.svg Log Message: commit tentative XO icon. might be too complicated. Index: RoadMap.svg =================================================================== RCS file: /cvsroot/roadmap/roadmap/sugar/activity/RoadMap.svg,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RoadMap.svg 8 Nov 2008 05:45:41 -0000 1.2 --- RoadMap.svg 18 Feb 2009 04:07:34 -0000 1.3 *************** *** 1,28 **** ! <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [ <!ENTITY stroke_color "#666666"> ! <!ENTITY fill_color "#ffffff"> <!ENTITY fill_opacity "1"> ! ]><svg height="45" id="svg2" inkscape:output_extension="org.inkscape.output.svg.inkscape" inkscape:version="0.46" sodipodi:docbase="/home/pgf/src/pdom/gps/roadmap/ndcvs/sugar/activity" sodipodi:docname="RoadMap.svg" sodipodi:version="0.32" version="1.0" width="45" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"> ! <metadata id="metadata16"> ! <rdf:RDF> ! <cc:Work rdf:about=""> ! <dc:format>image/svg+xml</dc:format> ! <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> ! </cc:Work> ! </rdf:RDF> ! </metadata> ! <sodipodi:namedview bordercolor="#666666" borderopacity="1.0" gridtolerance="10.0" guidetolerance="10.0" id="base" inkscape:current-layer="svg2" inkscape:cx="22.5" inkscape:cy="22.5" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="672" inkscape:window-width="640" inkscape:window-x="160" inkscape:window-y="38" inkscape:zoom="10.355556" objecttolerance="10.0" pagecolor="#ffffff" showgrid="false"/> ! <defs id="defs13"> ! <inkscape:perspective id="perspective17" inkscape:persp3d-origin="22.5 : 15 : 1" inkscape:vp_x="0 : 22.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="45 : 22.5 : 1" sodipodi:type="inkscape:persp3d"/> ! </defs> ! <rect height="14.11365" id="rect3138" ry="0.43426618" style="fill:&fill_color;;fill-opacity:&fill_opacity;;fill-rule:nonzero;stroke:&stroke_color;;stroke-width:1.934;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:8.1;stroke-opacity:1;" width="38.637459" x="2.5860298" y="1.6336505"/> ! <path d="M 8.3238071,6.2766696 C 8.5788169,6.5294076 8.773341,6.8310703 8.9704146,7.1279018 C 9.1289161,7.4262905 9.1756045,7.7579107 9.2351331,8.0849879 C 9.352776,8.312958 9.3864103,8.5637956 9.4365874,8.8109951 C 9.4662889,9.0618068 9.4738888,9.3149246 9.4858617,9.5668235 C 9.5566343,9.8006566 9.6208224,10.035716 9.681626,10.272401 C 9.7823823,10.517414 9.9331204,10.739748 10.066986,10.968532 C 10.165519,11.151962 10.283482,11.325677 10.38941,11.502104 L 8.8751293,12.406379 C 8.7657324,12.219988 8.6495328,12.035741 8.5434482,11.845895 C 8.4030489,11.604479 8.2457724,11.370773 8.1352532,11.114359 C 8.0734693,10.869223 8.0107105,10.62459 7.9267821,10.385522 C 7.9114891,10.134942 7.897353,9.8826516 7.880982,9.631194 C 7.8360001,9.3853526 7.8040448,9.140276 7.6837374,8.9154249 C 7.6348597,8.6056493 7.6019298,8.289419 7.4566863,8.0054537 C 7.2625761,7.7227569 7.0859997,7.4221374 6.8185944,7.1990651 L 8.3238071,6.2766696 z " id="path3142" style="fill:none;fill-opacity:0;fill-rule:nonzero;stroke:&stroke_color;;stroke-width:1.93400002;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:8.1;stroke-opacity:1;"/> ! <path d="M 14.235712,6.0959984 C 14.532727,6.0020396 14.841547,5.9718826 15.1483,5.9314483 C 15.41655,5.8687536 15.622573,5.9787057 15.867204,6.0572302 C 16.131376,6.1473187 16.370324,6.2903897 16.611884,6.419578 C 16.733462,6.6069886 16.872176,6.7895447 16.99619,6.9719752 C 17.158236,7.1448355 17.301157,7.3362051 17.450646,7.5205138 C 17.582045,7.7231405 17.735218,7.9058649 17.886331,8.0929312 C 18.053613,8.1969594 18.098701,8.3681662 18.187962,8.5187715 C 18.022109,9.1741949 16.898837,9.4271585 16.235212,9.7152387 C 15.998283,9.7889457 15.750735,9.7895774 15.505784,9.8030643 C 15.26559,9.807572 15.025338,9.8054686 14.78512,9.8048055 C 14.540211,9.8481082 14.320576,9.9687317 14.096569,10.067082 C 13.503625,10.332567 12.618743,10.886713 15.174352,9.4230854 L 13.536177,10.077259 C 14.195435,9.685598 14.78941,9.279243 15.470003,8.9684193 C 15.711044,8.8800063 15.947576,8.7666979 16.210565,8.7697514 C 16.44901,8.7696466 16.687616,8.7724816 16.925879,8.7610751 C 17.160539,8.7305723 17.401149,8.7317224 17.620354,8.6264761 C 18.751258,8.0533089 16.50945,9.1237688 16.603265,9.3181401 C 16.561198,9.2600681 16.484763,9.0550872 16.365812,8.990347 C 16.221776,8.804968 16.074041,8.6242939 15.945194,8.4274921 C 15.796216,8.2482886 15.652465,8.0635797 15.493358,7.8936445 C 15.36695,7.7197738 15.244395,7.5425301 15.124438,7.3654553 C 14.892572,7.250512 14.662779,7.1219613 14.411575,7.0479911 C 14.180029,6.9957919 13.98733,6.9067016 13.739312,6.979269 C 13.435787,7.0291747 13.128971,7.0669728 12.839932,7.1803743 L 14.235712,6.0959984 z " id="path3144" style="fill:none;fill-opacity:0;fill-rule:nonzero;stroke:&stroke_color;;stroke-width:1.93400002;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:8.1;stroke-opacity:1;"/> ! <path d="M 19.620775,12.645542 C 19.937459,12.436631 20.230272,12.194666 20.533389,11.967302 C 21.1622,11.443237 21.93724,11.092406 22.63318,10.703302 C 22.339941,10.951143 21.305611,11.454107 21.594545,11.20126 C 22.165591,10.670729 22.927457,10.359829 23.584688,9.9908861 C 23.869966,9.9915268 24.105715,9.8608599 24.359326,9.7545018 C 24.697872,9.6274566 25.035319,9.4977752 25.369666,9.3593459 C 26.201376,9.0341334 28.565857,7.6315138 24.826466,9.7277728 C 25.054917,9.5965635 25.253469,9.4279687 25.462065,9.2706405 C 26.691189,8.4719115 28.693811,7.3875494 26.023246,8.9093578 C 26.082081,8.8830521 26.10297,8.8221472 26.142833,8.7785419 L 27.752794,8.0529486 C 27.721858,8.1182335 27.713976,8.1944627 27.659987,8.2488034 C 27.635191,8.2750418 27.610395,8.3012802 27.5856,8.3275185 C 27.050565,8.635718 26.51553,8.9439175 25.980495,9.2521169 C 25.602141,9.4549224 27.464017,8.3887205 27.103654,8.622001 C 26.894858,8.7875907 26.690464,8.9563066 26.45385,9.0859179 C 25.651842,9.5632546 24.880481,10.131208 23.989742,10.440474 C 23.656456,10.576035 23.318894,10.700886 22.989492,10.845219 C 22.725773,10.932087 22.466401,11.023421 22.193256,11.078439 C 22.527917,10.880821 23.528083,10.2991 23.234498,10.553773 C 22.655784,11.068524 21.977599,11.514203 21.242602,11.790489 C 25.317614,9.3856005 22.575211,10.910217 22.163746,11.330643 C 21.852548,11.539842 21.563679,11.775651 21.264392,12.002441 L 19.620775,12.645542 z " id="path3146" style="fill:none;fill-opacity:0;fill-rule:nonzero;stroke:&stroke_color;;stroke-width:1.93400002;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:8.1;stroke-opacity:1;"/> ! <path d="M 32.138151,5.2953919 C 32.410166,5.4552967 32.705285,5.5775863 32.991026,5.7067304 C 33.187281,5.8293052 33.392752,5.9366946 33.592478,6.0516792 C 33.86967,6.0647062 33.962225,6.2431633 34.140065,6.3944098 C 34.211,6.5860821 34.240405,6.7962591 34.275475,6.9947378 C 34.392391,7.1671313 34.404572,7.3699783 34.451754,7.5642908 C 34.513336,7.7293742 34.581454,7.8980184 34.651481,8.0613831 C 34.74426,8.2789534 34.816417,8.5017851 34.888231,8.7266417 C 34.929593,8.9973628 35.103679,9.1559878 35.271861,9.3453319 C 35.419812,9.5086464 35.598806,9.6269463 35.773161,9.7587114 C 35.9708,9.8482485 36.135907,9.9820757 36.310137,10.10762 L 34.822596,11.060206 C 34.646245,10.935416 34.479601,10.801989 34.285433,10.703578 C 34.111822,10.565295 33.927879,10.443385 33.778774,10.275707 C 33.594323,10.055304 33.394804,9.861958 33.337786,9.5624402 C 33.263591,9.3418809 33.208262,9.1150949 33.100275,8.9058812 C 33.025549,8.7360443 32.959327,8.5564564 32.889973,8.3847566 C 32.851577,8.2041804 32.845853,8.0187318 32.734446,7.8602069 C 32.696744,7.6697329 32.642943,7.4755128 32.611009,7.2807561 C 32.461751,7.1966535 32.328147,7.0345718 32.121551,7.0208395 C 31.91908,6.9022996 31.713219,6.7887251 31.514597,6.6633474 C 31.223467,6.5344257 30.926778,6.4102528 30.651778,6.2471007 L 32.138151,5.2953919 z " id="path3148" style="fill:none;fill-opacity:0;fill-rule:nonzero;stroke:&stroke_color;;stroke-width:1.93400002;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:8.1;stroke-opacity:1;"/> ! <rect height="27.546658" id="rect3156" rx="1.2479817" ry="0" style="fill:none;fill-opacity:0;fill-rule:nonzero;stroke:&stroke_color;;stroke-width:1.94042726;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:8.1;stroke-opacity:1;" transform="matrix(0.9982626,-5.8921749e-2,0.2040576,0.9789589,0,0)" width="3.4035833" x="31.123331" y="19.333595"/> ! <path d="M 24.478322,4.6840136 C 24.467738,4.98681 24.471974,5.2898858 24.472816,5.5928029 C 24.477445,5.7975 24.596308,5.9615069 24.684204,6.1373777 C 24.808488,6.3574042 24.919583,6.5848779 25.037473,6.8082052 C 25.142461,7.0744239 25.333979,7.2821058 25.510098,7.5010135 C 25.686137,7.6979803 25.788677,7.943424 25.904696,8.1754459 C 25.982689,8.3380285 26.115859,8.4511072 26.225816,8.5887703 C 26.385568,8.7047409 26.51541,8.8556627 26.658028,8.9891471 C 26.781794,9.1363168 26.960466,9.2211755 27.124454,9.3138754 C 27.318704,9.4080413 27.457295,9.5585086 27.610057,9.7023819 C 27.708984,9.7950385 27.793816,9.9001338 27.885562,9.9988655 L 26.367366,10.902118 C 26.277845,10.804893 26.187191,10.708176 26.098332,10.60993 C 25.945747,10.491767 25.804507,10.35288 25.630308,10.258386 C 25.454182,10.152382 25.262962,10.074148 25.144699,9.8939823 C 24.996597,9.7653104 24.847189,9.6297383 24.705674,9.4926717 C 24.594835,9.3514964 24.457147,9.2336838 24.38081,9.0662522 C 24.272149,8.8389569 24.176815,8.5996355 24.008406,8.406887 C 23.822046,8.1750282 23.619429,7.9543657 23.505477,7.6740384 C 23.39064,7.4576706 23.282682,7.2367743 23.16051,7.0241182 C 23.056072,6.8193983 22.918825,6.6295222 22.908136,6.390047 C 22.90897,6.0890017 22.9133,5.7877884 22.902631,5.4868681 L 24.478322,4.6840136 z " id="path3179" style="fill:none;fill-opacity:0;fill-rule:nonzero;stroke:&stroke_color;;stroke-width:1.93400002;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:8.1;stroke-opacity:1;"/> ! <path d="M 7.5005297,44.642604 C 7.5005297,44.642604 10.458525,44.37633 7.5835072,31.178518 C 5.8080522,23.006161 12.659934,18.45531 20.66637,16.096548" id="path3190" style="color:#010101;fill:none;fill-opacity:0;fill-rule:nonzero;stroke:&stroke_color;;stroke-width:1.70000005;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;"/> ! <path d="M 24.78118,44.375531 C 24.78118,44.375531 26.145215,42.219535 24.964948,38.467111 C 24.31672,36.4062 25.045411,38.512838 21.981656,32.325895 C 18.562711,25.421682 21.53257,20.88734 25.616307,17.849583 C 26.63724,17.090144 27.274109,16.644179 28.215586,15.990453" id="path3195" style="color:#010101;fill:none;fill-opacity:0;fill-rule:nonzero;stroke:&stroke_color;;stroke-width:1.70000005;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;"/> ! <path d="M 15.776147,45.089864 C 15.776147,45.089864 16.886406,42.317466 16.874814,40.319062 C 16.8568,37.451413 16.548807,37.155454 14.65947,31.383001 C 12.809067,25.729503 15.033411,23.653596 17.415878,20.911991 C 19.798347,18.170387 23.433356,16.37067 27.216732,16.343884" id="path3215" style="color:#010101;fill:none;fill-opacity:0;fill-rule:nonzero;stroke:&stroke_color;;stroke-width:1.70000005;stroke-miterlimit:4;stroke-dasharray:5.10000014, 5.10000014;stroke-dashoffset:3.4000001;stroke-opacity:1;"/> </svg> \ No newline at end of file --- 1,12 ---- ! <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 20010904//EN' 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd' [ <!ENTITY stroke_color "#666666"> ! <!ENTITY fill_color "#000000"> <!ENTITY fill_opacity "1"> ! ]><svg height="468pt" preserveAspectRatio="xMidYMid meet" version="1.0" viewBox="0 0 468 468" width="468pt" xmlns="http://www.w3.org/2000/svg"> ! <metadata> ! Created by potrace 1.8, written by Peter Selinger 2001-2007 ! </metadata> ! <g fill="&fill_color;" stroke="&stroke_color;" style="fill-opacity:&fill_opacity;;" transform="translate(0,468) scale(0.731250,-0.731250)"> ! <path d="M0 320 l0 -320 58 0 c56 0 59 1 109 52 66 68 87 110 86 174 0 61 -22 109 -71 160 l-37 38 33 -23 c117 -81 126 -246 21 -366 l-31 -35 53 0 c46 0 57 4 86 32 37 36 53 32 27 -7 l-17 -26 54 3 c54 3 54 3 81 53 30 54 36 120 17 158 -7 12 -29 41 -50 64 -22 24 -39 47 -39 53 0 21 19 47 47 65 l28 18 -28 -30 c-15 -16 -27 -38 -27 -49 0 -11 20 -40 45 -64 56 -55 71 -101 55 -173 -6 -29 -17 -62 -26 -74 l-14 -23 90 0 90 0 0 320 0 320 -320 0 -320 0 0 -320z m630 271 c0 -36 -2 -39 -37 -44 -21 -4 -49 -19 -68 -37 l-31 -30 -90 31 c-54 18 -119 33 -166 36 -70 5 -82 3 -133 -22 -71 -34 -85 -26 -85 51 l0 54 305 0 305 0 0 -39z m-381 -166 l54 -26 44 21 c64 30 75 24 12 -8 l-54 -27 -55 26 c-30 15 -62 29 -70 32 -13 5 -13 5 0 6 8 0 39 -11 69 -24z m208 19 c-3 -3 -12 -4 -19 -1 -8 3 -5 6 6 6 11 1 17 -2 13 -5z m-129 -139 c-3 -3 -9 2 -12 12 -6 14 -5 15 5 6 7 -7 10 -15 7 -18z m27 -35 c3 -5 1 -10 -4 -10 -6 0 -11 5 -11 10 0 6 2 10 4 10 3 0 8 -4 11 -10z m35 -72 c0 -5 -4 -8 -10 -8 -5 0 -10 10 -10 23 0 18 2 19 10 7 5 -8 10 -18 10 -22z m-7 -68 c-3 -11 -9 -20 -14 -20 -10 0 -12 24 -2 33 13 13 21 7 16 -13z"/> ! </g> </svg> \ No newline at end of file |
|
From: Paul F. <pg...@us...> - 2009-02-18 04:07:14
|
Update of /cvsroot/roadmap/roadmap/sugar/activity In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28294 Modified Files: activity.info Log Message: bump XO activity to version 3 Index: activity.info =================================================================== RCS file: /cvsroot/roadmap/roadmap/sugar/activity/activity.info,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** activity.info 15 Sep 2008 20:18:17 -0000 1.5 --- activity.info 18 Feb 2009 04:07:06 -0000 1.6 *************** *** 4,8 **** service_name = net.sourceforge.roadmap icon = RoadMap ! activity_version = 2 show_launcher = yes exec = sugarRoadMap --- 4,8 ---- service_name = net.sourceforge.roadmap icon = RoadMap ! activity_version = 3 show_launcher = yes exec = sugarRoadMap |
|
From: Danny B. <dan...@us...> - 2009-02-16 16:11:54
|
Update of /cvsroot/roadmap/roadmap/src/navigate In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24889/navigate Modified Files: navigate_plugin.c Log Message: While I was entering the commit message yesterday, it became clear that I needed to provide an example based on the "demo maps". So here it is. Index: navigate_plugin.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/navigate/navigate_plugin.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** navigate_plugin.c 15 Feb 2009 16:47:49 -0000 1.1 --- navigate_plugin.c 16 Feb 2009 16:11:47 -0000 1.2 *************** *** 46,50 **** * @brief for debugging */ ! static void navigate_debug_trip(void) { /* departure : 4683870,50898550 */ --- 46,50 ---- * @brief for debugging */ ! static void navigate_debug_be_trip(void) { /* departure : 4683870,50898550 */ *************** *** 64,67 **** --- 64,78 ---- } + /** + * @brief for debugging + */ + static void navigate_debug_sf_trip(void) + { + roadmap_trip_set_selection(-122394181, 37794928); + roadmap_trip_set_selection_as ("Departure"); + roadmap_trip_set_selection(-122423168, 37788848); + roadmap_trip_set_selection_as ("Destination"); + } + static void navigate_start_navigate (void) { *************** *** 123,128 **** navigate_cost_preferences}, ! {"navigatedebug", "Debug trip for navigation", NULL, NULL, ! "Debug trip for navigation", NULL, navigate_debug_trip}, {"navigate-enable", "Enable navigation", NULL, NULL, --- 134,141 ---- navigate_cost_preferences}, ! {"navigate-be-debug", "Belgium Debug trip for navigation", NULL, NULL, ! "Debug trip for navigation", NULL, navigate_debug_be_trip}, ! {"navigate-sf-debug", "San Francisco trip for navigation", NULL, NULL, ! "Debug trip for navigation", NULL, navigate_debug_sf_trip}, {"navigate-enable", "Enable navigation", NULL, NULL, *************** *** 142,146 **** // "addaswaypoint", cannot be here, is a RoadMap action // "deletewaypoints", ! "navigatedebug", "navigate", RoadMapFactorySeparator, --- 155,160 ---- // "addaswaypoint", cannot be here, is a RoadMap action // "deletewaypoints", ! "navigate-be-debug", ! "navigate-sf-debug", "navigate", RoadMapFactorySeparator, |
|
From: Danny B. <dan...@us...> - 2009-02-16 16:11:52
|
Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24889 Modified Files: roadmap_trip.c Log Message: While I was entering the commit message yesterday, it became clear that I needed to provide an example based on the "demo maps". So here it is. Index: roadmap_trip.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_trip.c,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** roadmap_trip.c 15 Feb 2009 15:32:27 -0000 1.105 --- roadmap_trip.c 16 Feb 2009 16:11:47 -0000 1.106 *************** *** 210,214 **** ROADMAP_TRIP_ITEM ("Address", NULL, 0, 1, 0, 0), ROADMAP_TRIP_ITEM ("Selection", "Selection", 0, 0, 0, 0), ! ROADMAP_TRIP_ITEM ("Departure", "Departure", 0, 0, 1, 0), ROADMAP_TRIP_ITEM ("Hold", NULL, 0, 1, 0, 0), ROADMAP_TRIP_ITEM (NULL, NULL, 0, 0, 0, 0) --- 210,214 ---- ROADMAP_TRIP_ITEM ("Address", NULL, 0, 1, 0, 0), ROADMAP_TRIP_ITEM ("Selection", "Selection", 0, 0, 0, 0), ! ROADMAP_TRIP_ITEM ("Departure", "Departure", 0, 1, 1, 0), ROADMAP_TRIP_ITEM ("Hold", NULL, 0, 1, 0, 0), ROADMAP_TRIP_ITEM (NULL, NULL, 0, 0, 0, 0) |
|
From: Danny B. <dan...@us...> - 2009-02-15 16:47:59
|
Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28712 Modified Files: roadmap_navigate.c roadmap_navigate.h roadmap_start.c Added Files: roadmap_db_line_route.h roadmap_db_line_speed.h roadmap_line_route.c roadmap_line_route.h roadmap_line_speed.c roadmap_line_speed.h roadmap_res.c roadmap_res.h roadmap_turns.c roadmap_turns.h Log Message: Here's the rest ... --- NEW FILE: roadmap_line_speed.c --- /* * LICENSE: * * Copyright 2006 Ehud Shabtai * Copyright (c) 2008, 2009 Danny Backx * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief Manage line speed data */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <time.h> #include "roadmap.h" #include "roadmap_dbread.h" #include "roadmap_line.h" #include "roadmap_line_speed.h" static char *RoadMapLineSpeedType = "RoadMapLineSpeedContext"; typedef struct { char *type; RoadMapLineSpeedAvg *LineSpeedAvg; int LineSpeedAvgCount; RoadMapLineSpeed *LineSpeedRef; int LineSpeedRefCount; RoadMapLineSpeedRef *LineSpeedSlots; int LineSpeedSlotsCount; int *LineSpeedIndex; int LineSpeedIndexCount; } RoadMapLineSpeedContext; static RoadMapLineSpeedContext *RoadMapLineSpeedActive = NULL; static void *roadmap_line_speed_map (roadmap_db *root) { RoadMapLineSpeedContext *context; roadmap_db *ref_table; roadmap_db *avg_table; roadmap_db *index_table; roadmap_db *data_table; context = (RoadMapLineSpeedContext *) calloc (1, sizeof(RoadMapLineSpeedContext)); if (context == NULL) { roadmap_log (ROADMAP_ERROR, "no more memory (roadmap_line_speed)"); return NULL; } context->type = RoadMapLineSpeedType; ref_table = roadmap_db_get_subsection (root, "line_ref"); avg_table = roadmap_db_get_subsection (root, "avg"); index_table = roadmap_db_get_subsection (root, "index"); data_table = roadmap_db_get_subsection (root, "data"); if (avg_table) { context->LineSpeedAvg = (RoadMapLineSpeedAvg *) roadmap_db_get_data (avg_table); context->LineSpeedAvgCount = roadmap_db_get_count (avg_table); } if (ref_table) { context->LineSpeedRef = (RoadMapLineSpeed *) roadmap_db_get_data (ref_table); context->LineSpeedRefCount = roadmap_db_get_count (ref_table); context->LineSpeedIndex = (int *) roadmap_db_get_data (index_table); context->LineSpeedIndexCount = roadmap_db_get_count (index_table); context->LineSpeedSlots = (RoadMapLineSpeedRef *) roadmap_db_get_data (data_table); context->LineSpeedSlotsCount = roadmap_db_get_count (data_table); if (roadmap_db_get_size (data_table) != context->LineSpeedSlotsCount * sizeof(RoadMapLineSpeedRef)) { roadmap_log (ROADMAP_ERROR, "invalid line speed data structure"); free(context); return NULL; } } return context; } static void roadmap_line_speed_activate (void *context) { RoadMapLineSpeedContext *line_speed_context = (RoadMapLineSpeedContext *) context; if ((line_speed_context != NULL) && (line_speed_context->type != RoadMapLineSpeedType)) { roadmap_log (ROADMAP_FATAL, "invalid line speed context activated"); } RoadMapLineSpeedActive = line_speed_context; } static void roadmap_line_speed_unmap (void *context) { RoadMapLineSpeedContext *line_speed_context = (RoadMapLineSpeedContext *) context; if (line_speed_context->type != RoadMapLineSpeedType) { roadmap_log (ROADMAP_FATAL, "unmapping invalid line speed context"); } free (line_speed_context); } roadmap_db_handler RoadMapLineSpeedHandler = { "line_speed", roadmap_line_speed_map, roadmap_line_speed_activate, roadmap_line_speed_unmap }; /** * @brief * @param when * @return */ static int get_time_slot (time_t when) { int time_slot; struct tm *t = localtime (&when); time_slot = t->tm_hour * 2; if (t->tm_min >= 30) time_slot++; return time_slot; } int get_speed_ref (int line, int against_dir) { RoadMapLineSpeed *ref; if (RoadMapLineSpeedActive == NULL) return INVALID_SPEED; /* No data. */ if (line >= RoadMapLineSpeedActive->LineSpeedRefCount) return INVALID_SPEED; ref = RoadMapLineSpeedActive->LineSpeedRef +line; if (against_dir) return ref->to_speed_ref; else return ref->from_speed_ref; } static LineRouteTime calc_cross_time (int line, int time_slot, int against_dir) { int speed; int length; int speed_ref = get_speed_ref (line, against_dir); if (speed_ref == INVALID_SPEED) return 0; speed = roadmap_line_speed_get (speed_ref, time_slot); if (!speed) return 0; length = roadmap_line_length (line); return (LineRouteTime)(length * 3.6 / speed) + 1; } static LineRouteTime calc_avg_cross_time (int line, int against_dir) { int speed; int length; int speed_ref = get_speed_ref (line, against_dir); if (speed_ref == INVALID_SPEED) return 0; speed = roadmap_line_speed_get_avg (speed_ref); if (!speed) return 0; length = roadmap_line_length (line); return (LineRouteTime)(length * 3.6 / speed) + 1; } int roadmap_line_speed_get_avg (int speed_ref) { RoadMapLineSpeedRef *speed; int index; int count = 0; int total = 0; if (RoadMapLineSpeedActive == NULL) return 0; /* No data. */ if (RoadMapLineSpeedActive->LineSpeedIndexCount <= speed_ref) { roadmap_log (ROADMAP_ERROR, "Invalid speed_ref index:%d", speed_ref); return 0; } index = RoadMapLineSpeedActive->LineSpeedIndex[speed_ref]; speed = &RoadMapLineSpeedActive->LineSpeedSlots[index]; while (1) { total += speed->speed; count++; if (speed->time_slot & SPEED_EOL) break; speed++; } return total / count; } int roadmap_line_speed_get (int speed_ref, int time_slot) { RoadMapLineSpeedRef *speed; int index; if (RoadMapLineSpeedActive == NULL) return 0; /* No data. */ if (RoadMapLineSpeedActive->LineSpeedIndexCount <= speed_ref) { roadmap_log (ROADMAP_ERROR, "Invalid speed_ref index:%d", speed_ref); return 0; } index = RoadMapLineSpeedActive->LineSpeedIndex[speed_ref]; speed = &RoadMapLineSpeedActive->LineSpeedSlots[index]; while (!(speed->time_slot & SPEED_EOL) && (((speed+1)->time_slot & ~SPEED_EOL) <= time_slot)) { speed++; } return speed->speed; } int roadmap_line_speed_get_cross_times (int line, LineRouteTime *from, LineRouteTime *to) { int time_slot; if (RoadMapLineSpeedActive == NULL) return -1; /* No data. */ if (RoadMapLineSpeedActive->LineSpeedRefCount <= line) return -1; // *from = calc_avg_cross_time (line, route->from_speed_ref); // *to = calc_avg_cross_time (line, route->to_speed_ref); time_slot = get_time_slot (time(NULL)); *from = calc_cross_time (line, time_slot, 0); *to = calc_cross_time (line, time_slot, 1); return 0; } /** * @brief * @param line * @param against_dir * @param at_time * @return */ int roadmap_line_speed_get_cross_time_at (int line, int against_dir, int at_time) { int time_slot; time_slot = get_time_slot (at_time); return calc_cross_time (line, time_slot, against_dir); } int roadmap_line_speed_get_cross_time (int line, int against_dir) { return roadmap_line_speed_get_cross_time_at (line, against_dir, time(NULL)); } int roadmap_line_speed_get_avg_cross_time (int line, int against_dir) { int speed; int length; int avg_time; if (RoadMapLineSpeedActive == NULL) return 0; /* No data. */ if (line < RoadMapLineSpeedActive->LineSpeedRefCount) { avg_time = calc_avg_cross_time (line, against_dir); if (avg_time) return avg_time; } if (line < RoadMapLineSpeedActive->LineSpeedAvgCount) { RoadMapLineSpeedAvg *avg = RoadMapLineSpeedActive->LineSpeedAvg + line; if (!against_dir) { speed = avg->from_avg_speed; } else { speed = avg->to_avg_speed; } if (!speed) speed = 30; length = roadmap_line_length (line); return (int)(length * 3.6 / speed) + 1; } return -1; } int roadmap_line_speed_get_speed (int line, int against_dir) { int time_slot; int speed_ref = get_speed_ref (line, against_dir); if (speed_ref == INVALID_SPEED) return 0; time_slot = get_time_slot (time(NULL)); return roadmap_line_speed_get (speed_ref, time_slot); } int roadmap_line_speed_get_avg_speed (int line, int against_dir) { int speed_ref = get_speed_ref (line, against_dir); if (speed_ref == INVALID_SPEED) return 0; return roadmap_line_speed_get_avg (speed_ref); } --- NEW FILE: roadmap_line_speed.h --- /* * LICENSE: * * Copyright 2006 Ehud Shabtai * Copyright (c) 2008, 2009 Danny Backx * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief roadmap_line_speed.h - Manage the line speed data. */ #ifndef _ROADMAP_LINE_SPEED__H_ #define _ROADMAP_LINE_SPEED__H_ #include <time.h> #include "roadmap_types.h" #include "roadmap_dbread.h" #include "roadmap_db_line_speed.h" extern roadmap_db_handler RoadMapLineSpeedHandler; int roadmap_line_speed_get_avg (int speed_ref); int roadmap_line_speed_get (int speed_ref, int time_slot); int roadmap_line_speed_get_cross_times (int line, LineRouteTime *from, LineRouteTime *to); int roadmap_line_speed_get_cross_time_at (int line, int against_dir, int time_slot); int roadmap_line_speed_get_avg_cross_time (int line, int against_dir); int roadmap_line_speed_get_cross_time (int line, int against_dir); int roadmap_line_speed_get_speed (int line, int against_dir); int roadmap_line_speed_get_avg_speed (int line, int against_dir); #endif // _ROADMAP_LINE_SPEED__H_ --- NEW FILE: roadmap_db_line_route.h --- /* * LICENSE: * * Copyright 2005 Ehud Shabtai * Copyright (c) 2008, Danny Backx * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief the format of a line's route data * * RoadMap's lines route data is described by the following table: * line_route for each line its direction and cross time and allowed speed are specified */ #ifndef _ROADMAP_DB_LINE_ROUTE__H_ #define _ROADMAP_DB_LINE_ROUTE__H_ #include "roadmap_types.h" #define ROUTE_CAR_ALLOWED 0x1 /** * @brief table line_route */ typedef struct { unsigned char from_flags; unsigned char to_flags; unsigned char from_turn_res; unsigned char to_turn_res; } RoadMapLineRoute; #endif // _ROADMAP_DB_LINE_ROUTE__H_ --- NEW FILE: roadmap_res.h --- /* roadmap_res.h - Resources manager * * LICENSE: * * Copyright 2006 Ehud Shabtai * * 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 _ROADMAP_RES__H_ #define _ROADMAP_RES__H_ #define RES_BITMAP 0 #define RES_SOUND 1 #define MAX_RESOURCES 2 /* Flags */ #define RES_SKIN 0x1 #define RES_NOCACHE 0x2 #define RES_NOCREATE 0x4 void *roadmap_res_get (unsigned int type, unsigned int flags, const char *name); void roadmap_res_shutdown (void); #endif // _ROADMAP_RES__H_ Index: roadmap_navigate.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_navigate.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** roadmap_navigate.h 2 Nov 2006 01:39:23 -0000 1.7 --- roadmap_navigate.h 15 Feb 2009 16:47:49 -0000 1.8 *************** *** 1,4 **** ! /* roadmap_navigate.h - basic navigation engine. ! * * LICENSE: * --- 1,3 ---- ! /* * LICENSE: * *************** *** 22,25 **** --- 21,28 ---- */ + /** + * @file + * @brief roadmap_navigate.h - basic navigation engine. + */ #ifndef INCLUDED__ROADMAP_NAVIGATE__H #define INCLUDED__ROADMAP_NAVIGATE__H *************** *** 40,42 **** --- 43,80 ---- void roadmap_navigate_initialize (void); + #if defined(HAVE_TRIP_PLUGIN) || defined(HAVE_NAVIGATE_PLUGIN) + typedef struct { + void (*update) (RoadMapPosition *position, PluginLine *current); + void (*get_next_line) (PluginLine *current, int direction, PluginLine *next); + } RoadMapNavigateRouteCB; + #endif + + #include "roadmap_fuzzy.h" + typedef struct { + RoadMapFuzzy direction; + RoadMapFuzzy distance; + RoadMapFuzzy connected; + } RoadMapDebug; + /** + * @brief + */ + typedef struct { + int valid; /**< */ + PluginStreet street; /**< */ + int direction; /**< */ + RoadMapFuzzy fuzzyfied; /**< */ + PluginLine intersection; /**< */ + RoadMapPosition entry; /**< */ + RoadMapDebug debug; /**< */ + } RoadMapTracking; + /* static */ int roadmap_navigate_fuzzify (RoadMapTracking *tracked, + RoadMapNeighbour *line, int direction); + /* static */ int roadmap_navigate_get_neighbours (const RoadMapArea *focus, + const RoadMapPosition *position, + RoadMapNeighbour *neighbours, int max, + int navigation_mode); + PluginLine *roadmap_navigate_position2line(RoadMapPosition pos); + int roadmap_navigate_get_mode(void); + int roadmap_navigate_find_intersection (const RoadMapGpsPosition *position, + PluginLine *found, int navigation_mode); #endif // INCLUDED__ROADMAP_NAVIGATE__H --- NEW FILE: roadmap_turns.c --- /* * LICENSE: * * Copyright 2006 Ehud Shabtai. * Copyright (c) 2009, Danny Backx * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief Manage turn restrictions db. * * int roadmap_turns_in_square (int square, int *first, int *last); * int roadmap_turns_of_node (int node, int begin, int end, * int *first, int *last); * int roadmap_turns_find_restriction (int node, int from_line, int to_line); * * These functions are used to retrieve the turn restrictions that belong to a node. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "roadmap.h" #include "roadmap_dbread.h" #include "roadmap_db_turns.h" #include "roadmap_point.h" #include "roadmap_turns.h" #include "roadmap_square.h" static char *RoadMapTurnsType = "RoadMapTurnsContext"; typedef struct { char *type; RoadMapTurns *Turns; int TurnsCount; RoadMapTurnsByNode *TurnsByNode; int TurnsByNodeCount; RoadMapTurnsBySquare *TurnsBySquare; int TurnsBySquareCount; int *turns_cache; int turns_cache_size; /* This is the size in bits ! */ } RoadMapTurnsContext; static RoadMapTurnsContext *RoadMapTurnsActive = NULL; static int RoadMapTurns2Mask[8*sizeof(int)] = {0}; static void *roadmap_turns_map (roadmap_db *root) { unsigned i; RoadMapTurnsContext *context; roadmap_db *turns_table; roadmap_db *node_table; roadmap_db *square_table; for (i = 0; i < 8*sizeof(int); i++) { RoadMapTurns2Mask[i] = 1 << i; } context = malloc(sizeof(RoadMapTurnsContext)); roadmap_check_allocated(context); context->type = RoadMapTurnsType; turns_table = roadmap_db_get_subsection (root, "data"); node_table = roadmap_db_get_subsection (root, "bynode"); square_table = roadmap_db_get_subsection (root, "bysquare"); context->Turns = (RoadMapTurns *) roadmap_db_get_data (turns_table); context->TurnsCount = roadmap_db_get_count (turns_table); if (roadmap_db_get_size (turns_table) != context->TurnsCount * sizeof(RoadMapTurns)) { roadmap_log (ROADMAP_FATAL, "invalid turns/data structure"); } context->TurnsByNode = (RoadMapTurnsByNode *) roadmap_db_get_data (node_table); context->TurnsByNodeCount = roadmap_db_get_count (node_table); if (roadmap_db_get_size (node_table) != context->TurnsByNodeCount * sizeof(RoadMapTurnsByNode)) { roadmap_log (ROADMAP_FATAL, "invalid turns/byline structure"); } context->TurnsBySquare = (RoadMapTurnsBySquare *) roadmap_db_get_data (square_table); context->TurnsBySquareCount = roadmap_db_get_count (square_table); if (roadmap_db_get_size (square_table) != context->TurnsBySquareCount * sizeof(RoadMapTurnsBySquare)) { roadmap_log (ROADMAP_FATAL, "invalid turns/bysquare structure"); } context->turns_cache = NULL; context->turns_cache_size = 0; return context; } static void roadmap_turns_activate (void *context) { RoadMapTurnsContext *turns_context = (RoadMapTurnsContext *) context; if (turns_context != NULL) { if (turns_context->type != RoadMapTurnsType) { roadmap_log (ROADMAP_FATAL, "cannot activate turns (bad type)"); } if (turns_context->turns_cache == NULL) { turns_context->turns_cache_size = roadmap_point_count(); turns_context->turns_cache = calloc ((turns_context->turns_cache_size / (8 * sizeof(int))) + 1, sizeof(int)); roadmap_check_allocated(turns_context->turns_cache); } } RoadMapTurnsActive = turns_context; } static void roadmap_turns_unmap (void *context) { RoadMapTurnsContext *turns_context = (RoadMapTurnsContext *) context; if (turns_context->type != RoadMapTurnsType) { roadmap_log (ROADMAP_FATAL, "cannot unmap turns (bad type)"); } if (RoadMapTurnsActive == turns_context) { RoadMapTurnsActive = NULL; } if (turns_context->turns_cache != NULL) { free (turns_context->turns_cache); } free(turns_context); } roadmap_db_handler RoadMapTurnsHandler = { "turns", roadmap_turns_map, roadmap_turns_activate, roadmap_turns_unmap }; int roadmap_turns_in_square (int square, int *first, int *last) { RoadMapTurnsBySquare *TurnsBySquare; if (RoadMapTurnsActive == NULL) return 0; square = roadmap_square_index(square); if (square >= 0 && square < RoadMapTurnsActive->TurnsBySquareCount) { TurnsBySquare = RoadMapTurnsActive->TurnsBySquare; *first = TurnsBySquare[square].first; *last = TurnsBySquare[square].first + TurnsBySquare[square].count - 1; return TurnsBySquare[square].count; } return 0; } int roadmap_turns_of_node (int node, int begin, int end, int *first, int *last) { int middle = 0; RoadMapTurnsByNode *turns_by_node; if (RoadMapTurnsActive == NULL) return 0; if (node >= 0 && node < RoadMapTurnsActive->turns_cache_size) { int mask = RoadMapTurnsActive->turns_cache[node / (8 * sizeof(int))]; if (mask & RoadMapTurns2Mask[node & ((8*sizeof(int))-1)]) { return 0; } } turns_by_node = RoadMapTurnsActive->TurnsByNode; begin--; end++; while (end - begin > 1) { middle = (begin + end) / 2; if (node < turns_by_node[middle].node) { end = middle; } else if (node > turns_by_node[middle].node) { begin = middle; } else { end = middle; break; } } if (turns_by_node[end].node == node) { *first = turns_by_node[end].first; *last = turns_by_node[end].first + turns_by_node[end].count - 1; return turns_by_node[end].count; } RoadMapTurnsActive->turns_cache[node / (8 * sizeof(int))] |= RoadMapTurns2Mask[node & ((8*sizeof(int))-1)]; return 0; } int roadmap_turns_find_restriction (int node, int from_line, int to_line) { static int cache_square = -1; static int cache_first = -1; static int cache_last = -1; RoadMapPosition pos; int square; int first_turn; int last_turn; int i; from_line = abs(from_line); to_line = abs(to_line); /* no U turns */ if (from_line == to_line) return 1; roadmap_point_position (node, &pos); square = roadmap_square_search (&pos); if (square != cache_square) { cache_square = square; if (!roadmap_turns_in_square (cache_square, &cache_first, &cache_last)) { cache_first = cache_last = -1; } } if (cache_first < 0) return 0; i = roadmap_turns_of_node (node, cache_first, cache_last, &first_turn, &last_turn); if (!i) return 0; for (; first_turn <= last_turn; first_turn++) { if ((RoadMapTurnsActive->Turns[first_turn].from_line == from_line) && RoadMapTurnsActive->Turns[first_turn].to_line == to_line) { return 1; } } return 0; } --- NEW FILE: roadmap_line_route.c --- /* * LICENSE: * * Copyright 2005 Ehud Shabtai * Copyright (c) 2008, 2009, Danny Backx. * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief Manage line route data */ #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "roadmap.h" #include "roadmap_dbread.h" #include "roadmap_line.h" #include "roadmap_line_speed.h" #include "roadmap_line_route.h" #define MAX_ROUTE_TIME (LineRouteTime) 0xFFFF static char *RoadMapLineRouteType = "RoadMapLineRouteContext"; /** * @brief */ typedef struct { char *type; /**< */ RoadMapLineRoute *LineRoute; /**< */ int LineRouteCount; /**< */ } RoadMapLineRouteContext; /** * @brief */ static RoadMapLineRouteContext *RoadMapLineRouteActive = NULL; /** * @brief * @param root * @return */ static void *roadmap_line_route_map (roadmap_db *root) { RoadMapLineRouteContext *context; roadmap_db *data_table; context = (RoadMapLineRouteContext *) malloc (sizeof(RoadMapLineRouteContext)); if (context == NULL) { roadmap_log (ROADMAP_ERROR, "no more memory (roadmap_line_route)"); return NULL; } context->type = RoadMapLineRouteType; data_table = roadmap_db_get_subsection (root, "data"); context->LineRoute = (RoadMapLineRoute *) roadmap_db_get_data (data_table); context->LineRouteCount = roadmap_db_get_count (data_table); if (roadmap_db_get_size (data_table) != context->LineRouteCount * sizeof(RoadMapLineRoute)) { roadmap_log (ROADMAP_ERROR, "invalid line route data structure"); free(context); return NULL; } return context; } /** * @brief * @param context * @return */ static void roadmap_line_route_activate (void *context) { RoadMapLineRouteContext *line_route_context = (RoadMapLineRouteContext *) context; if ((line_route_context != NULL) && (line_route_context->type != RoadMapLineRouteType)) { roadmap_log (ROADMAP_FATAL, "invalid line route context activated"); } RoadMapLineRouteActive = line_route_context; } /** * @brief * @param context * @return */ static void roadmap_line_route_unmap (void *context) { RoadMapLineRouteContext *line_route_context = (RoadMapLineRouteContext *) context; if (line_route_context->type != RoadMapLineRouteType) { roadmap_log (ROADMAP_FATAL, "unmapping invalid line context"); } free (line_route_context); } /** * @brief * @return */ roadmap_db_handler RoadMapLineRouteHandler = { "line_route", roadmap_line_route_map, roadmap_line_route_activate, roadmap_line_route_unmap }; /** * @brief * @param line * @param who * @return */ int roadmap_line_route_get_direction (int line, int who) { RoadMapLineRoute *route; if (RoadMapLineRouteActive == NULL) return 0; /* No data. */ if (RoadMapLineRouteActive->LineRouteCount <= line) return 0; route = &RoadMapLineRouteActive->LineRoute[line]; if ((route->from_flags & who) && (route->to_flags & who)) { return ROUTE_DIRECTION_ANY; } else if (!(route->from_flags & who) && !(route->to_flags & who)) { return ROUTE_DIRECTION_NONE; } else if (route->from_flags & who) { return ROUTE_DIRECTION_WITH_LINE; } else { return ROUTE_DIRECTION_AGAINST_LINE; } } /** * @brief * @param line * @param from * @param to * @return */ int roadmap_line_route_get_flags (int line, LineRouteFlag *from, LineRouteFlag *to) { RoadMapLineRoute *route; if (RoadMapLineRouteActive == NULL) return -1; /* No data. */ if (RoadMapLineRouteActive->LineRouteCount <= line) return -1; route = &RoadMapLineRouteActive->LineRoute[line]; *from = route->from_flags; *to = route->to_flags; return 0; } /** * @brief * @param line * @param from * @param to * @return */ int roadmap_line_route_get_speed_limit (int line, LineRouteMax *from, LineRouteMax *to) { RoadMapLineRoute *route; if (RoadMapLineRouteActive == NULL) return -1; /* No data. */ if (RoadMapLineRouteActive->LineRouteCount <= line) return -1; route = &RoadMapLineRouteActive->LineRoute[line]; *from = *to = 0; return 0; } /** * @brief * @param line * @param against_dir * @return */ int roadmap_line_route_get_restrictions (int line, int against_dir) { RoadMapLineRoute *route; if (RoadMapLineRouteActive == NULL) return -1; /* No data. */ assert (line < RoadMapLineRouteActive->LineRouteCount); route = &RoadMapLineRouteActive->LineRoute[line]; if (!against_dir) { return route->to_turn_res; } else { return route->from_turn_res; } } --- NEW FILE: roadmap_db_line_speed.h --- /* * LICENSE: * * Copyright 2006 Ehud Shabtai * Copyright (c) 2008, Danny Backx * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief the format of a line's speed data * * RoadMap's lines speed data is described by the following table: */ #ifndef _ROADMAP_DB_LINE_SPEED__H_ #define _ROADMAP_DB_LINE_SPEED__H_ #define INVALID_SPEED 0xFFFF #define SPEED_EOL 0x40 //#define SPPED_ 0x80 typedef struct { unsigned char from_avg_speed; unsigned char to_avg_speed; } RoadMapLineSpeedAvg; typedef struct { unsigned short from_speed_ref; unsigned short to_speed_ref; } RoadMapLineSpeed; typedef struct { unsigned char speed; unsigned char time_slot; } RoadMapLineSpeedRef; #endif // _ROADMAP_DB_LINE_SPEED__H_ --- NEW FILE: roadmap_turns.h --- /* * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief roadmap_turns.h - Manage the turn restrictions table. */ #ifndef _ROADMAP_TURNS__H_ #define _ROADMAP_TURNS__H_ #include "roadmap_types.h" #include "roadmap_dbread.h" int roadmap_turns_in_square (int square, int *first, int *last); int roadmap_turns_of_line (int line, int begin, int end, int *first, int *last); int roadmap_turns_find_restriction (int node, int from_line, int to_line); extern roadmap_db_handler RoadMapTurnsHandler; #endif // _ROADMAP_TURNS__H_ Index: roadmap_navigate.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_navigate.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** roadmap_navigate.c 17 Aug 2007 13:45:45 -0000 1.26 --- roadmap_navigate.c 15 Feb 2009 16:47:49 -0000 1.27 *************** *** 1,7 **** ! /* roadmap_navigate.c - Basic navigation engine for RoadMap. ! * * LICENSE: * * Copyright 2003 Pascal F. Martin * * This file is part of RoadMap. --- 1,7 ---- ! /* * LICENSE: * * Copyright 2003 Pascal F. Martin + * Copyright (c) 2008, 2009, Danny Backx * * This file is part of RoadMap. *************** *** 20,27 **** * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * SYNOPSYS: ! * ! * See roadmap_navigate.h. */ --- 20,30 ---- * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + /** + * @file + * @brief Basic navigation support engine for RoadMap. * ! * This module keeps track of where we are and which street we're on. */ *************** *** 44,100 **** #include "roadmap_navigate.h" - - - typedef struct { - RoadMapFuzzy direction; - RoadMapFuzzy distance; - RoadMapFuzzy connected; - } RoadMapDebug; - static RoadMapConfigDescriptor RoadMapNavigateFlag = ROADMAP_CONFIG_ITEM("Navigation", "Enable"); ! /* The navigation flag will be set according to the session's content, ! * so that the user selected state is kept from one session to ! * the next. */ static int RoadMapNavigateEnabled = 0; - static int RoadMapCarMode; - - /* Avoid doing navigation work when the position has not changed. */ static RoadMapGpsPosition RoadMapLatestGpsPosition; static RoadMapPosition RoadMapLatestPosition; - typedef struct { - - int valid; - PluginStreet street; - - int direction; - - RoadMapFuzzy fuzzyfied; - - PluginLine intersection; - - RoadMapPosition entry; - - RoadMapDebug debug; - - } RoadMapTracking; - #define ROADMAP_TRACKING_NULL {0, PLUGIN_STREET_NULL, 0, 0, PLUGIN_LINE_NULL, {0, 0}, {0, 0, 0}}; ! #define ROADMAP_NEIGHBOURHOUD 16 static RoadMapTracking RoadMapConfirmedStreet = ROADMAP_TRACKING_NULL; static RoadMapNeighbour RoadMapConfirmedLine = ROADMAP_NEIGHBOUR_NULL; - static RoadMapNeighbour RoadMapNeighbourhood[ROADMAP_NEIGHBOURHOUD]; ! static void roadmap_navigate_trace (const char *format, PluginLine *line) { ! char text[1024]; PluginStreet street; --- 47,100 ---- #include "roadmap_navigate.h" static RoadMapConfigDescriptor RoadMapNavigateFlag = ROADMAP_CONFIG_ITEM("Navigation", "Enable"); ! /** ! * @brief The navigation flag will be set according to the session's content, ! * so that the user selected state is kept from one session to * the next. */ static int RoadMapNavigateEnabled = 0; /* Avoid doing navigation work when the position has not changed. */ static RoadMapGpsPosition RoadMapLatestGpsPosition; static RoadMapPosition RoadMapLatestPosition; #define ROADMAP_TRACKING_NULL {0, PLUGIN_STREET_NULL, 0, 0, PLUGIN_LINE_NULL, {0, 0}, {0, 0, 0}}; ! #define ROADMAP_NEIGHBOURHOOD 16 + /** + * @brief the street we're on in the current position + */ static RoadMapTracking RoadMapConfirmedStreet = ROADMAP_TRACKING_NULL; + /** + * @brief the line we're on in the current posiion + */ static RoadMapNeighbour RoadMapConfirmedLine = ROADMAP_NEIGHBOUR_NULL; + /** + * @brief local temporary storage with a list of roads close by + */ + static RoadMapNeighbour RoadMapNeighbourhood[ROADMAP_NEIGHBOURHOOD]; ! /** ! * @brief Navigation mode, defaults to 0. ! * Whatever that may be, probably "Car" as this is the first entry in the ! * default default/All file under "Class.NavigationModes". ! */ ! static int RoadMapNavigateMode = 0; ! ! /** ! * @brief query the navigation mode ! * @return the current navigation mode ! */ ! int roadmap_navigate_get_mode(void) ! { ! return RoadMapNavigateMode; ! } ! ! static void roadmap_navigate_trace (const char *format, PluginLine *line) ! { char text[1024]; PluginStreet street; *************** *** 121,130 **** } ! ! static int roadmap_navigate_get_neighbours ! (const RoadMapArea *focus, const RoadMapPosition *position, ! RoadMapNeighbour *neighbours, int max) { ! int count; int layers[128]; --- 121,138 ---- } ! /** ! * @brief ! * @param focus ! * @param position ! * @param neighbours ! * @param max ! * @param navigation_mode ! * @return ! */ ! int roadmap_navigate_get_neighbours (const RoadMapArea *focus, const RoadMapPosition *position, ! RoadMapNeighbour *neighbours, int max, ! int navigation_mode) ! { int count; int layers[128]; *************** *** 132,136 **** roadmap_log_push ("roadmap_navigate_get_neighbours"); ! count = roadmap_layer_navigable (RoadMapCarMode, layers, 128); if (count > 0) { --- 140,144 ---- roadmap_log_push ("roadmap_navigate_get_neighbours"); ! count = roadmap_layer_navigable (navigation_mode, layers, 128); if (count > 0) { *************** *** 149,155 **** } ! ! void roadmap_navigate_disable (void) { ! RoadMapNavigateEnabled = 0; roadmap_display_hide ("Approach"); --- 157,165 ---- } ! /** ! * @brief ! */ ! void roadmap_navigate_disable (void) ! { RoadMapNavigateEnabled = 0; roadmap_display_hide ("Approach"); *************** *** 159,165 **** } ! ! void roadmap_navigate_enable (void) { ! RoadMapNavigateEnabled = 1; --- 169,177 ---- } ! /** ! * @brief ! */ ! void roadmap_navigate_enable (void) ! { RoadMapNavigateEnabled = 1; *************** *** 167,171 **** } ! int roadmap_navigate_retrieve_line (const RoadMapArea *focus, const RoadMapPosition *position, --- 179,190 ---- } ! /** ! * @brief ! * @param focus ! * @param position ! * @param line ! * @param distance ! * @return ! */ int roadmap_navigate_retrieve_line (const RoadMapArea *focus, const RoadMapPosition *position, *************** *** 174,180 **** RoadMapNeighbour closest; ! if (roadmap_navigate_get_neighbours ! (focus, position, &closest, 1) <= 0) { return -1; --- 193,199 ---- RoadMapNeighbour closest; + int navigation_mode = roadmap_navigate_get_mode(); ! if (roadmap_navigate_get_neighbours (focus, position, &closest, 1, navigation_mode) <= 0) { return -1; *************** *** 190,199 **** } ! ! ! static int roadmap_navigate_fuzzify ! (RoadMapTracking *tracked, ! RoadMapNeighbour *line, int direction) { ! RoadMapFuzzy fuzzyfied_distance; RoadMapFuzzy fuzzyfied_direction; --- 209,221 ---- } ! /** ! * @brief ! * @param tracked ! * @param line ! * @param direction ! * @return ! */ ! int roadmap_navigate_fuzzify (RoadMapTracking *tracked, RoadMapNeighbour *line, int direction) ! { RoadMapFuzzy fuzzyfied_distance; RoadMapFuzzy fuzzyfied_direction; *************** *** 216,222 **** if (RoadMapConfirmedStreet.valid) { ! connected = ! roadmap_fuzzy_connected ! (line, &RoadMapConfirmedLine, &tracked->entry); } else { connected = roadmap_fuzzy_not (0); --- 238,242 ---- if (RoadMapConfirmedStreet.valid) { ! connected = roadmap_fuzzy_connected (line, &RoadMapConfirmedLine, &tracked->entry); } else { connected = roadmap_fuzzy_not (0); *************** *** 227,239 **** tracked->debug.connected = connected; ! return roadmap_fuzzy_and ! (connected, roadmap_fuzzy_and (fuzzyfied_distance, fuzzyfied_direction)); } ! ! static int roadmap_navigate_confirm_intersection ! (const RoadMapGpsPosition *position) { ! int delta; --- 247,261 ---- tracked->debug.connected = connected; ! return roadmap_fuzzy_and (connected, roadmap_fuzzy_and (fuzzyfied_distance, fuzzyfied_direction)); } ! /** ! * @brief ! * @param position ! * @return ! */ ! static int roadmap_navigate_confirm_intersection (const RoadMapGpsPosition *position) ! { int delta; *************** *** 247,260 **** ! /* Check if the given street block is a possible intersection and * evaluate how good an intersection guess it would be. * The criteria for a good intersection is that it must be as far * as possible from matching our current direction. */ ! static RoadMapFuzzy roadmap_navigate_is_intersection ! (PluginLine *line, ! int direction, ! const RoadMapPosition *crossing) { ! RoadMapPosition line_to; RoadMapPosition line_from; --- 269,286 ---- ! /** ! * @brief Check if the given street block is a possible intersection and * evaluate how good an intersection guess it would be. * The criteria for a good intersection is that it must be as far * as possible from matching our current direction. + * + * @param line + * @param direction + * @param crossing + * @return */ ! static RoadMapFuzzy roadmap_navigate_is_intersection (PluginLine *line, ! int direction, const RoadMapPosition *crossing) ! { RoadMapPosition line_to; RoadMapPosition line_from; *************** *** 277,289 **** } ! return roadmap_fuzzy_not ! (roadmap_fuzzy_direction ! (roadmap_math_azymuth (&line_from, &line_to), ! direction, ! 1)); } ! ! /* Find the next intersection point. * We compare the current direction with the azimuth to the two ends of * the closest segment of line. From there, we deduct which end of the line --- 303,312 ---- } ! return roadmap_fuzzy_not (roadmap_fuzzy_direction ! (roadmap_math_azymuth (&line_from, &line_to), direction, 1)); } ! /** ! * @brief Find the next intersection point. * We compare the current direction with the azimuth to the two ends of * the closest segment of line. From there, we deduct which end of the line *************** *** 293,300 **** * Once we know where we are going, we select a street that intersects * this point and seems the best guess as an intersection. */ ! static int roadmap_navigate_find_intersection ! (const RoadMapGpsPosition *position, PluginLine *found) { ! int layer; int square; --- 316,328 ---- * Once we know where we are going, we select a street that intersects * this point and seems the best guess as an intersection. + * + * @param position + * @param found + * @param navigation_mode + * @return */ ! int roadmap_navigate_find_intersection (const RoadMapGpsPosition *position, ! PluginLine *found, int navigation_mode) ! { int layer; int square; *************** *** 318,332 **** ! delta_from = ! roadmap_math_delta_direction ! (position->steering, ! roadmap_math_azymuth (&RoadMapLatestPosition, ! &RoadMapConfirmedLine.from)); ! delta_to = ! roadmap_math_delta_direction ! (position->steering, ! roadmap_math_azymuth (&RoadMapLatestPosition, ! &RoadMapConfirmedLine.to)); if (delta_to < delta_from - 30) { --- 346,354 ---- ! delta_from = roadmap_math_delta_direction (position->steering, ! roadmap_math_azymuth (&RoadMapLatestPosition, &RoadMapConfirmedLine.from)); ! delta_to = roadmap_math_delta_direction (position->steering, ! roadmap_math_azymuth (&RoadMapLatestPosition, &RoadMapConfirmedLine.to)); if (delta_to < delta_from - 30) { *************** *** 354,358 **** int i; int layers[128]; ! int count = roadmap_layer_navigable (RoadMapCarMode, layers, 128); for (i = 0; i < count; ++i) { --- 376,380 ---- int i; int layers[128]; ! int count = roadmap_layer_navigable (navigation_mode, layers, 128); for (i = 0; i < count; ++i) { *************** *** 439,462 **** /* Search among the plugin lines. */ ! count = roadmap_plugin_find_connected_lines ! (&crossing, ! plugin_lines, sizeof(plugin_lines)/sizeof(*plugin_lines)); for (i=0; i<count; ++i) { - PluginStreet street; ! match = roadmap_navigate_is_intersection ! (&plugin_lines[i], position->steering, &crossing); if (best_match < match) { - roadmap_plugin_get_street (&plugin_lines[i], &street); ! if (!roadmap_plugin_same_street ! (&street, ! &RoadMapConfirmedStreet.street)) { ! *found = plugin_lines[i]; best_match = match; --- 461,476 ---- /* Search among the plugin lines. */ ! count = roadmap_plugin_find_connected_lines (&crossing, plugin_lines, sizeof(plugin_lines)/sizeof(*plugin_lines)); for (i=0; i<count; ++i) { PluginStreet street; ! match = roadmap_navigate_is_intersection (&plugin_lines[i], position->steering, &crossing); if (best_match < match) { roadmap_plugin_get_street (&plugin_lines[i], &street); ! if (!roadmap_plugin_same_street (&street, &RoadMapConfirmedStreet.street)) { *found = plugin_lines[i]; best_match = match; *************** *** 471,479 **** } ! roadmap_navigate_trace ! ("Announce crossing %N, %C|Announce crossing %N", found); ! if (! roadmap_plugin_same_line ! (found, &RoadMapConfirmedStreet.intersection)) { PluginStreet street; RoadMapConfirmedStreet.intersection = *found; --- 485,491 ---- } ! roadmap_navigate_trace ("Announce crossing %N, %C|Announce crossing %N", found); ! if (! roadmap_plugin_same_line (found, &RoadMapConfirmedStreet.intersection)) { PluginStreet street; RoadMapConfirmedStreet.intersection = *found; *************** *** 484,490 **** } ! ! void roadmap_navigate_locate (const RoadMapGpsPosition *gps_position) { ! int i; int found; --- 496,508 ---- } ! /** ! * @brief called periodically (from roadmap_start_gps_listen) when new GPS info is available ! * ! * Influences RoadMapConfirmedStreet and RoadMapConfirmedLine ! * ! * @param gps_position the position info ! */ ! void roadmap_navigate_locate (const RoadMapGpsPosition *gps_position) ! { int i; int found; *************** *** 498,507 **** RoadMapArea focus; if (! RoadMapNavigateEnabled) { ! ! if (strcasecmp ! (roadmap_config_get (&RoadMapNavigateFlag), "yes") == 0) { RoadMapNavigateEnabled = 1; } else { --- 516,524 ---- RoadMapArea focus; + int navigation_mode = roadmap_navigate_get_mode(); if (! RoadMapNavigateEnabled) { ! if (strcasecmp (roadmap_config_get (&RoadMapNavigateFlag), "yes") == 0) { RoadMapNavigateEnabled = 1; } else { *************** *** 511,520 **** if ((RoadMapLatestGpsPosition.latitude == gps_position->latitude) && ! (RoadMapLatestGpsPosition.longitude == gps_position->longitude)) return; RoadMapLatestGpsPosition = *gps_position; ! if (gps_position->speed < roadmap_gps_speed_accuracy()) return; ! roadmap_fuzzy_start_cycle (); --- 528,538 ---- if ((RoadMapLatestGpsPosition.latitude == gps_position->latitude) && ! (RoadMapLatestGpsPosition.longitude == gps_position->longitude)) ! return; RoadMapLatestGpsPosition = *gps_position; ! if (gps_position->speed < roadmap_gps_speed_accuracy()) ! return; roadmap_fuzzy_start_cycle (); *************** *** 523,533 **** if (RoadMapConfirmedStreet.valid) { - /* We have an existing street match: check it is still valid. */ RoadMapFuzzy before = RoadMapConfirmedStreet.fuzzyfied; ! if (roadmap_plugin_activate_db ! (&RoadMapConfirmedLine.line) == -1) { return; } --- 541,549 ---- if (RoadMapConfirmedStreet.valid) { /* We have an existing street match: check it is still valid. */ RoadMapFuzzy before = RoadMapConfirmedStreet.fuzzyfied; ! if (roadmap_plugin_activate_db (&RoadMapConfirmedLine.line) == -1) { return; } *************** *** 536,546 **** &RoadMapConfirmedLine); ! if (roadmap_navigate_fuzzify ! (&RoadMapConfirmedStreet, &RoadMapConfirmedLine, gps_position->steering) >= before) { if (! roadmap_navigate_confirm_intersection (gps_position)) { PluginLine p_line; ! roadmap_navigate_find_intersection (gps_position, &p_line); } --- 552,561 ---- &RoadMapConfirmedLine); ! if (roadmap_navigate_fuzzify (&RoadMapConfirmedStreet, &RoadMapConfirmedLine, gps_position->steering) >= before) { if (! roadmap_navigate_confirm_intersection (gps_position)) { PluginLine p_line; ! roadmap_navigate_find_intersection (gps_position, &p_line, navigation_mode); } *************** *** 551,565 **** /* We must search again for the best street match. */ ! roadmap_math_focus_area ! (&focus, &RoadMapLatestPosition, roadmap_fuzzy_max_distance()); ! count = roadmap_navigate_get_neighbours ! (&focus, &RoadMapLatestPosition, ! RoadMapNeighbourhood, ROADMAP_NEIGHBOURHOUD); for (i = 0, best = roadmap_fuzzy_false(), found = 0; i < count; ++i) { ! ! result = roadmap_navigate_fuzzify ! (&candidate, RoadMapNeighbourhood+i, gps_position->steering); --- 566,576 ---- /* We must search again for the best street match. */ ! roadmap_math_focus_area (&focus, &RoadMapLatestPosition, roadmap_fuzzy_max_distance()); ! count = roadmap_navigate_get_neighbours (&focus, &RoadMapLatestPosition, ! RoadMapNeighbourhood, ROADMAP_NEIGHBOURHOOD, navigation_mode); for (i = 0, best = roadmap_fuzzy_false(), found = 0; i < count; ++i) { ! result = roadmap_navigate_fuzzify (&candidate, RoadMapNeighbourhood+i, gps_position->steering); *************** *** 572,591 **** if (roadmap_fuzzy_is_acceptable (best)) { ! ! if (roadmap_plugin_activate_db ! (&RoadMapNeighbourhood[found].line) == -1) { return; } ! if (! roadmap_plugin_same_line ! (&RoadMapConfirmedLine.line, &RoadMapNeighbourhood[found].line)) { if (PLUGIN_VALID(RoadMapConfirmedLine.line)) { ! roadmap_navigate_trace ! ("Quit street %N", &RoadMapConfirmedLine.line); } ! roadmap_navigate_trace ! ("Enter street %N, %C|Enter street %N", &RoadMapNeighbourhood[found].line); --- 583,597 ---- if (roadmap_fuzzy_is_acceptable (best)) { ! if (roadmap_plugin_activate_db (&RoadMapNeighbourhood[found].line) == -1) { return; } ! if (! roadmap_plugin_same_line (&RoadMapConfirmedLine.line, &RoadMapNeighbourhood[found].line)) { if (PLUGIN_VALID(RoadMapConfirmedLine.line)) { ! roadmap_navigate_trace ("Quit street %N", &RoadMapConfirmedLine.line); } ! roadmap_navigate_trace ("Enter street %N, %C|Enter street %N", &RoadMapNeighbourhood[found].line); *************** *** 600,625 **** INVALIDATE_PLUGIN(RoadMapConfirmedStreet.intersection); ! roadmap_display_activate ! ("Current Street", ! &RoadMapConfirmedLine.line, ! NULL, ! &RoadMapConfirmedStreet.street); if (gps_position->speed > roadmap_gps_speed_accuracy()) { PluginLine p_line; ! roadmap_navigate_find_intersection (gps_position, &p_line); } } else { - if (PLUGIN_VALID(RoadMapConfirmedLine.line)) { ! ! if (roadmap_plugin_activate_db ! (&RoadMapConfirmedLine.line) == -1) { return; } ! roadmap_navigate_trace ("Lost street %N", ! &RoadMapConfirmedLine.line); roadmap_display_hide ("Current Street"); roadmap_display_hide ("Approach"); --- 606,624 ---- INVALIDATE_PLUGIN(RoadMapConfirmedStreet.intersection); ! roadmap_display_activate ("Current Street", &RoadMapConfirmedLine.line, ! NULL, &RoadMapConfirmedStreet.street); if (gps_position->speed > roadmap_gps_speed_accuracy()) { PluginLine p_line; ! roadmap_navigate_find_intersection (gps_position, &p_line, navigation_mode); } } else { if (PLUGIN_VALID(RoadMapConfirmedLine.line)) { ! if (roadmap_plugin_activate_db (&RoadMapConfirmedLine.line) == -1) { return; } ! roadmap_navigate_trace ("Lost street %N", &RoadMapConfirmedLine.line); roadmap_display_hide ("Current Street"); roadmap_display_hide ("Approach"); *************** *** 631,641 **** } ! void roadmap_navigate_initialize (void) { ! ! RoadMapCarMode = roadmap_layer_declare_navigation_mode ("Car"); ! roadmap_config_declare_enumeration ! ("session", &RoadMapNavigateFlag, "yes", "no", NULL); } --- 630,683 ---- } + /** + * @brief initialize this module + */ + void roadmap_navigate_initialize (void) + { + int RoadMapNavigationClasses; ! RoadMapNavigationClasses = roadmap_layer_declare_navigation_mode ("Classes"); ! roadmap_config_declare_enumeration ("session", &RoadMapNavigateFlag, "yes", "no", NULL); ! } ! /** ! * @brief query current street ! */ ! RoadMapTracking *roadmap_navigate_get_confirmed_street(void) ! { ! return &RoadMapConfirmedStreet; } + /** + * @brief determine a street for a given position, ignoring vehicle/direction + * @param pos + * @return the street (pointer to a static variable !) + */ + PluginLine *roadmap_navigate_position2line(RoadMapPosition pos) + { + RoadMapNeighbour nb[ROADMAP_NEIGHBOURHOOD]; + RoadMapTracking nominated, candidate; + RoadMapArea focus; + int found, result, best, i, num; + static PluginLine res; + + roadmap_math_focus_area(&focus, &pos, roadmap_fuzzy_max_distance()); + num = roadmap_navigate_get_neighbours(&focus, &pos, nb, ROADMAP_NEIGHBOURHOOD, + 0 /* some default vehicle */); + + best = roadmap_fuzzy_false(); + for (found=0, i=0; i<num; i++) { + result = roadmap_navigate_fuzzify(&candidate, &nb[i], + 0 /* some default direction */); + if (result > best) { + found = i; + best = result; + nominated = candidate; + } + } + if (roadmap_fuzzy_is_acceptable (best)) { + res = nb[found].line; + return &res; + } + return NULL; + } --- NEW FILE: roadmap_res.c --- /* roadmap_res.c - Resources manager (Bitmap, voices, etc') * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See roadmap_res.h */ #include <string.h> #include <stdio.h> #include <stdlib.h> #include "roadmap_canvas.h" #include "roadmap_sound.h" #include "roadmap_hash.h" #include "roadmap_list.h" #include "roadmap_path.h" #include "roadmap_res.h" #define BLOCK_SIZE 100 const char *ResourceName[] = { "bitmap_res", "sound_res" }; struct resource_slot { char *name; void *data; }; typedef struct roadmap_resource { RoadMapHash *hash; struct resource_slot *slots; int count; int max; int used_mem; int max_mem; } RoadMapResource; static RoadMapResource Resources[MAX_RESOURCES]; static void allocate_resource (unsigned int type) { RoadMapResource *res = &Resources[type]; res->hash = roadmap_hash_new (ResourceName[type], BLOCK_SIZE); res->slots = malloc (BLOCK_SIZE * sizeof (*res->slots)); res->max = BLOCK_SIZE; } static void *load_resource (unsigned int type, unsigned int flags, const char *name, int *mem) { const char *cursor; void *data = NULL; if (flags & RES_SKIN) { for (cursor = roadmap_path_first ("skin"); cursor != NULL; cursor = roadmap_path_next ("skin", cursor)) { switch (type) { case RES_BITMAP: *mem = 0; #warning roadmap_canvas_load_image required // data = roadmap_canvas_load_image (cursor, name); break; case RES_SOUND: data = roadmap_sound_load (cursor, name, mem); break; } if (data) break; } } else { const char *user_path = roadmap_path_user (); char *path; switch (type) { case RES_BITMAP: *mem = 0; path = roadmap_path_join (user_path, "icons"); // data = roadmap_canvas_load_image (path, name); roadmap_path_free (path); break; case RES_SOUND: path = roadmap_path_join (user_path, "sound"); data = roadmap_sound_load (path, name, mem); roadmap_path_free (path); break; } } return data; } static void free_resource (unsigned int type, int slot) { void *data = Resources[type].slots[slot].data; switch (type) { case RES_BITMAP: #warning roadmap_canvas_free_image required // roadmap_canvas_free_image ((RoadMapImage)data); break; case RES_SOUND: roadmap_sound_free ((RoadMapSound)data); break; } free (Resources[type].slots[slot].name); } static void *find_resource (unsigned int type, const char *name) { int hash; int i; RoadMapResource *res = &Resources[type]; if (!res->count) return NULL; hash = roadmap_hash_string (name); for (i = roadmap_hash_get_first (res->hash, hash); i >= 0; i = roadmap_hash_get_next (res->hash, i)) { if (!strcmp(name, res->slots[i].name)) { return res->slots[i].data; } } return NULL; } void... [truncated message content] |
|
From: Danny B. <dan...@us...> - 2009-02-15 16:47:59
|
Update of /cvsroot/roadmap/roadmap/src/unix In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28712/unix Modified Files: roadmap_path.c Log Message: Here's the rest ... Index: roadmap_path.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/unix/roadmap_path.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** roadmap_path.c 24 Oct 2008 15:50:01 -0000 1.28 --- roadmap_path.c 15 Feb 2009 16:47:49 -0000 1.29 *************** *** 1,7 **** ! /* roadmap_path.c - a module to handle file path in an OS independent way. * * LICENSE: * * Copyright 2002 Pascal F. Martin * * This file is part of RoadMap. --- 1,9 ---- ! /** ! * @brief roadmap_path.c - a module to handle file path in an OS independent way. * * LICENSE: * * Copyright 2002 Pascal F. Martin + * Copyright (c) 2008, Danny Backx. * * This file is part of RoadMap. *************** *** 21,27 **** * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * SYNOPSYS: - * - * See roadmap_path.h. */ --- 23,26 ---- *************** *** 160,167 **** --- 159,181 ---- }; + /* The default path for the skin files (the "skin" path): */ + static char *RoadMapPathSkin[] = { + "&\\skins\\default\\day", + "&\\skins\\default", + NULL + }; + static const char RoadMapPathSkinPreferred[] = "&\\skins"; + static char *roadmap_path_expand (const char *item, size_t length); static void roadmap_path_addlist(RoadMapList *list, char *path); + /** + * @brief + * @param name + * @param items + * @param preferred + * @return + */ static RoadMapPathList roadmap_path_list_create(const char *name, const char **items, *************** *** 194,197 **** --- 208,214 ---- } + /** + * @brief + */ struct { char *name; *************** *** 203,209 **** --- 220,233 ---- {"maps", RoadMapPathMaps, RoadMapPathMapsPreferred }, {"icons", RoadMapPathIcons, NULL}, + {"skin", RoadMapPathSkin, RoadMapPathSkinPreferred }, {"features", NULL, NULL}, }; + /** + * @brief look up the directory path(s) associated with a given keyword + * @param name the keyword + * @param init_ok create the file if it doesn't exist + * @return + */ static RoadMapPathList roadmap_path_find (const char *name, int init_ok) { *************** *** 463,467 **** } ! const char *roadmap_path_first (const char *name) { --- 487,495 ---- } ! /** ! * @brief look up the path list, return the first element of that list ! * @param name the keyword used to look up the list ! * @return first element ! */ const char *roadmap_path_first (const char *name) { *************** *** 480,484 **** } ! const char *roadmap_path_next (const char *name, const char *current) { --- 508,517 ---- } ! /** ! * @brief called after roadmap_path_first, return subsequent elements of the list ! * @param name keyword ! * @param current the previous path ! * @return the next one ! */ const char *roadmap_path_next (const char *name, const char *current) { *************** *** 564,567 **** --- 597,608 ---- static char *RoadMapPathEmptyList = NULL; + /** + * @brief create a list of files matching the specified path and extension + * There is no wildcarding mechanism here, except all files in this directory with the + * specified extension are a match. + * @param path is the directory name in which to look for files + * @param extension can be empty or NULL + * @return a list of file names + */ char **roadmap_path_list (const char *path, const char *extension) { *************** *** 607,613 **** --- 648,656 ---- if (! strcmp (match, extension)) { *(cursor++) = strdup (entry->d_name); + roadmap_log (ROADMAP_WARNING, "--> %s", entry->d_name); } } else { *(cursor++) = strdup (entry->d_name); + roadmap_log (ROADMAP_WARNING, "--> %s", entry->d_name); } } |
|
From: Danny B. <dan...@us...> - 2009-02-15 16:47:58
|
Update of /cvsroot/roadmap/roadmap/src/win32 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28712/win32 Modified Files: roadmap_path.c Log Message: Here's the rest ... Index: roadmap_path.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/win32/roadmap_path.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** roadmap_path.c 19 Oct 2008 16:01:06 -0000 1.13 --- roadmap_path.c 15 Feb 2009 16:47:49 -0000 1.14 *************** *** 3,7 **** * * Copyright 2005 Ehud Shabtai ! * Copyright 2008 Danny Backx * * Based on an implementation by Pascal F. Martin. --- 3,7 ---- * * Copyright 2005 Ehud Shabtai ! * Copyright (c) 2008, 2009 Danny Backx * * Based on an implementation by Pascal F. Martin. *************** *** 26,29 **** --- 26,30 ---- * @file * @brief handle file path in an OS independent way, this is the Windows CE implementation + * @ingroup windows */ *************** *** 122,125 **** --- 123,129 ---- if (i == ROADMAP_MAX_CARDS) return; + if (strlen(dir) == 0) + return; + if (RoadMapPathConfig == 0) { RoadMapPathConfig = (char **)calloc(ROADMAP_MAX_CARDS + 1, *************** *** 314,318 **** } ! char *roadmap_path_skip_directories (const char *name) { --- 318,326 ---- } ! /** ! * @brief skip over all directories, return just the file name ! * @param name input file name ! * @return point inside the string parameter passed ! */ char *roadmap_path_skip_directories (const char *name) { |
Update of /cvsroot/roadmap/roadmap/src/navigate In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28712/navigate Added Files: navigate.c navigate.h navigate_bar.c navigate_bar.h navigate_cost.c navigate_cost.h navigate_instr.c navigate_instr.h navigate_plugin.c navigate_plugin.h navigate_route.c navigate_route.h navigate_simple.c navigate_simple.h navigate_visual.c navigate_visual.h Log Message: Here's the rest ... --- NEW FILE: navigate_bar.c --- /* * LICENSE: * * Copyright 2006 Ehud Shabtai * Copyright (c) 2008, Danny Backx. * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief implement navigation bar */ #include <stdlib.h> #include <string.h> #include "roadmap.h" #include "roadmap_canvas.h" #include "roadmap_screen_obj.h" #include "roadmap_file.h" #include "roadmap_res.h" #include "roadmap_math.h" #include "navigate.h" #include "navigate_bar.h" /** * @brief */ typedef struct { const char *image_file; int min_screen_width; RoadMapGuiPoint instruction_pos; RoadMapGuiRect distance_rect; RoadMapGuiPoint distance_value_pos; RoadMapGuiPoint distance_unit_pos; int street_start; int street_width; } NavigateBarPanel; static NavigateBarPanel NavigateBarDefaultPanels[] = { {"nav_panel_wide", 320, {0, 0}, {0, 65, 48, 110}, {3, 70}, {3, 95}, 75, 230}, {"nav_panel", 240, {0, 0}, {55, 0, 95, 50}, {55, 5}, {58, 30}, 98, 133}, {"nav_panel_small", 176, {0, 0}, {55, 0, 95, 50}, {55, 5}, {58, 30}, 98, 70} }; static NavigateBarPanel *NavigatePanel = NULL; static const char NAVIGATE_DIR_IMG[][40] = { "nav_turn_left", "nav_turn_right", "nav_keep_left", "nav_keep_right", "nav_continue", "nav_approaching" }; static RoadMapImage NavigateBarImage; static RoadMapImage NavigateBarBG; static RoadMapImage NavigateDirections[NAVIGATE_LAST_DIRECTION]; static int NavigateBarInitialized = 0; static RoadMapGuiPoint NavigateBarLocation; static enum NavigateInstr NavigateBarCurrentInstr = NAVIGATE_LAST_DIRECTION; static int NavigateBarCurrentDistance = -1; static int NavigateBarEnabled = 0; /** * @brief * @param text * @param line1 * @param line2 * @param size * @return */ static int navigate_bar_align_text (char *text, char **line1, char **line2, int size) { int width, ascent, descent; roadmap_log(ROADMAP_DEBUG, "navigate_bar_align_text(%s)", text); roadmap_canvas_get_text_extents (text, size, &width, &ascent, &descent, NULL); if (width >= 2 * NavigatePanel->street_width) return -1; if (width < NavigatePanel->street_width) { *line1 = text; return 1; } else { /* Check if we can place the text in two lines */ char *text_line = text; char *text_end = text_line + strlen(text_line); char *p1 = text_line + (strlen(text_line) / 2); char *p2 = p1; while (p1 > text_line) { if (*p1 == ' ') { break; } p1 -= 1; } while (p2 < text_end) { if (*p2 == ' ') { break; } p2 += 1; } if (text_end - p1 > p2 - text_line) { p1 = p2; } if (p1 > text_line) { char saved = *p1; *p1 = 0; roadmap_canvas_get_text_extents (text_line, size, &width, &ascent, &descent, NULL); if (width < NavigatePanel->street_width) { roadmap_canvas_get_text_extents (text_line, size, &width, &ascent, &descent, NULL); if (width < NavigatePanel->street_width) { *line1 = text_line; *line2 = p1 + 1; return 2; } } *p1 = saved; } } return -1; } /** * @brief called from a plugin handler */ void navigate_bar_after_refresh (void) { if (NavigateBarEnabled) { navigate_bar_draw (); } } /** * @brief initialize */ void navigate_bar_initialize (void) { int i; int width; const int sz = sizeof(NavigateBarDefaultPanels)/sizeof(NavigateBarDefaultPanels[0]); roadmap_log(ROADMAP_DEBUG, "navigate_bar_initialize"); if (NavigateBarInitialized) return; width = roadmap_canvas_width (); for (i=0; i< sz; i++) { if (width >= NavigateBarDefaultPanels[i].min_screen_width) { NavigatePanel = NavigateBarDefaultPanels + i; break; } } if (!NavigatePanel) { roadmap_log (ROADMAP_ERROR, "Can't find nav panel for screen width: %d", width); NavigateBarInitialized = -1; return; } NavigateBarBG = (RoadMapImage) roadmap_res_get (RES_BITMAP, RES_SKIN|RES_NOCACHE, NavigatePanel->image_file); NavigateBarImage = (RoadMapImage) roadmap_res_get (RES_BITMAP, RES_SKIN, NavigatePanel->image_file); if (!NavigateBarBG || !NavigateBarImage) { NavigateBarInitialized = -1; return; } // roadmap_canvas_image_set_mutable (NavigateBarImage); for (i=0; i<NAVIGATE_LAST_DIRECTION; i++) { NavigateDirections[i] = (RoadMapImage) roadmap_res_get (RES_BITMAP, RES_SKIN, NAVIGATE_DIR_IMG[i]); if (!NavigateDirections[i]) { NavigateBarInitialized = -1; return; } } NavigateBarLocation.x = 0; NavigateBarLocation.y = 0; NavigateBarInitialized = 1; /* * Replaced by an additional plugin field * * navigate_prev_after_refresh = roadmap_screen_subscribe_after_refresh * (navigate_bar_after_refresh); */ } /** * @brief * @param instr */ void navigate_bar_set_instruction (enum NavigateInstr instr) { #if 0 RoadMapGuiPoint pos = NavigatePanel->instruction_pos; roadmap_log(ROADMAP_DEBUG, "navigate_bar_set_instruction(%d)", instr); if (NavigateBarInitialized != 1) return; roadmap_canvas_copy_image (NavigateBarImage, &pos, NULL, NavigateBarBG, CANVAS_COPY_NORMAL); roadmap_canvas_copy_image (NavigateBarImage, &pos, NULL, NavigateDirections[(int)instr], CANVAS_COPY_BLEND); NavigateBarCurrentInstr = instr; #endif } /** * @brief * @param distance */ void navigate_bar_set_distance (int distance) { #if 0 char str[100]; char unit_str[20]; int distance_far; RoadMapGuiPoint position = {0, 0}; roadmap_log(ROADMAP_DEBUG, "navigate_bar_set_distance(%d)", distance); if (NavigateBarInitialized != 1) return; if (NavigateBarCurrentDistance == distance) return; /* erase the old distance */ roadmap_canvas_copy_image (NavigateBarImage, &position, &NavigatePanel->distance_rect, NavigateBarBG, CANVAS_COPY_NORMAL); distance_far = roadmap_math_to_trip_distance(distance); if (distance_far > 0) { int tenths = roadmap_math_to_trip_distance_tenths(distance); snprintf (str, sizeof(str), "%d.%d", distance_far, tenths % 10); snprintf (unit_str, sizeof(unit_str), "%s", roadmap_math_trip_unit()); } else { snprintf (str, sizeof(str), "%d", distance); snprintf (unit_str, sizeof(unit_str), "%s", roadmap_math_distance_unit()); }; position = NavigatePanel->distance_value_pos; roadmap_canvas_draw_image_text (NavigateBarImage, &NavigatePanel->distance_value_pos, 22, str); position = NavigatePanel->distance_unit_pos; roadmap_canvas_draw_image_text (NavigateBarImage, &NavigatePanel->distance_unit_pos, 18, unit_str); #endif } /** * @brief * @param street */ void navigate_bar_set_street (const char *street) { #if 0 #define NORMAL_SIZE 20 #define SMALL_SIZE 16 int width, ascent, descent; int size; char *line1; char *line2; char *text; int num_lines; int i; roadmap_log(ROADMAP_DEBUG, "navigate_bar_set_street(%s)", street); //street = "ר××× ×××× ×××××× ×××§× ×¤×¨××× 18"; if (NavigateBarInitialized != 1) return; text = strdup(street); size = NORMAL_SIZE; num_lines = navigate_bar_align_text (text, &line1, &line2, size); if (num_lines < 0) { /* Try again with a smaller font size */ size = SMALL_SIZE; num_lines = navigate_bar_align_text (text, &line1, &line2, size); } /* Cut some text until it fits */ while (num_lines < 0) { char *end = text + strlen(text) - 1; while ((end > text) && (*end != ' ')) end--; if (end == text) { roadmap_log (ROADMAP_ERROR, "Can't align street in nav bar: %s", street); free(text); return; } *end = '\0'; num_lines = navigate_bar_align_text (text, &line1, &line2, size); } for (i=0; i < num_lines; i++) { char *line; RoadMapGuiPoint position = {NavigatePanel->street_start, 5}; if (i ==0 ) { line = line1; } else { line = line2; position.y = 20; } roadmap_canvas_get_text_extents (line, size, &width, &ascent, &descent, NULL); position.x = NavigatePanel->street_width - width + NavigatePanel->street_start; roadmap_canvas_draw_image_text (NavigateBarImage, &position, size, line); } #endif } /** * @brief * @param mode */ void navigate_bar_set_mode (int mode) { #if 0 int x_offset; int y_offset; roadmap_log(ROADMAP_DEBUG, "navigate_bar_set_mode(%d)", mode); if (NavigateBarEnabled == mode) return; x_offset = 0; y_offset = roadmap_canvas_image_height (NavigateBarBG); if (mode) { roadmap_screen_obj_offset (x_offset, y_offset); roadmap_screen_move_center (-y_offset / 2); } else { roadmap_screen_obj_offset (-x_offset, -y_offset); roadmap_screen_move_center (y_offset / 2); } NavigateBarEnabled = mode; #endif } /** * @brief */ void navigate_bar_draw (void) { #if 0 if (NavigateBarInitialized != 1) return; roadmap_canvas_draw_image (NavigateBarImage, &NavigateBarLocation, 0, IMAGE_NORMAL); #endif } --- NEW FILE: navigate_plugin.h --- /** * @file navigate_plugin.h - Editor plugin interfaces * * LICENSE: * * Copyright 2005 Ehud Shabtai * * 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__NAVIGATE_PLUGIN__H #define INCLUDE__NAVIGATE_PLUGIN__H int navigate_plugin_register (void); void navigate_plugin_unregister (int plugin_id); #endif // INCLUDE__NAVIGATE_PLUGIN__H --- NEW FILE: navigate_bar.h --- /** * @file navigate_bar.h - Navigation bar images * * LICENSE: * * Copyright 2006 Ehud Shabtai * * 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__NAVIGATE_BAR__H #define INCLUDE__NAVIGATE_BAR__H #include "roadmap_canvas.h" #include "navigate.h" void navigate_bar_initialize (void); void navigate_bar_set_mode (int mode); void navigate_bar_draw (void); void navigate_bar_set_instruction (enum NavigateInstr instr); void navigate_bar_set_distance (int distance); void navigate_bar_set_street (const char *street); void navigate_bar_after_refresh(void); #endif // INCLUDE__NAVIGATE_BAR__H --- NEW FILE: navigate.h --- /* * LICENSE: * * Copyright 2006 Ehud Shabtai * Copyright (c) 2008, 2009, Danny Backx * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief navigate.h - main plugin file */ #ifndef INCLUDE__NAVIGATE_H #define INCLUDE__NAVIGATE_H #include "roadmap.h" #include "roadmap_canvas.h" #include "roadmap_plugin.h" #include "roadmap_screen.h" enum NavigateInstr { NAVIGATE_TURN_LEFT = 0, NAVIGATE_TURN_RIGHT, NAVIGATE_KEEP_LEFT, NAVIGATE_KEEP_RIGHT, NAVIGATE_CONTINUE, NAVIGATE_APPROACHING_DESTINATION, NAVIGATE_LAST_DIRECTION }; /** * @brief structure to keep iterations of a route in * also serves to pass them between navigate plugin and others */ typedef struct { PluginLine line; int line_direction; /**< is the direction reversed ? */ PluginStreet street; RoadMapPosition from_pos; int from_point; RoadMapPosition to_pos; int to_point; RoadMapPosition shape_initial_pos; int first_shape; int last_shape; RoadMapShapeItr shape_itr; enum NavigateInstr instruction; int group_id; int distance; int cross_time; } NavigateSegment; int navigate_is_enabled (void); void navigate_shutdown (void); void navigate_initialize (void); int navigate_reload_data (void); void navigate_set (int status); int navigate_calc_route (void); void navigate_screen_repaint (int max_pen); int navigate_override_pen (int line, int cfcc, int fips, int pen_type, RoadMapPen *override_pen); void navigate_adjust_layer (int layer, int thickness, int pen_count); void navigate_format_messages (void); #endif /* INCLUDE__NAVIGATE_H */ --- NEW FILE: navigate_instr.c --- #if 1 /* * LICENSE: * * Copyright 2006 Ehud Shabtai * Copyright (c) 2008, Danny Backx. * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief calculate navigation instructions */ #include <stdlib.h> #include "roadmap.h" #include "roadmap_line.h" #include "roadmap_line_route.h" #include "roadmap_math.h" #include "roadmap_point.h" #include "roadmap_street.h" #include "roadmap_turns.h" #include "roadmap_layer.h" #include "navigate.h" #include "navigate_cost.h" #include "navigate_instr.h" static int navigate_instr_azymuth_delta (int az1, int az2) { int delta; delta = az1 - az2; while (delta > 180) delta -= 360; while (delta < -180) delta += 360; return delta; } static int navigate_instr_calc_azymuth (NavigateSegment *seg, int type) { RoadMapPosition start; RoadMapPosition end; RoadMapPosition *shape_pos; int shape; start = seg->from_pos; end = seg->to_pos; if (seg->first_shape > -1) { int last_shape; if (type == LINE_START) { last_shape = seg->first_shape; shape_pos = &end; *shape_pos = seg->shape_initial_pos; } else { last_shape = seg->last_shape; shape_pos = &start; *shape_pos = seg->shape_initial_pos; } for (shape = seg->first_shape; shape <= last_shape; shape++) { seg->shape_itr (shape, shape_pos); } } return roadmap_math_azymuth (&start, &end); } static void navigate_fix_line_end (RoadMapPosition *position, NavigateSegment *segment, int type) { RoadMapPosition from; RoadMapPosition to; RoadMapPosition intersection; int smallest_distance = 0x7fffffff; int distance; int seg_shape_end = -1; RoadMapPosition seg_end_pos = {0, 0}; RoadMapPosition seg_shape_initial = {0, 0}; int i; if (segment->first_shape <= -1) { from = segment->from_pos; to = segment->to_pos; } else { to = from = segment->from_pos; for (i = segment->first_shape; i <= segment->last_shape; i++) { segment->shape_itr (i, &to); distance = roadmap_math_get_distance_from_segment (position, &from, &to, &intersection, NULL); if (distance < smallest_distance) { smallest_distance = distance; if (type == LINE_START) { seg_shape_end = i; seg_end_pos = intersection; seg_shape_initial = from; } else { seg_shape_end = i-1; seg_end_pos = intersection; } } from = to; } to = segment->to_pos; } distance = roadmap_math_get_distance_from_segment (position, &from, &to, &intersection, NULL); if (distance < smallest_distance) { if (type == LINE_START) { seg_shape_end = -1; seg_end_pos = intersection; seg_shape_initial = from; } else { seg_shape_end = segment->last_shape; seg_end_pos = intersection; } } if (type == LINE_START) { segment->from_pos = seg_end_pos; segment->shape_initial_pos = seg_shape_initial; if ((seg_shape_end < 0) || (seg_shape_end > segment->last_shape)) { segment->first_shape = segment->last_shape = -1; } else { segment->first_shape = seg_shape_end; } } else { segment->to_pos = seg_end_pos; if ((seg_shape_end < 0) || (seg_shape_end < segment->first_shape)) { segment->first_shape = segment->last_shape = -1; } else { segment->last_shape = seg_shape_end; } } } static void navigate_instr_check_neighbours (NavigateSegment *seg1, NavigateSegment *seg2) { RoadMapPosition *junction; int junction_node_id; RoadMapNeighbour neighbours[16]; int i; int count; int layers_count; int layers[128]; int seg1_azymuth; int seg2_azymuth; int delta; int left_delta; int right_delta; int accuracy; RoadMapArea focus; if (seg1->line_direction == ROUTE_DIRECTION_WITH_LINE) { seg1_azymuth = navigate_instr_calc_azymuth (seg1, LINE_END); /* TODO no plugin support */ roadmap_line_points (roadmap_plugin_get_line_id (&seg1->line), &i, &junction_node_id); junction = &seg1->to_pos; } else { seg1_azymuth = 180 + navigate_instr_calc_azymuth (seg1, LINE_START); /* TODO no plugin support */ roadmap_line_points (roadmap_plugin_get_line_id (&seg1->line), &junction_node_id, &i); junction = &seg1->from_pos; } if (seg2->line_direction == ROUTE_DIRECTION_WITH_LINE) { seg2_azymuth = navigate_instr_calc_azymuth (seg2, LINE_START); } else { seg2_azymuth = 180 + navigate_instr_calc_azymuth (seg2, LINE_END); } delta = navigate_instr_azymuth_delta (seg1_azymuth, seg2_azymuth); left_delta = right_delta = delta; layers_count = roadmap_layer_navigable (0 /* car ? */, layers, 128); accuracy = 10; focus.west = junction->longitude - accuracy; focus.east = junction->longitude + accuracy; focus.north = junction->latitude + accuracy; focus.south = junction->latitude - accuracy; roadmap_math_set_focus (&focus); /* TODO no plugin support */ count = roadmap_street_get_closest (junction, layers, layers_count, neighbours, sizeof(neighbours) / sizeof(RoadMapNeighbour)); roadmap_math_release_focus (); for (i = 0; i < count; ++i) { PluginLine *line = &neighbours[i].line; RoadMapPosition from_pos; RoadMapPosition to_pos; int line_delta; int direction; if (roadmap_plugin_same_line (line, &seg1->line) || roadmap_plugin_same_line (line, &seg2->line)) { continue; } roadmap_plugin_line_from (line, &from_pos); roadmap_plugin_line_to (line, &to_pos); direction = roadmap_plugin_get_direction (line, ROUTE_CAR_ALLOWED); if (!roadmap_math_distance (junction, &from_pos)) { if (direction == ROUTE_DIRECTION_AGAINST_LINE) continue; line_delta = navigate_instr_azymuth_delta (seg1_azymuth, roadmap_math_azymuth (&neighbours[i].from, &neighbours[i].to)); } else if (!roadmap_math_distance (junction, &to_pos)) { if (direction == ROUTE_DIRECTION_WITH_LINE) continue; line_delta = navigate_instr_azymuth_delta (seg1_azymuth, roadmap_math_azymuth (&neighbours[i].to, &neighbours[i].from)); } else { continue; } /* TODO no plugin support */ if (roadmap_plugin_get_id (line) == ROADMAP_PLUGIN_ID) { if (roadmap_turns_find_restriction (junction_node_id, roadmap_plugin_get_line_id (&seg1->line), roadmap_plugin_get_line_id (line))) { continue; } } if (line_delta < left_delta) left_delta = line_delta; if (line_delta > right_delta) right_delta = line_delta; } if (((left_delta != delta) && (right_delta != delta)) || ((left_delta == delta) && (right_delta == delta))) { seg1->instruction = NAVIGATE_CONTINUE; } else if (left_delta != delta) { seg1->instruction = NAVIGATE_KEEP_LEFT; } else { seg1->instruction = NAVIGATE_KEEP_RIGHT; } } static void navigate_instr_set_road_instr (NavigateSegment *seg1, NavigateSegment *seg2) { int seg1_azymuth; int seg2_azymuth; int delta; int minimum_turn_degree = 15; if (seg1->line_direction == ROUTE_DIRECTION_WITH_LINE) { seg1_azymuth = navigate_instr_calc_azymuth (seg1, LINE_END); } else { seg1_azymuth = 180 + navigate_instr_calc_azymuth (seg1, LINE_START); } if (seg2->line_direction == ROUTE_DIRECTION_WITH_LINE) { seg2_azymuth = navigate_instr_calc_azymuth (seg2, LINE_START); } else { seg2_azymuth = 180 + navigate_instr_calc_azymuth (seg2, LINE_END); } delta = navigate_instr_azymuth_delta (seg1_azymuth, seg2_azymuth); if (roadmap_plugin_same_street (&seg1->street, &seg2->street)) { minimum_turn_degree = 45; } if (delta < -minimum_turn_degree) { if (delta > -45) { seg1->instruction = NAVIGATE_KEEP_RIGHT; } else { seg1->instruction = NAVIGATE_TURN_RIGHT; } } else if (delta > minimum_turn_degree) { if (delta < 45) { seg1->instruction = NAVIGATE_KEEP_LEFT; } else { seg1->instruction = NAVIGATE_TURN_LEFT; } } else { if (!roadmap_plugin_same_street (&seg1->street, &seg2->street)) { navigate_instr_check_neighbours (seg1, seg2); } else { seg1->instruction = NAVIGATE_CONTINUE; } } } /** * @brief * @param position * @param segment * @param type * @return */ int navigate_instr_calc_length (const RoadMapPosition *position, const NavigateSegment *segment, int type) { int total_length = 0; int result = 0; result = roadmap_math_calc_line_length (position, &segment->from_pos, &segment->to_pos, segment->first_shape, segment->last_shape, segment->shape_itr, &total_length); if (type == LINE_START) { return result; } else { return total_length - result; } } /** * @brief * @param segments * @param count * @param src_pos * @param dst_pos * @return */ int navigate_instr_prepare_segments (NavigateSegment *segments, int count, RoadMapPosition *src_pos, RoadMapPosition *dst_pos) { int i; int group_id = 0; NavigateSegment *segment; int cur_cost; int prev_line_id; int is_prev_reversed; for (i=0; i < count; i++) { roadmap_plugin_get_line_points (&segments[i].line, &segments[i].from_pos, &segments[i].to_pos, &segments[i].first_shape, &segments[i].last_shape, &segments[i].shape_itr); segments[i].shape_initial_pos.longitude = segments[i].from_pos.longitude; segments[i].shape_initial_pos.latitude = segments[i].from_pos.latitude; roadmap_plugin_get_street (&segments[i].line, &segments[i].street); } for (i=0; i < count - 1; i++) { navigate_instr_set_road_instr (&segments[i], &segments[i+1]); } segments[i].instruction = NAVIGATE_APPROACHING_DESTINATION; if (segments[0].line_direction == ROUTE_DIRECTION_WITH_LINE) { navigate_fix_line_end (src_pos, &segments[0], LINE_START); } else { navigate_fix_line_end (src_pos, &segments[0], LINE_END); } if (segments[i].line_direction == ROUTE_DIRECTION_WITH_LINE) { navigate_fix_line_end (dst_pos, &segments[i], LINE_END); } else { navigate_fix_line_end (dst_pos, &segments[i], LINE_START); } /* assign group ids */ segment = segments; while (segment < segments + count) { int group_count = 0; while (segment->instruction == NAVIGATE_CONTINUE) { NavigateSegment *prev = segment; /* Check if the previous segment is the last */ if (prev == (segments + count - 1)) { break; } segment++; if (!roadmap_plugin_same_street (&prev->street, &segment->street)) { segment = prev; break; } group_count++; } while (group_count >= 0) { /* (segment - group_count)->instruction = segment->instruction; */ (segment - group_count)->group_id = group_id; group_count--; } segment++; group_id++; } /* Calculate lengths and ETA for each segment */ segment = segments; cur_cost = 0; prev_line_id = -1; is_prev_reversed = 0; navigate_cost_reset (); while (segment < segments + count) { segment->cross_time = navigate_cost_time (segment->line.line_id, segment->line_direction != ROUTE_DIRECTION_WITH_LINE, cur_cost, prev_line_id, is_prev_reversed); cur_cost += segment->cross_time; prev_line_id = segment->line.line_id; is_prev_reversed = segment->line_direction != ROUTE_DIRECTION_WITH_LINE; if ((segment == segments) || (segment == (segments + count -1))) { if (segment->line_direction == ROUTE_DIRECTION_WITH_LINE) { segment->distance = navigate_instr_calc_length (&segment->from_pos, segment, LINE_END); } else { segment->distance = navigate_instr_calc_length (&segment->to_pos, segment, LINE_START); } /* adjust cross time using the line length */ segment->cross_time = (int) (1.0 * segment->cross_time * segment->distance / (roadmap_line_length (segment->line.line_id)+1)); } else { segment->distance = roadmap_line_length (segment->line.line_id); } segment++; } return 0; } #endif --- NEW FILE: navigate_plugin.c --- /* * LICENSE: * * Copyright 2005 Ehud Shabtai * Copyright (c) 2008, Danny Backx. * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief implement plugin interfaces */ #include <stdlib.h> #include "roadmap_plugin.h" // #include "roadmap_trip.h" #include "roadmap_factory.h" #include "roadmap_display.h" #include "navigate.h" // #include "navigate_traffic.h" #include "navigate_plugin.h" #include "navigate_bar.h" #include "navigate_cost.h" #include "navigate_visual.h" #include "roadmap_navigate.h" #include "roadmap_trip.h" /** * @brief for debugging */ static void navigate_debug_trip(void) { /* departure : 4683870,50898550 */ roadmap_trip_set_selection(4683870, 50898550); roadmap_trip_set_selection_as ("Departure"); #if 0 /* destination : 4700775, 50903168 */ roadmap_trip_set_selection(4700775, 50903168); roadmap_trip_set_selection_as ("Destination"); #endif /* Sportschuur * <node id='325630180' timestamp='2009-01-04T09:55:50+00:00' * user='Danny Backx' visible='true' lat='50.9029438' lon='4.7012746' /> */ roadmap_trip_set_selection(4701274, 50902943); roadmap_trip_set_selection_as ("Destination"); } static void navigate_start_navigate (void) { roadmap_log (ROADMAP_DEBUG, "navigate_start_navigate"); navigate_calc_route (); } static void roadmap_start_set_destination (void) { roadmap_log (ROADMAP_DEBUG, "roadmap_start_set_destination"); roadmap_trip_set_selection_as ("Destination"); roadmap_screen_refresh(); } static void roadmap_start_set_departure (void) { roadmap_log (ROADMAP_DEBUG, "roadmap_start_set_departure"); roadmap_trip_set_selection_as ("Departure"); roadmap_screen_refresh(); } #if 0 /* Not used */ static void roadmap_start_set_waypoint (void) { const char *id = roadmap_display_get_id ("Selected Street"); roadmap_log (ROADMAP_DEBUG, "roadmap_start_set_waypoint"); if (id != NULL) { roadmap_trip_set_selection_as (id); roadmap_screen_refresh(); } } static void roadmap_start_delete_waypoint (void) { roadmap_log (ROADMAP_DEBUG, "roadmap_start_delete_waypoint"); roadmap_tripdb_remove_point (NULL); } #endif static RoadMapAction NavigateActions[] = { {"setasdestination", "Set as Destination", NULL, NULL, "Set the selected street block as the trip's destination", NULL, roadmap_start_set_destination}, {"navigate", "Navigate", NULL, NULL, "Calculate route", NULL, navigate_start_navigate}, #if 0 {"deletewaypoints", "Delete Waypoints...", "Delete...", NULL, "Delete selected waypoints", NULL, roadmap_start_delete_waypoint}, #endif {"setasdeparture", "Set as Departure", NULL, NULL, "Set the selected street block as the trip's departure", NULL, roadmap_start_set_departure}, {"traffic", "Routing preferences", NULL, NULL, "Change routing preferences", NULL, navigate_cost_preferences}, {"navigatedebug", "Debug trip for navigation", NULL, NULL, "Debug trip for navigation", NULL, navigate_debug_trip}, {"navigate-enable", "Enable navigation", NULL, NULL, "Enable navigation", NULL, roadmap_navigate_enable}, {"navigate-disable", "Disable navigation", NULL, NULL, "Disable navigation", NULL, roadmap_navigate_disable}, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} }; static const char *NavigateMenu[] = { ROADMAP_MENU "Navigate", // RoadMapFactorySeparator, "setasdestination", "setasdeparture", // "addaswaypoint", cannot be here, is a RoadMap action // "deletewaypoints", "navigatedebug", "navigate", RoadMapFactorySeparator, "traffic", "navigate-enable", "navigate-disable", NULL }; /** * @brief */ static void navigate_plugin_initialize (void) { navigate_initialize(); } /** * @brief */ static RoadMapPluginHooks navigate_plugin_hooks = { /* name */ "navigate plugin", /* size */ sizeof(navigate_plugin_hooks), /* line_from */ NULL, /* line_to */ NULL, /* activate_db */ NULL, /* get_distance */ NULL, /* override_line */ NULL, /* override_pen */ &navigate_visual_override_pen, /* screen_repaint */ NULL /* &navigate_screen_repaint */, /* get_street */ NULL, /* get_street_full_name */ NULL, /* get_street_properties */ NULL, /* find_connected_lines */ NULL, /* adjust_layer */ NULL /* &navigate_traffic_adjust_layer */, /* get_closest */ NULL, /* route_direction */ NULL, /* shutdown */ NULL, /* initialize */ &navigate_plugin_initialize, /* actions */ &NavigateActions[0], /* menu */ (char **)NavigateMenu, /* after_refresh */ &navigate_bar_after_refresh, /* format messages */ &navigate_format_messages, /* route_clear */ navigate_visual_route_clear, /* route_add */ navigate_visual_route_add }; /** * @brief * @return */ int navigate_plugin_register (void) { return roadmap_plugin_register (&navigate_plugin_hooks); } /** * @brief * @param plugin_id */ void navigate_plugin_unregister (int plugin_id) { roadmap_plugin_unregister (plugin_id); } --- NEW FILE: navigate_instr.h --- /** * @file navigate_instr.h - Navigation instructions * * LICENSE: * * Copyright 2006 Ehud Shabtai * * 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__NAVIGATE_INSTR__H #define INCLUDE__NAVIGATE_INSTR__H #include "navigate.h" #define LINE_START 0 #define LINE_END 1 int navigate_instr_calc_length (const RoadMapPosition *position, const NavigateSegment *segment, int type); int navigate_instr_prepare_segments (NavigateSegment *segments, int count, RoadMapPosition *src_pos, RoadMapPosition *dst_pos); #endif // INCLUDE__NAVIGATE_INSTR__H --- NEW FILE: navigate_cost.h --- /** * @file navigate_cost.h - generic navigate cost functions * * LICENSE: * * Copyright 2007 Ehud Shabtai * * 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 _NAVIGATE_COST_H_ #define _NAVIGATE_COST_H_ #define COST_FASTEST 1 #define COST_SHORTEST 2 typedef int (*NavigateCostFn) (int line_id, int is_revesred, int cur_cost, int prev_line_id, int is_prev_reversed, int node_id); void navigate_cost_reset (void); NavigateCostFn navigate_cost_get (void); int navigate_cost_time (int line_id, int is_revesred, int cur_cost, int prev_line_id, int is_prev_reversed); void navigate_cost_initialize (void); int navigate_cost_type (void); void navigate_cost_preferences (void); #endif /* _NAVIGATE_COST_H_ */ --- NEW FILE: navigate.c --- /* * LICENSE: * * Copyright 2006 Ehud Shabtai * Copyright (c) 2008, Danny Backx. * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief Navigate plugin, main plugin file */ /** * @defgroup NavigatePlugin Navigate Plugin */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include "roadmap.h" #include "roadmap_pointer.h" #include "roadmap_plugin.h" #include "roadmap_line.h" #include "roadmap_display.h" #include "roadmap_message.h" #include "roadmap_voice.h" #include "roadmap_messagebox.h" #include "roadmap_canvas.h" #include "roadmap_street.h" #include "roadmap_trip.h" #include "roadmap_tripdb.h" #include "roadmap_navigate.h" #include "roadmap_screen.h" #include "roadmap_line_route.h" #include "roadmap_math.h" #include "roadmap_point.h" #include "roadmap_layer.h" #include "roadmap_adjust.h" #include "roadmap_lang.h" #include "roadmap_address.h" #include "roadmap_sound.h" #include "roadmap_locator.h" #include "roadmap_config.h" #include "roadmap_skin.h" #include "roadmap_dialog.h" #include "roadmap_main.h" #include "navigate_plugin.h" #include "navigate_bar.h" #include "navigate_cost.h" #include "navigate_route.h" #include "navigate.h" #define ROUTE_PEN_WIDTH 4 static RoadMapConfigDescriptor NavigateConfigRouteColor = ROADMAP_CONFIG_ITEM("Navigation", "RouteColor"); static RoadMapConfigDescriptor NavigateConfigPossibleRouteColor = ROADMAP_CONFIG_ITEM("Navigation", "PossibleRouteColor"); RoadMapConfigDescriptor NavigateConfigAutoZoom = ROADMAP_CONFIG_ITEM("Routing", "Auto zoom"); RoadMapConfigDescriptor NavigateConfigLastPos = ROADMAP_CONFIG_ITEM("Navigation", "Last position"); RoadMapConfigDescriptor NavigateConfigNavigating = ROADMAP_CONFIG_ITEM("Navigation", "Is navigating"); int NavigateEnabled = 0; int NavigatePluginID = -1; static int NavigateTrackEnabled = 0; static int NavigateTrackFollowGPS = 0; static RoadMapPen NavigatePen[2]; static RoadMapPen NavigatePenEst[2]; static void navigate_update (RoadMapPosition *position, PluginLine *current); static void navigate_get_next_line (PluginLine *current, int direction, PluginLine *next); static RoadMapCallback NextMessageUpdate; static int NavigateDistanceToDest; static int NavigateETA; static int NavigateDistanceToTurn; static int NavigateETAToTurn; static int NavigateFlags; static NavigateSegment NavigateSegments[MAX_NAV_SEGMENTS]; static int NavigateNumSegments = 0; static int NavigateCurrentSegment = 0; static PluginLine NavigateDestination = PLUGIN_LINE_NULL; static int NavigateDestPoint; static RoadMapPosition NavigateDestPos; static RoadMapPosition NavigateSrcPos; static int NavigateNextAnnounce; /** * @brief * @return */ static int navigate_recalc_route () { #if 0 int track_time; PluginLine from_line; int from_point; int flags; NavigateNumSegments = MAX_NAV_SEGMENTS; if (navigate_route_load_data () < 0) { return -1; } if (navigate_find_track_points (&from_line, &from_point, &NavigateDestination, &NavigateDestPoint) < 0) { return -1; } roadmap_main_set_cursor (ROADMAP_CURSOR_WAIT); flags = RECALC_ROUTE; navigate_cost_reset (); track_time = navigate_route_get_segments (&from_line, from_point, &NavigateDestination, NavigateDestPoint, NavigateSegments, &NavigateNumSegments, &flags); roadmap_main_set_cursor (ROADMAP_CURSOR_NORMAL); if (track_time <= 0) { return -1; } NavigateFlags = flags; navigate_instr_prepare_segments (NavigateSegments, NavigateNumSegments, &NavigateSrcPos, &NavigateDestPos); NavigateTrackEnabled = 1; navigate_bar_set_mode (NavigateTrackEnabled); NavigateCurrentSegment = 0; roadmap_navigate_enable (); #endif return 0; } /****** Route calculation progress dialog ******/ /** * @brief * @param name * @param data */ static void cancel_calc (const char *name, void *data) { } /** * @brief */ static void show_progress_dialog (void) { if (roadmap_dialog_activate ("Route calc", NULL)) { roadmap_dialog_new_label ("Calculating", "Calculting route, please wait..."); roadmap_dialog_new_progress ("Calculating", "Progress"); roadmap_dialog_add_button ("Cancel", cancel_calc); roadmap_dialog_complete (0); } roadmap_dialog_set_progress ("Calculating", "Progress", 0); roadmap_main_flush (); } /** * @brief * @param position * @param current */ static void navigate_update (RoadMapPosition *position, PluginLine *current) { #if 0 int announce = 0; const NavigateSegment *segment = NavigateSegments + NavigateCurrentSegment; const NavigateSegment *next_turn_segment; int group_id = segment->group_id; const char *inst_text = ""; const char *inst_voice = NULL; RoadMapSoundList sound_list; const int ANNOUNCES[] = { 800, 200, 50 }; int announce_distance = 0; int distance_to_prev; int distance_to_next; #define NAVIGATE_COMPENSATE 20 if (!NavigateTrackEnabled) return; if (segment->line_direction == ROUTE_DIRECTION_WITH_LINE) { NavigateDistanceToTurn = navigate_instr_calc_length (position, segment, LINE_END); } else { NavigateDistanceToTurn = navigate_instr_calc_length (position, segment, LINE_START); } distance_to_prev = segment->distance - NavigateDistanceToTurn; NavigateETAToTurn = (int) (1.0 * segment->cross_time * NavigateDistanceToTurn / (segment->distance + 1)); while (segment < (NavigateSegments + NavigateNumSegments - 1)) { if ((segment+1)->group_id != group_id) break; segment++; NavigateDistanceToTurn += segment->distance; NavigateETAToTurn += segment->cross_time; } distance_to_next = 0; if (segment < (NavigateSegments + NavigateNumSegments - 1)) { next_turn_segment = segment + 1; group_id = next_turn_segment->group_id; distance_to_next = next_turn_segment->distance; while (next_turn_segment < (NavigateSegments + NavigateNumSegments - 1)) { if ((next_turn_segment+1)->group_id != group_id) break; next_turn_segment++; distance_to_next += next_turn_segment->distance; } } if (roadmap_config_match(&NavigateConfigAutoZoom, "yes")) { const char *focus = roadmap_trip_get_focus_name (); if (focus && !strcmp (focus, "GPS")) { navigate_zoom_update (position, NavigateSegments, NavigateCurrentSegment, segment, distance_to_prev, distance_to_next); } } navigate_bar_set_distance (NavigateDistanceToTurn); switch (segment->instruction) { case NAVIGATE_TURN_LEFT: inst_text = "Turn left"; inst_voice = "TurnLeft"; break; case NAVIGATE_KEEP_LEFT: inst_text = "Keep left"; inst_voice = "KeepLeft"; break; case NAVIGATE_TURN_RIGHT: inst_text = "Turn right"; inst_voice = "TurnRight"; break; case NAVIGATE_KEEP_RIGHT: inst_text = "Keep right"; inst_voice = "KeepRight"; break; case NAVIGATE_APPROACHING_DESTINATION: inst_text = "Approaching destination"; break; case NAVIGATE_CONTINUE: inst_text = "Continue straight"; inst_voice = "Straight"; break; default: break; } if ((segment->instruction == NAVIGATE_APPROACHING_DESTINATION) && NavigateDistanceToTurn <= 20) { sound_list = roadmap_sound_list_create (0); roadmap_sound_list_add (sound_list, "Arrive"); roadmap_sound_play_list (sound_list); NavigateTrackEnabled = 0; navigate_bar_set_mode (NavigateTrackEnabled); if (roadmap_config_match(&NavigateConfigAutoZoom, "yes")) { const char *focus = roadmap_trip_get_focus_name (); /* We used auto zoom, so now we need to reset it */ if (focus && !strcmp (focus, "GPS")) { roadmap_screen_zoom_reset (); } } roadmap_navigate_end_route (NavigateCallbacks); return; } roadmap_message_set ('I', inst_text); if (NavigateNextAnnounce == -1) { unsigned int i; for (i=0; i<sizeof(ANNOUNCES)/sizeof(ANNOUNCES[0]) - 1; i++) { if (NavigateDistanceToTurn > ANNOUNCES[i]) { NavigateNextAnnounce = ANNOUNCES[i]; break; } } if (NavigateNextAnnounce == -1) { NavigateNextAnnounce = ANNOUNCES[sizeof(ANNOUNCES)/sizeof(ANNOUNCES[0]) - 1]; } } if (NavigateNextAnnounce && (NavigateDistanceToTurn <= (NavigateNextAnnounce + NAVIGATE_COMPENSATE))) { unsigned int i; announce_distance = NavigateNextAnnounce; NavigateNextAnnounce = 0; if (inst_voice) { announce = 1; } for (i=0; i<sizeof(ANNOUNCES)/sizeof(ANNOUNCES[0]); i++) { if ((ANNOUNCES[i] < announce_distance) && (NavigateDistanceToTurn > ANNOUNCES[i])) { NavigateNextAnnounce = ANNOUNCES[i]; break; } } } if (announce) { PluginStreetProperties properties; if (segment < (NavigateSegments + NavigateNumSegments - 1)) { segment++; } roadmap_plugin_get_street_properties (&segment->line, &properties); roadmap_message_set ('#', properties.address); roadmap_message_set ('N', properties.street); #ifdef HAVE_STREET_T2S roadmap_message_set ('T', properties.street_t2s); #endif roadmap_message_set ('C', properties.city); sound_list = roadmap_sound_list_create (0); if (!NavigateNextAnnounce) { roadmap_message_unset ('w'); } else { char distance_str[100]; int distance_far = roadmap_math_to_trip_distance(announce_distance); roadmap_sound_list_add (sound_list, "within"); if (distance_far > 0) { roadmap_message_set ('w', "%d %s", distance_far, roadmap_math_trip_unit()); sprintf(distance_str, "%d", distance_far); roadmap_sound_list_add (sound_list, distance_str); roadmap_sound_list_add (sound_list, roadmap_math_trip_unit()); } else { roadmap_message_set ('w', "%d %s", announce_distance, roadmap_math_distance_unit()); sprintf(distance_str, "%d", announce_distance); roadmap_sound_list_add (sound_list, distance_str); roadmap_sound_list_add (sound_list, roadmap_math_distance_unit()); }; } roadmap_sound_list_add (sound_list, inst_voice); //roadmap_voice_announce ("Driving Instruction"); roadmap_sound_play_list (sound_list); } #endif } void navigate_format_messages(void) { // roadmap_log (ROADMAP_WARNING, "navigate_format_messages -> navigate_update(NULL, NULL);"); navigate_update(NULL, NULL); } /** * @brief * @param current * @param direction * @param next */ void navigate_get_next_line (PluginLine *current, int direction, PluginLine *next) { #if 0 int new_instruction = 0; if (!NavigateTrackEnabled) { if (navigate_recalc_route () != -1) { roadmap_trip_route_stop (); } return; } /* Ugly hack as we don't support navigation through editor lines */ if (roadmap_plugin_get_id (current) != ROADMAP_PLUGIN_ID) { *next = NavigateSegments[NavigateCurrentSegment+1].line; return; } if (!roadmap_plugin_same_line (current, &NavigateSegments[NavigateCurrentSegment].line)) { int i; for (i=NavigateCurrentSegment+1; i < NavigateNumSegments; i++) { if (roadmap_plugin_same_line (current, &NavigateSegments[i].line)) { if (NavigateSegments[NavigateCurrentSegment].group_id != NavigateSegments[i].group_id) { new_instruction = 1; } NavigateCurrentSegment = i; break; } } } if ((NavigateCurrentSegment < NavigateNumSegments) && !roadmap_plugin_same_line (current, &NavigateSegments[NavigateCurrentSegment].line)) { NavigateTrackEnabled = 0; navigate_bar_set_mode (NavigateTrackEnabled); if (navigate_recalc_route () == -1) { roadmap_trip_route_start (); } NavigateNextAnnounce = -1; return; } if ((NavigateCurrentSegment+1) >= NavigateNumSegments) { next->plugin_id = INVALID_PLUGIN_ID; } else { *next = NavigateSegments[NavigateCurrentSegment+1].line; } if (new_instruction || !NavigateCurrentSegment) { int group_id; /* new driving instruction */ PluginStreetProperties properties; const NavigateSegment *segment = NavigateSegments + NavigateCurrentSegment; while (segment < NavigateSegments + NavigateNumSegments - 1) { if ((segment + 1)->group_id != segment->group_id) break; segment++; } navigate_bar_set_instruction (segment->instruction); group_id = segment->group_id; if (segment < NavigateSegments + NavigateNumSegments - 1) { /* we need the name of the next street */ segment++; } #warning "roadmap_plugin_get_street_properties not right" #if 0 roadmap_plugin_get_street_properties (&segment->line, &properties, 0); #endif navigate_bar_set_street (properties.street); NavigateNextAnnounce = -1; NavigateDistanceToDest = 0; NavigateETA = 0; if (segment->group_id != group_id) { /* Update distance to destination and ETA * excluding current group (computed in navigate_update) */ while (segment < NavigateSegments + NavigateNumSegments) { NavigateDistanceToDest += segment->distance; NavigateETA += segment->cross_time; segment++; } } } return; #endif } /** * @brief * @return */ int navigate_is_enabled (void) { return NavigateEnabled; } /** * @brief */ static void navigate_init_pens (void) { RoadMapPen pen; roadmap_log (ROADMAP_DEBUG, "navigate_init_pens"); pen = roadmap_canvas_create_pen ("NavigatePen1"); roadmap_canvas_set_foreground (roadmap_config_get (&NavigateConfigRouteColor)); roadmap_canvas_set_thickness (ROUTE_PEN_WIDTH); NavigatePen[0] = pen; pen = roadmap_canvas_create_pen ("NavigatePen2"); roadmap_canvas_set_foreground (roadmap_config_get (&NavigateConfigRouteColor)); roadmap_canvas_set_thickness (ROUTE_PEN_WIDTH); NavigatePen[1] = pen; pen = roadmap_canvas_create_pen ("NavigatePenEst1"); roadmap_canvas_set_foreground (roadmap_config_get (&NavigateConfigPossibleRouteColor)); roadmap_canvas_set_thickness (ROUTE_PEN_WIDTH); NavigatePenEst[0] = pen; pen = roadmap_canvas_create_pen ("NavigatePenEst2"); roadmap_canvas_set_foreground (roadmap_config_get (&NavigateConfigPossibleRouteColor)); roadmap_canvas_set_thickness (ROUTE_PEN_WIDTH); NavigatePenEst[1] = pen; } /** * @brief */ void navigate_shutdown (void) { roadmap_config_set_integer (&NavigateConfigNavigating, 0); } /** * @brief */ void navigate_initialize (void) { roadmap_log (ROADMAP_DEBUG, "navigate_initialize"); roadmap_config_declare ("preferences", &NavigateConfigRouteColor, "#00ff00a0"); roadmap_config_declare ("preferences", &NavigateConfigPossibleRouteColor, "#ff0000a0"); roadmap_config_declare_enumeration ("preferences", &NavigateConfigAutoZoom, "no", "yes", NULL); roadmap_config_declare ("session", &NavigateConfigLastPos, "0, 0"); roadmap_config_declare ("session", &NavigateConfigNavigating, "0"); navigate_init_pens (); navigate_cost_initialize (); navigate_bar_initialize (); navigate_visual_initialize (); navigate_set (1); // roadmap_address_register_nav (navigate_address_cb); roadmap_skin_register (navigate_init_pens); if (roadmap_config_get_integer (&NavigateConfigNavigating)) { RoadMapPosition pos; roadmap_config_get_position (&NavigateConfigLastPos, &pos); roadmap_trip_set_focus ("GPS"); roadmap_trip_set_point ("Destination", &pos); navigate_calc_route (); } } /** * @brief enable or disable navigation * @param status whether to set NavigateEnabled */ void navigate_set (int status) { if (status && NavigateEnabled) { return; } else if (!status && !NavigateEnabled) { return; } NavigateEnabled = status; } /** * @brief Calculate an initial route between the GPS position and the destination * @return success */ int navigate_calc_route () { int track_time; PluginLine from_line; RoadMapPosition from_pos, *fp, *dp; int flags; const char *focus = roadmap_trip_get_focus_name (); if (!(fp = roadmap_trip_get_position ("Departure"))) { roadmap_log (ROADMAP_DEBUG, "navigate_calc_route: no departure"); } from_pos = *fp; if (!(dp = roadmap_trip_get_position ("Destination"))) { roadmap_log (ROADMAP_DEBUG, "navigate_calc_route: no destination"); } roadmap_log(ROADMAP_DEBUG, "navigate_calc_route : start"); NavigateDestPos = *dp; NavigateTrackEnabled = 0; navigate_bar_set_mode (NavigateTrackEnabled); NavigateNumSegments = MAX_NAV_SEGMENTS; flags = NEW_ROUTE; show_progress_dialog (); navigate_cost_reset (); track_time = navigate_route_get_segments (&from_line, from_pos, &NavigateDestination, NavigateDestPos, NavigateSegments, &NavigateNumSegments, &flags); roadmap_log(ROADMAP_DEBUG, "navigate_calc_route: after navigate_route_get_segments()"); if (track_time <= 0) { roadmap_dialog_hide ("Route calc"); NavigateTrackEnabled = 0; navigate_bar_set_mode (NavigateTrackEnabled); if (track_time < 0) { roadmap_messagebox("Error", "Error calculating route."); } else { roadmap_messagebox("Error", "Can't find a route."); } return -1; } else { char msg[200] = {0}; int i; int length = 0; /* navigate_instr_prepare_segments (NavigateSegments, NavigateNumSegments, &NavigateSrcPos, &NavigateDestPos); */ track_time = 0; for (i=0; i<NavigateNumSegments; i++) { length += NavigateSegments[i].distance; track_time += NavigateSegments[i].cross_time; } roadmap_dialog_hide ("Route calc"); NavigateFlags = flags; if (flags & GRAPH_IGNORE_TURNS) { snprintf(msg, sizeof(msg), "%s\n", roadmap_lang_get ("The calculated route may have incorrect turn instructions.")); } snprintf(msg + strlen(msg), sizeof(msg) - strlen(msg), "%s: %.1f %s,\n%s: %.1f %s", roadmap_lang_get ("Length"), length/1000.0, roadmap_lang_get ("Km"), roadmap_lang_get ("Time"), track_time/60.0, roadmap_lang_get ("minutes")); NavigateTrackEnabled = 1; navigate_bar_set_mode (NavigateTrackEnabled); #if 1 roadmap_navigate_enable (); #else if (NavigateTrackFollowGPS) { NavigateCurrentSegment = 0; roadmap_trip_route_stop (); roadmap_navigate_enable (); } #endif roadmap_screen_repaint (); roadmap_config_set_position (&NavigateConfigLastPos, &NavigateDestPos); roadmap_config_set_integer (&NavigateConfigNavigating, 1); roadmap_config_save (0); roadmap_messagebox ("Route found", msg); /* Stuff this route in the trip plugin */ roadmap_trip_new(); roadmap_tripdb_empty_list(); roadmap_trip_add_waypoint("", &NavigateSegments[0].from_pos, TRIP_PLACE_ROUTE_MARK_START); for (i=0; i<NavigateNumSegments; i++) { #if 0 roadmap_trip_add_way(NavigateSegments[i].from_pos, NavigateSegments[i].to_pos, (i == NavigateNumSegments-1) ? TRIP_APPROACHING_DESTINATION : TRIP_CONTINUE); #else roadmap_trip_add_point_way(NavigateSegments[i].from_point, NavigateSegments[i].to_point, NavigateSegments[i].line, (i == NavigateNumSegments - 1) ? TRIP_APPROACHING_DESTINATION : TRIP_CONTINUE); #endif roadmap_trip_add_waypoint("", &NavigateSegments[i].to_pos, TRIP_PLACE_ROUTE_MARK_INSERT); } roadmap_trip_complete(); roadmap_trip_refresh(); } return 0; } /** * @brief * @return */ int navigate_reload_data (void) { // navigate_traffic_refresh (); return navigate_route_reload_data (); } /** * @brief * @param max_pen */ void navigate_screen_repaint (int max_pen) { #if 0 int i; int current_width = -1; int last_cfcc = -1; RoadMapPen *pens; int current_pen = 0; if (!NavigateTrackEnabled) return; if (NavigateFlags & GRAPH_IGNORE_TURNS) { pens = NavigatePenEst; } else { pens = NavigatePen; } if (!NavigateTrackFollowGPS && !strcmp (roadmap_trip_get_focus_name (), "GPS")) { NavigateTrackFollowGPS = 1; roadmap_trip_route_stop (); if (roadmap_trip_get_position ("Departure")) { ... [truncated message content] |
|
From: Danny B. <dan...@us...> - 2009-02-15 16:32:00
|
Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27985 Modified Files: Makefile config.mk Log Message: Small modifications Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/Makefile,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** Makefile 15 Feb 2009 15:22:31 -0000 1.136 --- Makefile 15 Feb 2009 16:31:54 -0000 1.137 *************** *** 403,416 **** NAVIGATE_PLUGINSRC = \ navigate/navigate.c \ - navigate/navigate_instr.c \ navigate/navigate_bar.c \ - navigate/navigate_zoom.c \ navigate/navigate_plugin.c \ ! navigate/navigate_traffic.c \ ! navigate/navigate_graph.c \ navigate/navigate_cost.c \ navigate/navigate_simple.c \ navigate/navigate_route.c - # navigate/fib-1.1/fib.c CFLAGS += -DHAVE_NAVIGATE_PLUGIN --- 403,412 ---- NAVIGATE_PLUGINSRC = \ navigate/navigate.c \ navigate/navigate_bar.c \ navigate/navigate_plugin.c \ ! navigate/navigate_visual.c \ navigate/navigate_cost.c \ navigate/navigate_simple.c \ navigate/navigate_route.c CFLAGS += -DHAVE_NAVIGATE_PLUGIN Index: config.mk =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/config.mk,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** config.mk 5 Nov 2008 13:52:02 -0000 1.34 --- config.mk 15 Feb 2009 16:31:54 -0000 1.35 *************** *** 12,15 **** --- 12,19 ---- # GNU make is probably required to build RoadMap. + USE_EDITOR_PLUGIN = no + USE_TRIP_PLUGIN = no + USE_NAVIGATE_PLUGIN = no + # default installation directory. # INSTALLDIR = /usr/local |
|
From: Danny B. <dan...@us...> - 2009-02-15 16:24:24
|
Update of /cvsroot/roadmap/roadmap/src/navigate In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27544/navigate Log Message: Directory /cvsroot/roadmap/roadmap/src/navigate added to the repository |
|
From: Danny B. <dan...@us...> - 2009-02-15 15:32:30
|
Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21923 Modified Files: roadmap_plugin.c roadmap_plugin.h roadmap_trip.c roadmap_trip.h roadmap_start.c roadmap_types.h Log Message: Implement some of the trip functionality needed for the navigate plugin. Some small part of roadmap_trip.c was moved to roadmap_tripdb.c . Index: roadmap_plugin.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_plugin.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** roadmap_plugin.h 9 Feb 2009 19:24:27 -0000 1.3 --- roadmap_plugin.h 15 Feb 2009 15:32:27 -0000 1.4 *************** *** 72,75 **** --- 72,78 ---- const char *address; const char *street; + #ifdef HAVE_STREET_T2S + const char *street_t2s; /* What is this ? */ + #endif const char *city; PluginStreet plugin_street; *************** *** 164,169 **** --- 167,178 ---- typedef const char *(*plugin_street_full_name_func) (const PluginLine *line); + #if 0 + typedef void (*plugin_street_properties_func) (const PluginLine *line, + PluginStreetProperties *props, + int type); + #else typedef void (*plugin_street_properties_func) (const PluginLine *line, PluginStreetProperties *props); + #endif typedef int (*plugin_find_connected_lines_func) *************** *** 192,195 **** --- 201,206 ---- typedef void (*plugin_after_refresh) (void); typedef void (*plugin_format_messages) (void); + typedef void (*plugin_route_clear)(void); + typedef void (*plugin_route_add)(int, int, int); /** *************** *** 219,222 **** --- 230,235 ---- plugin_after_refresh after_refresh; /**< Call this after refresh */ plugin_format_messages format_messages; /**< Display directions */ + plugin_route_clear route_clear; /**< clear the route */ + plugin_route_add route_add; /**< add a hop to the route */ } RoadMapPluginHooks; *************** *** 287,289 **** --- 300,306 ---- RoadMapShapeItr *shape_itr); #endif + + void roadmap_plugin_route_clear(void); + void roadmap_plugin_route_add(int, int, int); + #endif /* INCLUDED__ROADMAP_PLUGIN__H */ Index: roadmap_types.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_types.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** roadmap_types.h 12 Feb 2009 18:22:23 -0000 1.4 --- roadmap_types.h 15 Feb 2009 15:32:27 -0000 1.5 *************** *** 53,59 **** typedef unsigned char LineRouteMax; typedef unsigned short LineRouteTime; typedef void (*RoadMapShapeItr) (int shape, RoadMapPosition *position); - #endif #endif // INCLUDED__ROADMAP_TYPES__H --- 53,59 ---- typedef unsigned char LineRouteMax; typedef unsigned short LineRouteTime; + #endif typedef void (*RoadMapShapeItr) (int shape, RoadMapPosition *position); #endif // INCLUDED__ROADMAP_TYPES__H Index: roadmap_plugin.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_plugin.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** roadmap_plugin.c 9 Feb 2009 19:24:27 -0000 1.5 --- roadmap_plugin.c 15 Feb 2009 15:32:27 -0000 1.6 *************** *** 490,501 **** } void roadmap_plugin_get_street_properties (const PluginLine *line, PluginStreetProperties *props) { - if (line->plugin_id == ROADMAP_PLUGIN_ID) { - RoadMapStreetProperties rm_properties; roadmap_street_get_properties (line->line_id, &rm_properties); --- 490,515 ---- } + #if 0 + void roadmap_plugin_get_street_properties (const PluginLine *line, + PluginStreetProperties *props, + int type) + #else void roadmap_plugin_get_street_properties (const PluginLine *line, PluginStreetProperties *props) + #endif { if (line->plugin_id == ROADMAP_PLUGIN_ID) { RoadMapStreetProperties rm_properties; + #warning "roadmap_street_get_street fix needed" + #if 0 + if (type == PLUGIN_STREET_ONLY) { + roadmap_street_get_street (line->line_id, &rm_properties); + props->street = roadmap_street_get_street_name (&rm_properties); + props->plugin_street.plugin_id = ROADMAP_PLUGIN_ID; + props->plugin_street.street_id = rm_properties.street; + return; + } + #endif roadmap_street_get_properties (line->line_id, &rm_properties); *************** *** 522,527 **** --- 536,546 ---- } + #if 0 + if (hp->get_street_properties != NULL) { + (*hp->get_street_properties) (line, props, type); + #else if (hp->get_street_properties != NULL) { (*hp->get_street_properties) (line, props); + #endif } *************** *** 601,604 **** --- 620,724 ---- } + #ifdef HAVE_NAVIGATE_PLUGIN + int roadmap_plugin_get_direction (PluginLine *line, int who) + { + if (line->plugin_id == ROADMAP_PLUGIN_ID) { + + return roadmap_line_route_get_direction (line->line_id, who); + + } else { + RoadMapPluginHooks *hp = get_hooks (line->plugin_id); + + if (hp == NULL) { + roadmap_log (ROADMAP_ERROR, "plugin id:%d is missing.", + line->plugin_id); + + return 0; + } + + if (hp->route_direction != NULL) { + return (*hp->route_direction) (line, who); + } + + return 0; + } + + } + #endif + + #if defined(HAVE_TRIP_PLUGIN) || defined(HAVE_NAVIGATE_PLUGIN) + void roadmap_plugin_get_line_points (const PluginLine *line, + RoadMapPosition *from_pos, + RoadMapPosition *to_pos, + int *first_shape, + int *last_shape, + RoadMapShapeItr *shape_itr) + { + roadmap_plugin_line_from (line, from_pos); + roadmap_plugin_line_to (line, to_pos); + + if (line->plugin_id == ROADMAP_PLUGIN_ID) { + #warning "roadmap_line_shapes needed" + #if 0 + roadmap_line_shapes (line->line_id, -1, first_shape, last_shape); + *shape_itr = &roadmap_shape_get_position; + #endif + } else { + RoadMapPluginHooks *hp = get_hooks (line->plugin_id); + + if (hp == NULL) { + roadmap_log (ROADMAP_ERROR, "plugin id:%d is missing.", + line->plugin_id); + + *first_shape = *last_shape = -1; + *shape_itr = NULL; + return; + } + + //FIXME implement for plugins + #if 0 + if (hp->line_shapes != NULL) { + (*hp->line_shapes) (line, first_shape, last_shape, shape_itr); + + } else { + #else + { + #endif + *first_shape = *last_shape = -1; + *shape_itr = NULL; + } + + return; + } + } + #endif + + /* + * roadmap_plugin_initialize should be here, but it's moved to roadmap_start.c + * because otherwise all the tools like buildmap fail to build. + */ + int roadmap_plugin_get_line_cfcc (const PluginLine *line) { + return line->layer; + } + + #ifdef HAVE_EDITOR_PLUGIN + int roadmap_plugin_calc_length (const RoadMapPosition *position, + const PluginLine *line, + int *total_length) + { + RoadMapPosition line_from_pos; + RoadMapPosition line_to_pos; + int first_shape; + int last_shape; + RoadMapShapeItr shape_itr; + roadmap_plugin_get_line_points (line, &line_from_pos, &line_to_pos, + &first_shape, &last_shape, &shape_itr); + return roadmap_math_calc_line_length (position, + &line_from_pos, &line_to_pos, + first_shape, last_shape, + shape_itr, total_length); + } + #endif + /** * @brief call the "factory" handler to register actions and menu items *************** *** 641,642 **** --- 761,790 ---- } } + + void roadmap_plugin_route_clear(void) + { + int id; + RoadMapPluginHooks *p; + + for (id=1; id<= PluginCount; id++) { + p = hooks[id].plugin; + if (!p) + continue; + if (p->route_clear) + p->route_clear(); + } + } + + void roadmap_plugin_route_add(int line, int layer, int fips) + { + int id; + RoadMapPluginHooks *p; + + for (id=1; id<= PluginCount; id++) { + p = hooks[id].plugin; + if (!p) + continue; + if (p->route_add) + p->route_add(line, layer, fips); + } + } Index: roadmap_trip.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_trip.c,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** roadmap_trip.c 16 Jan 2009 16:57:51 -0000 1.104 --- roadmap_trip.c 15 Feb 2009 15:32:27 -0000 1.105 *************** *** 1,7 **** ! /* roadmap_trip.c - Manage a trip: destination & waypoints. ! * * LICENSE: * * Copyright 2002,2005 Pascal F. Martin, Paul G. Fox * * This file is part of RoadMap. --- 1,7 ---- ! /* * LICENSE: [...1952 lines suppressed...] + for (i=0; RoadMapTripFocalPoints[i].id; i++) + if (strcmp(RoadMapTripFocalPoints[i].id, name) == 0) { + fp = &RoadMapTripFocalPoints[i].config_position; + roadmap_config_get_position (fp, &pos); + roadmap_log (ROADMAP_DEBUG, "roadmap_trip_get_position(%s) -> %d,%d", + name, pos.longitude, pos.latitude); + return &pos; + } + return NULL; } + #endif + /** + * @brief indicate that refresh is needed + */ + void roadmap_trip_refresh_needed(void) + { + RoadMapTripRefresh = 1; + } Index: roadmap_trip.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_trip.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** roadmap_trip.h 10 Jun 2008 03:50:03 -0000 1.36 --- roadmap_trip.h 15 Feb 2009 15:32:27 -0000 1.37 *************** *** 28,32 **** #include "roadmap_gui.h" #include "roadmap_gps.h" ! void roadmap_trip_set_point (const char *name, RoadMapPosition *position); --- 28,32 ---- #include "roadmap_gui.h" #include "roadmap_gps.h" ! #include "roadmap_plugin.h" void roadmap_trip_set_point (const char *name, RoadMapPosition *position); *************** *** 125,128 **** #endif ! #endif // INCLUDE__ROADMAP_TRIP__H --- 125,150 ---- #endif ! void roadmap_trip_set_selection_as (const char *name); ! ! #ifdef HAVE_NAVIGATE_PLUGIN ! void roadmap_trip_set_selection (int lon, int lat); ! #endif ! ! void roadmap_trip_enable (int status); ! void roadmap_trip_refresh (void); ! void roadmap_trip_refresh_needed(void); ! void roadmap_trip_set_modified(int modified); ! void roadmap_trip_unset_route_focii (void); + /* Add Waypoint dialog */ + #define TRIP_PLACE_PERSONAL_MARK 0 + #define TRIP_PLACE_TRIP_MARK 1 + #define TRIP_PLACE_NEW_ROUTE 2 + #define TRIP_PLACE_ROUTE_MARK_DEST 3 + #define TRIP_PLACE_ROUTE_MARK_INSERT 4 + #define TRIP_PLACE_ROUTE_MARK_START 5 + + #define TRIP_NUM_PLACEMENTS 3 + #define TRIP_NUM_ROUTE_PLACEMENTS 6 + + #endif // INCLUDE__ROADMAP_TRIP__H Index: roadmap_start.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_start.c,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** roadmap_start.c 10 Feb 2009 11:41:02 -0000 1.154 --- roadmap_start.c 15 Feb 2009 15:32:27 -0000 1.155 *************** *** 1396,1399 **** --- 1396,1400 ---- roadmap_math_initialize (); roadmap_trip_initialize (); + roadmap_tripdb_initialize (); roadmap_track_initialize (); roadmap_landmark_initialize (); |
|
From: Danny B. <dan...@us...> - 2009-02-15 15:22:36
|
Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20561 Modified Files: Makefile Log Message: Build the roadmap_tripdb.c file. Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/Makefile,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** Makefile 15 Feb 2009 09:17:59 -0000 1.135 --- Makefile 15 Feb 2009 15:22:31 -0000 1.136 *************** *** 57,60 **** --- 57,61 ---- roadmap_object.c \ roadmap_trip.c \ + roadmap_tripdb.c \ roadmap_track.c \ roadmap_landmark.c \ *************** *** 297,300 **** --- 298,302 ---- roadmap_trigonometry.h \ roadmap_trip.h \ + roadmap_tripdb.h \ roadmap_types.h \ roadmap_vii.h \ *************** *** 383,386 **** --- 385,391 ---- # roadmap_line_route.c roadmap_turns.c + RMHEADERS += roadmap_skin.h roadmap_line_speed.h roadmap_db_line_speed.h roadmap_res.h + # roadmap_line_route.h roadmap_db_line_route.h roadmap_db_turns.h roadmap_turns.h + PLUGIN_CLEAN += ${TRIP_PLUGINSRC:.c=.o} ${RMLIBSRC:.c=.o} |
|
From: Danny B. <dan...@us...> - 2009-02-15 15:20:32
|
Update of /cvsroot/roadmap/roadmap/src/unix In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20117/unix Added Files: roadmap_sound.c Log Message: Add some source files. The skin and sound stuff is inherited and not well tested (by me) yet. The tripdb stuff is an attempt to start separating out functionality from roadmap_trip.c . --- NEW FILE: roadmap_sound.c --- /* * LICENSE: * * Copyright (c) 2008, Danny Backx. * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief Play sound on unix. */ #include "../roadmap.h" #include "../roadmap_path.h" #include "../roadmap_file.h" #include "../roadmap_res.h" #include "../roadmap_sound.h" #define MAX_LISTS 2 static RoadMapSoundList sound_lists[MAX_LISTS]; static int save_wav_file (void *data, unsigned int size); int roadmap_sound_play (RoadMapSound sound) { return -1; } int roadmap_sound_play_file (const char *file_name) { return -1; } RoadMapSound roadmap_sound_load (const char *path, const char *file, int *mem) { return NULL; } int roadmap_sound_free (RoadMapSound sound) { return 0; } RoadMapSoundList roadmap_sound_list_create (int flags) { return NULL; } int roadmap_sound_list_add (RoadMapSoundList list, const char *name) { return -1; } int roadmap_sound_list_count (const RoadMapSoundList list) { return -1; } const char *roadmap_sound_list_get (const RoadMapSoundList list, int i) { return NULL; } void roadmap_sound_list_free (RoadMapSoundList list) { } int roadmap_sound_play_list (const RoadMapSoundList list) { return 0; } void roadmap_sound_initialize (void) { } void roadmap_sound_shutdown (void) { } /* Recording */ static int allocate_rec_buffer(int seconds) { return 0; } static int save_wav_file (void *data, unsigned int size) { return 0; } int roadmap_sound_record (const char *file_name, int seconds) { return 0; } |
|
From: Danny B. <dan...@us...> - 2009-02-15 15:20:32
|
Update of /cvsroot/roadmap/roadmap/src/win32 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20117/win32 Added Files: roadmap_sound.c Log Message: Add some source files. The skin and sound stuff is inherited and not well tested (by me) yet. The tripdb stuff is an attempt to start separating out functionality from roadmap_trip.c . --- NEW FILE: roadmap_sound.c --- /* * LICENSE: * * Copyright 2006 Ehud Shabtai * Copyright (c) 2008, Danny Backx. * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief Play sound on Windows. * @ingroup windows */ #include <windows.h> #include "../roadmap.h" #include "../roadmap_path.h" #include "../roadmap_file.h" #include "../roadmap_res.h" #include "../roadmap_sound.h" #define MAX_LISTS 2 static RoadMapSoundList sound_lists[MAX_LISTS]; static CRITICAL_SECTION SoundCriticalSection; static HANDLE SoundEvent; static HANDLE SoundRecEvent; static HANDLE sound_thread; static HANDLE sound_rec_thread; static int current_list = -1; /* Recording stuff */ static WAVEHDR WaveHeader; static WAVEFORMATEX PCMfmt; static HWAVEIN hWaveIn; static char *RoadMapSoundRecName; struct WAVE_FORMAT { WORD wFormatTag; WORD wChannels; DWORD dwSamplesPerSec; DWORD dwAvgBytesPerSec; WORD wBlockAlign; WORD wBitsPerSample; }; struct RIFF_HEADER { CHAR szRiffID[4]; // 'R','I','F','F' DWORD dwRiffSize; CHAR szRiffFormat[4]; // 'W','A','V','E' }; struct FMT_BLOCK { CHAR szFmtID[4]; // 'f','m','t',' ' DWORD dwFmtSize; struct WAVE_FORMAT wavFormat; }; struct DATA_BLOCK { CHAR szDataID[4]; // 'd','a','t','a' DWORD dwDataSize; }; static int save_wav_file (void *data, unsigned int size); /** * @brief * @param lpParam * @return */ DWORD WINAPI SoundThread (LPVOID lpParam) { roadmap_log (ROADMAP_WARNING, "Start SoundThread()"); SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL); while (1) { int i; if (WaitForSingleObject(SoundEvent, INFINITE) == WAIT_FAILED) { return 0; } while (1) { RoadMapSoundList list; EnterCriticalSection (&SoundCriticalSection); current_list = (current_list + 1) % MAX_LISTS; if (sound_lists[current_list] == NULL) { /* nothing to play */ current_list = -1; } LeaveCriticalSection (&SoundCriticalSection); if (current_list == -1) break; list = sound_lists[current_list]; for (i=0; i<roadmap_sound_list_count (list); i++) { const char *name = roadmap_sound_list_get (list, i); RoadMapSound sound = roadmap_res_get (RES_SOUND, RES_NOCREATE, name); if (sound) { roadmap_sound_play (sound); } else { roadmap_sound_play_file (name); } } if (!(list->flags & SOUND_LIST_NO_FREE)) { roadmap_sound_list_free (list); } sound_lists[current_list] = NULL; } } roadmap_log (ROADMAP_WARNING, "Exit SoundThread()"); } /** * @brief * @param lpParam * @return */ DWORD WINAPI SoundRecThread (LPVOID lpParam) { roadmap_log (ROADMAP_WARNING, "Start SoundRecThread()"); while (1) { DWORD res; if (WaitForSingleObject(SoundRecEvent, INFINITE) == WAIT_FAILED) { return 0; } res = waveInUnprepareHeader(hWaveIn, &WaveHeader, sizeof(WAVEHDR)); res = save_wav_file (WaveHeader.lpData, WaveHeader.dwBytesRecorded); free(WaveHeader.lpData); WaveHeader.lpData = NULL; res = waveInReset(hWaveIn); res = waveInClose(hWaveIn); hWaveIn = NULL; roadmap_sound_play_file ("rec_end.wav"); res = res; } roadmap_log (ROADMAP_WARNING, "Exit SoundRecThread()"); } /** * @brief play a sound from a memory structure * @param sound * @return 0 on success, -1 on failure */ int roadmap_sound_play (RoadMapSound sound) { BOOL res; void *mem; if (!sound) return -1; mem = roadmap_file_base ((RoadMapFileContext)sound); res = PlaySound((LPWSTR)mem, NULL, SND_SYNC | SND_MEMORY); if (res == TRUE) return 0; else return -1; } /** * @brief play a sound from a file * @param file_name this file contains the sound * @return 0 on success, -1 on failure */ int roadmap_sound_play_file (const char *file_name) { char full_name[256]; LPWSTR file_name_unicode; BOOL res; if (roadmap_path_is_full_path (file_name)) { file_name_unicode = ConvertToUNICODE(file_name); } else { snprintf (full_name, sizeof(full_name), "%s\\sound\\%s", roadmap_path_user (), file_name); file_name_unicode = ConvertToUNICODE(full_name); } res = PlaySound(file_name_unicode, NULL, SND_SYNC | SND_FILENAME); free(file_name_unicode); if (res == TRUE) return 0; else return -1; } /** * @brief Create a RoadMapSound structure from a file * @param path name of directory containing the file * @param file the file name * @param mem pointer to an int that'll contain the size of this sound * @return the newly created structure */ RoadMapSound roadmap_sound_load (const char *path, const char *file, int *mem) { char *full_name = roadmap_path_join (path, file); const char *seq; RoadMapFileContext sound; seq = roadmap_file_map (NULL, full_name, "r", &sound); roadmap_path_free (full_name); if (seq == NULL) { *mem = 0; return NULL; } *mem = roadmap_file_size (sound); return (RoadMapSound) sound; } /** * @brief unmap/release the file associated with this RoadMapSound structure * @param sound * @return 0 for success */ int roadmap_sound_free (RoadMapSound sound) { if (! sound) return -1; roadmap_file_unmap ((RoadMapFileContext*) &sound); return 0; } /** * @brief * @param flags * @return */ RoadMapSoundList roadmap_sound_list_create (int flags) { RoadMapSoundList list = (RoadMapSoundList) calloc (1, sizeof(struct roadmap_sound_list_t)); list->flags = flags; return list; } /** * @brief * @param list * @param name * @return */ int roadmap_sound_list_add (RoadMapSoundList list, const char *name) { if (list->count == MAX_SOUND_LIST) return -1; strncpy (list->list[list->count], name, sizeof(list->list[0])); list->list[list->count][sizeof(list->list[0])-1] = '\0'; list->count++; return list->count - 1; } int roadmap_sound_list_count (const RoadMapSoundList list) { return list->count; } const char *roadmap_sound_list_get (const RoadMapSoundList list, int i) { if (i >= MAX_SOUND_LIST) return NULL; return list->list[i]; } void roadmap_sound_list_free (RoadMapSoundList list) { free(list); } int roadmap_sound_play_list (const RoadMapSoundList list) { EnterCriticalSection (&SoundCriticalSection); if (current_list == -1) { /* not playing */ sound_lists[0] = list; SetEvent(SoundEvent); } else { int next = (current_list + 1) % MAX_LISTS; if (sound_lists[next] != NULL) { if (!(sound_lists[next]->flags & SOUND_LIST_NO_FREE)) { roadmap_sound_list_free (sound_lists[next]); } } sound_lists[next] = list; } LeaveCriticalSection (&SoundCriticalSection); return 0; } void roadmap_sound_initialize (void) { SoundEvent = CreateEvent (NULL, FALSE, FALSE, NULL); SoundRecEvent = CreateEvent (NULL, FALSE, FALSE, NULL); InitializeCriticalSection (&SoundCriticalSection); sound_thread = CreateThread(NULL, 0, SoundThread, NULL, 0, NULL); /* Recording */ PCMfmt.cbSize=0; PCMfmt.wFormatTag=WAVE_FORMAT_PCM; PCMfmt.nChannels=1; PCMfmt.nSamplesPerSec=11025; PCMfmt.wBitsPerSample=8; PCMfmt.nBlockAlign=1; PCMfmt.nAvgBytesPerSec=11025; } void roadmap_sound_shutdown (void) { DWORD res; CloseHandle (SoundEvent); if (SoundRecEvent) CloseHandle (SoundRecEvent); DeleteCriticalSection (&SoundCriticalSection); if (hWaveIn != NULL) { res = waveInReset(hWaveIn); res = waveInClose(hWaveIn); hWaveIn = NULL; } } /* Recording */ static int allocate_rec_buffer(int seconds) { int length = PCMfmt.nSamplesPerSec*PCMfmt.nChannels* PCMfmt.wBitsPerSample*seconds/8; void *buffer = malloc(length); if (!buffer) return -1; WaveHeader.lpData=buffer; WaveHeader.dwBufferLength=length; WaveHeader.dwBytesRecorded=0; WaveHeader.dwUser=0; WaveHeader.dwFlags=0; WaveHeader.reserved=0; WaveHeader.lpNext=0; return 0; } /** * @brief * @param data * @param size * @return */ static int save_wav_file (void *data, unsigned int size) { struct RIFF_HEADER rh = { {'R', 'I', 'F', 'F'}, size - 8, {'W', 'A', 'V', 'E'}}; struct FMT_BLOCK fb = { {'f', 'm', 't', ' '}, sizeof(struct WAVE_FORMAT), {0, 0, 0, 0, 0, 0} }; struct DATA_BLOCK db = { {'d', 'a', 't', 'a'}, size }; FILE *file; fb.wavFormat.wFormatTag = PCMfmt.wFormatTag; fb.wavFormat.wChannels = PCMfmt.nChannels; fb.wavFormat.dwSamplesPerSec = PCMfmt.nSamplesPerSec; fb.wavFormat.dwAvgBytesPerSec = PCMfmt.nAvgBytesPerSec; fb.wavFormat.wBlockAlign = PCMfmt.nBlockAlign; fb.wavFormat.wBitsPerSample = PCMfmt.wBitsPerSample; file = roadmap_file_fopen (NULL, RoadMapSoundRecName, "w"); if (!file) return -1; { int test = sizeof(rh) + sizeof(fb) + sizeof(db); test = test; } fwrite(&rh, sizeof(rh), 1, file); fwrite(&fb, sizeof(fb), 1, file); fwrite(&db, sizeof(db), 1, file); fwrite(data, size, 1, file); fclose (file); return 0; } int roadmap_sound_record (const char *file_name, int seconds) { DWORD res; if (hWaveIn != NULL) return -1; if (sound_rec_thread == NULL) { sound_rec_thread = CreateThread(NULL, 0, SoundRecThread, NULL, 0, NULL); } if (RoadMapSoundRecName != NULL) { free(RoadMapSoundRecName); } RoadMapSoundRecName = strdup(file_name); res = waveInOpen(&hWaveIn, (UINT) WAVE_MAPPER, &PCMfmt, (DWORD) SoundRecEvent, (DWORD) 0, CALLBACK_EVENT); res = allocate_rec_buffer (seconds); res = waveInPrepareHeader(hWaveIn, &WaveHeader, sizeof(WAVEHDR)); res = waveInAddBuffer(hWaveIn, &WaveHeader, sizeof(WAVEHDR)); roadmap_sound_play_file ("rec_start.wav"); res = waveInStart(hWaveIn); return 0; } |
|
From: Danny B. <dan...@us...> - 2009-02-15 15:20:31
|
Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20117 Added Files: roadmap_skin.c roadmap_skin.h roadmap_sound.h roadmap_tripdb.c roadmap_tripdb.h Log Message: Add some source files. The skin and sound stuff is inherited and not well tested (by me) yet. The tripdb stuff is an attempt to start separating out functionality from roadmap_trip.c . --- NEW FILE: roadmap_tripdb.c --- /* * LICENSE: * * Copyright (c) 2008, 2009 Danny Backx * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief Manage a trip: destination & waypoints. * * This file is somewhat overloaded with functionality : it appears to keep track * of quite a number of things (trip, waypoints, starting point/destination/.., * focal points, ..), it draws a visual indication (green dots and slim red lines * between them) of the current route, .. . */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include "roadmap.h" #include "roadmap_list.h" #include "roadmap_gpx.h" #include "roadmap_plugin.h" #include "roadmap_types.h" #include "roadmap_math.h" #include "roadmap_street.h" #include "roadmap_tripdb.h" #include "roadmap_trip.h" #include "roadmap_layer.h" #include "roadmap_point.h" /** * @brief this array holds the current route (from the navigate plugin) */ static RoadMapTripSegment RoadMapTripSegments[MAX_NAV_SEGMENTS]; static int RoadMapTripNumSegments = 0; /**< number of segments */ static int RoadMapTripCurrentSegment = 0; /**< where we are from the start */ static RoadMapPosition RoadMapTripLastPos; RoadMapList RoadMapTripWaypointHead; RoadMapList RoadMapTripRouteHead; RoadMapList RoadMapTripTrackHead; /* route following flags */ route_head *RoadMapCurrentRoute = NULL; /* These point at waypoints in the current route. */ waypoint *RoadMapTripDest = NULL; /** * @brief */ void roadmap_tripdb_empty_list (void) { RoadMapTripNumSegments = 0; RoadMapTripCurrentSegment = 0; RoadMapTripLastPos.longitude = -1; RoadMapTripLastPos.latitude = -1; roadmap_plugin_route_clear(); } /** * @brief * @param pos */ void roadmap_trip_add_waypoint_iter (RoadMapPosition pos) { waypoint *wpt = waypt_new(); wpt->pos = pos; waypt_add(&RoadMapTripWaypointHead, wpt); } /** * @brief call this after having added all waypoints and ways */ void roadmap_trip_complete (void) { #if 0 ROADMAP_LIST_MOVE(&TripWaypointHead, &tmp_waypoint_list); ROADMAP_LIST_MOVE(&TripRouteHead, &tmp_route_list); ROADMAP_LIST_MOVE(&TripTrackHead, &tmp_track_list); #endif RoadMapCurrentRoute = (route_head *)ROADMAP_LIST_FIRST(&RoadMapTripRouteHead); } /** * @brief inefficient way (look up everything again) to .. * add a line between two positions to the trip, * find a street that appears to match (FIX ME simple/bar heuristic here), * and add the street to the list of streets that gets highlighted * @param from starting point of this line * @param to end point of this line * @param instr trip instruction associated with this */ #define TRIP_MAX_NEIGHBOURS 200 #define MAX_CAT 10 void roadmap_trip_add_way(RoadMapPosition from, RoadMapPosition to, enum RoadMapTurningInstruction instr) { int num, ncategories, maxneighbours, i; int categories[MAX_CAT]; RoadMapNeighbour neighbours[TRIP_MAX_NEIGHBOURS]; roadmap_log (ROADMAP_DEBUG, "trip_add_way %d", RoadMapTripNumSegments); RoadMapTripSegments[RoadMapTripNumSegments].instruction = instr; RoadMapTripSegments[RoadMapTripNumSegments].from_pos = from; RoadMapTripSegments[RoadMapTripNumSegments].to_pos = to; RoadMapTripNumSegments++; maxneighbours = 100; ncategories = roadmap_layer_navigable(0 /* car ?? */, categories, MAX_CAT); num = roadmap_street_get_closest(&from, categories, ncategories, neighbours, maxneighbours); if (num == TRIP_MAX_NEIGHBOURS) { roadmap_log (ROADMAP_WARNING, "trip_add_way: sizing %d insufficient", TRIP_MAX_NEIGHBOURS); } for (i=0; i<num; i++) { if (roadmap_math_distance(&neighbours[i].from, &from) < 20) { RoadMapStreetProperties p; roadmap_street_get_properties(neighbours[i].line.line_id, &p); /* Get a highlight */ roadmap_plugin_route_add(neighbours[i].line.line_id, neighbours[i].line.layer, neighbours[i].line.fips); } } } /** * @brief efficient approach to add a line between two points to the trip, and get it highlighted * @param from_point starting point of this line * @param to_point end point of this line * @param line the line * @param instr trip instruction associated with this */ #define TRIP_MAX_NEIGHBOURS 200 #define MAX_CAT 10 void roadmap_trip_add_point_way(int from_point, int to_point, PluginLine line, enum RoadMapTurningInstruction instr) { roadmap_log (ROADMAP_DEBUG, "trip_add_way2 %d, line %d", RoadMapTripNumSegments, line.line_id); RoadMapTripSegments[RoadMapTripNumSegments].instruction = instr; roadmap_point_position(from_point, &RoadMapTripSegments[RoadMapTripNumSegments].from_pos); roadmap_point_position(to_point, &RoadMapTripSegments[RoadMapTripNumSegments].to_pos); RoadMapTripNumSegments++; roadmap_plugin_route_add(line.line_id, line.layer, line.fips); } /** * @brief function to call from iterator, meaning it gets called for all trip waypoints loaded * Need to convert two consecutive calls (each with a waypoint) into one line. * @param waypointp pointer to the current waypoint */ void roadmap_tripdb_waypoint_iter (const waypoint *waypointp) { if (RoadMapTripLastPos.longitude == -1) { RoadMapTripLastPos = waypointp->pos; return; } roadmap_trip_add_way(RoadMapTripLastPos, waypointp->pos, (waypointp == RoadMapTripDest) ? TRIP_APPROACHING_DESTINATION : TRIP_CONTINUE); /* remember this waypoint for next line */ RoadMapTripLastPos = waypointp->pos; return; } /** * @brief */ void roadmap_tripdb_initialize (void) { ROADMAP_LIST_INIT(&RoadMapTripWaypointHead); ROADMAP_LIST_INIT(&RoadMapTripRouteHead); } /** * @brief * @param name */ void roadmap_tripdb_remove_point (const char *name) { #warning reimplement roadmap_trip_remove_point #if 0 RoadMapTripPoint *result; if (name == NULL) { roadmap_trip_remove_dialog (); return; } result = roadmap_trip_search (name); if (result == NULL) { roadmap_log (ROADMAP_ERROR, "cannot delete: point %s not found", name); return; } if (result->predefined) { roadmap_log (ROADMAP_ERROR, "cannot delete: point %s is predefined", name); return; } if (RoadMapTripFocus == result || RoadMapTripDeparture == result || RoadMapTripDestination == result) { roadmap_trip_unfocus (); } if (roadmap_math_point_is_visible (&result->map)) { roadmap_trip_refresh_needed(); } roadmap_list_remove (&result->link); free (result->id); free (result->sprite); free(result); RoadMapTripModified = 1; roadmap_screen_refresh(); #endif } /** * * @brief clear the current trip * */ void roadmap_tripdb_clear (void) { waypt_flush_queue (&RoadMapTripWaypointHead); route_flush_queue (&RoadMapTripRouteHead); route_flush_queue (&RoadMapTripTrackHead); roadmap_trip_set_modified(1); RoadMapCurrentRoute = NULL; roadmap_trip_unset_route_focii (); roadmap_trip_refresh_needed(); } --- NEW FILE: roadmap_tripdb.h --- /* * LICENSE: * * Copyright (c) 2008, 2009 Danny Backx * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief maintain a database with a trip */ #ifndef _ROADMAP_TRIPDB_H_ #define _ROADMAP_TRIPDB_H_ #include "roadmap_gpx.h" extern RoadMapList RoadMapTripWaypointHead; extern RoadMapList RoadMapTripRouteHead; extern RoadMapList RoadMapTripTrackHead; extern route_head *RoadMapCurrentRoute; extern waypoint *RoadMapTripDest; /* * @brief turning instructions */ enum RoadMapTurningInstruction { TRIP_TURN_LEFT = 0, TRIP_TURN_RIGHT, TRIP_KEEP_LEFT, TRIP_KEEP_RIGHT, TRIP_CONTINUE, TRIP_APPROACHING_DESTINATION, TRIP_LAST_DIRECTION /**< not to be used */ }; /** * @brief this structure holds an entry in the route */ typedef struct { PluginLine line; int line_direction; PluginStreet street; RoadMapPosition from_pos; RoadMapPosition to_pos; RoadMapPosition shape_initial_pos; int first_shape; int last_shape; RoadMapShapeItr shape_itr; enum RoadMapTurningInstruction instruction; int group_id; int distance; int cross_time; } RoadMapTripSegment; #define MAX_NAV_SEGMENTS 1500 void roadmap_tripdb_empty_list (void); void roadmap_tripdb_add_waypoint_iter (RoadMapPosition pos); void roadmap_trip_complete (void); void roadmap_trip_add_way(RoadMapPosition from, RoadMapPosition to, enum RoadMapTurningInstruction instr); void roadmap_trip_add_point_way(int from_point, int to_point, PluginLine line, enum RoadMapTurningInstruction instr); void roadmap_tripdb_waypoint_iter (const waypoint *waypointp); void roadmap_tripdb_initialize (void); void roadmap_tripdb_remove_point (const char *name); void roadmap_tripdb_clear(void); #endif --- NEW FILE: roadmap_skin.c --- /* roadmap_skin.c - manage skins * * LICENSE: * * Copyright 2006 Ehud Shabtai * * 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 * * DESCRIPTION: * */ #include <stdio.h> #include <string.h> #include "roadmap.h" #include "roadmap_path.h" #include "roadmap_config.h" #include "roadmap_screen.h" #include "roadmap_skin.h" #define MAX_LISTENERS 16 static RoadMapCallback RoadMapSkinListeners[MAX_LISTENERS] = {NULL}; static const char *CurrentSkin = "default"; static const char *CurrentSubSkin = "day"; static void notify_listeners (void) { int i; for (i = 0; i < MAX_LISTENERS; ++i) { if (RoadMapSkinListeners[i] == NULL) break; (RoadMapSkinListeners[i]) (); } } void roadmap_skin_register (RoadMapCallback listener) { int i; for (i = 0; i < MAX_LISTENERS; ++i) { if (RoadMapSkinListeners[i] == NULL) { RoadMapSkinListeners[i] = listener; break; } } } void roadmap_skin_set_subskin (const char *sub_skin) { const char *base_path = roadmap_path_preferred ("skin"); char path[255]; char *skin_path; char *subskin_path; CurrentSubSkin = sub_skin; skin_path = roadmap_path_join (base_path, CurrentSkin); subskin_path = roadmap_path_join (skin_path, CurrentSubSkin); snprintf (path, sizeof(path), "%s,%s", subskin_path, skin_path); roadmap_path_set ("skin", path); roadmap_path_free (subskin_path); roadmap_path_free (skin_path); roadmap_config_reload ("preferences"); notify_listeners (); roadmap_screen_repaint (); } void roadmap_skin_toggle (void) { if (!strcmp (CurrentSubSkin, "day")) { roadmap_skin_set_subskin ("night"); } else { roadmap_skin_set_subskin ("day"); } } --- NEW FILE: roadmap_skin.h --- /* roadmap_skin.h - manage skins. * * LICENSE: * * Copyright 2006 Ehud Shabtai * * 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_SKIN__H #define INCLUDE__ROADMAP_SKIN__H #include "roadmap.h" void roadmap_skin_register (RoadMapCallback listener); void roadmap_skin_set_subskin (const char *sub_skin); void roadmap_skin_toggle (void); #endif // INCLUDE__ROADMAP_SKIN__H --- NEW FILE: roadmap_sound.h --- /* roadmap_sound.h - Play sound * * LICENSE: * * Copyright 2006 Ehud Shabtai * * 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 __ROADMAP_SOUND__H #define __ROADMAP_SOUND__H #define MAX_SOUND_LIST 20 #define MAX_SOUND_NAME 30 #define SOUND_LIST_NO_FREE 0x1 #ifndef J2ME struct roadmap_sound_list_t { int flags; int count; char list[MAX_SOUND_LIST][MAX_SOUND_NAME]; }; typedef struct roadmap_sound_list_t *RoadMapSoundList; #else typedef int RoadMapSoundList; #endif struct roadmap_sound_st; typedef struct roadmap_sound_st *RoadMapSound; RoadMapSoundList roadmap_sound_list_create (int flags); int roadmap_sound_list_add (RoadMapSoundList list, const char *name); int roadmap_sound_list_count (const RoadMapSoundList list); const char *roadmap_sound_list_get (const RoadMapSoundList list, int i); void roadmap_sound_list_free (RoadMapSoundList list); RoadMapSound roadmap_sound_load (const char *path, const char *file, int *mem); int roadmap_sound_free (RoadMapSound sound); int roadmap_sound_play (RoadMapSound sound); int roadmap_sound_play_file (const char *file_name); int roadmap_sound_play_list (const RoadMapSoundList list); void roadmap_sound_initialize (void); void roadmap_sound_shutdown (void); int roadmap_sound_record (const char *file_name, int seconds); #endif // __ROADMAP_SOUND__H |
|
From: Danny B. <dan...@us...> - 2009-02-15 09:19:36
|
Update of /cvsroot/roadmap/roadmap/src/unix In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv2199/unix Modified Files: Makefile Log Message: Also support plugins in unix world :-) Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/unix/Makefile,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Makefile 28 Jun 2008 16:49:28 -0000 1.12 --- Makefile 15 Feb 2009 09:19:32 -0000 1.13 *************** *** 14,17 **** --- 14,24 ---- roadmap_time.c + ifeq ($(USE_TRIP_PLUGIN),yes) + LIBSRCS += roadmap_sound.c + endif + ifeq ($(USE_NAVIGATE_PLUGIN),yes) + LIBSRCS += roadmap_sound.c + endif + LIBOBJS=$(LIBSRCS:.c=.o) |
|
From: Danny B. <dan...@us...> - 2009-02-15 09:18:05
|
Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv2126 Modified Files: Makefile Log Message: Add support for building three plugins (editor, trip, navigate). Note : I'll focus on only the navigate plugin now. Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/Makefile,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -d -r1.134 -r1.135 *** Makefile 8 Feb 2009 21:16:28 -0000 1.134 --- Makefile 15 Feb 2009 09:17:59 -0000 1.135 *************** *** 90,95 **** RGGUIOBJS = $(RGGUISRC:.c=.o) ! ! RMPLUGINSRC = roadmap_copy.c roadmap_httpcopy.c RMPLUGINOBJS=$(RMPLUGINSRC:.c=.o) --- 90,97 ---- RGGUIOBJS = $(RGGUISRC:.c=.o) ! RMPLUGINSRC = \ ! roadmap_copy.c \ ! roadmap_httpcopy.c \ ! $(EDITOR_PLUGINSRC) $(TRIP_PLUGINSRC) $(NAVIGATE_PLUGINSRC) RMPLUGINOBJS=$(RMPLUGINSRC:.c=.o) *************** *** 339,343 **** # more products ifeq ($(DESKTOP),WINCE) ! BUILD = else BUILD = buildmap buildmap_osm buildus buildplace dumpmap --- 341,345 ---- # more products ifeq ($(DESKTOP),WINCE) ! BUILD = # buildus else BUILD = buildmap buildmap_osm buildus buildplace dumpmap *************** *** 365,368 **** --- 367,480 ---- ALL_SUBDIRS = unix gpx gtk gtk2 qt qt4 icons ipkg agg_support php win32 + # --- Additions for Trip plugin ------------------------------- + + ifeq ($(USE_TRIP_PLUGIN),yes) + TRIP_PLUGINSRC = \ + trip/trip_bar.c \ + trip/trip_cost.c \ + trip/trip_instr.c \ + trip/trip.c \ + trip/trip_plugin.c \ + trip/trip_traffic.c + + CFLAGS += -DHAVE_TRIP_PLUGIN + + RMLIBSRC += roadmap_skin.c roadmap_line_speed.c roadmap_res.c + # roadmap_line_route.c roadmap_turns.c + + PLUGIN_CLEAN += ${TRIP_PLUGINSRC:.c=.o} ${RMLIBSRC:.c=.o} + + RMGUISRC += + + ALL_SUBDIRS += + + else + TRIP_PLUGINSRC = + endif + + # --- Additions for Navigate plugin ------------------------------- + + ifeq ($(USE_NAVIGATE_PLUGIN),yes) + NAVIGATE_PLUGINSRC = \ + navigate/navigate.c \ + navigate/navigate_instr.c \ + navigate/navigate_bar.c \ + navigate/navigate_zoom.c \ + navigate/navigate_plugin.c \ + navigate/navigate_traffic.c \ + navigate/navigate_graph.c \ + navigate/navigate_cost.c \ + navigate/navigate_simple.c \ + navigate/navigate_route.c + # navigate/fib-1.1/fib.c + + CFLAGS += -DHAVE_NAVIGATE_PLUGIN + + PLUGIN_CLEAN += ${NAVIGATE_PLUGINSRC:.c=.o} + # + # support for navigate plugin without trip plugin + # + RMLIBSRC += roadmap_skin.c roadmap_line_speed.c roadmap_res.c roadmap_line_route.c + # roadmap_turns.c + # + # End of support for navigate plugin without trip plugin + # + + RMGUISRC += + + ALL_SUBDIRS += + + else + NAVIGATE_PLUGINSRC = + endif + + # --- Additions for Editor plugin ------------------------------- + + ifeq ($(USE_EDITOR_PLUGIN),yes) + EDITOR_PLUGINSRC = \ + editor/editor_plugin.c \ + editor/editor_main.c \ + editor/editor_screen.c \ + editor/static/editor_dialog.c \ + editor/static/update_range.c \ + editor/static/edit_marker.c \ + editor/static/notes.c \ + editor/db/editor_street.c \ + editor/db/editor_point.c \ + editor/db/editor_shape.c \ + editor/db/editor_line.c \ + editor/db/editor_square.c \ + editor/db/editor_route.c \ + editor/db/editor_marker.c \ + editor/db/editor_dictionary.c \ + editor/db/editor_override.c \ + editor/export/editor_export.c \ + editor/export/editor_download.c \ + editor/export/editor_upload.c \ + editor/export/editor_sync.c \ + editor/db/editor_trkseg.c \ + editor/track/editor_track_filter.c \ + editor/track/editor_track_util.c \ + editor/track/editor_track_main.c \ + editor/track/editor_track_unknown.c \ + editor/track/editor_track_known.c \ + editor/track/editor_gps_data.c \ + editor/db/editor_db.c \ + buildmap_dbwrite.c \ + buildmap_metadata.c \ + buildmap_messages.c + + CFLAGS += -DHAVE_EDITOR_PLUGIN + + RMLIBSRC += \ + + RMGUISRC += + + ALL_SUBDIRS += + + else + EDITOR_PLUGINSRC = + endif + # --- Conventional targets ---------------------------------------- *************** *** 431,435 **** $(MAKE) -C $$module clean || exit 1; \ done ! rm -f agg_support/*.o agg_support/.depends.mk --- 543,547 ---- $(MAKE) -C $$module clean || exit 1; \ done ! rm -f agg_support/*.o agg_support/.depends.mk ${PLUGIN_CLEAN} *************** *** 633,634 **** --- 745,757 ---- apidocs: roadmap.doxy doxygen roadmap.doxy + # + # This special dependency makes sure you pick up changes to the Makefile. + # Psst: mention all the sources that have #ifdef HAVE_TRIP_PLUGIN or so. + # + roadmap_start.o: Makefile config.mk + roadmap_line.o: Makefile config.mk + roadmap_math.o: Makefile config.mk + roadmap_point.o: Makefile config.mk + roadmap_screen.o: Makefile config.mk + roadmap_plugin.o: Makefile config.mk + roadmap_trip.o: Makefile config.mk |
|
From: Danny B. <dan...@us...> - 2009-02-15 09:18:04
|
Update of /cvsroot/roadmap/roadmap/src/win32 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv2126/win32 Modified Files: Makefile Log Message: Add support for building three plugins (editor, trip, navigate). Note : I'll focus on only the navigate plugin now. Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/win32/Makefile,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Makefile 9 Feb 2009 23:24:04 -0000 1.20 --- Makefile 15 Feb 2009 09:17:59 -0000 1.21 *************** *** 39,42 **** --- 39,52 ---- roadmap_colors.c + # + # No support for navigate plugin without trip plugin + # + ifeq ($(USE_TRIP_PLUGIN),yes) + RMLIBSRC += roadmap_sound.c + endif + ifeq ($(USE_NAVIGATE_PLUGIN),yes) + RMLIBSRC += roadmap_sound.c + endif + # roadmap_keyboard.c \ # roadmap_signals.c \ *************** *** 54,58 **** TARGETS = wroadmap.exe ! # TARGETS += wroadmap.cab demomaps.cab # --- The real targets -------------------------------------------- --- 64,69 ---- TARGETS = wroadmap.exe ! TARGETS += wroadmap.cab demomaps.cab ! # TARGETS += testpower.exe # --- The real targets -------------------------------------------- *************** *** 70,73 **** --- 81,87 ---- $(RANLIB) libwroadmap.a + WINCE_LIBS= -lcommctrl -laygshell -lws2 + # WINCE_LIBS= -lcommctrl -lws2 + wroadmap.exe: roadmap_main.o libwroadmap.a roadmap.rsc \ roadmap_build.c \ *************** *** 77,81 **** roadmap_build.o \ $(TOP)/libguiroadmap.a libwroadmap.a $(LIBS) \ ! libwroadmap.a -lcommctrl -laygshell -lws2 # --- 91,95 ---- roadmap_build.o \ $(TOP)/libguiroadmap.a libwroadmap.a $(LIBS) \ ! libwroadmap.a ${WINCE_LIBS} # *************** *** 88,92 **** # libwroadmap.a -lcommctrl -laygshell -lws2 - # for win32 we aren't as rigorous about producing # this list of source as we are for the other RoadMap --- 102,105 ---- |
|
From: Danny B. <dan...@us...> - 2009-02-12 20:09:44
|
Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv19858 Modified Files: roadmap_math.c Log Message: Add documentation stubs and a function. Index: roadmap_math.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_math.c,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** roadmap_math.c 6 Nov 2008 20:31:02 -0000 1.57 --- roadmap_math.c 12 Feb 2009 20:09:38 -0000 1.58 *************** *** 1,8 **** ! /* roadmap_math.c - Manage the little math required to place points on a map. ! * * LICENSE: * * Copyright 2002 Pascal F. Martin * Copyright 2005,2006 Ehud Shabtai * * 3D perspective support was integrated from the RoadNav project --- 1,8 ---- ! /* * LICENSE: * * Copyright 2002 Pascal F. Martin * Copyright 2005,2006 Ehud Shabtai + * Copyright (c) 2008, 2009, Danny Backx. * * 3D perspective support was integrated from the RoadNav project *************** *** 24,31 **** * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * ! * SYNOPSYS: ! * ! * See roadmap_math.h. * * These functions are used to compute the position of points on the map, --- 24,32 ---- * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! /** ! * @file ! * @brief roadmap_math.c - Manage the little math required to place points on a map. * * These functions are used to compute the position of points on the map, *************** *** 104,110 **** }; ! static struct { - unsigned short zoom; --- 105,126 ---- }; ! /** ! * @brief We maintain two copies of this context struct, which is all ! * of the state information needed to position and scale the map. ! * ! * One copy is the working copy, and is used by all of the worker ! * routines that adjust that context -- the zoom and motion commands, etc. ! * ! * The other copy is _only_ used while we're repainting the ! * screen -- this copy is created from the "working" context when ! * we commence the repaint. ! * ! * Making a static copy for the duration of the repaint guarantees that the ! * entire repaint will be done using just one set of parameters, even if ! * motion/zoom/rotation actions happen in the middle. (Many of those actions ! * will cause a new repaint, but sometimes we ignore them -- if we're almost ! * finished with the current repaint, for instance. ! */ static struct { unsigned short zoom; *************** *** 143,161 **** } RoadMapDisplayContext, RoadMapWorkingContext, *RoadMapContext; ! /* ! * We maintain two copies of the above context struct, which is all ! * of the state information needed to position and scale the map. ! * One copy is the working copy, and is used by all of the worker ! * routines that adjust that context -- the zoom and motion commands, ! * etc. The other copy is _only_ used while we're repainting the ! * screen -- this copy is created from the "working" context when ! * we commence the repaint. Making a static copy for the duration of ! * the repaint guarantees that the entire repaint will be done using ! * just one set of parameters, even if motion/zoom/rotation actions ! * happen in the middle. (Many of those actions will cause a new ! * repaint, but sometimes we ignore them -- if we're almost finished ! * with the current repaint, for instance. */ - void roadmap_math_display_context(int copy) { --- 159,166 ---- } RoadMapDisplayContext, RoadMapWorkingContext, *RoadMapContext; ! /** ! * @brief ! * @param copy */ void roadmap_math_display_context(int copy) { *************** *** 165,168 **** --- 170,176 ---- } + /** + * @brief + */ void roadmap_math_working_context(void) { *************** *** 170,175 **** } ! ! static void roadmap_math_trigonometry (int angle, int *sine_p, int *cosine_p) { --- 178,187 ---- } ! /** ! * @brief ! * @param angle ! * @param sine_p ! * @param cosine_p ! */ static void roadmap_math_trigonometry (int angle, int *sine_p, int *cosine_p) { *************** *** 204,208 **** } ! static int roadmap_math_arccosine (int cosine, int sign) { --- 216,225 ---- } ! /** ! * @brief ! * @param cosine ! * @param sign ! * @return ! */ static int roadmap_math_arccosine (int cosine, int sign) { *************** *** 276,280 **** } ! void roadmap_math_compute_scale (void) { --- 293,299 ---- } ! /** ! * @brief ! */ void roadmap_math_compute_scale (void) { *************** *** 344,348 **** } ! static int roadmap_math_check_point_in_segment (const RoadMapPosition *from, const RoadMapPosition *to, --- 363,375 ---- } ! /** ! * @brief ! * @param from ! * @param to ! * @param point ! * @param count ! * @param intersections ! * @return ! */ static int roadmap_math_check_point_in_segment (const RoadMapPosition *from, const RoadMapPosition *to, *************** *** 369,373 **** } ! static int roadmap_math_find_screen_intersection (const RoadMapPosition *from, const RoadMapPosition *to, --- 396,409 ---- } ! /** ! * @brief ! * @param from ! * @param to ! * @param a ! * @param b ! * @param intersections ! * @param max_intersections ! * @return ! */ static int roadmap_math_find_screen_intersection (const RoadMapPosition *from, const RoadMapPosition *to, *************** *** 459,463 **** } ! static void roadmap_math_counter_rotate_coordinate (RoadMapGuiPoint *point) { --- 495,502 ---- } ! /** ! * @brief ! * @param point ! */ static void roadmap_math_counter_rotate_coordinate (RoadMapGuiPoint *point) { *************** *** 476,480 **** } ! #if USE_FLOAT /* for reference, until we're sure integer version works */ static void roadmap_math_project (RoadMapGuiPoint *point) { --- 515,522 ---- } ! /** ! * @brief ! * @param point ! */ #if USE_FLOAT /* for reference, until we're sure integer version works */ static void roadmap_math_project (RoadMapGuiPoint *point) { *************** *** 506,509 **** --- 548,555 ---- } + /** + * @brief + * @param point + */ void roadmap_math_unproject (RoadMapGuiPoint *point) { *************** *** 618,625 **** } ! /* Rotation of the screen: * rotate the coordinates of a point on the screen, the center of * the rotation being the center of the screen. */ void roadmap_math_rotate_coordinates (int count, RoadMapGuiPoint *points) { --- 664,691 ---- } + #if defined(HAVE_TRIP_PLUGIN) ! #define DOTS_PER_INCH 72 ! #define INCHES_PER_DEGREE 4374754 ! ! void roadmap_math_set_scale (int scale, int use_map_units) ! { ! int res; ! if (use_map_units) { ! res = scale / (RoadMapContext->units->unit_per_latitude * use_map_units); ! } else { ! res = scale / (1.0 * DOTS_PER_INCH * INCHES_PER_DEGREE / 1000000); ! } ! roadmap_math_zoom_set (res); ! } ! #endif ! ! /** ! * @brief Rotation of the screen: * rotate the coordinates of a point on the screen, the center of * the rotation being the center of the screen. + * + * @param count + * @param points */ void roadmap_math_rotate_coordinates (int count, RoadMapGuiPoint *points) { *************** *** 659,664 **** ! /* ! * rotate the coordinates of a point to an arbitrary angle */ void roadmap_math_rotate_point (RoadMapGuiPoint *point, --- 725,733 ---- ! /** ! * @brief rotate the coordinates of a point to an arbitrary angle ! * @param point ! * @param center ! * @param angle */ void roadmap_math_rotate_point (RoadMapGuiPoint *point, *************** *** 736,740 **** } ! void roadmap_math_initialize (void) { --- 805,811 ---- } ! /** ! * @brief ! */ void roadmap_math_initialize (void) { *************** *** 754,758 **** } ! void roadmap_math_use_metric (void) { --- 825,831 ---- } ! /** ! * @brief ! */ void roadmap_math_use_metric (void) { *************** *** 761,765 **** } ! void roadmap_math_use_imperial (void) { --- 834,840 ---- } ! /** ! * @brief ! */ void roadmap_math_use_imperial (void) { *************** *** 767,770 **** --- 842,850 ---- } + /** + * @brief + * @param focus + * @param focused_point + */ static void roadmap_math_adjust_focus (RoadMapArea *focus, const RoadMapGuiPoint *focused_point) { *************** *** 788,791 **** --- 868,877 ---- } + /** + * @brief + * @param focus + * @param position + * @param accuracy + */ void roadmap_math_focus_area *************** *** 863,866 **** --- 949,958 ---- } + /** + * @brief + * @param point1 + * @param point2 + * @return + */ int roadmap_math_line_is_visible (const RoadMapPosition *point1, const RoadMapPosition *point2) { *************** *** 889,893 **** } ! int roadmap_math_point_is_visible (const RoadMapPosition *point) { --- 981,989 ---- } ! /** ! * @brief ! * @param point ! * @return ! */ int roadmap_math_point_is_visible (const RoadMapPosition *point) { *************** *** 1259,1263 **** } ! /* determine whether "point" is within the "bbox" relative to "ref" */ int roadmap_math_point_in_box (RoadMapGuiPoint *point, RoadMapGuiPoint *ref, RoadMapGuiRect *bbox) --- 1355,1365 ---- } ! /** ! * @brief determine whether "point" is within the "bbox" relative to "ref" ! * @param point ! * @param ref ! * @param bbox ! * @return ! */ int roadmap_math_point_in_box (RoadMapGuiPoint *point, RoadMapGuiPoint *ref, RoadMapGuiRect *bbox) *************** *** 1269,1272 **** --- 1371,1380 ---- } + /** + * @brief + * @param a + * @param b + * @return + */ int roadmap_math_rectangle_overlap (RoadMapGuiRect *a, RoadMapGuiRect *b) { *************** *** 1371,1386 **** } ! ! int roadmap_math_distance ! (const RoadMapPosition *position1, const RoadMapPosition *position2) { ! double x; double y; ! ! x = RoadMapContext->units->unit_per_longitude ! * (position1->longitude - position2->longitude); ! y = RoadMapContext->units->unit_per_latitude ! * (position1->latitude - position2->latitude); return (int) sqrt ((x * x) + (y * y)); --- 1479,1495 ---- } ! /** ! * @brief calculate the distance between two points ! * @param position1 ! * @param position2 ! * @return ! */ ! int roadmap_math_distance (const RoadMapPosition *position1, const RoadMapPosition *position2) ! { double x; double y; ! x = RoadMapContext->units->unit_per_longitude * (position1->longitude - position2->longitude); ! y = RoadMapContext->units->unit_per_latitude * (position1->latitude - position2->latitude); return (int) sqrt ((x * x) + (y * y)); *************** *** 1388,1397 **** ! /* ! * returns a square bounding box, centered at 'from', ! * roughly "distance" miles/km on a side */ ! void roadmap_math_bbox_around_point ! (RoadMapArea *bbox, const RoadMapPosition *from, double distance, char *unitstring) { --- 1497,1508 ---- ! /** ! * @brief returns a square bounding box, centered at 'from', roughly "distance" miles/km on a side ! * @param bbox ! * @param from ! * @param distance ! * @param unitstring */ ! void roadmap_math_bbox_around_point (RoadMapArea *bbox, const RoadMapPosition *from, double distance, char *unitstring) { *************** *** 1419,1423 **** } ! /* Take a number followed by ft/mi/m/km, and converts it to current units. */ int roadmap_math_distance_convert(const char *string, int *was_explicit) { --- 1530,1539 ---- } ! /* ! * @brief Take a number followed by ft/mi/m/km, and converts it to current units. ! * @param string ! * @param was_explicit ! * @return ! */ int roadmap_math_distance_convert(const char *string, int *was_explicit) { *************** *** 1493,1496 **** --- 1609,1617 ---- } + /** + * @brief set some distance into the message API's buffers + * @param which indicate which distance to set + * @param distance the value to use + */ void roadmap_math_trip_set_distance(char which, int distance) { *************** *** 1931,1938 **** static int powers_of_10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000 }; ! /* convert: * from a string that looks like a floating point number * to an integer, using just the specified number of fractional digits * (e.g. 40.1 degrees --> 40100000 millionths of a degree) */ int roadmap_math_from_floatstring(const char *f, int fracdigits) --- 2052,2063 ---- static int powers_of_10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000 }; ! /** ! * @brief convert * from a string that looks like a floating point number * to an integer, using just the specified number of fractional digits * (e.g. 40.1 degrees --> 40100000 millionths of a degree) + * @param f + * @param fracdigits + * @return */ int roadmap_math_from_floatstring(const char *f, int fracdigits) *************** *** 1989,1990 **** --- 2114,2192 ---- return buf; } + + #if defined(HAVE_TRIP_PLUGIN) || defined(HAVE_NAVIGATE_PLUGIN) + /** + * @brief + * @param position + * @param from_pos + * @param to_pos + * @param first_shape + * @param last_shape + * @param shape_itr + * @param total_length + * @return + */ + int roadmap_math_calc_line_length (const RoadMapPosition *position, + const RoadMapPosition *from_pos, + const RoadMapPosition *to_pos, + int first_shape, + int last_shape, + RoadMapShapeItr shape_itr, + int *total_length) + { + RoadMapPosition from; + RoadMapPosition to; + RoadMapPosition intersection; + int current_length = 0; + int length_result = 0; + int smallest_distance = 0x7fffffff; + int distance; + int i; + + if (first_shape <= -1) { + + from = *from_pos; + to = *to_pos; + } else { + + from = *from_pos; + to = *from_pos; + + for (i = first_shape; i <= last_shape; i++) { + + shape_itr (i, &to); + + distance = + roadmap_math_get_distance_from_segment + (position, &from, &to, &intersection, NULL); + + if (distance < smallest_distance) { + smallest_distance = distance; + length_result = current_length + + roadmap_math_distance (&from, &intersection); + } + + current_length += roadmap_math_distance (&from, &to); + from = to; + } + + to = *to_pos; + } + + distance = + roadmap_math_get_distance_from_segment + (position, &from, &to, &intersection, NULL); + + if (distance < smallest_distance) { + + length_result = current_length + + roadmap_math_distance (&from, &intersection); + } + + current_length += roadmap_math_distance (&from, &to); + + if (total_length) *total_length = current_length; + + return length_result; + } + #endif |
|
From: Danny B. <dan...@us...> - 2009-02-12 19:14:28
|
Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv11831 Modified Files: roadmap_street.c Log Message: Documentation stubs. Index: roadmap_street.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_street.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** roadmap_street.c 21 Nov 2007 15:40:51 -0000 1.31 --- roadmap_street.c 12 Feb 2009 19:14:22 -0000 1.32 *************** *** 1,4 **** ! /* roadmap_street.c - Handle streets operations and attributes. ! * * LICENSE: * --- 1,3 ---- ! /* * LICENSE: * *************** *** 20,27 **** * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * ! * SYNOPSYS: ! * ! * see roadmap_street.h. */ --- 19,26 ---- * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! /** ! * @file ! * @brief handle streets operations and attributes. */ *************** *** 107,111 **** static RoadMapRangeContext *RoadMapRangeActive = NULL; ! static void *roadmap_street_map (roadmap_db *root) { --- 106,114 ---- static RoadMapRangeContext *RoadMapRangeActive = NULL; ! /** ! * @brief ! * @param root ! * @return ! */ static void *roadmap_street_map (roadmap_db *root) { *************** *** 143,146 **** --- 146,153 ---- } + /** + * @brief + * @param context + */ static void roadmap_street_activate (void *context) { *************** *** 153,156 **** --- 160,167 ---- } + /** + * @brief + * @param context + */ static void roadmap_street_unmap (void *context) { *************** *** 166,169 **** --- 177,183 ---- } + /** + * @brief + */ roadmap_db_handler RoadMapStreetHandler = { "street", *************** *** 173,177 **** }; ! static void *roadmap_street_zip_map (roadmap_db *root) { --- 187,194 ---- }; ! /** ! * @brief ! * @param root ! */ static void *roadmap_street_zip_map (roadmap_db *root) { *************** *** 195,198 **** --- 212,219 ---- } + /** + * @brief + * @param context + */ static void roadmap_street_zip_activate (void *context) { *************** *** 205,208 **** --- 226,233 ---- } + /** + * @brief + * @param context + */ static void roadmap_street_zip_unmap (void *context) { *************** *** 218,221 **** --- 243,249 ---- } + /** + * @brief + */ roadmap_db_handler RoadMapZipHandler = { "zip", *************** *** 225,229 **** }; ! static void *roadmap_street_range_map (roadmap_db *root) { --- 253,260 ---- }; ! /** ! * @brief ! * @param root ! */ static void *roadmap_street_range_map (roadmap_db *root) { *************** *** 309,312 **** --- 340,347 ---- } + /** + * @brief + * @param context + */ static void roadmap_street_range_activate (void *context) { *************** *** 345,348 **** --- 380,387 ---- } + /** + * @brief + * @param context + */ static void roadmap_street_range_unmap (void *context) { *************** *** 358,361 **** --- 397,403 ---- } + /** + * @brief + */ roadmap_db_handler RoadMapRangeHandler = { "range", *************** *** 366,369 **** --- 408,414 ---- + /** + * @brief + */ typedef struct roadmap_street_identifier { *************** *** 376,380 **** ! /* * the list of possible types (second column) was generated with: * --- 421,428 ---- ! /** ! * @brief ! * ! * * the list of possible types (second column) was generated with: * *************** *** 396,400 **** } RoadmapStreetTypeMap; ! /* Both many-to-one and one-to-many mappings are supported, but * the first column must be alphabetical! * --- 444,451 ---- } RoadmapStreetTypeMap; ! /** ! * @brief ! * ! * Both many-to-one and one-to-many mappings are supported, but * the first column must be alphabetical! * *************** *** 468,471 **** --- 519,528 ---- }; + /** + * @brief + * @param type + * @param last + * @return + */ static RoadmapStreetTypeMap *roadmap_street_type_to_abbrev ( const char *type, RoadmapStreetTypeMap *last) { *************** *** 489,493 **** } ! static void roadmap_street_locate (const char *name, RoadMapStreetIdentifier *street) { --- 546,555 ---- } ! /** ! * @brief ! * @param name ! * @param street ! * @return ! */ static void roadmap_street_locate (const char *name, RoadMapStreetIdentifier *street) { *************** *** 614,618 **** } ! static int roadmap_street_block_by_county_subdivision (RoadMapStreetIdentifier *street, --- 676,687 ---- } ! /** ! * @brief ! * @param street ! * @param city ! * @param blocks ! * @param size ! * @return ! */ static int roadmap_street_block_by_county_subdivision (RoadMapStreetIdentifier *street, *************** *** 625,628 **** --- 694,698 ---- int range_count = RoadMapRangeActive->RoadMapByStreetCount; + roadmap_log(ROADMAP_DEBUG, "block_by_county_subdivision"); for (i = 0; i < range_count; i++) { *************** *** 681,685 **** } ! int roadmap_street_blocks_by_city (const char *street_name, const char *city_name, --- 751,762 ---- } ! /** ! * @brief ! * @param street_name ! * @param city_name ! * @param blocks ! * @param size ! * @return ! */ int roadmap_street_blocks_by_city (const char *street_name, const char *city_name, *************** *** 839,845 **** #endif /* NEEDED ? */ ! ! int roadmap_street_get_ranges ! (RoadMapBlocks *blocks, int count, RoadMapStreetRange *ranges) { int i; --- 916,927 ---- #endif /* NEEDED ? */ ! /** ! * @brief ! * @param blocks ! * @param count ! * @param ranges ! * @return ! */ ! int roadmap_street_get_ranges (RoadMapBlocks *blocks, int count, RoadMapStreetRange *ranges) { int i; *************** *** 884,888 **** } ! int roadmap_street_get_position (RoadMapBlocks *blocks, unsigned int number, --- 966,976 ---- } ! /** ! * @brief ! * @param blocks ! * @param number ! * @param position ! * @return ! */ int roadmap_street_get_position (RoadMapBlocks *blocks, unsigned int number, *************** *** 972,976 **** } ! static int roadmap_street_get_distance_with_shape (const RoadMapPosition *position, --- 1060,1073 ---- } ! /** ! * @brief ! * @param position ! * @param line ! * @param layer ! * @param first_shape ! * @param last_shape ! * @param neighbour ! * @return ! */ static int roadmap_street_get_distance_with_shape (const RoadMapPosition *position, *************** *** 1034,1057 **** } ! ! static int roadmap_street_get_distance_no_shape ! (const RoadMapPosition *position, int line, int layer, ! RoadMapNeighbour *neighbour) { ! roadmap_line_from (line, &neighbour->from); roadmap_line_to (line, &neighbour->to); if (roadmap_math_line_is_visible (&neighbour->from, &neighbour->to)) { ! neighbour->distance = ! roadmap_math_get_distance_from_segment ! (position, &neighbour->from, &neighbour->to, ! &neighbour->intersection, NULL); ! ! roadmap_plugin_set_line (&neighbour->line, ! ROADMAP_PLUGIN_ID, ! line, ! layer, ! roadmap_locator_active ()); return 1; --- 1131,1154 ---- } ! /** ! * @brief calculate distance between a position and a line ! * @param position the position to take into account ! * @param line the line ! * @param layer which layer is this line in ! * @param neighbour results are stored in this record ! * @return 1 indicates success ! */ ! static int roadmap_street_get_distance_no_shape (const RoadMapPosition *position, ! int line, int layer, RoadMapNeighbour *neighbour) ! { roadmap_line_from (line, &neighbour->from); roadmap_line_to (line, &neighbour->to); if (roadmap_math_line_is_visible (&neighbour->from, &neighbour->to)) { + neighbour->distance = roadmap_math_get_distance_from_segment (position, + &neighbour->from, &neighbour->to, &neighbour->intersection, NULL); ! roadmap_plugin_set_line (&neighbour->line, ROADMAP_PLUGIN_ID, ! line, layer, roadmap_locator_active ()); return 1; *************** *** 1100,1107 **** ! int roadmap_street_get_distance (const RoadMapPosition *position, ! int line, ! int layer, ! RoadMapNeighbour *result) { int found = 0; --- 1197,1210 ---- ! /** ! * @brief calculate distance between a position and a line ! * @param position the position to take into account ! * @param line the line ! * @param layer the line's layer ! * @param result store the results in this structure ! * @result whether we found something ! */ ! int roadmap_street_get_distance (const RoadMapPosition *position, int line, int layer, ! RoadMapNeighbour *result) { int found = 0; *************** *** 1120,1128 **** if (square < 0) return 0; ! if (roadmap_shape_in_square (square, &first_shape_line, ! &last_shape_line) > 0) { ! ! if (roadmap_shape_of_line (line, first_shape_line, ! last_shape_line, &first_shape, &last_shape) > 0) { --- 1223,1228 ---- if (square < 0) return 0; ! if (roadmap_shape_in_square (square, &first_shape_line, &last_shape_line) > 0) { ! if (roadmap_shape_of_line (line, first_shape_line, last_shape_line, &first_shape, &last_shape) > 0) { *************** *** 1133,1138 **** if (!found) { ! found = roadmap_street_get_distance_no_shape (position, ! line, layer, result); } return found; --- 1233,1237 ---- if (!found) { ! found = roadmap_street_get_distance_no_shape (position, line, layer, result); } return found; *************** *** 1322,1326 **** ! int roadmap_street_get_closest (const RoadMapPosition *position, --- 1421,1433 ---- ! /** ! * @brief ! * @param position ! * @param categories ! * @param categories_count ! * @param neighbours ! * @param max ! * @return ! */ int roadmap_street_get_closest (const RoadMapPosition *position, *************** *** 1868,1875 **** } ! ! const char *roadmap_street_get_street_address ! (const RoadMapStreetProperties *properties) { ! static char RoadMapStreetAddress [32]; unsigned int min; --- 1975,1985 ---- } ! /** ! * @brief figure out a text describing the range of addresses in this street ! * @param properties the properties of this street ! * @return pointer to a static array ! */ ! const char *roadmap_street_get_street_address (const RoadMapStreetProperties *properties) ! { static char RoadMapStreetAddress [32]; unsigned int min; *************** *** 1910,1917 **** } ! ! const char *roadmap_street_get_street_name ! (const RoadMapStreetProperties *properties) { ! static char RoadMapStreetName [512]; --- 2020,2030 ---- } ! /** ! * @brief get the name of this street ! * @param properties the properties of this street ! * @return pointer to a static array ! */ ! const char *roadmap_street_get_street_name (const RoadMapStreetProperties *properties) ! { static char RoadMapStreetName [512]; *************** *** 1934,1956 **** } ! ! roadmap_street_append ! (RoadMapStreetName, ! roadmap_dictionary_get (RoadMapRangeActive->RoadMapStreetPrefix, this_street->fedirp)); ! roadmap_street_append ! (RoadMapStreetName, ! roadmap_dictionary_get (RoadMapRangeActive->RoadMapStreetNames, this_street->fename)); ! roadmap_street_append ! (RoadMapStreetName, ! roadmap_dictionary_get (RoadMapRangeActive->RoadMapStreetType, this_street->fetype)); ! roadmap_street_append ! (RoadMapStreetName, ! roadmap_dictionary_get (RoadMapRangeActive->RoadMapStreetSuffix, this_street->fedirs)); --- 2047,2060 ---- } ! roadmap_street_append (RoadMapStreetName, roadmap_dictionary_get (RoadMapRangeActive->RoadMapStreetPrefix, this_street->fedirp)); ! roadmap_street_append (RoadMapStreetName, roadmap_dictionary_get (RoadMapRangeActive->RoadMapStreetNames, this_street->fename)); ! roadmap_street_append (RoadMapStreetName, roadmap_dictionary_get (RoadMapRangeActive->RoadMapStreetType, this_street->fetype)); ! roadmap_street_append (RoadMapStreetName, roadmap_dictionary_get (RoadMapRangeActive->RoadMapStreetSuffix, this_street->fedirs)); *************** *** 1965,1972 **** } ! ! const char *roadmap_street_get_city_name ! (const RoadMapStreetProperties *properties) { ! if (RoadMapRangeActive == NULL) return 0; --- 2069,2079 ---- } ! /** ! * @brief get the city name ! * @param properties the properties of this street ! * @return ! */ ! const char *roadmap_street_get_city_name (const RoadMapStreetProperties *properties) ! { if (RoadMapRangeActive == NULL) return 0; *************** *** 1975,1982 **** } ! ! const char *roadmap_street_get_full_name ! (const RoadMapStreetProperties *properties) { ! static char RoadMapStreetName [512]; --- 2082,2092 ---- } ! /** ! * @brief get street+city name and address range in one text ! * @param properties the properties of this street ! * @return pointer to a static array ! */ ! const char *roadmap_street_get_full_name (const RoadMapStreetProperties *properties) ! { static char RoadMapStreetName [512]; |
|
From: Danny B. <dan...@us...> - 2009-02-12 19:08:26
|
Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv10934 Modified Files: roadmap_input.c Log Message: Add documentation stubs. Index: roadmap_input.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_input.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** roadmap_input.c 20 Jun 2006 00:51:59 -0000 1.5 --- roadmap_input.c 12 Feb 2009 19:08:23 -0000 1.6 *************** *** 1,4 **** ! /* roadmap_input.c - Decode an ASCII data stream. ! * * LICENSE: * --- 1,3 ---- ! /* * LICENSE: * *************** *** 20,27 **** * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * ! * SYNOPSYS: ! * ! * See roadmap_input.h */ --- 19,27 ---- * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! /** ! * @file ! * @brief roadmap_input.c - Decode an ASCII data stream. */ *************** *** 38,42 **** #include "roadmap_input.h" ! static char *roadmap_input_end_of_line (RoadMapInputContext *context, char *from) { --- 38,47 ---- #include "roadmap_input.h" ! /** ! * @brief ! * @param context ! * @param from ! * @return ! */ static char *roadmap_input_end_of_line (RoadMapInputContext *context, char *from) { *************** *** 57,61 **** } ! static void roadmap_input_shift_to_next_line (RoadMapInputContext *context, char *from) { --- 62,70 ---- } ! /** ! * @brief ! * @param context ! * @param from ! */ static void roadmap_input_shift_to_next_line (RoadMapInputContext *context, char *from) { *************** *** 80,84 **** } ! int roadmap_input_split (char *text, char separator, char *field[], int max) { --- 89,100 ---- } ! /** ! * @brief ! * @param text ! * @param separator ! * @param field ! * @param max ! * @return ! */ int roadmap_input_split (char *text, char separator, char *field[], int max) { *************** *** 100,104 **** } ! int roadmap_input (RoadMapInputContext *context) { --- 116,124 ---- } ! /** ! * @brief ! * @param context ! * @return ! */ int roadmap_input (RoadMapInputContext *context) { *************** *** 202,204 **** return result; } - --- 222,223 ---- |