Skip to content

Commit

Permalink
Merge pull request #408 from sigcorporativo-ja/develop
Browse files Browse the repository at this point in the history
v6.3.0
  • Loading branch information
fbma authored Nov 2, 2022
2 parents b7c1c09 + 26bcf2b commit 18a88eb
Show file tree
Hide file tree
Showing 155 changed files with 6,801 additions and 1,345 deletions.
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.2.0",
"version": "6.3.0",
"description": "Herramienta para desarrollo de mapas interactivos de forma sencilla",
"keywords": [
"map",
Expand Down Expand Up @@ -65,7 +65,7 @@
"handlebars": "4.5.2",
"jsdoc": "^3.6.4",
"jsts": "^2.0.2",
"ol": "6.14.1",
"ol": "6.15.1",
"proj4": "^2.4.4"
},
"scripts": {
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.2.0</version>
<version>6.3.0</version>
<relativePath>../mapea-parent/pom.xml</relativePath>
</parent>
<licenses>
Expand Down
30 changes: 15 additions & 15 deletions mapea-js/src/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @public
* @api stable
*/
M.config('MAPEA_URL', location.protocol + '${mapea.url}');
M.config('MAPEA_URL', '${mapea.url}');

/**
* The path to the Mapea proxy to send
Expand All @@ -29,7 +29,7 @@
* @public
* @api stable
*/
M.config('PROXY_URL', location.protocol + '${mapea.proxy.url}');
M.config('PROXY_URL', '${mapea.proxy.url}');

/**
* The path to the Mapea proxy to send
Expand All @@ -39,7 +39,7 @@
* @public
* @api stable
*/
M.config('PROXY_POST_URL', location.protocol + '${mapea.proxy_post.url}');
M.config('PROXY_POST_URL', '${mapea.proxy_post.url}');

/**
* The path to the Mapea templates
Expand All @@ -57,7 +57,7 @@
* @public
* @api stable
*/
M.config('THEME_URL', location.protocol + '${mapea.theme.url}');
M.config('THEME_URL', '${mapea.theme.url}');

/**
* The Geosearch URL
Expand All @@ -66,7 +66,7 @@
* @public
* @api stable
*/
M.config('GEOSEARCH_URL', location.protocol + '${geosearch.url}');
M.config('GEOSEARCH_URL', '${geosearch.url}');

/**
* The Geosearch core
Expand Down Expand Up @@ -137,7 +137,7 @@
* @public
* @api stable
*/
'urls': '${wmc.urls}'.split(',').map(e => location.protocol + e),
'urls': '${wmc.urls}'.split(',').map(e => e),

/**
* WMC predefined names
Expand Down Expand Up @@ -181,7 +181,7 @@
* @public
* @api stable
*/
'tiledUrls': '${tile.mappings.tiledUrls}'.split(',').map(e => location.protocol + e),
'tiledUrls': '${tile.mappings.tiledUrls}'.split(',').map(e => e),

/**
* WMC context names
Expand All @@ -199,7 +199,7 @@
* @public
* @api stable
*/
'urls': '${tile.mappings.urls}'.split(',').map(e => location.protocol + e)
'urls': '${tile.mappings.urls}'.split(',').map(e => e)
});

/**
Expand All @@ -226,7 +226,7 @@
* @public
* @api stable
*/
'URL': location.protocol + '${geoprint.url}',
'URL': '${geoprint.url}',

/**
* WMC predefined names
Expand Down Expand Up @@ -288,7 +288,7 @@
* @public
* @api stable
*/
'URL': location.protocol + '${geoprint2.url}',
'URL': '${geoprint2.url}',

/**
* Printer service URL
Expand All @@ -297,7 +297,7 @@
* @public
* @api stable
*/
'URL_APPLICATION': location.protocol + '${geoprint.url_application}',
'URL_APPLICATION': '${geoprint.url_application}',
});

/**
Expand Down Expand Up @@ -334,7 +334,7 @@
* @public
* @api stable
*/
M.config('SEARCHSTREET_URL', location.protocol + '${searchstreet.url}');
M.config('SEARCHSTREET_URL', '${searchstreet.url}');

/**
* Autocomplete municipality service URL
Expand All @@ -343,7 +343,7 @@
* @public
* @api stable
*/
M.config('SEARCHSTREET_URLCODINEAUTOCOMPLETE', location.protocol + '${searchstreet.urlcodineautocomplete}');
M.config('SEARCHSTREET_URLCODINEAUTOCOMPLETE', '${searchstreet.urlcodineautocomplete}');

/**
* service URL check code INE
Expand All @@ -352,7 +352,7 @@
* @public
* @api stable
*/
M.config('SEARCHSTREET_URLCOMPROBARINE', location.protocol + '${searchstreet.urlcomprobarine}');
M.config('SEARCHSTREET_URLCOMPROBARINE', '${searchstreet.urlcomprobarine}');

