Skip to content

Commit

Permalink
Merge pull request #692 from geoadmin/develop
Browse files Browse the repository at this point in the history
New Release v1.9.0 - #minor
  • Loading branch information
ltshb authored Mar 7, 2024
2 parents cf6f1bf + 1008b1a commit 66bd988
Show file tree
Hide file tree
Showing 114 changed files with 3,348 additions and 3,014 deletions.
553 changes: 286 additions & 267 deletions package-lock.json

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/vue-fontawesome": "^3.0.6",
"@geoblocks/cesium-compass": "^0.5.0",
"@geoblocks/ol-maplibre-layer": "^0.1.2",
"@geoblocks/ol-maplibre-layer": "^0.1.3",
"@ivanv/vue-collapse-transition": "^1.0.2",
"@mapbox/togeojson": "^0.16.2",
"@popperjs/core": "^2.11.8",
Expand All @@ -53,29 +53,29 @@
"@turf/point-to-line-distance": "^6.5.0",
"animate.css": "^4.1.1",
"axios": "^1.6.7",
"bootstrap": "^5.3.2",
"cesium": "^1.113.0",
"chart.js": "^4.4.1",
"bootstrap": "^5.3.3",
"cesium": "^1.115.0",
"chart.js": "^4.4.2",
"chartjs-plugin-zoom": "^2.0.1",
"dompurify": "^3.0.8",
"dompurify": "^3.0.9",
"file-saver": "^2.0.5",
"form-data": "^4.0.0",
"geographiclib-geodesic": "^2.0.0",
"hammerjs": "^2.0.8",
"jquery": "^3.7.1",
"liang-barsky": "^1.0.5",
"maplibre-gl": "^3.6.2",
"ol": "^8.2.0",
"maplibre-gl": "^4.1.0",
"ol": "^9.0.0",
"pako": "^2.1.0",
"print-js": "^1.6.0",
"proj4": "^2.10.0",
"reproject": "^1.2.7",
"sortablejs": "^1.15.2",
"tippy.js": "^6.3.7",
"vue": "^3.4.15",
"vue": "^3.4.21",
"vue-chartjs": "^5.3.0",
"vue-i18n": "^9.9.0",
"vue-router": "^4.2.5",
"vue-i18n": "^9.10.1",
"vue-router": "^4.3.0",
"vue-social-sharing": "next",
"vuex": "^4.1.0"
},
Expand All @@ -86,42 +86,42 @@
"@nuintun/qrcode": "^3.4.0",
"@rushstack/eslint-patch": "^1.7.2",
"@types/jsdom": "^21.1.6",
"@types/node": "^18.19.8",
"@vitejs/plugin-vue": "^5.0.3",
"@types/node": "^18.19.21",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/tsconfig": "^0.5.1",
"axios-retry": "^4.0.0",
"chai": "^5.0.3",
"cypress": "^13.6.3",
"chai": "^5.1.0",
"cypress": "^13.6.6",
"cypress-browser-permissions": "^1.1.0",
"cypress-real-events": "^1.11.0",
"cypress-real-events": "^1.12.0",
"cypress-recurse": "^1.35.2",
"cypress-vite": "^1.5.0",
"cypress-wait-until": "^3.0.1",
"dotenv": "^16.4.1",
"eslint": "^8.56.0",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-markdownlint": "^0.5.0",
"eslint-plugin-mocha": "^10.2.0",
"eslint-plugin-mocha": "^10.3.0",
"eslint-plugin-prettier-vue": "^5.0.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-vue": "^9.21.0",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-vue": "^9.22.0",
"git-describe": "^4.1.1",
"googleapis": "^131.0.0",
"googleapis": "^133.0.0",
"jsdom": "^24.0.0",
"mime-types": "^2.1.35",
"mocha-junit-reporter": "^2.2.1",
"prettier": "^3.2.4",
"prettier": "^3.2.5",
"prettier-plugin-jsdoc": "^1.3.0",
"rimraf": "^5.0.5",
"sass": "^1.70.0",
"sass": "^1.71.1",
"start-server-and-test": "^2.0.3",
"typescript": "^5.3.3",
"vite": "^5.0.12",
"vite-node": "^1.2.2",
"vite": "^5.1.4",
"vite-node": "^1.3.1",
"vite-plugin-static-copy": "^1.0.1",
"vitest": "^1.2.2",
"vitest": "^1.3.1",
"vue-tsc": "^1.8.27",
"write-yaml-file": "^5.0.0",
"yargs": "^17.7.2"
Expand Down
2 changes: 1 addition & 1 deletion src/api/features/LayerFeature.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ export default class LayerFeature extends SelectableFeature {

// overwriting get ID so that we use the layer ID with the feature ID
get id() {
return `${this.layer.getID()}-${this._id}`
return `${this.layer.id}-${this._id}`
}
}
8 changes: 4 additions & 4 deletions src/api/features/features.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const identify = (
projection
) => {
return new Promise((resolve, reject) => {
if (!layer || !layer.getID()) {
if (!layer || !layer.id) {
log.error('Invalid layer', layer)
reject('Needs a valid layer with an ID')
}
Expand All @@ -93,7 +93,7 @@ export const identify = (
`${API_BASE_URL}rest/services/${layer.getTopicForIdentifyAndTooltipRequests()}/MapServer/identify`,
{
params: {
layers: `all:${layer.getID()}`,
layers: `all:${layer.id}`,
sr: projection.epsgNumber,
geometry: coordinate.join(','),
geometryFormat: 'geojson',
Expand Down Expand Up @@ -144,15 +144,15 @@ export const identify = (
*/
const getFeature = (layer, featureID, outputProjection, lang = 'en') => {
return new Promise((resolve, reject) => {
if (!layer || !layer.getID()) {
if (!layer || !layer.id) {
reject('Needs a valid layer with an ID')
}
if (!featureID) {
reject('Needs a valid feature ID')
}
// combining the two requests in one promise
const topic = layer.getTopicForIdentifyAndTooltipRequests()
const featureUrl = `${API_BASE_URL}rest/services/${topic}/MapServer/${layer.getID()}/${featureID}`
const featureUrl = `${API_BASE_URL}rest/services/${topic}/MapServer/${layer.id}/${featureID}`
axios
.all([
axios.get(featureUrl, {
Expand Down
12 changes: 5 additions & 7 deletions src/api/files.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export function loadKmlMetadata(kmlLayer) {
if (!kmlLayer.fileId || kmlLayer.isExternal) {
reject(
new Error(
`This KML is not one managed by our infrastructure, metadata loading is not possible ${kmlLayer.getID()}`
`This KML is not one managed by our infrastructure, metadata loading is not possible ${kmlLayer.id}`
)
)
}
Expand All @@ -283,13 +283,13 @@ export function loadKmlMetadata(kmlLayer) {
}
resolve(metadata)
} else {
const msg = `Incorrect response while getting metadata for KML layer ${kmlLayer.getID()}`
const msg = `Incorrect response while getting metadata for KML layer ${kmlLayer.id}`
log.error(msg, response)
reject(new Error(msg))
}
})
.catch((error) => {
log.error(`Error while getting metadata for KML layer ${kmlLayer.getID()}`, error)
log.error(`Error while getting metadata for KML layer ${kmlLayer.id}`, error)
reject(new Error(error))
})
})
Expand All @@ -308,9 +308,7 @@ export function loadKmlData(kmlLayer) {
}
if (!kmlLayer.kmlFileUrl) {
reject(
new Error(
`No file URL defined in this KML layer, cannot load data ${kmlLayer.getID()}`
)
new Error(`No file URL defined in this KML layer, cannot load data ${kmlLayer.id}`)
)
}
axios
Expand All @@ -319,7 +317,7 @@ export function loadKmlData(kmlLayer) {
if (response.status === 200 && response.data) {
resolve(response.data)
} else {
const msg = `Incorrect response while getting KML file data for layer ${kmlLayer.getID()}`
const msg = `Incorrect response while getting KML file data for layer ${kmlLayer.id}`
log.error(msg, response)
reject(new Error(msg))
}
Expand Down
84 changes: 48 additions & 36 deletions src/api/layers/AbstractLayer.class.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LayerTypes from './LayerTypes.enum'
import { InvalidLayerDataError } from '@/api/layers/InvalidLayerData.error'

/**
* Name (or description) of a data holder for a layer, with the possibility to define a URL
Expand Down Expand Up @@ -42,41 +42,62 @@ export class LayerAttribution {
*/
export default class AbstractLayer {
/**
* @param {String} name Name of this layer in the current lang
* @param {LayerTypes} type See {@link LayerTypes}
* @param {Number} opacity Value from 0.0 to 1.0 telling with which opacity this layer should be
* shown on the map
* @param {boolean} visible If the layer should be visible on the map or hidden
* @param {LayerAttribution[]} attributions Description of the data owner(s) for this layer
* @param {Boolean} hasTooltip Define if this layer shows tooltip when clicked on
* @param {Boolean} isExternal Define if this layer comes from our backend, or is from another
* (external) source
* @param {boolean} isLoading Set to true if some parts of the layer (e.g. metadata) are still
* loading
* @param {String} layerData.name Name of this layer in the current lang
* @param {String} layerData.id The unique ID of this layer that will be used in the URL to
* identify it (and also in subsequent backend services for GeoAdmin layers)
* @param {LayerTypes} layerData.type See {@link LayerTypes}
* @param {Number} [layerData.opacity=1.0] Value from 0.0 to 1.0 telling with which opacity this
* layer should be shown on the map. Default is `1.0`
* @param {boolean} [layerData.visible=false] If the layer should be visible on the map or
* hidden. Default is `false`
* @param {LayerAttribution[]} [layerData.attributions=[]] Description of the data owner(s) for
* this layer. Default is `[]`
* @param {Boolean} [layerData.hasTooltip=false] Define if this layer shows tooltip when clicked
* on. Default is `false`
* @param {Boolean} [layerData.hasLegend=false] Define if this layer has a legend that can be
* shown to users to explain its content. Default is `false`
* @param {Boolean} [layerData.isExternal=false] Define if this layer comes from our backend, or
* is from another (external) source. Default is `false`
* @param {boolean} [layerData.isLoading=false] Set to true if some parts of the layer (e.g.
* metadata) are still loading. Default is `false`
* @throws InvalidLayerDataError if no `layerData` is given, or if `layerData.name` or
* `layerData.type` aren't valid
*/
constructor(
name = '',
type = null,
opacity = 1.0,
visible = false,
attributions = [],
hasTooltip = false,
isExternal = false,
isLoading = false
) {
constructor(layerData) {
if (!layerData) {
throw new InvalidLayerDataError('Missing layer data', layerData)
}
const {
name = null,
id = null,
type = null,
opacity = 1.0,
visible = false,
attributions = [],
hasTooltip = false,
hasLegend = false,
isExternal = false,
isLoading = false,
} = layerData
if (name === null) {
throw new InvalidLayerDataError('Missing layer name', layerData)
}
if (id === null) {
throw new InvalidLayerDataError('Missing layer ID', layerData)
}
if (type === null) {
throw new InvalidLayerDataError('Missing layer type', layerData)
}
this.name = name
this.id = id
this.type = type
this.opacity = opacity
this.visible = visible
this.attributions = [...attributions]
this.hasTooltip = hasTooltip
this.isExternal = isExternal
this.isLoading = isLoading
if ([LayerTypes.KML, LayerTypes.GPX].includes(this.type)) {
this.hasLegend = false
} else {
this.hasLegend = true
}
this.hasLegend = hasLegend
this.errorKey = null
this.hasError = false
}
Expand All @@ -94,15 +115,6 @@ export default class AbstractLayer {
throw new Error('You have to implement the method getURL!')
}

/**
* @abstract
* @returns {String} The unique ID of this layer that will be used in the URL to identify it
* (and also in subsequent backend services for GeoAdmin layers)
*/
getID() {
throw new Error('You have to implement the method getID!')
}

clone() {
let clone = Object.assign(Object.create(Object.getPrototypeOf(this)), this)
clone.attributions = this.attributions.map((attribution) => attribution.clone())
Expand Down
Loading

0 comments on commit 66bd988

Please sign in to comment.