Skip to content

Commit

Permalink
fix profil alti trop gros
Browse files Browse the repository at this point in the history
  • Loading branch information
azarz authored Dec 18, 2024
1 parent 975d85c commit 60d4b11
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/OpenLayers/Controls/ElevationPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -1384,8 +1384,10 @@ var ElevationPath = (function (Control) {
// Calcul de la distance au départ pour chaque point + arrondi des lat/lon
_data[0].dist = 0;
_data[0].slope = 0;
_data[0].lat = Math.round(_data[0].lat * 10000) / 10000;
_data[0].lon = Math.round(_data[0].lon * 10000) / 10000;
_data[0].oldlat = _data[0].lat;
_data[0].oldlon = _data[0].lon;
_data[0].lat = Math.round(_data[0].lat * 100000) / 100000;
_data[0].lon = Math.round(_data[0].lon * 100000) / 100000;

var _distanceMinus = 0;
var _distancePlus = 0;
Expand All @@ -1398,7 +1400,7 @@ var ElevationPath = (function (Control) {

for (var i = 1; i < _data.length; i++) {
var a = [_data[i].lon, _data[i].lat];
var distanceToPrevious = olGetDistanceSphere(a, [_data[i-1].lon, _data[i-1].lat]);
var distanceToPrevious = olGetDistanceSphere(a, [_data[i-1].oldlon, _data[i-1].oldlat]);
var dist = distanceToPrevious + _distance;

var za = _data[i].z;
Expand Down Expand Up @@ -1439,8 +1441,10 @@ var ElevationPath = (function (Control) {
_data[i].color = "#00B798";
}

_data[i].lat = Math.round(_data[i].lat * 10000) / 10000;
_data[i].lon = Math.round(_data[i].lon * 10000) / 10000;
_data[i].oldlat = _data[i].lat;
_data[i].oldlon = _data[i].lon;
_data[i].lat = Math.round(_data[i].lat * 100000) / 100000;
_data[i].lon = Math.round(_data[i].lon * 100000) / 100000;
}

// check distance totale
Expand Down

0 comments on commit 60d4b11

Please sign in to comment.