Skip to content

Commit

Permalink
Merge pull request #468 from sigcorporativo-ja/develop
Browse files Browse the repository at this point in the history
v6.7.0
  • Loading branch information
fbma authored Aug 7, 2024
2 parents fd8c913 + d103375 commit e3ea5ea
Show file tree
Hide file tree
Showing 290 changed files with 16,838 additions and 17,437 deletions.
13 changes: 12 additions & 1 deletion mapea-js/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@
"no-template-curly-in-string": "off",
"import/no-duplicates": "off",
"import/no-named-default": "off",
"import/extensions": "off"
"import/extensions": "off",
"import/no-cycle": "off",
"semi": 2
},
"env": {
"node": true,
"es6": true,
"browser": true
},
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
}
}
26,302 changes: 12,173 additions & 14,129 deletions mapea-js/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions mapea-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mapea",
"version": "6.6.0",
"version": "6.7.0",
"description": "Herramienta para desarrollo de mapas interactivos de forma sencilla",
"keywords": [
"map",
Expand Down Expand Up @@ -61,7 +61,7 @@
"handlebars": "4.5.2",
"jsdoc": "^3.6.4",
"jsts": "^2.0.2",
"ol": "8.1",
"ol": "9.1.0",
"proj4": "2.8.1"
},
"overrides": {
Expand Down
2 changes: 1 addition & 1 deletion mapea-js/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>es.juntadeandalucia.mapea</groupId>
<artifactId>mapea-parent</artifactId>
<version>6.6.0</version>
<version>6.7.0</version>
<relativePath>../mapea-parent/pom.xml</relativePath>
</parent>
<licenses>
Expand Down
2 changes: 1 addition & 1 deletion mapea-js/src/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @private
* @type {Number}
*/
M.config('MOBILE_WIDTH', ${mobile.width});
M.config('MOBILE_WIDTH', parseInt('${mobile.width}', 10));

/**
* The Mapea URL
Expand Down
55 changes: 26 additions & 29 deletions mapea-js/src/facade/js/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ class Map extends Base {
* @api
*/
getRootLayers(layersParamVar) {
const layers = this.getLayers(layersParamVar).filter(l => isNullOrEmpty(l.getLayerGroup()));
const layers = this.getLayers(layersParamVar).filter((l) => isNullOrEmpty(l.getLayerGroup()));

return layers;
}
Expand Down Expand Up @@ -508,8 +508,7 @@ class Map extends Base {
// KML and WFS layers handler its features
if (layer instanceof Vector
/* && !(layer instanceof KML) */
&&
!(layer instanceof WFS)) {
&& !(layer instanceof WFS)) {
this.featuresHandler_.addLayer(layer);
}

Expand Down Expand Up @@ -624,7 +623,6 @@ class Map extends Base {
return this;
}


/**
* This function gets the WMC layers added to the map
*
Expand Down Expand Up @@ -708,7 +706,7 @@ class Map extends Base {
/* checks if it should create the WMC control
to select WMC */
const addedWmcLayers = this.getWMC();
const wmcSelected = addedWmcLayers.filter(wmc => wmc.selected === true)[0];
const wmcSelected = addedWmcLayers.filter((wmc) => wmc.selected === true)[0];
if (wmcSelected == null) {
addedWmcLayers[0].select();
}
Expand All @@ -731,7 +729,7 @@ class Map extends Base {
this.getWMC()[0].select();
} else if (this.getWMC().length > 1) {
this.addControls(new WMCSelector());
const wmcSelected = this.getWMC().filter(wmc => wmc.selected === true)[0];
const wmcSelected = this.getWMC().filter((wmc) => wmc.selected === true)[0];
if (wmcSelected == null) {
this.getWMC()[0].select();
}
Expand Down Expand Up @@ -1381,7 +1379,7 @@ class Map extends Base {
controlName = control.name;
}
const controls = this.getControls();
const controlFiltered = controls.find(ctrl => ctrl.name === controlName);
const controlFiltered = controls.find((ctrl) => ctrl.name === controlName);
const hasControl = !isNullOrEmpty(controlFiltered);

return hasControl;
Expand Down Expand Up @@ -1436,9 +1434,9 @@ class Map extends Base {
getMaxExtent() {
let maxExtent = this.userMaxExtent;
if (isNullOrEmpty(maxExtent)) {
const selectedWmc = this.getWMC().find(wmc => wmc.selected);
const selectedWmc = this.getWMC().find((wmc) => wmc.selected);
if (isNullOrEmpty(selectedWmc)) {
maxExtent = getEnvolvedExtent(this.getLayers().filter(layer => layer.name !== '__draw__').map(l => l.getMaxExtent()));
maxExtent = getEnvolvedExtent(this.getLayers().filter((layer) => layer.name !== '__draw__').map((l) => l.getMaxExtent()));
} else {
maxExtent = selectedWmc.getMaxExtent();
}
Expand All @@ -1463,9 +1461,9 @@ class Map extends Base {
return new Promise((resolve) => {
let maxExtent = this.userMaxExtent;
if (isNullOrEmpty(maxExtent)) {
const selectedWmc = this.getWMC().find(wmc => wmc.selected);
const selectedWmc = this.getWMC().find((wmc) => wmc.selected);
if (isNullOrEmpty(selectedWmc)) {
const calculateExtents = this.getLayers().filter(layer => layer.name !== '__draw__' && layer.isVisible()).map(l => l.calculateMaxExtent());
const calculateExtents = this.getLayers().filter((layer) => layer.name !== '__draw__' && layer.isVisible()).map((l) => l.calculateMaxExtent());
Promise.all(calculateExtents).then((extents) => {
maxExtent = getEnvolvedExtent(extents);
if (isNullOrEmpty(maxExtent)) {
Expand All @@ -1486,7 +1484,6 @@ class Map extends Base {
});
}


/**
* This function sets the maximum extent for this
* map instance
Expand Down Expand Up @@ -2017,7 +2014,7 @@ class Map extends Base {
// removes controls from their panels
plugins.forEach((plugin) => {
plugin.destroy();
this._plugins = this._plugins.filter(plugin2 => plugin.name !== plugin2.name);
this._plugins = this._plugins.filter((plugin2) => plugin.name !== plugin2.name);
});
}

Expand All @@ -2036,19 +2033,20 @@ class Map extends Base {
getEnvolvedExtent() {
return new Promise((resolve) => {
// 1 check the WMC extent
const wmcLayer = this.getWMC().find(wmc => wmc.selected);
const wmcLayer = this.getWMC().find((wmc) => wmc.selected);
if (!isNullOrEmpty(wmcLayer)) {
wmcLayer.getMaxExtent(resolve);
} else {
const visibleBaseLayer = this.getBaseLayers().find(layer => layer.isVisible());
const visibleBaseLayer = this.getBaseLayers().find((layer) => layer.isVisible());
if (!isNullOrEmpty(visibleBaseLayer)) {
visibleBaseLayer.getMaxExtent(resolve);
} else {
const layers = this.getLayers().filter(layer => layer.name !== '__draw__');
Promise.all(layers.map(layer => layer.calculateMaxExtent()))
const layers = this.getLayers().filter((layer) => layer.name !== '__draw__');
Promise.all(layers.map((layer) => layer.calculateMaxExtent()))
.then((extents) => {
const extentsToCalculate =
isNullOrEmpty(extents) ? [this.getProjection().getExtent()] : extents;
const extentsToCalculate = isNullOrEmpty(extents)
? [this.getProjection().getExtent()]
: extents;
const envolvedMaxExtent = getEnvolvedExtent(extentsToCalculate);
resolve(envolvedMaxExtent);
});
Expand Down Expand Up @@ -2194,9 +2192,9 @@ class Map extends Base {
}

arrayLabel.forEach((element, index) => {
const panMapIfOutOfView = element.panMapIfOutOfView === undefined ?
true :
labelParam.panMapIfOutOfView;
const panMapIfOutOfView = element.panMapIfOutOfView === undefined
? true
: labelParam.panMapIfOutOfView;

// object
if (isObject(element)) {
Expand Down Expand Up @@ -2341,7 +2339,7 @@ class Map extends Base {
panels = [panels];
}
panels.forEach((panel) => {
const isIncluded = this._panels.some(panel2 => panel2.equals(panel));
const isIncluded = this._panels.some((panel2) => panel2.equals(panel));
if ((panel instanceof Panel) && !isIncluded) {
this._panels.push(panel);
const queryArea = 'div.m-area'.concat(panel.position);
Expand All @@ -2365,7 +2363,7 @@ class Map extends Base {
}
if (panel instanceof Panel) {
panel.destroy();
this._panels = this._panels.filter(panel2 => !panel2.equals(panel));
this._panels = this._panels.filter((panel2) => !panel2.equals(panel));
}

return this;
Expand All @@ -2390,7 +2388,7 @@ class Map extends Base {
names = [names];
}
names.forEach((name) => {
const filteredPanels = this._panels.filter(panel => panel.name === name);
const filteredPanels = this._panels.filter((panel) => panel.name === name);
filteredPanels.forEach((panel) => {
if (!isNullOrEmpty(panel)) {
panels.push(panel);
Expand Down Expand Up @@ -2529,7 +2527,7 @@ class Map extends Base {
this.popup_ = [];
} else if (isArray(popup)) {
popup.forEach((elm, index) => {
const findPopup = element => element.getId() === elm.getId();
const findPopup = (element) => element.getId() === elm.getId();
const find = this.popup_.findIndex(findPopup);
this.getImpl().removePopup(this.popup_[find]);
this.popup_[find].destroy();
Expand Down Expand Up @@ -2563,7 +2561,6 @@ class Map extends Base {
let arrayPopup = popup;
let arrayCoordinate = coordinate;


if (!isArray(popup)) {
arrayPopup = [popup];
}
Expand Down Expand Up @@ -2637,7 +2634,7 @@ class Map extends Base {
if (!isUndefined(this.getImpl().refresh) && isFunction(this.getImpl().refresh)) {
this.getImpl().refresh();
}
this.getLayers().forEach(layer => layer.refresh());
this.getLayers().forEach((layer) => layer.refresh());
return this;
}

Expand Down Expand Up @@ -2813,7 +2810,7 @@ class Map extends Base {
* @api
*/
getOverlayLayers() {
const layers = this.getLayers().filter(layer => layer.name !== '__draw__' && layer.transparent === true);
const layers = this.getLayers().filter((layer) => layer.name !== '__draw__' && layer.transparent === true);
return layers;
}

Expand Down
13 changes: 7 additions & 6 deletions mapea-js/src/facade/js/Popup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable max-classes-per-file */
/**
* @module M/Popup
*/
Expand All @@ -19,9 +20,9 @@ let id = 0;
*/
const getUrlFromPlatform = (platform, coords) => {
const platformURL = {
android: coord => `geo:${coord[1]}},${coord[0]}?q=${coord[1]},${coord[0]}`,
ios: coord => `maps://?ll=${coord[1]},${coord[0]}`,
unknown: coord => `http://maps.google.com?q=${coord[1]},${coord[0]}`,
android: (coord) => `geo:${coord[1]}},${coord[0]}?q=${coord[1]},${coord[0]}`,
ios: (coord) => `maps://?ll=${coord[1]},${coord[0]}`,
unknown: (coord) => `http://maps.google.com?q=${coord[1]},${coord[0]}`,
};
return platformURL[platform](coords);
};
Expand Down Expand Up @@ -152,7 +153,7 @@ class Popup extends Base {
tabRemove = tab;
}
});
this.tabs_ = this.tabs_.filter(tab => tab.content !== tabToRemove.content);
this.tabs_ = this.tabs_.filter((tab) => tab.content !== tabToRemove.content);
this.fire(EventType.POPUP_REMOVED_TAB, [tabRemove]);
this.update();
}
Expand Down Expand Up @@ -290,11 +291,11 @@ class Popup extends Base {
listeners.forEach((listener) => {
if (listener.all === true) {
html.querySelectorAll(listener.selector).forEach((element) => {
element.addEventListener(listener.type, e => listener.callback(e));
element.addEventListener(listener.type, (e) => listener.callback(e));
});
} else {
html.querySelector(listener.selector)
.addEventListener(listener.type, e => listener.callback(e));
.addEventListener(listener.type, (e) => listener.callback(e));
}
});
}
Expand Down
1 change: 0 additions & 1 deletion mapea-js/src/facade/js/control/Control.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ class Control extends Base {
return this.getImpl().getElement();
}


/**
* Sets the panel of the control
*
Expand Down
12 changes: 6 additions & 6 deletions mapea-js/src/facade/js/control/Layerswitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class LayerSwitcher extends ControlBase {
// gets base layers and overlay layers
if (!isNullOrEmpty(map)) {
const baseLayers = map.getBaseLayers()
.filter(layer => layer.displayInLayerSwitcher === true);
.filter((layer) => layer.displayInLayerSwitcher === true);
const layerGroups = map.getLayerGroup();
const orderedLayerGroups = LayerSwitcher.orderLayerGroups(layerGroups);
const overlayLayers = map.getRootLayers().filter((layer) => {
Expand All @@ -153,11 +153,11 @@ class LayerSwitcher extends ControlBase {
const overlayLayersPromise = Promise.all(overlayLayers
.map(LayerSwitcher.parseLayerForTemplate));
const layerGroupsPromise = Promise.all(orderedLayerGroups
.map(layerGroup => LayerSwitcher.parseGroupForTemplate(layerGroup, baseLayers))
.filter(g => !isNullOrEmpty(g)));
.map((layerGroup) => LayerSwitcher.parseGroupForTemplate(layerGroup, baseLayers))
.filter((g) => !isNullOrEmpty(g)));
baseLayersPromise.then((parsedBaseLayers) => {
layerGroupsPromise.then((parsedLayerGroups) => {
overlayLayersPromise.then(parsedOverlayLayers => success({
overlayLayersPromise.then((parsedOverlayLayers) => success({
baseLayers: parsedBaseLayers,
overlayLayers: parsedOverlayLayers,
layerGroups: parsedLayerGroups,
Expand Down Expand Up @@ -248,9 +248,9 @@ class LayerSwitcher extends ControlBase {

let visibleLevel = 0;
const layers = groupLayer.getAllLayers();
if (layers.every(l => l.isVisible())) {
if (layers.every((l) => l.isVisible())) {
visibleLevel = 2;
} else if (layers.some(l => l.isVisible())) {
} else if (layers.some((l) => l.isVisible())) {
visibleLevel = 1;
}
varTemplate.visible = visibleLevel;
Expand Down
1 change: 1 addition & 0 deletions mapea-js/src/facade/js/control/Navtoolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Navtoolbar extends ControlBase {
Exception(getValue('exception').navtoolbar_method);
}
}

/**
* This function creates the view to the specified map
*
Expand Down
4 changes: 2 additions & 2 deletions mapea-js/src/facade/js/control/Rotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const rotateListener = (e, html, map) => {
let x = 0;
let y = 0;

while (sliderContainer && !Number.isNaN(sliderContainer.offsetLeft) &&
!Number.isNaN(sliderContainer.offsetTop)) {
while (sliderContainer && !Number.isNaN(sliderContainer.offsetLeft)
&& !Number.isNaN(sliderContainer.offsetTop)) {
x += sliderContainer.offsetLeft - sliderContainer.scrollLeft;
y += sliderContainer.offsetTop - sliderContainer.scrollTop;
sliderContainer = sliderContainer.offsetParent;
Expand Down
2 changes: 1 addition & 1 deletion mapea-js/src/facade/js/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const show = (message, title, severity) => {

// adds listener to close the dialog
const okButton = html.querySelector('div.m-button > button');
okButton.addEventListener('click', evt => removeElement(html));
okButton.addEventListener('click', (evt) => removeElement(html));
mapeaContainer.appendChild(html);
};

Expand Down
2 changes: 1 addition & 1 deletion mapea-js/src/facade/js/filter/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const parseParamToGeometries = (paramParameter) => {
let param = paramParameter;
let geometries = [];
if (param instanceof Vector) {
geometries = [...param.getFeatures().map(feature => feature.getGeometry())];
geometries = [...param.getFeatures().map((feature) => feature.getGeometry())];
} else {
if (!isArray(param)) {
param = [param];
Expand Down
4 changes: 3 additions & 1 deletion mapea-js/src/facade/js/format/GeoJSON.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
*/
import GeoJSONImpl from 'impl/format/GeoJSON.js';
import Base from '../Base.js';
import { isUndefined, isArray, isNullOrEmpty, isString } from '../util/Utils.js';
import {
isUndefined, isArray, isNullOrEmpty, isString,
} from '../util/Utils.js';
import Exception from '../exception/exception.js';
import { getValue } from '../i18n/language.js';

Expand Down
Loading

0 comments on commit e3ea5ea

Please sign in to comment.