From 1abb9ab96ee678e4442e14c350d1cbf6b7599d57 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 27 Nov 2022 07:23:43 -0700 Subject: [PATCH] add power to kml track descriptions and balloons. (#950) --- defs.h | 2 + kml.cc | 42 +- random.cc | 3 + reference/realtime.csv | 18 +- reference/realtime.kml | 707 +++++++++--------- .../track/gpx_garmin_extensions-kml_track.kml | 16 +- route.cc | 15 + testo.d/kml.test | 3 +- 8 files changed, 436 insertions(+), 370 deletions(-) diff --git a/defs.h b/defs.h index d59ba99bf..52524b93e 100644 --- a/defs.h +++ b/defs.h @@ -666,11 +666,13 @@ struct computed_trkdata { std::optional min_spd; /* Meters/sec */ std::optional avg_hrt; /* Avg Heartrate */ std::optional avg_cad; /* Avg Cadence */ + std::optional avg_pwr; /* Avg Power */ gpsbabel::DateTime start; /* Min time */ gpsbabel::DateTime end; /* Max time */ std::optional min_hrt; /* Min Heartrate */ std::optional max_hrt; /* Max Heartrate */ std::optional max_cad; /* Max Cadence */ + std::optional max_pwr; /* Max Power */ }; class route_head diff --git a/kml.cc b/kml.cc index 548b63f85..e0adc1a40 100644 --- a/kml.cc +++ b/kml.cc @@ -603,6 +603,12 @@ void KmlFormat::kml_output_trkdescription(const route_head* header, const comput } } } + if (td->avg_cad) { + kml_td(hwriter, QStringLiteral("Avg Cadence"), QStringLiteral(" %1 rpm ").arg(QString::number(*td->avg_cad, 'f', 1))); + } + if (td->max_cad) { + kml_td(hwriter, QStringLiteral("Max Cadence"), QStringLiteral(" %1 rpm ").arg(QString::number(*td->max_cad))); + } if (td->avg_hrt) { kml_td(hwriter, QStringLiteral("Avg Heart Rate"), QStringLiteral(" %1 bpm ").arg(QString::number(*td->avg_hrt, 'f', 1))); } @@ -612,11 +618,11 @@ void KmlFormat::kml_output_trkdescription(const route_head* header, const comput if (td->max_hrt) { kml_td(hwriter, QStringLiteral("Max Heart Rate"), QStringLiteral(" %1 bpm ").arg(QString::number(*td->max_hrt))); } - if (td->avg_cad) { - kml_td(hwriter, QStringLiteral("Avg Cadence"), QStringLiteral(" %1 rpm ").arg(QString::number(*td->avg_cad, 'f', 1))); + if (td->avg_pwr) { + kml_td(hwriter, QStringLiteral("Avg Power"), QStringLiteral(" %1 watts ").arg(QString::number(*td->avg_pwr, 'f', 1))); } - if (td->max_cad) { - kml_td(hwriter, QStringLiteral("Max Cadence"), QStringLiteral(" %1 rpm ").arg(QString::number(*td->max_cad))); + if (td->max_pwr) { + kml_td(hwriter, QStringLiteral("Max Power"), QStringLiteral(" %1 watts ").arg(QString::number(*td->max_pwr, 'f', 1))); } if (td->start.isValid() && td->end.isValid()) { kml_td(hwriter, QStringLiteral("Start Time"), td->start.toPrettyString()); @@ -737,12 +743,16 @@ void KmlFormat::kml_output_description(const Waypoint* pt) const kml_td(hwriter, QStringLiteral("Altitude: %1 %2 ").arg(QString::number(alt, 'f', 3), alt_units)); } + if (pt->cadence) { + kml_td(hwriter, QStringLiteral("Cadence: %1 ").arg(QString::number(pt->cadence))); + } + if (pt->heartrate) { kml_td(hwriter, QStringLiteral("Heart rate: %1 ").arg(QString::number(pt->heartrate))); } - if (pt->cadence) { - kml_td(hwriter, QStringLiteral("Cadence: %1 ").arg(QString::number(pt->cadence))); + if (pt->power) { + kml_td(hwriter, QStringLiteral("Power: %1 ").arg(QString::number(pt->power, 'f', 1))); } /* Which unit is this temp in? C? F? K? */ @@ -1525,11 +1535,11 @@ void KmlFormat::write_as_linestring(const route_head* header) void KmlFormat::kml_mt_hdr(const route_head* header) { - int has_cadence = 0; - int has_depth = 0; - int has_heartrate = 0; - int has_temperature = 0; - int has_power = 0; + bool has_cadence = false; + bool has_depth = false; + bool has_heartrate = false; + bool has_temperature = false; + bool has_power = false; // This logic is kind of inside-out for GPSBabel. If a track doesn't // have enough interesting timestamps, just write it as a LineString. @@ -1572,19 +1582,19 @@ void KmlFormat::kml_mt_hdr(const route_head* header) // Capture interesting traits to see if we need to do an ExtendedData // section later. if (tpt->cadence) { - has_cadence = 1; + has_cadence = true; } if (WAYPT_HAS(tpt, depth)) { - has_depth = 1; + has_depth = true; } if (tpt->heartrate) { - has_heartrate = 1; + has_heartrate = true; } if (WAYPT_HAS(tpt, temperature)) { - has_temperature = 1; + has_temperature = true; } if (tpt->power) { - has_power = 1; + has_power = true; } } diff --git a/random.cc b/random.cc index 959c1b19b..27d7c9991 100644 --- a/random.cc +++ b/random.cc @@ -158,6 +158,9 @@ RandomFormat::random_generate_wpt(int i, const QDateTime& time, const Waypoint* if RND(3) { wpt->heartrate = rand_int(255); } + if RND(3) { + wpt->power = rand_flt(500.0); + } } else { if (doing_rtes && (i > 0)) { wpt->latitude = prev->latitude + rand_dbl(0.01); diff --git a/reference/realtime.csv b/reference/realtime.csv index 07a651856..48ee8caf3 100644 --- a/reference/realtime.csv +++ b/reference/realtime.csv @@ -1,10 +1,10 @@ -28.606309,41.491196,85.918,Wpt_RD,1970-01-01T00:00:00Z --28.605513,41.492136,,Wpt_lBahVv7,1970-01-01T00:00:01.745Z --28.604906,41.492637,31.126,Wpt_hTE,1970-01-01T00:00:03.253Z --28.604548,41.493038,,Wpt_0H,1970-01-01T00:00:04.655Z --28.604396,41.493069,24.212,Wpt_k,1970-01-01T00:00:06.328Z --28.603524,41.493167,5.795,Wpt_iX,1970-01-01T00:00:07.835Z --28.603490,41.494039,36.201,Wpt_TyhlOke,1970-01-01T00:00:09.090Z --28.602885,41.494402,73.608,Wpt_rS,1970-01-01T00:00:10.507Z --28.602833,41.494822,2.947,Wpt_obZdF3b0,1970-01-01T00:00:11.965Z --28.601890,41.495138,,ESTIMATED Position,1970-01-01T00:00:13.543Z +-28.605513,41.492136,0.027,Wpt_ahVv,1970-01-01T00:00:01.189Z +-28.605013,41.492918,78.576,Wpt_ElFRt5,1970-01-01T00:00:02.317Z +-28.604849,41.492946,,Wpt_Stg4W,1970-01-01T00:00:04.160Z +-28.604045,41.493083,11.875,Wpt_DlFC,1970-01-01T00:00:05.731Z +-28.603882,41.493350,60.271,Wpt_m,1970-01-01T00:00:07.093Z +-28.603126,41.493573,41.702,Wpt_cvYH1aA,1970-01-01T00:00:08.272Z +-28.602827,41.494044,,Wpt_C8obZd,1970-01-01T00:00:09.921Z +-28.602226,41.494598,70.466,Wpt_8cx1JYr7,1970-01-01T00:00:11.351Z +-28.602044,41.494654,,Wpt_ydet6fH,1970-01-01T00:00:13.320Z diff --git a/reference/realtime.kml b/reference/realtime.kml index bca161447..b81f77ff3 100644 --- a/reference/realtime.kml +++ b/reference/realtime.kml @@ -4,12 +4,12 @@ GPS position - 1970-01-01T00:00:03.464Z - 1970-01-01T00:10:29.519Z + 1970-01-01T00:00:01.400Z + 1970-01-01T00:10:31.102Z - -32.056227 - 30.474664 - 1728.780603 + -32.056174 + 30.474557 + 1717.685395 - -32.051141,30.478722 + -32.051036,30.478508,37.15 @@ -147,116 +150,135 @@ #multiTrack - 1970-01-01T00:00:03.464Z - 1970-01-01T00:00:04.834Z - 1970-01-01T00:00:06.126Z - 1970-01-01T00:00:07.686Z - 1970-01-01T00:00:09.493Z - 1970-01-01T00:00:12.434Z - 1970-01-01T00:00:14.191Z - 1970-01-01T00:00:16.984Z - 1970-01-01T00:00:18.913Z - 1970-01-01T00:00:20.628Z - 1970-01-01T00:00:22.594Z - 1970-01-01T00:00:23.968Z - 1970-01-01T00:00:25.135Z - 1970-01-01T00:00:26.718Z - 1970-01-01T00:00:28.139Z - 1970-01-01T00:00:29.519Z + 1970-01-01T00:00:01.400Z + 1970-01-01T00:00:02.479Z + 1970-01-01T00:00:04.381Z + 1970-01-01T00:00:05.810Z + 1970-01-01T00:00:09.290Z + 1970-01-01T00:00:10.767Z + 1970-01-01T00:00:12.440Z + 1970-01-01T00:00:13.488Z + 1970-01-01T00:00:15.388Z + 1970-01-01T00:00:17.171Z + 1970-01-01T00:00:19.146Z + 1970-01-01T00:00:21.021Z + 1970-01-01T00:00:24.084Z + 1970-01-01T00:00:25.515Z + 1970-01-01T00:00:27.508Z + 1970-01-01T00:00:31.102Z -32.061312 30.470605 26.03 - -32.060351 30.471588 - -32.059442 30.471933 30.62 - -32.058752 30.472451 75.70 - -32.058143 30.473278 - -32.057275 30.474104 26.70 - -32.056245 30.474413 72.49 - -32.056020 30.475032 - -32.055280 30.475289 57.64 - -32.054461 30.475367 91.16 - -32.054306 30.475838 - -32.053593 30.476512 77.01 - -32.052896 30.476701 2.66 - -32.052293 30.477107 59.30 - -32.051494 30.477113 - -32.051415 30.477953 30.00 - -32.051141 30.478722 + -32.060342 30.470920 + -32.059568 30.471064 1.55 + -32.059063 30.471908 + -32.058841 30.472469 98.45 + -32.058482 30.473114 19.13 + -32.057616 30.473838 + -32.056698 30.474180 69.71 + -32.056143 30.474314 41.34 + -32.055584 30.475019 40.10 + -32.055159 30.475586 56.16 + -32.054485 30.475607 40.47 + -32.053788 30.475796 72.50 + -32.052873 30.476442 13.88 + -32.052820 30.477075 16.71 + -32.052052 30.477389 73.75 + -32.051036 30.478508 37.15 245 - 19 - 227 - 97 - 112 - 142 - 222 - 130 - 142 - 118 - 64 0 - 186 - 155 - 210 0 0 + 0 + 146 + 204 + 108 + 0 + 120 + 165 + 1 + 186 + 156 + 0 + 33 + 40 + 0.0 + 201.2 + 76.0 0.0 0.0 - 162.6 + 249.4 0.0 - 170.7 + 978.7 + 511.7 + 509.5 + 407.5 + 136.0 + 275.3 + 680.8 0.0 - 421.8 - 830.1 - 218.1 - 292.2 - 426.2 0.0 - 911.3 - 174.5 - 804.5 - 52.5 - 640.0 + 630.0 25 + 90 + 151 + 4 + 168 0 - 41 - 244 - 250 - 253 - 33 - 194 - 238 + 145 0 - 227 + 55 + 247 + 119 164 246 - 52 - 90 - 53 + 77 + 2 96 + 0 0.0 - 17.8 - 4.4 - 12.7 + 8.2 + 5.2 + 13.7 + 12.6 + 19.8 + 24.7 + 10.2 0.0 + 2.7 + 2.7 + 24.6 + 16.9 + 23.9 + 0.0 + 19.0 + 0.0 + + + 88.9 0.0 - 2.2 - 7.9 - 4.7 - 31.9 + 81.3 + 378.5 + 85.3 0.0 - 24.3 - 23.2 - 28.0 - 21.8 + 384.3 + 61.9 + 262.2 0.0 0.0 + 493.0 + 0.0 + 350.7 + 114.8 + 402.7 + 0.0 @@ -267,24 +289,26 @@ -Distance 4761.1 ft -Min Alt 8.740 ft -Max Alt 299.085 ft -Min Speed 57.9 mph -Max Speed 156.4 mph -Avg Speed 124.6 mph -Avg Heart Rate 147.1 bpm -Min Heart Rate 25 bpm -Max Heart Rate 253 bpm -Avg Cadence 147.8 rpm +Distance 4667.3 ft +Min Alt 5.090 ft +Max Alt 322.998 ft +Min Speed 65.4 mph +Max Speed 175.3 mph +Avg Speed 107.1 mph +Avg Cadence 127.6 rpm Max Cadence 245 rpm -Start Time1970-01-01T00:00:03.464Z -End Time1970-01-01T00:00:29.519Z +Avg Heart Rate 113.5 bpm +Min Heart Rate 2 bpm +Max Heart Rate 247 bpm +Avg Power 245.8 watts +Max Power 493.0 watts +Start Time1970-01-01T00:00:01.400Z +End Time1970-01-01T00:00:31.102Z ]]> - 1970-01-01T00:00:03.464Z - 1970-01-01T00:00:29.519Z + 1970-01-01T00:00:01.400Z + 1970-01-01T00:00:31.102Z Points @@ -296,8 +320,9 @@ Longitude: -32.061312 Latitude: 30.470605 Altitude: 85.400 ft -Heart rate: 25 Cadence: 245 +Heart rate: 25 +Power: 88.9 Heading: 317.9 ]]> @@ -312,463 +337,473 @@ - Wpt_Y8GPuG + Wpt_BZS -Longitude: -32.060351 -Latitude: 30.471588 -Cadence: 19 -Temperature: 17.8 -Speed: 146.2 mph -Heading: 40.1 -Time: 1970-01-01T00:00:03.464Z +Longitude: -32.060342 +Latitude: 30.470920 +Heart rate: 90 +Temperature: 8.2 +Depth: 660.0 ft +Speed: 158.9 mph +Heading: 69.4 +Time: 1970-01-01T00:00:01.400Z ]]> - -32.060351 - 30.471588 + -32.060342 + 30.470920 66 - 1970-01-01T00:00:03.464Z + 1970-01-01T00:00:01.400Z #track - -32.060351,30.471588 + -32.060342,30.470920 - Wpt_hTiV + Wpt_Igkh -Longitude: -32.059442 -Latitude: 30.471933 -Altitude: 100.458 ft -Heart rate: 41 -Cadence: 227 -Temperature: 4.4 -Depth: 533.4 ft -Speed: 155.7 mph -Heading: 66.3 -Time: 1970-01-01T00:00:04.834Z +Longitude: -32.059568 +Latitude: 30.471064 +Altitude: 5.090 ft +Heart rate: 151 +Power: 81.3 +Temperature: 5.2 +Depth: 249.3 ft +Speed: 157.4 mph +Heading: 77.8 +Time: 1970-01-01T00:00:02.479Z ]]> - -32.059442 - 30.471933 + -32.059568 + 30.471064 66 - 1970-01-01T00:00:04.834Z + 1970-01-01T00:00:02.479Z #track - -32.059442,30.471933,30.62 + -32.059568,30.471064,1.55 - Wpt_Fr0VTZa + Wpt_YF8dkyi -Longitude: -32.058752 -Latitude: 30.472451 -Altitude: 248.355 ft -Heart rate: 244 -Cadence: 97 -Temperature: 12.7 -Speed: 152.0 mph -Heading: 48.9 -Time: 1970-01-01T00:00:06.126Z +Longitude: -32.059063 +Latitude: 30.471908 +Heart rate: 4 +Power: 378.5 +Temperature: 13.7 +Speed: 124.4 mph +Heading: 27.3 +Time: 1970-01-01T00:00:04.381Z ]]> - -32.058752 - 30.472451 + -32.059063 + 30.471908 66 - 1970-01-01T00:00:06.126Z + 1970-01-01T00:00:04.381Z #track - -32.058752,30.472451,75.70 + -32.059063,30.471908 - Wpt_8f + ESTIMATED Position -Longitude: -32.058143 -Latitude: 30.473278 -Heart rate: 250 -Cadence: 112 -Depth: 560.0 ft -Speed: 156.4 mph -Heading: 32.4 -Time: 1970-01-01T00:00:07.686Z +Longitude: -32.058841 +Latitude: 30.472469 +Altitude: 322.998 ft +Heart rate: 168 +Power: 85.3 +Temperature: 12.6 +Speed: 103.3 mph +Heading: 18.9 +Time: 1970-01-01T00:00:05.810Z ]]> - -32.058143 - 30.473278 + -32.058841 + 30.472469 66 - 1970-01-01T00:00:07.686Z + 1970-01-01T00:00:05.810Z #track - -32.058143,30.473278 + -32.058841,30.472469,98.45 - Wpt_R + Wpt_IZIJ9q -Longitude: -32.057275 -Latitude: 30.474104 -Altitude: 87.606 ft -Heart rate: 253 -Cadence: 142 -Speed: 153.6 mph -Heading: 42.2 -Time: 1970-01-01T00:00:09.493Z +Longitude: -32.058482 +Latitude: 30.473114 +Altitude: 62.765 ft +Cadence: 146 +Temperature: 19.8 +Depth: 818.2 ft +Speed: 65.4 mph +Heading: 25.6 +Time: 1970-01-01T00:00:09.290Z ]]> - -32.057275 - 30.474104 + -32.058482 + 30.473114 66 - 1970-01-01T00:00:09.493Z + 1970-01-01T00:00:09.290Z #track - -32.057275,30.474104,26.70 + -32.058482,30.473114,19.13 - ESTIMATED Position + Wpt_ADL -Longitude: -32.056245 -Latitude: 30.474413 -Altitude: 237.843 ft -Heart rate: 33 -Cadence: 222 -Temperature: 2.2 -Depth: 1383.8 ft -Speed: 83.3 mph -Heading: 70.8 -Time: 1970-01-01T00:00:12.434Z +Longitude: -32.057616 +Latitude: 30.473838 +Cadence: 204 +Heart rate: 145 +Power: 384.3 +Temperature: 24.7 +Speed: 175.3 mph +Heading: 45.9 +Time: 1970-01-01T00:00:10.767Z ]]> - -32.056245 - 30.474413 + -32.057616 + 30.473838 66 - 1970-01-01T00:00:12.434Z + 1970-01-01T00:00:10.767Z #track - -32.056245,30.474413,72.49 + -32.057616,30.473838 - Wpt_8JwVPYQ + Wpt_Qvmm0pH -Longitude: -32.056020 -Latitude: 30.475032 -Heart rate: 194 -Cadence: 130 -Temperature: 7.9 -Depth: 2723.3 ft -Speed: 91.8 mph -Heading: 17.4 -Time: 1970-01-01T00:00:14.191Z +Longitude: -32.056698 +Latitude: 30.474180 +Altitude: 228.720 ft +Cadence: 108 +Power: 61.9 +Temperature: 10.2 +Depth: 3210.9 ft +Speed: 128.3 mph +Heading: 66.6 +Time: 1970-01-01T00:00:12.440Z ]]> - -32.056020 - 30.475032 + -32.056698 + 30.474180 66 - 1970-01-01T00:00:14.191Z + 1970-01-01T00:00:12.440Z #track - -32.056020,30.475032 + -32.056698,30.474180,69.71 - Wpt_e + Wpt_jgOtX1h -Longitude: -32.055280 -Latitude: 30.475289 -Altitude: 189.100 ft -Heart rate: 238 -Cadence: 142 -Temperature: 4.7 -Depth: 715.4 ft -Speed: 57.9 mph -Heading: 68.0 -Time: 1970-01-01T00:00:16.984Z +Longitude: -32.056143 +Latitude: 30.474314 +Altitude: 135.637 ft +Heart rate: 55 +Power: 262.2 +Depth: 1679.0 ft +Speed: 118.0 mph +Heading: 74.3 +Time: 1970-01-01T00:00:13.488Z ]]> - -32.055280 - 30.475289 + -32.056143 + 30.474314 66 - 1970-01-01T00:00:16.984Z + 1970-01-01T00:00:13.488Z #track - -32.055280,30.475289,57.64 + -32.056143,30.474314,41.34 - ESTIMATED Position + Wpt_AqGP -Longitude: -32.054461 -Latitude: 30.475367 -Altitude: 299.085 ft -Cadence: 118 -Temperature: 31.9 -Depth: 958.6 ft -Speed: 91.8 mph -Heading: 83.7 -Time: 1970-01-01T00:00:18.913Z +Longitude: -32.055584 +Latitude: 30.475019 +Altitude: 131.558 ft +Cadence: 120 +Heart rate: 247 +Temperature: 2.7 +Depth: 1671.5 ft +Speed: 111.9 mph +Heading: 34.4 +Time: 1970-01-01T00:00:15.388Z ]]> - -32.054461 - 30.475367 + -32.055584 + 30.475019 66 - 1970-01-01T00:00:18.913Z + 1970-01-01T00:00:15.388Z #track - -32.054461,30.475367,91.16 + -32.055584,30.475019,40.10 - ESTIMATED Position + Wpt_4Q9cH -Longitude: -32.054306 -Latitude: 30.475838 -Heart rate: 227 -Cadence: 64 -Depth: 1398.4 ft -Speed: 71.0 mph -Heading: 15.8 -Time: 1970-01-01T00:00:20.628Z +Longitude: -32.055159 +Latitude: 30.475586 +Altitude: 184.239 ft +Cadence: 165 +Heart rate: 119 +Temperature: 2.7 +Depth: 1336.9 ft +Speed: 94.4 mph +Heading: 32.9 +Time: 1970-01-01T00:00:17.171Z ]]> - -32.054306 - 30.475838 + -32.055159 + 30.475586 66 - 1970-01-01T00:00:20.628Z + 1970-01-01T00:00:17.171Z #track - -32.054306,30.475838 + -32.055159,30.475586,56.16 - Wpt_4 + Wpt_OYkWpx37 -Longitude: -32.053593 -Latitude: 30.476512 -Altitude: 252.661 ft +Longitude: -32.054485 +Latitude: 30.475607 +Altitude: 132.775 ft +Cadence: 1 Heart rate: 164 -Temperature: 24.3 -Speed: 115.5 mph -Heading: 42.4 -Time: 1970-01-01T00:00:22.594Z +Power: 493.0 +Temperature: 24.6 +Depth: 446.1 ft +Speed: 73.3 mph +Heading: 88.0 +Time: 1970-01-01T00:00:19.146Z ]]> - -32.053593 - 30.476512 + -32.054485 + 30.475607 66 - 1970-01-01T00:00:22.594Z + 1970-01-01T00:00:19.146Z #track - -32.053593,30.476512,77.01 + -32.054485,30.475607,40.47 - Wpt_25dSc2Mb + Wpt_dSc2MbGM -Longitude: -32.052896 -Latitude: 30.476701 -Altitude: 8.740 ft -Heart rate: 246 +Longitude: -32.053788 +Latitude: 30.475796 +Altitude: 237.855 ft Cadence: 186 -Temperature: 23.2 -Depth: 2989.8 ft -Speed: 114.1 mph +Heart rate: 246 +Temperature: 16.9 +Depth: 903.2 ft +Speed: 83.6 mph Heading: 72.5 -Time: 1970-01-01T00:00:23.968Z +Time: 1970-01-01T00:00:21.021Z ]]> - -32.052896 - 30.476701 + -32.053788 + 30.475796 66 - 1970-01-01T00:00:23.968Z + 1970-01-01T00:00:21.021Z #track - -32.052896,30.476701,2.66 + -32.053788,30.475796,72.50 - Wpt_iHp8 + Wpt_KLzmKH -Longitude: -32.052293 -Latitude: 30.477107 -Altitude: 194.545 ft -Heart rate: 52 -Cadence: 155 -Temperature: 28.0 -Depth: 572.3 ft -Speed: 140.7 mph -Heading: 52.0 -Time: 1970-01-01T00:00:25.135Z +Longitude: -32.052873 +Latitude: 30.476442 +Altitude: 45.522 ft +Cadence: 156 +Heart rate: 77 +Power: 350.7 +Temperature: 23.9 +Depth: 2233.7 ft +Speed: 125.4 mph +Heading: 50.7 +Time: 1970-01-01T00:00:24.084Z ]]> - -32.052293 - 30.477107 + -32.052873 + 30.476442 66 - 1970-01-01T00:00:25.135Z + 1970-01-01T00:00:24.084Z #track - -32.052293,30.477107,59.30 + -32.052873,30.476442,13.88 - Wpt_lFMiR + Wpt_RvAVk2l -Longitude: -32.051494 -Latitude: 30.477113 -Heart rate: 90 -Cadence: 210 -Temperature: 21.8 -Depth: 2639.6 ft -Speed: 108.3 mph -Heading: 89.5 -Time: 1970-01-01T00:00:26.718Z +Longitude: -32.052820 +Latitude: 30.477075 +Altitude: 54.810 ft +Heart rate: 2 +Power: 114.8 +Speed: 110.4 mph +Heading: 4.1 +Time: 1970-01-01T00:00:25.515Z ]]> - -32.051494 - 30.477113 + -32.052820 + 30.477075 66 - 1970-01-01T00:00:26.718Z + 1970-01-01T00:00:25.515Z #track - -32.051494,30.477113 + -32.052820,30.477075,16.71 - Wpt_k2lz15k + Wpt_Wmx -Longitude: -32.051415 -Latitude: 30.477953 -Altitude: 98.438 ft -Heart rate: 53 -Depth: 172.3 ft -Speed: 147.6 mph -Heading: 4.6 -Time: 1970-01-01T00:00:28.139Z +Longitude: -32.052052 +Latitude: 30.477389 +Altitude: 241.967 ft +Cadence: 33 +Heart rate: 96 +Power: 402.7 +Temperature: 19.0 +Speed: 91.6 mph +Heading: 64.6 +Time: 1970-01-01T00:00:27.508Z ]]> - -32.051415 - 30.477953 + -32.052052 + 30.477389 66 - 1970-01-01T00:00:28.139Z + 1970-01-01T00:00:27.508Z #track - -32.051415,30.477953,30.00 + -32.052052,30.477389,73.75 - Wpt_hCT + Wpt_8u4Dqkf -Longitude: -32.051141 -Latitude: 30.478722 -Heart rate: 96 -Depth: 2099.9 ft -Speed: 145.1 mph -Heading: 17.1 -Time: 1970-01-01T00:00:29.519Z +Longitude: -32.051036 +Latitude: 30.478508 +Altitude: 121.888 ft +Cadence: 40 +Depth: 2066.8 ft +Speed: 160.6 mph +Heading: 38.0 +Time: 1970-01-01T00:00:31.102Z ]]> - -32.051141 - 30.478722 + -32.051036 + 30.478508 66 - 1970-01-01T00:00:29.519Z + 1970-01-01T00:00:31.102Z #track - -32.051141,30.478722 + -32.051036,30.478508,37.15 @@ -779,22 +814,22 @@ 1 -32.061312,30.470605,26.03 --32.060351,30.471588 --32.059442,30.471933,30.62 --32.058752,30.472451,75.70 --32.058143,30.473278 --32.057275,30.474104,26.70 --32.056245,30.474413,72.49 --32.056020,30.475032 --32.055280,30.475289,57.64 --32.054461,30.475367,91.16 --32.054306,30.475838 --32.053593,30.476512,77.01 --32.052896,30.476701,2.66 --32.052293,30.477107,59.30 --32.051494,30.477113 --32.051415,30.477953,30.00 --32.051141,30.478722 +-32.060342,30.470920 +-32.059568,30.471064,1.55 +-32.059063,30.471908 +-32.058841,30.472469,98.45 +-32.058482,30.473114,19.13 +-32.057616,30.473838 +-32.056698,30.474180,69.71 +-32.056143,30.474314,41.34 +-32.055584,30.475019,40.10 +-32.055159,30.475586,56.16 +-32.054485,30.475607,40.47 +-32.053788,30.475796,72.50 +-32.052873,30.476442,13.88 +-32.052820,30.477075,16.71 +-32.052052,30.477389,73.75 +-32.051036,30.478508,37.15 diff --git a/reference/track/gpx_garmin_extensions-kml_track.kml b/reference/track/gpx_garmin_extensions-kml_track.kml index 192d1d41f..bb0bcf87d 100644 --- a/reference/track/gpx_garmin_extensions-kml_track.kml +++ b/reference/track/gpx_garmin_extensions-kml_track.kml @@ -190,11 +190,11 @@ Min Speed 2.7 mph Max Speed 11.3 mph Avg Speed 8.4 mph +Avg Cadence 135.0 rpm +Max Cadence 153 rpm Avg Heart Rate 113.9 bpm Min Heart Rate 111 bpm Max Heart Rate 117 bpm -Avg Cadence 135.0 rpm -Max Cadence 153 rpm Start Time2008-08-20T07:04:48Z End Time2008-08-20T07:04:55Z ]]> @@ -213,8 +213,8 @@ Longitude: -0.035187 Latitude: 51.506172 Altitude: 0.449 ft -Heart rate: 111 Cadence: 151 +Heart rate: 111 Heading: 360.0 Time: 2008-08-20T07:04:48Z @@ -240,8 +240,8 @@ Longitude: -0.035242 Latitude: 51.506196 Altitude: -2.703 ft -Heart rate: 112 Cadence: 153 +Heart rate: 112 Speed: 10.4 mph Heading: 305.0 Time: 2008-08-20T07:04:49Z @@ -268,8 +268,8 @@ Longitude: -0.035303 Latitude: 51.506221 Altitude: -51.588 ft -Heart rate: 113 Cadence: 153 +Heart rate: 113 Speed: 11.3 mph Heading: 303.4 Time: 2008-08-20T07:04:50Z @@ -296,8 +296,8 @@ Longitude: -0.035354 Latitude: 51.506246 Altitude: -51.588 ft -Heart rate: 114 Cadence: 153 +Heart rate: 114 Speed: 10.1 mph Heading: 308.2 Time: 2008-08-20T07:04:51Z @@ -378,8 +378,8 @@ Longitude: -0.035462 Latitude: 51.506315 Altitude: -50.013 ft -Heart rate: 116 Cadence: 76 +Heart rate: 116 Speed: 5.8 mph Heading: 320.3 Time: 2008-08-20T07:04:54Z @@ -406,8 +406,8 @@ Longitude: -0.035472 Latitude: 51.506324 Altitude: -50.013 ft -Heart rate: 117 Cadence: 124 +Heart rate: 117 Speed: 2.7 mph Heading: 325.3 Time: 2008-08-20T07:04:55Z diff --git a/route.cc b/route.cc index d06cfc732..8b9365c5c 100644 --- a/route.cc +++ b/route.cc @@ -247,6 +247,8 @@ computed_trkdata track_recompute(const route_head* trk) double tot_hrt = 0.0; int pts_cad = 0; double tot_cad = 0.0; + int pts_pwr = 0; + double tot_pwr = 0.0; computed_trkdata tdata; // first.latitude = 0; @@ -329,6 +331,15 @@ computed_trkdata track_recompute(const route_head* trk) tdata.max_cad = thisw->cadence; } + if (thisw->power > 0) { + pts_pwr++; + tot_pwr += thisw->power; + } + + if ((thisw->power > 0) && ((!tdata.max_pwr) || (thisw->power > tdata.max_pwr))) { + tdata.max_pwr = thisw->power; + } + if (thisw->GetCreationTime().isValid()) { if (!tdata.start.isValid() || (thisw->GetCreationTime() < tdata.start)) { tdata.start = thisw->GetCreationTime(); @@ -354,6 +365,10 @@ computed_trkdata track_recompute(const route_head* trk) tdata.avg_cad = tot_cad / pts_cad; } + if (pts_pwr > 0) { + tdata.avg_pwr = tot_pwr / pts_pwr; + } + return tdata; } diff --git a/testo.d/kml.test b/testo.d/kml.test index b44c8c438..1de3d2319 100644 --- a/testo.d/kml.test +++ b/testo.d/kml.test @@ -74,6 +74,7 @@ if [ -z "${VALGRIND}" ]; then if command -v xmllint > /dev/null; then KMLS=$(find ${REFERENCE} -name \*.kml) + mkdir -p ${TMPDIR}/validcheck for f in $KMLS do case $f in @@ -81,7 +82,7 @@ if [ -z "${VALGRIND}" ]; then # to be legal in Earth GX 2.2. ${REFERENCE}/track/segmented_tracks-track.kml) continue;; *) - tmpf=${TMPDIR}/$(basename $f) + tmpf=${TMPDIR}/validcheck/$(basename $f) gpsbabel -i kml -f $f -o kml -F $tmpf xmllint --schema ${BASEPATH}/tools/kml22-schema/kml22gx.xsd --noout $tmpf esac;