Skip to content

Commit

Permalink
release ext-ol-3.0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
azarz committed May 11, 2021
2 parents 0f7c874 + afd46e9 commit b48488f
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 112 deletions.
28 changes: 9 additions & 19 deletions DRAFT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,61 +6,51 @@
## Summary

Correctifs sur le profil altimétriques

## Changelog

* [Added]

* [Changed]
- Adaptation du style du profil alti par défaut

* [Deprecated]

* [Removed]

* [Fixed]

- Correctif sur les clics multiple en fin de saisie du profil altimétrique (#298)

* [Security]

---



# Extension Geoportail Leaflet, version __VERSION__

**__DATE__**
> Release Extension Geoportail leaflet
## Summary

* gestion des loggers :
> Exposition de la classe statique *Logger* avec les méthodes suivantes :
`Gp.Logger.disableAll()` et `Gp.Logger.enableAll()`
Reparation du le profil altimétrique

## Changelog

* [Added]

* [Changed]

- mise à jour de la lib. geoportal-access-lib : 2.1.8

* [Deprecated]

* [Removed]

- la dépendance *request* est supprimée, et remplacée par *node-fetch*

* [Fixed]

- Possibilité de activer / desactiver les loggers des API lors de l'utilisation des API en module ES6 :

```js
import { Logger } from "geoportal-extensions-leaflet";
Logger.disableAll();
```

- corrections des erreurs à partir de DeepScan (#288)
- corrections syntaxiques eslint (da275a2 et 306506a)
- cf. issue : Erreur compilation par webpack [#294](https://github.com/IGNF/geoportal-extensions/issues/294)
- cf. issue : Erreur dépendances à la compilation [#283](https://github.com/IGNF/geoportal-extensions/issues/283)
- Correction et réparation du profil altimétrique de Leaflet (#297)

* [Security]

Expand All @@ -76,7 +66,7 @@
## Summary

* gestion des loggers :
* gestion des loggers :
> Exposition de la classe statique *Logger* avec les méthodes suivantes :
`Gp.Logger.disableAll()` et `Gp.Logger.enableAll()`

Expand Down
Binary file not shown.
45 changes: 45 additions & 0 deletions doc/CHANGELOG-leaflet.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Extension Geoportail Leaflet, version 2.1.8](#extension-geoportail-leaflet-version-218)
* [Summary](#summary-14)
* [Changelog](#changelog-11)
- [Extension Geoportail Leaflet, version 2.1.9](#extension-geoportail-leaflet-version-219)
* [Summary](#summary-15)
* [Changelog](#changelog-12)

<!-- tocstop -->

Expand Down Expand Up @@ -449,3 +452,45 @@ Nouveau widget de profil altimétrique par défaut, et correctif mineur
* [Security]

---
# Extension Geoportail Leaflet, version 2.1.9

**26/04/2021**
> Release Extension Geoportail leaflet
## Summary

* gestion des loggers :
> Exposition de la classe statique *Logger* avec les méthodes suivantes :
`Gp.Logger.disableAll()` et `Gp.Logger.enableAll()`

## Changelog

* [Added]

* [Changed]

- mise à jour de la lib. geoportal-access-lib : 2.1.8

* [Deprecated]

* [Removed]

- la dépendance *request* est supprimée, et remplacée par *node-fetch*

* [Fixed]

- Possibilité de activer / desactiver les loggers des API lors de l'utilisation des API en module ES6 :

```js
import { Logger } from "geoportal-extensions-leaflet";
Logger.disableAll();
```

- corrections des erreurs à partir de DeepScan (#288)
- corrections syntaxiques eslint (da275a2 et 306506a)
- cf. issue : Erreur compilation par webpack [#294](https://github.com/IGNF/geoportal-extensions/issues/294)
- cf. issue : Erreur dépendances à la compilation [#283](https://github.com/IGNF/geoportal-extensions/issues/283)

* [Security]

---
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "geoportal-extensions",
"description": "French Geoportal Extensions for OpenLayers, Leaflet and iTowns libraries",
"version": "2.3.5",
"date": "26/04/2021",
"date": "11/05/2021",
"leafletExtName": "French Geoportal Extension for Leaflet",
"leafletExtVersion": "2.1.9",
"olExtName": "French Geoportal Extension for OpenLayers",
"olExtVersion": "3.0.15",
"olExtVersion": "3.0.16",
"itownsExtName": "French Geoportal Extension for Itowns",
"itownsExtVersion": "2.3.2",
"main": "dist/leaflet/GpPluginLeaflet.js, dist/openlayers/GpPluginOpenLayers.js, dist/itowns/GpPluginItowns.js",
Expand Down
58 changes: 38 additions & 20 deletions src/Common/Controls/ProfileElevationPathDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ var ProfileElevationPathDOM = {
*
* @param {String} text The text to be rendered.
* @param {String} container The container of the text
* @param {String} font The font of the container if known, format: 'weight size familiy'
* @returns {Number} The width of the text
*
* @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393
*/
_getTextWidth : function (text, container) {
_getTextWidth : function (text, container, font = null) {
// re-use canvas object for better performance
var canvas = this.canvas || (this.canvas = document.createElement("canvas"));
var context = canvas.getContext("2d");
context.font = `${this._getCssProperty(container, "font-weight")} ${this._getCssProperty(container, "font-size")} ${this._getCssProperty(container, "font-family")}`;
if (font === null) {
context.font = `${this._getCssProperty(container, "font-weight")} ${this._getCssProperty(container, "font-size")} ${this._getCssProperty(container, "font-family")}`;
} else {
context.font = font;
}

var metrics = context.measureText(text);
return metrics.width;
},
Expand Down Expand Up @@ -148,7 +154,7 @@ var ProfileElevationPathDOM = {
const widgetWidth = container.clientWidth - margin.left - margin.right;

const zLabelWidth = 17;
const zGradWidth = 8 + this._getTextWidth(Math.round(maxZ).toLocaleString() + ",88", container);
const zGradWidth = this._getTextWidth(Math.round(maxZ).toLocaleString() + ",88", container, "400 10 Verdana");
const xLabelHeight = 17;
const xGradHeight = 15;

Expand Down Expand Up @@ -225,6 +231,9 @@ var ProfileElevationPathDOM = {
for (let i = 0; i <= numZguides; i++) {
gradZtext = document.createElementNS("http://www.w3.org/2000/svg", "text");
gradZtext.setAttribute("class", "profile-z-graduation");
gradZtext.setAttribute("font-family", "Verdana");
gradZtext.setAttribute("font-size", "10px");
gradZtext.setAttribute("fill", "#5E5E5E");
// Cas où gradZ < 1 : nombres flottants capricieux...
// Le Math.round est pour éviter des ennuis du genre 3 * 0.1 = 0.300000000000004
gradZtext.textContent = (Math.round(100 * (minGraphZ + i * gradZ)) / 100).toLocaleString();
Expand Down Expand Up @@ -266,6 +275,9 @@ var ProfileElevationPathDOM = {

var axisZLegend = document.createElementNS("http://www.w3.org/2000/svg", "text");
axisZLegend.setAttribute("class", "profile-z-legend");
axisZLegend.setAttribute("font-family", "Verdana");
axisZLegend.setAttribute("font-size", "11px");
axisZLegend.setAttribute("fill", "#5E5E5E");
axisZLegend.textContent = "Altitude (m)";

axisZLegend.setAttribute("transform", `translate(${zLabelWidth - 8}, ${Math.round(pathHeight / 2)}) rotate(-90)`);
Expand Down Expand Up @@ -319,6 +331,9 @@ var ProfileElevationPathDOM = {
for (let i = 0; i <= numXguides + 1; i++) {
gradXtext = document.createElementNS("http://www.w3.org/2000/svg", "text");
gradXtext.setAttribute("class", "profile-x-graduation");
gradXtext.setAttribute("font-family", "Verdana");
gradXtext.setAttribute("font-size", "10px");
gradXtext.setAttribute("fill", "#5E5E5E");

// Exclusion du cas de la dernière graduation : correspond à la distance max : pas de texte
if (i !== numXguides + 1) {
Expand Down Expand Up @@ -367,6 +382,9 @@ var ProfileElevationPathDOM = {

var axisXLegend = document.createElementNS("http://www.w3.org/2000/svg", "text");
axisXLegend.setAttribute("class", "profile-x-legend");
axisXLegend.setAttribute("font-family", "Verdana");
axisXLegend.setAttribute("font-size", "11px");
axisXLegend.setAttribute("fill", "#5E5E5E");
axisXLegend.textContent = `Distance (${distUnit})`;

axisXLegend.setAttribute("transform", `translate(${zLabelWidth + zGradWidth + pathWidth / 2}, ${pathHeight + xGradHeight + xLabelHeight + 3})`);
Expand Down Expand Up @@ -468,7 +486,7 @@ var ProfileElevationPathDOM = {
const br2 = document.createElement("br");
const coordsSpan = document.createElement("span");

tooltipDiv.setAttribute("style", "text-align:center; max-width:220px; font-size:10px; color:#000000; font-family:Verdana;");
tooltipDiv.setAttribute("style", "text-align:center; max-width:220px; font-size:10px; color:#000000; font-family:Verdana; z-index:50;");
tooltipDiv.style.pointerEvents = "none";
tooltipDiv.style.position = "fixed";
// tooltipDiv.classList.add("tooltipInit");
Expand Down Expand Up @@ -606,12 +624,12 @@ var ProfileElevationPathDOM = {

let toolTipBubbleD;
if (d.dist > (dist * factor) / 2) {
toolTipBubbleD = `M -0.5 -0.5 l -6 6 l 0 16 l -${tooltipTextWidth + 5} 0 l 0 -44 l ${tooltipTextWidth + 5} 0 l 0 16 l 6 6`;
tooltipDivLeft -= tooltipTextWidth;
toolTipBubbleD = `M -0.5 -0.5 l -6 6 l 0 16 l -${tooltipTextWidth + 10} 0 l 0 -44 l ${tooltipTextWidth + 10} 0 l 0 16 l 6 6`;
tooltipDivLeft -= (tooltipTextWidth + 12);
} else if (d.dist <= (dist * factor) / 2) {
toolTipBubbleD = `M -0.5 -0.5 l 6 6 l 0 16 l ${tooltipTextWidth + 5} 0 l 0 -44 l -${tooltipTextWidth + 5} 0 l 0 16 l -6 6`;
toolTipBubbleD = `M -0.5 -0.5 l 6 6 l 0 16 l ${tooltipTextWidth + 10} 0 l 0 -44 l -${tooltipTextWidth + 10} 0 l 0 16 l -6 6`;
// Largeur de la fleche de la bulle du tooltip
tooltipDivLeft += 15;
tooltipDivLeft += 12;
}

tooltipBubble.setAttribute("d", toolTipBubbleD);
Expand Down Expand Up @@ -959,18 +977,18 @@ var ProfileElevationPathDOM = {
}
}

for (let i = 0; i < _points.length; i++){
var dist = _points[i].dist;
var coeffArrond = 100;
if (dist > 100) {
coeffArrond = 1;
} else if (dist > 10) {
coeffArrond = 10;
}

// Correction arrondi distance totale
dist = Math.round(dist * coeffArrond) / coeffArrond;
_points[i].dist = dist;
for (let i = 0; i < _points.length; i++) {
var dist = _points[i].dist;
var coeffArrond = 100;
if (dist > 100) {
coeffArrond = 1;
} else if (dist > 10) {
coeffArrond = 10;
}

// Correction arrondi distance totale
dist = Math.round(dist * coeffArrond) / coeffArrond;
_points[i].dist = dist;
}

var settings = {
Expand Down
Loading

0 comments on commit b48488f

Please sign in to comment.