Skip to content

Commit

Permalink
hotline
Browse files Browse the repository at this point in the history
  • Loading branch information
strukturart committed Sep 19, 2023
1 parent 2d94e04 commit c272b4a
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
2 changes: 2 additions & 0 deletions application/assets/js/d3.v7.min.js

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions application/assets/js/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,36 @@ const module = (() => {
return result;
};

var polylineGroup = L.layerGroup().addTo(map);

let hotline = (data) => {
// Create a color scale for the altitude values
var colorScale = d3
.scaleLinear()
.domain([
0,
d3.max(data, function (d) {
return d.alt;
}),
]) // Altitude range
.range(["blue", "red"]); // Color range

// Loop through the coordinates using forEach
data.forEach(function (coord, index, array) {
if (index < array.length - 1) {
var segmentCoords = [
[coord.lat, coord.lng],
[array[index + 1].lat, array[index + 1].lng],
];

var altitude = coord.alt;
var color = colorScale(altitude);

L.polyline(segmentCoords, { color: color }).addTo(polylineGroup);
}
});
};

/////////////////////////
/////Load GPX///////////
///////////////////////
Expand Down Expand Up @@ -868,6 +898,8 @@ const module = (() => {
timestamp: ts.toISOString(),
});

hotline(tracking_cache);

// Update the view with tracking data

if (tracking_cache.length > 2) {
Expand Down
7 changes: 7 additions & 0 deletions application/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,7 @@ <h2>Thank You!</h2>
<script src="http://127.0.0.1/api/v1/shared/core.js"></script>
<script src="http://127.0.0.1/api/v1/shared/session.js"></script>
<script src="http://127.0.0.1/api/v1/apps/service.js"></script>

<script defer src="assets/js/keepalive.js"></script>
<script defer src="assets/js/osm.js"></script>

Expand All @@ -840,6 +841,9 @@ <h2>Thank You!</h2>
<script defer src="assets/js/applait.finder.min.js"></script>
<script defer src="assets/js/olc.js"></script>
<script defer src="assets/js/leaflet.js"></script>
<script defer src="assets/js/d3.v7.min.js"></script>


<script defer src="assets/js/GeometryUtil.js"></script>
<script defer src="assets/js/pouchdb_7.3.0_pouchdb.min.js"></script>

Expand All @@ -862,5 +866,8 @@ <h2>Thank You!</h2>
<script defer src="assets/js/openweather.js"></script>
<script defer src="assets/js/togpx.js"></script>

<script src="assets/js/hotline.js"></script>


</body>
</html>
2 changes: 1 addition & 1 deletion application/manifest.webapp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.9.72",
"version": "1.9.721",
"version_name": "together we are strong",
"name": "o.map",
"description": "O.map, your ultimate navigation companion for KaiOS-powered devices. O.map is a lightweight and feature-rich map application designed specifically for KaiOS, enabling you to explore and navigate the world with ease. Whether you're a local resident, a tourist, or an adventurer, O.map is here to enhance your journey and keep you on the right track.",
Expand Down
2 changes: 1 addition & 1 deletion docs/manifest.webapp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.9.72",
"version": "1.9.721",
"version_name": "together we are strong",
"name": "o.map",
"description": "O.map, your ultimate navigation companion for KaiOS-powered devices. O.map is a lightweight and feature-rich map application designed specifically for KaiOS, enabling you to explore and navigate the world with ease. Whether you're a local resident, a tourist, or an adventurer, O.map is here to enhance your journey and keep you on the right track.",
Expand Down

0 comments on commit c272b4a

Please sign in to comment.