Skip to content

Commit

Permalink
fix(profil-alti): le graphique déborde (#303)
Browse files Browse the repository at this point in the history
* fix(profil-alti): le graphique déborde
  • Loading branch information
azarz authored Dec 18, 2024
1 parent 226cbae commit 88040c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "geopf-extensions-openlayers",
"description": "French Geoportal Extensions for OpenLayers libraries",
"version": "1.0.0-beta.1-300",
"version": "1.0.0-beta.1-303",
"date": "11/12/2024",
"module": "src/index.js",
"directories": {},
Expand Down
18 changes: 10 additions & 8 deletions src/packages/Controls/ElevationPath/ElevationPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,6 @@ var ElevationPath = class ElevationPath extends Control {
logger.trace("ElevationPath::_computeElevationMeasure", elevations);

var _data = elevations;
console.log(_data);
var _unit = "m";

var _sketchPoints = this._getSketchCoords();
Expand All @@ -1384,8 +1383,10 @@ var ElevationPath = class ElevationPath extends 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 @@ -1395,10 +1396,10 @@ var ElevationPath = class ElevationPath extends Control {
var _slopes = 0;

var distances = [];

console.log(_data);
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 @@ -1438,9 +1439,10 @@ var ElevationPath = class ElevationPath extends Control {
} else {
_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 88040c2

Please sign in to comment.