This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Routes.activeMap.activeRoute.flattenBridgesAndTunnels = | |
function() { | |
var e, t, n = !1, r = Routes.activeMap.activeRoute.trackPoints(), o = r.length; | |
r.some((function(e) { | |
return !(Number.isFinite(e.distance) && Number.isFinite(e.ele)) | |
} | |
)) || r.forEach((function(i, a) { | |
if (!i.flattened) | |
if (i.roadEnv && !n) | |
for (n = !0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function garmin(lat1, lon1, lat2, lon2) { | |
-180 == lon1 && (lon1 = 180); | |
var e; | |
var o; | |
var r; | |
var n; | |
var a; | |
var s; | |
var h = lat1 * Math.PI / 180; | |
var u = lon1 * Math.PI / 180; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BRM名 | |
console.log([...document.querySelectorAll("h3")].filter(e=>e.textContent.match(/BRM\d+.+/)).map(e=>e.textContent.replace(/・.*$/,"")).join("\n")) | |
// 距離 | |
console.log([...document.querySelectorAll("h3")].filter(e=>e.textContent.match(/BRM\d+.+/)).map(e=>e.textContent.replace(/.*?(\d+)km.*$/,"$1")).join("\n")) | |
// BRM開催日時 | |
console.log([...document.querySelectorAll("h3")].filter(e=>e.textContent.match(/BRM\d+.+/)).map(e=>e.textContent.replace(/BRM(\d+)(\d\d).*$/,"2023/$1/$2")).join("\n")) | |
// エントリー期間 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 通れた道マップ(https://www.toyota.co.jp/jpn/auto/passable_route/map/)にGPXファイルをロードする機能を追加 | |
*/ | |
(function(){ | |
const readXML = function(file){ | |
return new Promise(function(resolve, reject){ | |
try{ | |
const reader = new FileReader(); | |
const parser = new DOMParser(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gsidistance(lat1, lon1, lat2, lon2){ | |
"use strict"; | |
const a = 6378137.0; | |
const f = 1 / 298.257223563; | |
const MAX_ITERATION = 200; | |
const abs = Math.abs; | |
const sqrt = Math.sqrt; | |
const sin = Math.sin; | |
const cos = Math.cos; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hubeny1(lat1, lon1, lat2, lon2){ | |
"use strict"; | |
const a = 6378137.0; | |
const f = 1 / 298.257223563; | |
const e2 = f * (2 - f); | |
const e2p = e2 / (1 - e2); | |
const degree = Math.PI / 180.0; | |
const sin = Math.sin; | |
const cos = Math.cos; | |
const tan = Math.tan; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Vincenty75 測地線距離計算式 | |
* @param {number} lat1 | |
* @param {number} lon1 | |
* @param {number} lat2 | |
* @param {number} lon2 | |
* @return {number} distance [m] | |
*/ | |
function vincenty(lat1, lon1, lat2, lon2){ | |
"use strict"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Hubeny測地線距離計算式(標準) | |
* https://amano-tec.com/apps/paceruler.html | |
* @param {number} lat1 | |
* @param {number} lon1 | |
* @param {number} lat2 | |
* @param {number} lon2 | |
* @return {number} distance [m] | |
*/ | |
function hubeny(lat1, lon1, lat2, lon2){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* L1, L2の2層のキャッシュ | |
* @param {string} cache_name Cache APIで使用する名前(cacheName) | |
* @param {function} parser responseを受け取ってキャッシュに保存する内容を返すコールバック関数(async function可) | |
* @param {number} l1_cache_size L1キャッシュに保持するURL件数 | |
* @param {number} l2_cache_expiration L2キャッシュの有効期限 | |
*/ | |
function LayeredCache(cache_name, parser, l1_cache_size = 1000, cache_expiration = 30 * 86400 * 1000){ | |
const HEADER_EXPIRATION = "_expire_on"; | |
const l1_cache = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map = Routes.activeMap, route = map.activeRoute, trackpoints = route.trackPoints(), update = () => { | |
if(trackpoints.length === trackpoints.filter((e)=>(e.roadEnv!==undefined)).length){ | |
route.rebuildBounds(); | |
route.flattenBridgesAndTunnels(); | |
route.calculateMetrics(); | |
map.loadElevationProfile(); | |
console.log("完了"); | |
}else{ | |
setTimeout(update, 1000); | |
} |
NewerOlder