/**
* Normalizar searchstreet service URL
Expand All @@ -361,7 +361,7 @@
* @public
* @api stable
*/
M.config('SEARCHSTREET_NORMALIZAR', location.protocol + '${searchstreet.normalizar}');
M.config('SEARCHSTREET_NORMALIZAR', '${searchstreet.normalizar}');

/**
* Minimum number of characters to start autocomplete
Expand Down
51 changes: 51 additions & 0 deletions mapea-js/src/facade/js/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
isObject,
getEnvolvedExtent,
generateResolutionsFromExtent,
getResolutionFromScale,
} from './util/Utils.js';
import { getValue } from './i18n/language';
import Exception from './exception/exception';
Expand All @@ -26,6 +27,7 @@ import FeaturesHandler from './handler/Feature.js';
import Feature from './feature/Feature.js';
import * as Dialog from './dialog';
import GetFeatureInfo from './control/GetFeatureInfo.js';
import Layerswitcher from './control/Layerswitcher.js';
import WMCSelector from './control/WMCSelector.js';
import Layer from './layer/Layer.js';
import * as LayerType from './layer/Type.js';
Expand Down Expand Up @@ -293,6 +295,16 @@ class Map extends Base {
}
}

// layerswitcher
if (!isUndefined(params.layerswitcher)) {
if (params.layerswitcher !== 'emptylayer' && params.layerswitcher !== '') {
Dialog.error(getValue('layerswitcher').unsupported_param);
} else {
const layerswitcher = new Layerswitcher(params.layerswitcher);
this.addControls(layerswitcher);
}
}

// default WMC
if (isNullOrEmpty(params.wmc) && isNullOrEmpty(params.layers)) {
this.addWMC(M.config.predefinedWMC.predefinedNames[0]);
Expand Down Expand Up @@ -1956,6 +1968,32 @@ class Map extends Base {
return this;
}

/**
* This function adds plugins
*
* @public
* @function
* @param {Array<Plugin>} plugins plugins to add to the map
* @returns {Map}
* @api
*/
addPlugins(plugins) {
// checks if the param is null or empty
if (isNullOrEmpty(plugins)) {
Exception(getValue('exception').no_plugins);
}
let allPlugins = plugins;
if (!isArray(plugins)) {
allPlugins = [plugins];
}

allPlugins.forEach((plugin) => {
this.addPlugin(plugin);
});

return this;
}

/**
* This function removes the specified plugins from the map
*
Expand Down Expand Up @@ -2753,6 +2791,19 @@ class Map extends Base {
getImageMap() {
return this.getImpl().getImageMap();
}

/**
* This function set scale to map
*
* @function
* @public
* @param { Number }
* @api
*/
setToClosestScale(scale) {
const resolution = getResolutionFromScale(scale, this.getProjection().units);
this.getImpl().setToClosestScale(resolution);
}
}

/**
Expand Down
33 changes: 30 additions & 3 deletions mapea-js/src/facade/js/control/Layerswitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,21 @@ class LayerSwitcher extends ControlBase {
* @extends {M.Control}
* @api
*/
constructor() {
constructor(emptyLayer) {
// implementation of this control
const impl = new LayerSwitcherImpl();
const impl = new LayerSwitcherImpl(emptyLayer);
// calls the super constructor
super(impl, LayerSwitcher.NAME);

if (isUndefined(LayerSwitcherImpl)) {
Exception(getValue('exception').layerswitcher_method);
}

if (!isUndefined(emptyLayer) && emptyLayer !== '') {
this.activeEmptyLayer = true;
} else {
this.activeEmptyLayer = false;
}
}

/**
Expand Down Expand Up @@ -68,6 +74,9 @@ class LayerSwitcher extends ControlBase {
createView(map) {
return new Promise((resolve) => {
LayerSwitcher.getTemplateVariables(this.map_).then((templateVars) => {
if (this.activeEmptyLayer) {
templateVars.baseLayers.unshift(LayerSwitcher.EMPTYLAYER);
}
const html = compileTemplate(layerswitcherTemplate, {
vars: templateVars,
});
Expand Down Expand Up @@ -185,7 +194,7 @@ class LayerSwitcher extends ControlBase {
const layerVarTemplate = {
base: (layer.transparent === false),
visible: (layer.isVisible() === true),
id: layer.name,
id: layer.id,
title: layerTitle,
outOfRange: !layer.inRange(),
opacity: layer.getOpacity(),
Expand Down Expand Up @@ -297,4 +306,22 @@ class LayerSwitcher extends ControlBase {
*/
LayerSwitcher.NAME = 'layerswitcher';

/**
* Empty layer
* @const
* @type {Object}
* @public
* @api
*/
LayerSwitcher.EMPTYLAYER = {
base: true,
id: 'emptyLayer',
isIcon: false,
legend: '',
opacity: 1,
outOfRange: false,
title: getValue('layerswitcher').no_base_layer,
visible: false,
};

export default LayerSwitcher;
Loading

0 comments on commit 18a88eb

Please sign in to comment.