From c080aa8bf56114194b0cb739a48e8250b595c3f8 Mon Sep 17 00:00:00 2001 From: lboulanger Date: Fri, 27 May 2016 16:28:17 +0200 Subject: [PATCH] geographical coordinates management (CRS:84 => lon, lat ; EPSG:4326 => lat, lon) + fix Autoconf response getters --- dist/GpServices-debug.js | 221 +++++++++++------- dist/GpServices-src.js | 71 +++++- dist/GpServices.js | 10 +- samples/Services/Geocode/amd-xhr.html | 6 +- samples/Services/ReverseGeocode/amd-xhr.html | 21 +- .../Response/model/AutoConfResponse.js | 40 ++-- src/Services/AutoConf/Response/model/Layer.js | 76 +++--- .../Formats/DirectGeocodeResponseReader.js | 26 +-- .../Formats/ReverseGeocodeResponseReader.js | 30 +-- src/Services/Geocode/Geocode.js | 4 + .../Response/ReverseGeocodeResponseFactory.js | 24 +- src/Services/Geocode/ReverseGeocode.js | 20 +- src/Services/Services.js | 15 +- 13 files changed, 365 insertions(+), 199 deletions(-) diff --git a/dist/GpServices-debug.js b/dist/GpServices-debug.js index e8c91f46..05f5b8c6 100644 --- a/dist/GpServices-debug.js +++ b/dist/GpServices-debug.js @@ -10,7 +10,7 @@ * copyright IGN * @author IGN * @version 1.0.0-beta2 - * @date 2016-04-22 + * @date 2016-05-27 * */ /*! @@ -32,7 +32,7 @@ }(this, function() { /* BEGIN CODE */ -var log4js, loggerCfg, UtilsLoggerByDefault, UtilsMessagesResources, ExceptionsErrorService, UtilsHelper, promise, ProtocolsXHR, ProtocolsJSONP, ProtocolsProtocol, ServicesDefaultUrlService, ServicesCommonService, ServicesAltiRequestModelAltiRequest, ServicesAltiRequestModelAltiElevationRequest, ServicesAltiRequestModelAltiProfilRequest, ServicesAltiRequestAltiRequestREST, FormatsWPS, ServicesAltiRequestAltiRequestWPS, ServicesAltiRequestAltiRequestFactory, FormatsXML, ServicesAltiResponseModelAltiResponse, ServicesAltiResponseModelElevation, ServicesAltiFormatsAltiResponseReader, ServicesAltiResponseAltiResponseFactory, ServicesAltiAlti, ServicesAutoConfResponseModelAutoConfResponse, ServicesAutoConfResponseModelConstraint, ServicesAutoConfResponseModelFormat, ServicesAutoConfResponseModelLayer, ServicesAutoConfResponseModelLegend, ServicesAutoConfResponseModelMetadata, ServicesAutoConfResponseModelOriginator, ServicesAutoConfResponseModelService, ServicesAutoConfResponseModelStyle, ServicesAutoConfResponseModelTerritory, ServicesAutoConfResponseModelThematic, ServicesAutoConfResponseModelTileMatrixSet, ServicesAutoConfResponseModelTileMatrix, ServicesAutoConfResponseModelTileMatrixLimit, ServicesAutoConfFormatsAutoConfResponseReader, ServicesAutoConfResponseAutoConfResponseFactory, ServicesAutoConfAutoConf, FormatsXLSRequestHeader, FormatsXLSRequest, FormatsXLSAbstractService, FormatsXLS, FormatsXLSLocationUtilityServiceModelAddress, FormatsXLSLocationUtilityServiceGeocodeFilterExtension, FormatsXLSLocationUtilityServiceGeocodeRequest, FormatsXLSLocationUtilityServiceModelPosition, FormatsXLSLocationUtilityServiceModelPreference, FormatsXLSLocationUtilityServiceReverseGeocodeRequest, FormatsXLSLocationUtilityService, ServicesGeocodeRequestGeocodeLocation, ServicesGeocodeRequestModelStreetAddress, ServicesGeocodeRequestModelPositionOfInterest, ServicesGeocodeRequestModelCadastralParcel, ServicesGeocodeRequestModelAdministratif, ServicesGeocodeRequestDirectGeocodeRequestFactory, ServicesGeocodeResponseModelGeocodeResponse, ServicesGeocodeResponseModelGeocodedLocation, ServicesGeocodeResponseModelDirectGeocodedLocation, ServicesGeocodeFormatsDirectGeocodeResponseReader, ServicesGeocodeResponseDirectGeocodeResponseFactory, ServicesGeocodeGeocode, ServicesGeocodeRequestReverseGeocodeRequestFactory, ServicesGeocodeResponseModelReverseGeocodedLocation, ServicesGeocodeFormatsReverseGeocodeResponseReader, ServicesGeocodeResponseReverseGeocodeResponseFactory, ServicesGeocodeReverseGeocode, ServicesAutoCompleteResponseModelAutoCompleteResponse, ServicesAutoCompleteResponseModelSuggestedLocation, ServicesAutoCompleteResponseAutoCompleteResponseFactory, ServicesAutoCompleteAutoComplete, FormatsXLSRouteServiceModelRoutePlan, FormatsXLSRouteServiceDetermineRouteRequest, FormatsXLSRouteServiceRouteRequestExtension, FormatsXLSRouteService, ServicesRouteRequestRouteRequestOLS, ServicesRouteRequestModelRouteParamREST, ServicesRouteRequestRouteRequestREST, ServicesRouteRequestRouteRequestFactory, FormatsWKT, ServicesRouteResponseModelRouteResponse, ServicesRouteResponseModelRouteInstruction, ServicesRouteFormatsRouteResponseRESTReader, ServicesRouteFormatsRouteResponseOLSReader, ServicesRouteResponseRouteResponseFactory, ServicesRouteRoute, ServicesProcessIsoCurveRequestModelProcessIsoCurveParam, ServicesProcessIsoCurveRequestProcessIsoCurveRequest, ServicesProcessIsoCurveResponseModelProcessIsoCurveResponse, ServicesProcessIsoCurveFormatsProcessIsoCurveResponseReader, ServicesProcessIsoCurveResponseProcessIsoCurveResponseFactory, ServicesProcessIsoCurveProcessIsoCurve, ServicesServices, Gp; +var log4js, loggerCfg, UtilsLoggerByDefault, UtilsHelper, promise, ProtocolsXHR, UtilsMessagesResources, ExceptionsErrorService, ProtocolsJSONP, ProtocolsProtocol, ServicesDefaultUrlService, ServicesCommonService, ServicesAltiRequestModelAltiRequest, ServicesAltiRequestModelAltiElevationRequest, ServicesAltiRequestModelAltiProfilRequest, ServicesAltiRequestAltiRequestREST, FormatsWPS, ServicesAltiRequestAltiRequestWPS, ServicesAltiRequestAltiRequestFactory, FormatsXML, ServicesAltiResponseModelAltiResponse, ServicesAltiResponseModelElevation, ServicesAltiFormatsAltiResponseReader, ServicesAltiResponseAltiResponseFactory, ServicesAltiAlti, ServicesAutoConfResponseModelAutoConfResponse, ServicesAutoConfResponseModelConstraint, ServicesAutoConfResponseModelFormat, ServicesAutoConfResponseModelLayer, ServicesAutoConfResponseModelLegend, ServicesAutoConfResponseModelMetadata, ServicesAutoConfResponseModelOriginator, ServicesAutoConfResponseModelService, ServicesAutoConfResponseModelStyle, ServicesAutoConfResponseModelTerritory, ServicesAutoConfResponseModelThematic, ServicesAutoConfResponseModelTileMatrixSet, ServicesAutoConfResponseModelTileMatrix, ServicesAutoConfResponseModelTileMatrixLimit, ServicesAutoConfFormatsAutoConfResponseReader, ServicesAutoConfResponseAutoConfResponseFactory, ServicesAutoConfAutoConf, FormatsXLSRequestHeader, FormatsXLSRequest, FormatsXLSAbstractService, FormatsXLS, FormatsXLSLocationUtilityServiceModelAddress, FormatsXLSLocationUtilityServiceGeocodeFilterExtension, FormatsXLSLocationUtilityServiceGeocodeRequest, FormatsXLSLocationUtilityServiceModelPosition, FormatsXLSLocationUtilityServiceModelPreference, FormatsXLSLocationUtilityServiceReverseGeocodeRequest, FormatsXLSLocationUtilityService, ServicesGeocodeRequestGeocodeLocation, ServicesGeocodeRequestModelStreetAddress, ServicesGeocodeRequestModelPositionOfInterest, ServicesGeocodeRequestModelCadastralParcel, ServicesGeocodeRequestModelAdministratif, ServicesGeocodeRequestDirectGeocodeRequestFactory, ServicesGeocodeResponseModelGeocodeResponse, ServicesGeocodeResponseModelGeocodedLocation, ServicesGeocodeResponseModelDirectGeocodedLocation, ServicesGeocodeFormatsDirectGeocodeResponseReader, ServicesGeocodeResponseDirectGeocodeResponseFactory, ServicesGeocodeGeocode, ServicesGeocodeRequestReverseGeocodeRequestFactory, ServicesGeocodeResponseModelReverseGeocodedLocation, ServicesGeocodeFormatsReverseGeocodeResponseReader, ServicesGeocodeResponseReverseGeocodeResponseFactory, ServicesGeocodeReverseGeocode, ServicesAutoCompleteResponseModelAutoCompleteResponse, ServicesAutoCompleteResponseModelSuggestedLocation, ServicesAutoCompleteResponseAutoCompleteResponseFactory, ServicesAutoCompleteAutoComplete, FormatsXLSRouteServiceModelRoutePlan, FormatsXLSRouteServiceDetermineRouteRequest, FormatsXLSRouteServiceRouteRequestExtension, FormatsXLSRouteService, ServicesRouteRequestRouteRequestOLS, ServicesRouteRequestModelRouteParamREST, ServicesRouteRequestRouteRequestREST, ServicesRouteRequestRouteRequestFactory, FormatsWKT, ServicesRouteResponseModelRouteResponse, ServicesRouteResponseModelRouteInstruction, ServicesRouteFormatsRouteResponseRESTReader, ServicesRouteFormatsRouteResponseOLSReader, ServicesRouteResponseRouteResponseFactory, ServicesRouteRoute, ServicesProcessIsoCurveRequestModelProcessIsoCurveParam, ServicesProcessIsoCurveRequestProcessIsoCurveRequest, ServicesProcessIsoCurveResponseModelProcessIsoCurveResponse, ServicesProcessIsoCurveFormatsProcessIsoCurveResponseReader, ServicesProcessIsoCurveResponseProcessIsoCurveResponseFactory, ServicesProcessIsoCurveProcessIsoCurve, ServicesServices, Gp; (function (rootRequire) { log4js = function () { var requirejs, require, define; @@ -2660,77 +2660,6 @@ UtilsLoggerByDefault = function (Log4js, Config) { }; return LoggerByDefault; }(log4js, loggerCfg); -UtilsMessagesResources = function () { - var MessagesResources = { - PARAM_MISSING: 'Parameter(s) \'%var%\' missing', - PARAM_EMPTY: 'Parameter(s) \'%var%\' empty', - PARAM_TYPE: 'Wrong type(s) for parameter(s) \'%var%\'', - PARAM_FORMAT: 'Parameter(s) \'%var%\' not correctly formatted', - PARAM_NOT_SUPPORT: 'Value(s) for parameter(s) \'%var%\' not supported', - PARAM_UNKNOWN: 'Value(s) for parameter(s) \'%var%\' unknown', - SERVICE_REQUEST_BUILD: 'An error occurred during the request building of the service', - SERVICE_REQUEST_EMPTY: 'The request sent to the service is empty', - SERVICE_RESPONSE_EXCEPTION: 'The service returned an exception : \'%var%\'', - SERVICE_RESPONSE_EXCEPTION_2: 'The service returned an exception', - SERVICE_RESPONSE_ANALYSE: 'An error occurred while parsing the response \'%var%\' of the service', - SERVICE_RESPONSE_ANALYSE_2: 'An unknown error occurred while parsing the response', - SERVICE_RESPONSE_EMPTY: 'The response of the service is empty', - SERVICE_RESPONSE_EMPTY_2: 'The response from the service could not be analyzed or is empty', - SERVICE_RESPONSE_FORMAT: 'The format of the service response is not supported (handled format(s) : \'%var%\')', - SERVICE_RESPONSE_FORMAT_2: 'The format of the service response is not supported', - SERVICE_RESPONSE_FORMAT_3: 'No suggestion matching the search', - CLASS_CONSTRUCTOR: '\'%var%\' constructor cannot be called as a function.', - getMessage: function (clef, parametres) { - if (!arguments) { - return 'Message indefined !'; - } - var params = Array.prototype.slice.call(arguments); - var key = params.shift(); - var args = params; - var message = this[key]; - try { - if (Array.isArray(args) && args.length > 0) { - message = message.replace('%var%', args.join(' - ')); - } else { - message = message.replace('%var%', '%var% (not specified)'); - } - } catch (e) { - } - return message; - } - }; - return MessagesResources; -}(); -ExceptionsErrorService = function () { - function ErrorService(error) { - if (!(this instanceof ErrorService)) { - throw new TypeError('ErrorService constructor cannot be called as a function.'); - } - var e = error; - if (typeof error === 'string' || error instanceof String) { - this.message = error; - this.status = -1; - this.type = ErrorService.TYPE_UNKERR; - } else { - this.message = e.message || 'undefined!?'; - this.type = e.type; - this.status = e.status || -1; - } - this.name = 'ErrorService'; - this.stack = new Error().stack; - } - ErrorService.TYPE_SRVERR = 'SERVICE_ERROR'; - ErrorService.TYPE_USEERR = 'USAGE_ERROR'; - ErrorService.TYPE_UNKERR = 'UNKNOWN_ERROR'; - ErrorService.prototype = Object.create(Error.prototype, { - constructor: { - value: ErrorService, - writable: true, - configurable: true - } - }); - return ErrorService; -}(); UtilsHelper = function () { var Helper = { normalyzeParameters: function (params) { @@ -3476,6 +3405,77 @@ ProtocolsXHR = function (Logger, Helper, ES6Promise) { }; return XHR; }(UtilsLoggerByDefault, UtilsHelper, promise); +UtilsMessagesResources = function () { + var MessagesResources = { + PARAM_MISSING: 'Parameter(s) \'%var%\' missing', + PARAM_EMPTY: 'Parameter(s) \'%var%\' empty', + PARAM_TYPE: 'Wrong type(s) for parameter(s) \'%var%\'', + PARAM_FORMAT: 'Parameter(s) \'%var%\' not correctly formatted', + PARAM_NOT_SUPPORT: 'Value(s) for parameter(s) \'%var%\' not supported', + PARAM_UNKNOWN: 'Value(s) for parameter(s) \'%var%\' unknown', + SERVICE_REQUEST_BUILD: 'An error occurred during the request building of the service', + SERVICE_REQUEST_EMPTY: 'The request sent to the service is empty', + SERVICE_RESPONSE_EXCEPTION: 'The service returned an exception : \'%var%\'', + SERVICE_RESPONSE_EXCEPTION_2: 'The service returned an exception', + SERVICE_RESPONSE_ANALYSE: 'An error occurred while parsing the response \'%var%\' of the service', + SERVICE_RESPONSE_ANALYSE_2: 'An unknown error occurred while parsing the response', + SERVICE_RESPONSE_EMPTY: 'The response of the service is empty', + SERVICE_RESPONSE_EMPTY_2: 'The response from the service could not be analyzed or is empty', + SERVICE_RESPONSE_FORMAT: 'The format of the service response is not supported (handled format(s) : \'%var%\')', + SERVICE_RESPONSE_FORMAT_2: 'The format of the service response is not supported', + SERVICE_RESPONSE_FORMAT_3: 'No suggestion matching the search', + CLASS_CONSTRUCTOR: '\'%var%\' constructor cannot be called as a function.', + getMessage: function (clef, parametres) { + if (!arguments) { + return 'Message indefined !'; + } + var params = Array.prototype.slice.call(arguments); + var key = params.shift(); + var args = params; + var message = this[key]; + try { + if (Array.isArray(args) && args.length > 0) { + message = message.replace('%var%', args.join(' - ')); + } else { + message = message.replace('%var%', '%var% (not specified)'); + } + } catch (e) { + } + return message; + } + }; + return MessagesResources; +}(); +ExceptionsErrorService = function () { + function ErrorService(error) { + if (!(this instanceof ErrorService)) { + throw new TypeError('ErrorService constructor cannot be called as a function.'); + } + var e = error; + if (typeof error === 'string' || error instanceof String) { + this.message = error; + this.status = -1; + this.type = ErrorService.TYPE_UNKERR; + } else { + this.message = e.message || 'undefined!?'; + this.type = e.type; + this.status = e.status || -1; + } + this.name = 'ErrorService'; + this.stack = new Error().stack; + } + ErrorService.TYPE_SRVERR = 'SERVICE_ERROR'; + ErrorService.TYPE_USEERR = 'USAGE_ERROR'; + ErrorService.TYPE_UNKERR = 'UNKNOWN_ERROR'; + ErrorService.prototype = Object.create(Error.prototype, { + constructor: { + value: ErrorService, + writable: true, + configurable: true + } + }); + return ErrorService; +}(); ProtocolsJSONP = function (Logger) { var JSONP = { uuid: function () { @@ -5022,31 +5022,45 @@ ServicesAutoConfResponseModelAutoConfResponse = function () { getLayersConf: function (apiKey) { var layers = {}; var layersIdArray = this.getLayersId(apiKey); - for (var i = 0; i < layersIdArray.length; i++) { - var lyrId = layersIdArray[i]; - layers[lyrId] = this.layers[lyrId]; + if (layersIdArray) { + for (var i = 0; i < layersIdArray.length; i++) { + var lyrId = layersIdArray[i]; + layers[lyrId] = this.layers[lyrId]; + } } return layers; }, getLayerConf: function (layerId) { + if (!this.layers) { + return; + } return this.layers[layerId]; }, getTileMatrixSets: function () { return this.tileMatrixSets; }, getTMSConf: function (tmsID) { + if (!this.tileMatrixSets) { + return; + } return this.tileMatrixSets[tmsID]; }, getTerritories: function () { return this.territories; }, getTerritoryConf: function (territoryID) { + if (!this.territories) { + return; + } return this.territories[territoryID]; }, getServices: function () { return this.services; }, getServiceConf: function (serviceID) { + if (!this.services) { + return; + } return this.services[serviceID]; } }; @@ -5160,6 +5174,9 @@ ServicesAutoConfResponseModelLayer = function () { return this.styles; }, getDefaultStyle: function () { + if (!this.styles) { + return; + } var style; var s = this.styles; for (var i = 0; i < s.length; i++) { @@ -5174,6 +5191,9 @@ ServicesAutoConfResponseModelLayer = function () { return this.thematics; }, getDefaultFormat: function () { + if (!this.formats) { + return; + } var format; var f = this.formats; for (var i = 0; i < f.length; i++) { @@ -7663,6 +7683,23 @@ ServicesGeocodeGeocode = function (Logger, _, ErrorService, CommonService, Direc var filter = Object.keys(options.filterOptions); for (var i = 0; i < filter.length; i++) { var key = filter[i]; + var filtersCouldBeNumberList = [ + 'department', + 'number', + 'postalCode', + 'insee', + 'importance', + 'ID', + 'IDTR', + 'absorbedCity', + 'sheet', + 'section', + 'inseeRegion', + 'inseeDepartment' + ]; + if (filtersCouldBeNumberList.indexOf(key) !== -1 && typeof options.filterOptions[key] !== 'string') { + options.filterOptions[key] = options.filterOptions[key].toString(); + } if (!options.filterOptions[key] || Object.keys(options.filterOptions[key]).length === 0) { delete this.options.filterOptions[key]; } @@ -8054,6 +8091,24 @@ ServicesGeocodeResponseReverseGeocodeResponseFactory = function (Logger, MRes, E })); return; } + if (options.scope && options.scope.options && options.scope.options.srs && options.scope.options.srs !== 'EPSG:4326') { + var location; + var pos; + if (data || data.locations || data.locations.length) { + for (var i = 0; i < data.locations.length; i++) { + location = data.locations[i]; + if (location) { + pos = location.position; + if (pos) { + location.position = { + x: pos.y, + y: pos.x + }; + } + } + } + } + } } } else { options.onError.call(options.scope, new ErrorService({ @@ -8107,8 +8162,8 @@ ServicesGeocodeReverseGeocode = function (Logger, _, ErrorService, CommonService } this.options.maximumResponses = options.maximumResponses || 25; this.options.returnFreeForm = options.returnFreeForm || false; - this.options.srs = options.srs || 'EPSG:4326'; - if (ReverseGeocode.geoEPSG.indexOf(this.options.srs) !== -1) { + this.options.srs = options.srs || 'CRS:84'; + if (ReverseGeocode.geoEPSG.indexOf(this.options.srs) === -1) { this.options.position = { x: this.options.position.y, y: this.options.position.x @@ -8142,7 +8197,7 @@ ServicesGeocodeReverseGeocode = function (Logger, _, ErrorService, CommonService position: this.options.position, returnFreeForm: this.options.returnFreeForm, filterOptions: this.options.filterOptions, - srs: this.options.srs, + srs: 'EPSG:4326', maximumResponses: this.options.maximumResponses }; this.request = ReverseGeocodeRequestFactory.build(options); @@ -9991,11 +10046,11 @@ ServicesServices = function (Alti, AutoConf, Geocode, ReverseGeocode, AutoComple var bbox = {}; return Services; }(ServicesAltiAlti, ServicesAutoConfAutoConf, ServicesGeocodeGeocode, ServicesGeocodeReverseGeocode, ServicesAutoCompleteAutoComplete, ServicesRouteRoute, ServicesProcessIsoCurveProcessIsoCurve); -Gp = function (Services, AltiResponse, Elevation, AutoCompleteResponse, SuggestedLocation, GetConfigResponse, Constraint, Format, Layer, Legend, Metadata, Originator, Service, Style, Territory, Thematic, TM, TMLimit, TMS, GeocodeResponse, GeocodedLocation, DirectGeocodedLocation, ReverseGeocodedLocation, IsoCurveResponse, RouteResponse, RouteInstruction, Error) { +Gp = function (XHR, Services, AltiResponse, Elevation, AutoCompleteResponse, SuggestedLocation, GetConfigResponse, Constraint, Format, Layer, Legend, Metadata, Originator, Service, Style, Territory, Thematic, TM, TMLimit, TMS, GeocodeResponse, GeocodedLocation, DirectGeocodedLocation, ReverseGeocodedLocation, IsoCurveResponse, RouteResponse, RouteInstruction, Error) { var scope = typeof window !== 'undefined' ? window : {}; var Gp = scope.Gp || { servicesVersion: '1.0.0-beta2', - servicesDate: '2016-04-22', + servicesDate: '2016-05-27', extend: function (strNS, value) { var parts = strNS.split('.'); var parent = this; @@ -10014,6 +10069,8 @@ Gp = function (Services, AltiResponse, Elevation, AutoCompleteResponse, Suggeste return this; } }; + Gp.extend('Protocols', {}); + Gp.extend('Protocols.XHR', XHR); Gp.extend('Services', Services); Gp.extend('Services.AltiResponse', AltiResponse); Gp.extend('Services.Alti.Elevation', Elevation); @@ -10043,7 +10100,7 @@ Gp = function (Services, AltiResponse, Elevation, AutoCompleteResponse, Suggeste Gp.extend('Error', Error); scope.Gp = Gp; return scope.Gp; -}(ServicesServices, ServicesAltiResponseModelAltiResponse, ServicesAltiResponseModelElevation, ServicesAutoCompleteResponseModelAutoCompleteResponse, ServicesAutoCompleteResponseModelSuggestedLocation, ServicesAutoConfResponseModelAutoConfResponse, ServicesAutoConfResponseModelConstraint, ServicesAutoConfResponseModelFormat, ServicesAutoConfResponseModelLayer, ServicesAutoConfResponseModelLegend, ServicesAutoConfResponseModelMetadata, ServicesAutoConfResponseModelOriginator, ServicesAutoConfResponseModelService, ServicesAutoConfResponseModelStyle, ServicesAutoConfResponseModelTerritory, ServicesAutoConfResponseModelThematic, ServicesAutoConfResponseModelTileMatrix, ServicesAutoConfResponseModelTileMatrixLimit, ServicesAutoConfResponseModelTileMatrixSet, ServicesGeocodeResponseModelGeocodeResponse, ServicesGeocodeResponseModelGeocodedLocation, ServicesGeocodeResponseModelDirectGeocodedLocation, ServicesGeocodeResponseModelReverseGeocodedLocation, ServicesProcessIsoCurveResponseModelProcessIsoCurveResponse, ServicesRouteResponseModelRouteResponse, ServicesRouteResponseModelRouteInstruction, ExceptionsErrorService); +}(ProtocolsXHR, ServicesServices, ServicesAltiResponseModelAltiResponse, ServicesAltiResponseModelElevation, ServicesAutoCompleteResponseModelAutoCompleteResponse, ServicesAutoCompleteResponseModelSuggestedLocation, ServicesAutoConfResponseModelAutoConfResponse, ServicesAutoConfResponseModelConstraint, ServicesAutoConfResponseModelFormat, ServicesAutoConfResponseModelLayer, ServicesAutoConfResponseModelLegend, ServicesAutoConfResponseModelMetadata, ServicesAutoConfResponseModelOriginator, ServicesAutoConfResponseModelService, ServicesAutoConfResponseModelStyle, ServicesAutoConfResponseModelTerritory, ServicesAutoConfResponseModelThematic, ServicesAutoConfResponseModelTileMatrix, ServicesAutoConfResponseModelTileMatrixLimit, ServicesAutoConfResponseModelTileMatrixSet, ServicesGeocodeResponseModelGeocodeResponse, ServicesGeocodeResponseModelGeocodedLocation, ServicesGeocodeResponseModelDirectGeocodedLocation, ServicesGeocodeResponseModelReverseGeocodedLocation, ServicesProcessIsoCurveResponseModelProcessIsoCurveResponse, ServicesRouteResponseModelRouteResponse, ServicesRouteResponseModelRouteInstruction, ExceptionsErrorService); /* END CODE */ return Gp; diff --git a/dist/GpServices-src.js b/dist/GpServices-src.js index 726a7920..475c05e9 100644 --- a/dist/GpServices-src.js +++ b/dist/GpServices-src.js @@ -10,7 +10,7 @@ * copyright IGN * @author IGN * @version 1.0.0-beta2 - * @date 2016-05-18 + * @date 2016-05-27 * */ /*! @@ -2349,31 +2349,45 @@ ServicesAutoConfResponseModelAutoConfResponse = function () { getLayersConf: function (apiKey) { var layers = {}; var layersIdArray = this.getLayersId(apiKey); - for (var i = 0; i < layersIdArray.length; i++) { - var lyrId = layersIdArray[i]; - layers[lyrId] = this.layers[lyrId]; + if (layersIdArray) { + for (var i = 0; i < layersIdArray.length; i++) { + var lyrId = layersIdArray[i]; + layers[lyrId] = this.layers[lyrId]; + } } return layers; }, getLayerConf: function (layerId) { + if (!this.layers) { + return; + } return this.layers[layerId]; }, getTileMatrixSets: function () { return this.tileMatrixSets; }, getTMSConf: function (tmsID) { + if (!this.tileMatrixSets) { + return; + } return this.tileMatrixSets[tmsID]; }, getTerritories: function () { return this.territories; }, getTerritoryConf: function (territoryID) { + if (!this.territories) { + return; + } return this.territories[territoryID]; }, getServices: function () { return this.services; }, getServiceConf: function (serviceID) { + if (!this.services) { + return; + } return this.services[serviceID]; } }; @@ -2487,6 +2501,9 @@ ServicesAutoConfResponseModelLayer = function () { return this.styles; }, getDefaultStyle: function () { + if (!this.styles) { + return; + } var style; var s = this.styles; for (var i = 0; i < s.length; i++) { @@ -2501,6 +2518,9 @@ ServicesAutoConfResponseModelLayer = function () { return this.thematics; }, getDefaultFormat: function () { + if (!this.formats) { + return; + } var format; var f = this.formats; for (var i = 0; i < f.length; i++) { @@ -4936,6 +4956,23 @@ ServicesGeocodeGeocode = function (Logger, _, ErrorService, CommonService, Direc var filter = Object.keys(options.filterOptions); for (var i = 0; i < filter.length; i++) { var key = filter[i]; + var filtersCouldBeNumberList = [ + 'department', + 'number', + 'postalCode', + 'insee', + 'importance', + 'ID', + 'IDTR', + 'absorbedCity', + 'sheet', + 'section', + 'inseeRegion', + 'inseeDepartment' + ]; + if (filtersCouldBeNumberList.indexOf(key) !== -1 && typeof options.filterOptions[key] !== 'string') { + options.filterOptions[key] = options.filterOptions[key].toString(); + } if (!options.filterOptions[key] || Object.keys(options.filterOptions[key]).length === 0) { delete this.options.filterOptions[key]; } @@ -5324,6 +5361,24 @@ ServicesGeocodeResponseReverseGeocodeResponseFactory = function (Logger, MRes, E })); return; } + if (options.scope && options.scope.options && options.scope.options.srs && options.scope.options.srs !== 'EPSG:4326') { + var location; + var pos; + if (data || data.locations || data.locations.length) { + for (var i = 0; i < data.locations.length; i++) { + location = data.locations[i]; + if (location) { + pos = location.position; + if (pos) { + location.position = { + x: pos.y, + y: pos.x + }; + } + } + } + } + } } } else { options.onError.call(options.scope, new ErrorService({ @@ -5375,8 +5430,8 @@ ServicesGeocodeReverseGeocode = function (Logger, _, ErrorService, CommonService } this.options.maximumResponses = options.maximumResponses || 25; this.options.returnFreeForm = options.returnFreeForm || false; - this.options.srs = options.srs || 'EPSG:4326'; - if (ReverseGeocode.geoEPSG.indexOf(this.options.srs) !== -1) { + this.options.srs = options.srs || 'CRS:84'; + if (ReverseGeocode.geoEPSG.indexOf(this.options.srs) === -1) { this.options.position = { x: this.options.position.y, y: this.options.position.x @@ -5410,7 +5465,7 @@ ServicesGeocodeReverseGeocode = function (Logger, _, ErrorService, CommonService position: this.options.position, returnFreeForm: this.options.returnFreeForm, filterOptions: this.options.filterOptions, - srs: this.options.srs, + srs: 'EPSG:4326', maximumResponses: this.options.maximumResponses }; this.request = ReverseGeocodeRequestFactory.build(options); @@ -7207,7 +7262,7 @@ Gp = function (XHR, Services, AltiResponse, Elevation, AutoCompleteResponse, Sug var scope = typeof window !== 'undefined' ? window : {}; var Gp = scope.Gp || { servicesVersion: '1.0.0-beta2', - servicesDate: '2016-05-18', + servicesDate: '2016-05-27', extend: function (strNS, value) { var parts = strNS.split('.'); var parent = this; diff --git a/dist/GpServices.js b/dist/GpServices.js index bc98d0d5..11a84974 100644 --- a/dist/GpServices.js +++ b/dist/GpServices.js @@ -10,7 +10,7 @@ * copyright IGN * @author IGN * @version 1.0.0-beta2 - * @date 2016-05-18 + * @date 2016-05-27 * */ /*! @@ -31,9 +31,9 @@ } }(this, function() { var log4js,loggerCfg,UtilsLoggerByDefault,UtilsHelper,promise,ProtocolsXHR,UtilsMessagesResources,ExceptionsErrorService,ProtocolsJSONP,ProtocolsProtocol,ServicesDefaultUrlService,ServicesCommonService,ServicesAltiRequestModelAltiRequest,ServicesAltiRequestModelAltiElevationRequest,ServicesAltiRequestModelAltiProfilRequest,ServicesAltiRequestAltiRequestREST,FormatsWPS,ServicesAltiRequestAltiRequestWPS,ServicesAltiRequestAltiRequestFactory,FormatsXML,ServicesAltiResponseModelAltiResponse,ServicesAltiResponseModelElevation,ServicesAltiFormatsAltiResponseReader,ServicesAltiResponseAltiResponseFactory,ServicesAltiAlti,ServicesAutoConfResponseModelAutoConfResponse,ServicesAutoConfResponseModelConstraint,ServicesAutoConfResponseModelFormat,ServicesAutoConfResponseModelLayer,ServicesAutoConfResponseModelLegend,ServicesAutoConfResponseModelMetadata,ServicesAutoConfResponseModelOriginator,ServicesAutoConfResponseModelService,ServicesAutoConfResponseModelStyle,ServicesAutoConfResponseModelTerritory,ServicesAutoConfResponseModelThematic,ServicesAutoConfResponseModelTileMatrixSet,ServicesAutoConfResponseModelTileMatrix,ServicesAutoConfResponseModelTileMatrixLimit,ServicesAutoConfFormatsAutoConfResponseReader,ServicesAutoConfResponseAutoConfResponseFactory,ServicesAutoConfAutoConf,FormatsXLSRequestHeader,FormatsXLSRequest,FormatsXLSAbstractService,FormatsXLS,FormatsXLSLocationUtilityServiceModelAddress,FormatsXLSLocationUtilityServiceGeocodeFilterExtension,FormatsXLSLocationUtilityServiceGeocodeRequest,FormatsXLSLocationUtilityServiceModelPosition,FormatsXLSLocationUtilityServiceModelPreference,FormatsXLSLocationUtilityServiceReverseGeocodeRequest,FormatsXLSLocationUtilityService,ServicesGeocodeRequestGeocodeLocation,ServicesGeocodeRequestModelStreetAddress,ServicesGeocodeRequestModelPositionOfInterest,ServicesGeocodeRequestModelCadastralParcel,ServicesGeocodeRequestModelAdministratif,ServicesGeocodeRequestDirectGeocodeRequestFactory,ServicesGeocodeResponseModelGeocodeResponse,ServicesGeocodeResponseModelGeocodedLocation,ServicesGeocodeResponseModelDirectGeocodedLocation,ServicesGeocodeFormatsDirectGeocodeResponseReader,ServicesGeocodeResponseDirectGeocodeResponseFactory,ServicesGeocodeGeocode,ServicesGeocodeRequestReverseGeocodeRequestFactory,ServicesGeocodeResponseModelReverseGeocodedLocation,ServicesGeocodeFormatsReverseGeocodeResponseReader,ServicesGeocodeResponseReverseGeocodeResponseFactory,ServicesGeocodeReverseGeocode,ServicesAutoCompleteResponseModelAutoCompleteResponse,ServicesAutoCompleteResponseModelSuggestedLocation,ServicesAutoCompleteResponseAutoCompleteResponseFactory,ServicesAutoCompleteAutoComplete,FormatsXLSRouteServiceModelRoutePlan,FormatsXLSRouteServiceDetermineRouteRequest,FormatsXLSRouteServiceRouteRequestExtension,FormatsXLSRouteService,ServicesRouteRequestRouteRequestOLS,ServicesRouteRequestModelRouteParamREST,ServicesRouteRequestRouteRequestREST,ServicesRouteRequestRouteRequestFactory,FormatsWKT,ServicesRouteResponseModelRouteResponse,ServicesRouteResponseModelRouteInstruction,ServicesRouteFormatsRouteResponseRESTReader,ServicesRouteFormatsRouteResponseOLSReader,ServicesRouteResponseRouteResponseFactory,ServicesRouteRoute,ServicesProcessIsoCurveRequestModelProcessIsoCurveParam,ServicesProcessIsoCurveRequestProcessIsoCurveRequest,ServicesProcessIsoCurveResponseModelProcessIsoCurveResponse,ServicesProcessIsoCurveFormatsProcessIsoCurveResponseReader,ServicesProcessIsoCurveResponseProcessIsoCurveResponseFactory,ServicesProcessIsoCurveProcessIsoCurve,ServicesServices,Gp;log4js=void 0,loggerCfg={loggers:[{root:!0,level:"all",appenders:[{type:"Console",layout:{type:"PatternLayout",pattern:"%d{yyyy-MM-dd HH:mm:ss} [%p] %c - %m%n"}}]}]},UtilsLoggerByDefault=function(e,t){var o={getLogger:function(o){e.load(t,function(e){if(e)throw e});var r=o||"default";return e.getLogger(r)}};return o}(log4js,loggerCfg),UtilsHelper=function(){var e={normalyzeParameters:function(e){var t=null;if(e){var o=[];for(var r in e)if(e.hasOwnProperty(r)){var s=e[r];s||(s=""),o.push(r+"="+s)}t=o.join("&")}return t},normalyzeUrl:function(e,t,o){var r=e;if(e){var s=e.indexOf("?");-1===s&&(r+="?"),-1!==s&&s!==e.length-1&&(r+="&")}return t&&(r+="string"==typeof t?t:this.normalyzeParameters(t)),o&&(r=encodeURIComponent(r)),r},indent:function(e,t){var o=e||0;return new Array(o+1).join(" ")+t}};return e}(),function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function t(e){return"function"==typeof e}function o(e){return"object"==typeof e&&null!==e}function r(e){V=e}function s(e){Y=e}function n(){return function(){process.nextTick(u)}}function i(){return function(){k(u)}}function a(){var e=0,t=new W(u),o=document.createTextNode("");return t.observe(o,{characterData:!0}),function(){o.data=e=++e%2}}function c(){var e=new MessageChannel;return e.port1.onmessage=u,function(){e.port2.postMessage(0)}}function l(){return function(){setTimeout(u,1)}}function u(){for(var e=0;B>e;e+=2){var t=Q[e],o=Q[e+1];t(o),Q[e]=void 0,Q[e+1]=void 0}B=0}function p(){try{var e=require,t=e("vertx");return k=t.runOnLoop||t.runOnContext,i()}catch(o){return l()}}function h(){}function f(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function g(e){try{return e.then}catch(t){return te.error=t,te}}function m(e,t,o,r){try{e.call(t,o,r)}catch(s){return s}}function R(e,t,o){Y(function(e){var r=!1,s=m(o,t,function(o){r||(r=!0,t!==o?E(e,o):y(e,o))},function(t){r||(r=!0,w(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&s&&(r=!0,w(e,s))},e)}function v(e,t){t._state===Z?y(e,t._result):t._state===ee?w(e,t._result):A(t,void 0,function(t){E(e,t)},function(t){w(e,t)})}function S(e,o){if(o.constructor===e.constructor)v(e,o);else{var r=g(o);r===te?w(e,te.error):void 0===r?y(e,o):t(r)?R(e,o,r):y(e,o)}}function E(t,o){t===o?w(t,f()):e(o)?S(t,o):y(t,o)}function _(e){e._onerror&&e._onerror(e._result),P(e)}function y(e,t){e._state===$&&(e._result=t,e._state=Z,0!==e._subscribers.length&&Y(P,e))}function w(e,t){e._state===$&&(e._state=ee,e._result=t,Y(_,e))}function A(e,t,o,r){var s=e._subscribers,n=s.length;e._onerror=null,s[n]=t,s[n+Z]=o,s[n+ee]=r,0===n&&e._state&&Y(P,e)}function P(e){var t=e._subscribers,o=e._state;if(0!==t.length){for(var r,s,n=e._result,i=0;ii;i++)A(r.resolve(e[i]),void 0,t,o);return s}function N(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var o=new t(h);return E(o,e),o}function I(e){var t=this,o=new t(h);return w(o,e),o}function F(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function D(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function U(e){this._id=ce++,this._state=void 0,this._result=void 0,this._subscribers=[],h!==e&&(t(e)||F(),this instanceof U||D(),O(this,e))}function q(){var e;if("undefined"!=typeof global)e=global;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var o=e.Promise;(!o||"[object Promise]"!==Object.prototype.toString.call(o.resolve())||o.cast)&&(e.Promise=le)}var G;G=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var k,V,X,j=G,B=0,Y=({}.toString,function(e,t){Q[B]=e,Q[B+1]=t,B+=2,2===B&&(V?V(u):X())}),H="undefined"!=typeof window?window:void 0,K=H||{},W=K.MutationObserver||K.WebKitMutationObserver,z="undefined"!=typeof process&&"[object process]"==={}.toString.call(process),J="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Q=new Array(1e3);X=z?n():W?a():J?c():void 0===H&&"function"==typeof require?p():l();var $=void 0,Z=1,ee=2,te=new T,oe=new T;x.prototype._validateInput=function(e){return j(e)},x.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},x.prototype._init=function(){this._result=new Array(this.length)};var re=x;x.prototype._enumerate=function(){for(var e=this,t=e.length,o=e.promise,r=e._input,s=0;o._state===$&&t>s;s++)e._eachEntry(r[s],s)},x.prototype._eachEntry=function(e,t){var r=this,s=r._instanceConstructor;o(e)?e.constructor===s&&e._state!==$?(e._onerror=null,r._settledAt(e._state,t,e._result)):r._willSettleAt(s.resolve(e),t):(r._remaining--,r._result[t]=e)},x.prototype._settledAt=function(e,t,o){var r=this,s=r.promise;s._state===$&&(r._remaining--,e===ee?w(s,o):r._result[t]=o),0===r._remaining&&y(s,r._result)},x.prototype._willSettleAt=function(e,t){var o=this;A(e,void 0,function(e){o._settledAt(Z,t,e)},function(e){o._settledAt(ee,t,e)})};var se=b,ne=L,ie=N,ae=I,ce=0,le=U;U.all=se,U.race=ne,U.resolve=ie,U.reject=ae,U._setScheduler=r,U._setAsap=s,U._asap=Y,U.prototype={constructor:U,then:function(e,t){var o=this,r=o._state;if(r===Z&&!e||r===ee&&!t)return this;var s=new this.constructor(h),n=o._result;if(r){var i=arguments[r-1];Y(function(){C(r,s,i,n)})}else A(o,s,e,t);return s},"catch":function(e){return this.then(null,e)}};var ue=q,pe={Promise:le,polyfill:ue};promise=function(){return pe}(),ue()}.call(this),ProtocolsXHR=function(e,t,o){var r={call:function(e){if(o.polyfill(),!e.url)throw new Error("missing parameter : url is not defined !");if(!e.method)throw new Error("missing parameter : method is not defined !");e.format||(e.format="text");var t={};switch(t.url=e.url,t.data=e.data?e.data:null,t.method=e.method,t.timeOut=e.timeOut||0,e.method){case"GET":break;case"POST":t.content=e.content?e.content:"application/x-www-form-urlencoded",t.headers=e.headers?e.headers:{referer:"http://localhost"};break;case"DELETE":case"PUT":throw new Error("HTTP method not yet supported !");default:throw new Error("HTTP method unknown !")}switch(e.format){case"text":this.__call(t).then(function(t){e.onResponse.call(this,t)})["catch"](function(t){e.onFailure.call(this,t)});break;case"json":this.__callJSON(t).then(function(t){e.onResponse.call(this,t)})["catch"](function(t){e.onFailure.call(this,t)});break;case"xml":this.__callXML(t).then(function(t){e.onResponse.call(this,t)})["catch"](function(t){e.onFailure.call(this,t)});break;default:throw new Error("This output Format is not yet supported !")}},__call:function(e){var o=new Promise(function(o,r){e.data&&"GET"==e.method&&(e.url=t.normalyzeUrl(e.url,e.data));var s=null;if(window.XDomainRequest){s=new XDomainRequest,s.open(e.method,e.url),s.overrideMimeType=e.content,e.timeOut>0&&(s.timeout=e.timeout),"GET"!==e.method&&s.setRequestHeader("Content-type",e.content),s.onerror=function(){r(new Error("Errors Occured on Http Request with XMLHttpRequest !"))},s.ontimeout=function(){r(new Error("TimeOut Occured on Http Request with XMLHttpRequest !"))},s.onload=function(){if(200==s.status)o(s.response);else{var e="Errors Occured on Http Request (status : '"+s.status+"' | response : '"+s.response+"')",t=s.status;r({message:e,status:t})}};var n=e.data&&"POST"==e.method?e.data:null;s.send(n)}else{if(!window.XMLHttpRequest)throw new Error("CORS not supported");s=new XMLHttpRequest,s.open(e.method,e.url,!0),s.overrideMimeType=e.content;var i=null;e.timeOut>0&&(i=window.setTimeout(function(){var e="TimeOut Occured on Http Request with XMLHttpRequest !";r({message:e,status:-1})},e.timeOut)),"GET"!==e.method&&s.setRequestHeader("Content-type",e.content),s.onerror=function(e){console.log(e),r(new Error("Errors Occured on Http Request with XMLHttpRequest !"))},s.ontimeout=function(){r(new Error("TimeOut Occured on Http Request with XMLHttpRequest !"))},s.onreadystatechange=function(){if(4==s.readyState)if(200==s.status)window.clearTimeout(i),o(s.response);else{var e="Errors Occured on Http Request (status : '"+s.status+"' | response : '"+s.response+"')",t=s.status;r({message:e,status:t})}};var a=e.data&&"POST"==e.method?e.data:null;s.send(a)}});return o},__callJSON:function(e){return this.__call(e).then(JSON.parse)["catch"](function(t){throw console.log("_callJSON failed on : ",e.url,t),t})},__callXML:function(e){return this.__call(e).then(function(e){var t;if(window.DOMParser){var o=new DOMParser;t=o.parseFromString(e,"text/xml")}else t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.loadXML(e);return t})["catch"](function(t){throw console.log("__callXML failed on : ",e.url,t),t})}};return r}(UtilsLoggerByDefault,UtilsHelper,promise),UtilsMessagesResources=function(){var e={PARAM_MISSING:"Parameter(s) '%var%' missing",PARAM_EMPTY:"Parameter(s) '%var%' empty",PARAM_TYPE:"Wrong type(s) for parameter(s) '%var%'",PARAM_FORMAT:"Parameter(s) '%var%' not correctly formatted",PARAM_NOT_SUPPORT:"Value(s) for parameter(s) '%var%' not supported",PARAM_UNKNOWN:"Value(s) for parameter(s) '%var%' unknown",SERVICE_REQUEST_BUILD:"An error occurred during the request building of the service",SERVICE_REQUEST_EMPTY:"The request sent to the service is empty",SERVICE_RESPONSE_EXCEPTION:"The service returned an exception : '%var%'",SERVICE_RESPONSE_EXCEPTION_2:"The service returned an exception",SERVICE_RESPONSE_ANALYSE:"An error occurred while parsing the response '%var%' of the service",SERVICE_RESPONSE_ANALYSE_2:"An unknown error occurred while parsing the response",SERVICE_RESPONSE_EMPTY:"The response of the service is empty",SERVICE_RESPONSE_EMPTY_2:"The response from the service could not be analyzed or is empty",SERVICE_RESPONSE_FORMAT:"The format of the service response is not supported (handled format(s) : '%var%')",SERVICE_RESPONSE_FORMAT_2:"The format of the service response is not supported",SERVICE_RESPONSE_FORMAT_3:"No suggestion matching the search",CLASS_CONSTRUCTOR:"'%var%' constructor cannot be called as a function.",getMessage:function(e,t){if(!arguments)return"Message indefined !";var o=Array.prototype.slice.call(arguments),r=o.shift(),s=o,n=this[r];try{n=Array.isArray(s)&&s.length>0?n.replace("%var%",s.join(" - ")):n.replace("%var%","%var% (not specified)")}catch(i){}return n}};return e}(),ExceptionsErrorService=function(){function e(t){if(!(this instanceof e))throw new TypeError("ErrorService constructor cannot be called as a function.");var o=t;"string"==typeof t||t instanceof String?(this.message=t,this.status=-1,this.type=e.TYPE_UNKERR):(this.message=o.message||"undefined!?",this.type=o.type,this.status=o.status||-1),this.name="ErrorService",this.stack=(new Error).stack}return e.TYPE_SRVERR="SERVICE_ERROR",e.TYPE_USEERR="USAGE_ERROR",e.TYPE_UNKERR="UNKNOWN_ERROR",e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),e}(),ProtocolsJSONP=function(e){var t={uuid:function(){var e=Math.floor(Date.now());return function(){return e++}}(),call:function(e){if(!e)throw new Error("missing parameter : options !");if(!e.url)throw new Error("missing parameter : options.url !");if(e.timeOut||(e.timeOut=0),!e.onResponse)throw new Error("missing parameter : options.onResponse !");var t="string"==typeof e.callbackSuffix?e.callbackSuffix:this.uuid(),o=!1,r=!1,s=e.url.indexOf("callback=");if(-1!=s){o=!0;var n=e.url.indexOf("&",s);-1===n&&(n=e.url.length);var i=e.url.substring(s+9,n);i&&(r=!0,e.callbackName=i)}if(!o){var a=e.url.indexOf("?");-1===a?e.url=e.url+"?callback=":a===e.url.length?e.url=e.url+"callback=":e.url=e.url+"&callback="}var c=e.callbackName?!0:r;if(r||(e.callbackName||(e.callbackName="callback",(t||""===t)&&(e.callbackName+=t)),e.url=e.url.replace("callback=","callback="+e.callbackName)),e.onTimeOut||(e.onTimeOut=function(){console.log("TimeOut while invoking url : "+e.url)}),!c){var l=this,u=null;e.timeOut>0&&(u=window.setTimeout(function(){window[e.callbackName]=function(){},e.onTimeOut(),l._deleteScript(t)},e.timeOut)),window[e.callbackName]=function(o){window.clearTimeout(u),e.onResponse(o),l._deleteScript(t)}}this._createScript(t,e.url)},_createScript:function(e,t){var o,r=document.getElementById("results"+e);o=document.createElement("script"),o.setAttribute("type","text/javascript"),o.setAttribute("src",t),o.setAttribute("charset","UTF-8"),o.setAttribute("id","results"+e),o.setAttribute("async","true");var s=document.documentElement||document.getElementsByTagName("head")[0];null===r?s.appendChild(o):s.replaceChild(o,r)},_deleteScript:function(e){var t=document.getElementById("results"+e);if(t){var o=t.parentNode||document.documentElement;if(!o)return;o.removeChild(t)}}};return t}(UtilsLoggerByDefault),ProtocolsProtocol=function(e,t,o){var r={send:function(r){var s=r||{method:"GET",protocol:"JSONP",timeOut:0,format:null,wrap:!0,nocache:!0,output:"json",callback:null,callbackSuffix:null};if("XHR"===r.protocol||"json"===r.format?s.wrap=!1:"JSONP"===r.protocol&&"xml"===r.format&&(s.wrap=!0),s.callback=("JSONP"==r.protocol,null),s.output=s.wrap?"json":null,s.wrap){var n={};n.output=s.output,n.callback=s.callback,delete n.callback,s.url=e.normalyzeUrl(r.url,n)}switch(s.protocol){case"XHR":"GET"===r.method&&r.nocache&&(s.url=e.normalyzeUrl(s.url,{t:(new Date).getTime()})),t.call(s);break;case"JSONP":s.data&&(s.url=e.normalyzeUrl(s.url,s.data)),o.call(s);break;default:throw new Error("protocol not supported (XHR|JSONP) !")}}};return r}(UtilsHelper,ProtocolsXHR,ProtocolsJSONP),ServicesDefaultUrlService=function(){var e="http://",t="wxs.ign.fr",o="%KEY%",r=e+t.concat("/",o),s=function(e){return this._key.replace(e?o:null,e)},n={Alti:{_key:{"elevation-json":r+"/alti/rest/elevation.json","elevation-xml":r+"/alti/rest/elevation.xml","profil-json":r+"/alti/rest/elevationLine.json","profil-xml":r+"/alti/rest/elevationLine.xml",wps:r+"/alti/wps"},url:function(e){return{"elevation-json":this._key["elevation-json"].replace(e?o:null,e),"elevation-xml":this._key["elevation-xml"].replace(e?o:null,e),"profil-json":this._key["profil-json"].replace(e?o:null,e),"profil-xml":this._key["profil-xml"].replace(e?o:null,e),wps:this._key.wps.replace(e?o:null,e)}}},ProcessIsoCurve:{_key:{"iso-json":r+"/isochrone/isochrone.json","iso-xml":r+"/isochrone/isochrone.xml"},url:function(e){return{"iso-json":this._key["iso-json"].replace(e?o:null,e),"iso-xml":this._key["iso-xml"].replace(e?o:null,e)}}},AutoComplete:{_key:r+"/ols/apis/completion",url:s},ReverseGeocode:{_key:r+"/geoportail/ols",url:s},AutoConf:{_key:{apiKey:r+"/autoconf",apiKeys:r+"/autoconf?keys=%KEYS%"},url:function(r){var s="";if(Array.isArray(r)&&r.length>0){s=r[0];for(var n=1;nt||t>e?this.positions:this.positions[e]},addPositions:function(e){for(var t=0;t",input:"__KEY__=__DATA__"},post:{value:'__IDENTIFIER____RAWDATAOUTPUT__',input:"__KEY____DATA__"}},namespaceByDefault:function(){var e=['xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"','xmlns="http://www.opengis.net/wps/1.0.0"','xmlns:wfs="http://www.opengis.net/wfs"','xmlns:wps="http://www.opengis.net/wps/1.0.0"','xmlns:ows="http://www.opengis.net/ows/1.1"','xmlns:gml="http://www.opengis.net/gml"','xmlns:ogc="http://www.opengis.net/ogc"','xmlns:wcs="http://www.opengis.net/wcs/1.1.1"','xmlns:xlink="http://www.w3.org/1999/xlink"'];return e.join(" ")},schemaLocationByDefault:function(){return'xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd"'},processRequestString:function(){var e="";if("POST"==this.method)e=this.template.post.value;else{if("GET"!=this.method)return!1;e=this.template.get.value}return e=e.replace(/__SERVICE__/g,this.paramservice),e=e.replace(/__VERSION__/g,this.paramversion),e=e.replace(/__RAWDATAOUTPUT__/g,this.paramrawdataoutput),e=e.replace(/__IDENTIFIER__/g,this.paramidentifier),e=e.replace(/__REQUEST__/g,this.paramrequest),"POST"==this.method&&(e=e.replace(/__NAMESPACE__/g,this.namespaceByDefault),e=e.replace(/__SCHEMALOCATION__/g,this.schemaLocationByDefault)),(e=e.replace(//g,this.__addDataInputs()))?(this.requestString=e,!0):!1},__addDataInputs:function(){for(var e="GET"==this.method?this.template.get.input:this.template.post.input,t="GET"==this.method?";":"",o="",r=this,s=this.DataObject.getData(),n=0;n0)for(var a=r.getElementsByTagName("parsererror"),c=0;c0){var o=n(e);t.attributes=o}if(e.hasChildNodes())for(var r,i={},a=e.childNodes,c=0;c0){for(var t={},o=e.attributes,r=0;r0){for(var t={},o=e.attributes,r=0;r0){var t=g(e);for(var o in t)if(t.hasOwnProperty(o)){if("version"===o&&t.version!==S.VERSION)return void console.log("[AutoConfResponseReader] autoconf version is not the expected one : there may be errors in parsing");if("xmlns"===o){if(t[o]!==S.NAMESPACES.xmlns)return void console.log("[AutoConfResponseReader] autoconf response default namespace is not the expected one");continue}var r=o.split(":")[0],s=o.split(":")[1];if("xmlns"===r&&s&&S.NAMESPACES[s]&&S.NAMESPACES[s]!==t[o])return void console.log("[AutoConfResponseReader] autoconf response "+o+" namespace is not the expected one");if("schemaLocation"===s&&t[o]!==S.SCHEMALOCATION[0]&&t[o]!==S.SCHEMALOCATION[1])return void console.log("[AutoConfResponseReader] autoconf response schema location is not the expected one")}}}var S={};return S.VERSION="1.1.0",S.NAMESPACES={xmlns:"http://www.opengis.net/context",gpp:"http://api.ign.fr/geoportail",ows:"http://www.opengis.net/ows/1.1",sld:"http://www.opengis.net/sld",wmts:"http://www.opengis.net/wmts/1.0",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},S.SCHEMALOCATION=["http://www.opengis.net/context http://gpp3-wxs.ign.fr/schemas/extContext.xsd http://api.ign.fr/geoportail http://wxs.ign.fr/schemas/autoconf/autoconf.xsd","http://www.opengis.net/context http://gpp3-wxs.ign.fr/schemas/extContext.xsd http://api.ign.fr/geoportail http://gpp3-wxs.ign.fr/schemas/autoconf.xsd"],S.DEFAULTPREFIX="context",S.READERS={context:{ViewContext:function(e){v(e);var o=new t;return m(e,o),o},Title:function(e,t){t&&t.generalOptions?t.generalOptions.title=R(e):t&&t.lyr&&(t.lyr.title=R(e))},Abstract:function(e,t){t&&t.lyr&&(t.lyr.description=R(e))},Server:function(e,t){var o=e.getAttribute("service"),r=e.getAttribute("title"),s=e.getAttribute("version");if(o)if(t&&t.services&&"object"==typeof t.services&&!t.services[o]){var n=new c;n.title=r,n.version=s,m(e,n),t.services[o]=n}else t&&t.lyr&&(t.lyr.serviceParams||(t.lyr.serviceParams={}),t.lyr.serviceParams.id=o,t.lyr.serviceParams.version=s)},OnlineResource:function(e,t){t&&t.hasOwnProperty("serverUrl")&&(t.serverUrl=e.getAttribute("xlink:href"))},LayerList:function(e,t){if(m(e,t),t&&t.layers&&t.generalOptions&&t.services)for(var o in t.layers)if(t.layers.hasOwnProperty(o)){var r=t.layers[o],s=r.apiKeys;if(s&&Array.isArray(s))for(var n=0;n0?this.options.serverUrl=o.apiKeys:this.options.serverUrl=o.apiKey}"XHR"===this.options.protocol&&"POST"===this.options.httpMethod&&(this.options.httpMethod="GET"),this.options.outputFormat="xml"}return a.prototype=Object.create(n.prototype,{}),a.prototype.constructor=a,a.prototype.buildRequest=function(e,t){var o="undefined"!=typeof window?window:{};if(o.Gp&&o.Gp.Config&&o.Gp.Config.generalOptions&&o.Gp.Config.layers&&o.Gp.Config.generalOptions.apiKeys[this.options.apiKey]){if(!this.options.layerId)return void this.options.onSuccess.call(this,o.Gp.Config);if(o.Gp.Config.layers[this.options.layerId]&&o.Gp.Config.layers[this.options.layerId].aggregatedLayers)return void this.options.onSuccess.call(this,o.Gp.Config)}this.request="";var s;s=-1===this.options.serverUrl.indexOf("http://")?!0:!1,!s&&this.layerId&&(this.request=r.normalyzeParameters({layerId:this.layerId})),t.call(this,this.request)},a.prototype.analyzeResponse=function(e,r){if(this.response){var s={layerId:this.options.layerId,response:this.response,rawResponse:this.options.rawResponse,onSuccess:r,onError:e,scope:this};i.build(s)}else e.call(this,new o(t.getMessage("SERVICE_RESPONSE_EMPTY")))},a}(UtilsLoggerByDefault,UtilsMessagesResources,ExceptionsErrorService,UtilsHelper,ServicesDefaultUrlService,ServicesCommonService,ServicesAutoConfResponseAutoConfResponseFactory),FormatsXLSRequestHeader=function(e){function t(e){if(!(this instanceof t))throw new TypeError("RequestHeader constructor cannot be called as a function.");this.options=e||{srsName:"EPSG:4326"};for(var o in e)e.hasOwnProperty(o)&&(this.options[o]=e[o])}return t.prototype={requestString:null,template:'',constructor:t,toString:function(){var e=null;return e=this.template,e=e.replace(/__SRSNAME__/g,this.options.srsName),this.requestString=e,this.requestString}},t}(UtilsLoggerByDefault),FormatsXLSRequest=function(e){function t(e){if(!(this instanceof t))throw new TypeError("Request constructor cannot be called as a function.");this.options=e||{maximumResponses:25,methodName:null,version:"1.2"};for(var o in e)e.hasOwnProperty(o)&&(this.options[o]=e[o])}return t.prototype={requestString:null,template:'',constructor:t,guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0,o="x"===e?t:3&t|8;return o.toString(16)})},toString:function(){var e=null;return e=this.template,e=e.replace(/__MAXRESPONSES__/g,this.options.maximumResponses),e=e.replace(/__METHODNAME__/g,this.options.methodName),e=e.replace(/__UUID__/g,this.guid()),e=e.replace(/__VERSION__/g,this.options.version),this.requestString=e,this.requestString}},t}(UtilsLoggerByDefault),FormatsXLSAbstractService=function(e){function t(e){if(!(this instanceof t))throw new TypeError("AbstractService constructor cannot be called as a function.");this.options=e||{};for(var o in e)e.hasOwnProperty(o)&&(this.options[o]=e[o])}return t.prototype={strRequest:null,oRequest:null,oFilter:null,constructor:t,addRequest:function(e){},addFilter:function(e){},toString:function(){}},t}(UtilsLoggerByDefault),FormatsXLS=function(e,t,o,r){function s(e){if(!(this instanceof s))throw new TypeError("XLS constructor cannot be called as a function.");this.options={srsName:"EPSG:4326",maximumResponses:25};for(var t in e)e.hasOwnProperty(t)&&e[t]&&(this.options[t]=e[t])}return s.VERSION="1.2",s.prototype={requestString:null,namespace:!1,oService:null,constructor:s,template:'\n\n__REQUESTHEADER__\n__REQUEST__\n\n',namespaceByDefault:function(){var e=['xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"','xmlns:xls="http://www.opengis.net/xls"','xmlns:gml="http://www.opengis.net/gml"'];return e.join(" ")},schemaLocationByDefault:function(){return'xsi:schemaLocation="http://www.opengis.net/xls http://schemas.opengis.net/ols/1.2/olsAll.xsd"'},setService:function(e){e&&e instanceof r&&(this.oService=e)},getService:function(){return this.oService}},s.prototype.addNamespace=function(e,t){for(var o=e.key,r=!1,s=this.namespaceByDefault().split(" "),n=0;n])/g,u="<"+o+":$1",t=t.replace(l,u),l=/<\/(\w+[\s>])/g,u="/g,this.getService().toString())),r?(this.namespace&&(r=this.addNamespace({key:"xls",url:"http://www.opengis.net/xls"},r)),this.requestString=r,this.requestString):void 0},s}(UtilsLoggerByDefault,FormatsXLSRequestHeader,FormatsXLSRequest,FormatsXLSAbstractService),FormatsXLSLocationUtilityServiceModelAddress=function(e,t){function o(e){if(!(this instanceof o))throw new TypeError("Address constructor cannot be called as a function.");if(this.options=e||{location:{},type:["StreetAddress"],filter:{}},!e.location)throw new Error("l'option 'location' n'est pas renseignée !");for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t])}return o.prototype={constructor:o,requestString:null,template:{address:'
__LOCATION____PLACE____POSTALCODE____ENVELOPE__
',location:{freeFormAddress:"__FREEFORMADDRESSVALUE__",streetAddress:{container:"__STREET____BUILDING__",building:'',street:"__STREETVALUE__"}},place:'__PLACEVALUE__',postalCode:"__POSTALCODEVALUE__",envelope:"__LEFT__ __BOTTOM____RIGHT__ __TOP__"}},o.prototype.toString=function(){var e=null;if(e=this.template.address,e=e.replace(/__COUNTRYCODE__/g,this.options.type),"string"==typeof this.options.location){var t=this.template.location.freeFormAddress;t=t.replace(/__FREEFORMADDRESSVALUE__/g,this.options.location),e=e.replace(/__LOCATION__/g,t)}else{var o="",r="";this.options.location.number&&(o=this.template.location.streetAddress.building,o=o.replace(/__BUILDINGVALUE__/g,this.options.location.number)),this.options.location.street&&(r=this.template.location.streetAddress.street,r=r.replace(/__STREETVALUE__/g,this.options.location.street));var s=this.template.location.streetAddress.container;s=s.replace(/__STREET__/g,r),s=s.replace(/__BUILDING__/g,o),e=e.replace(/__LOCATION__/g,s)}var n="";this.options.location.postalCode&&(n=this.template.postalCode,n=n.replace(/__POSTALCODEVALUE__/g,this.options.location.postalCode));var i="";if(this.options.filter){var a=this.options.filter.bbox;a&&(i=this.template.envelope,i=i.replace(/__LEFT__/g,a.left),i=i.replace(/__BOTTOM__/g,a.bottom),i=i.replace(/__RIGHT__/g,a.right),i=i.replace(/__TOP__/g,a.top))}var c=[],l="";if(this.options.filter){var u=this.options.filter;for(var p in u)"bbox"!==p&&(l=this.template.place,l=l.replace(/__PLACETYPE__/g,p),l=l.replace(/__PLACEVALUE__/g,u[p]),c.push(l))}var h="";return this.options.location.city&&(h=this.template.place,h=h.replace(/__PLACETYPE__/g,"Municipality"),h=h.replace(/__PLACEVALUE__/g,this.options.location.city),c.push(h)),e=e.replace(/__POSTALCODE__/g,n),e=e.replace(/__PLACE__/g,c.join("\n")),e=e.replace(/__ENVELOPE__/g,i),this.requestString=e,this.requestString},o}(Gp,UtilsLoggerByDefault),FormatsXLSLocationUtilityServiceGeocodeFilterExtension=function(e){function t(){if(!(this instanceof t))throw new TypeError("GeocodeFilterExtension constructor cannot be called as a function.");this.filters=[]}return t.prototype={constructor:t,addFilterExtensions:function(e){e&&this.filters.push(e)},getNames:function(){var e=[];for(var t in this.filters)e.push(this.filters[t].CLASSNAME);return e},getFilter:function(e){var t=null;for(var o in this.filters)this.filters[o].CLASSNAME==e&&(t=this.filters[o]);return t},getFilters:function(){return this.filters},getAttributs:function(e){var t=[];for(var o in this.filters)this.filters[o].CLASSNAME==e&&(t=this.filters[o].attributesList);return t},setPlaceAttributs:function(e,t){var o=this.getFilter(e),r=this.getAttributs(e);for(var s in r){var n=r[s];t[n]&&(o.placeAttributes[n]=t[n])}},getPlaceAttributs:function(e){var t={};for(var o in this.filters)this.filters[o].CLASSNAME==e&&(t=this.filters[o].placeAttributes);return t}},t}(UtilsLoggerByDefault),FormatsXLSLocationUtilityServiceGeocodeRequest=function(e,t,o){function r(e){if(!(this instanceof r))throw new TypeError("GeocodeRequest constructor cannot be called as a function.");this.options=e||{};for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);this.CLASSNAME="GeocodeRequest"}return r.prototype={strRequest:null,oAddress:null,oFilter:null,template:'__ADDRESS__',addAddress:function(e){e instanceof t&&(this.oAddress=e)},addFilter:function(e){e instanceof o&&(this.oFilter=e)},constructor:r,toString:function(){var e="";if(e=this.template,!this.oAddress){var o={};if(o.location=this.options.location,o.type=this.options.filterOptions.type||["StreetAddress"],o.filter=this.options.filterOptions,delete o.filter.type,this.oFilter){o.filter={};for(var r in o.type){var s=o.type[r],n=this.oFilter.getFilter(s);if(n){for(var i=this.options.filterOptions,a=n.attributesList,c=0;c__GMLPOINT____GMLFILTER__",gml:{point:'__X__ __Y__',pos:null,filter:{bbox:'__LEFT__ __BOTTOM____RIGHT__ __TOP__',circle:'__X__ __Y____RADIUS__',polygon:'__XY__',multipolygon:null}}}},t.prototype.toString=function(){var e=this.template.position,t=this.template.gml.point;t=t.replace(/__X__/g,this.options.position.x),t=t.replace(/__Y__/g,this.options.position.y);var o="";if(this.options.filter){var r=this.options.filter;for(var s in r)switch(s){case"circle":o=this.template.gml.filter[s],o=o.replace(/__X__/g,r[s].x),o=o.replace(/__Y__/g,r[s].y),o=o.replace(/__RADIUS__/g,r[s].radius);break;case"bbox":o=this.template.gml.filter[s],o=o.replace(/__LEFT__/g,r[s].left),o=o.replace(/__BOTTOM__/g,r[s].bottom),o=o.replace(/__RIGHT__/g,r[s].right),o=o.replace(/__TOP__/g,r[s].top);break;case"polygon":o=this.template.gml.filter[s];for(var n="",i=r[s],a=0;a__TYPE__"},t.prototype.toString=function(){var e=[],t="";for(var o in this.type)t=this.template,t=t.replace(/__TYPE__/g,this.type[o]),e.push(t);return this.strRequest=e.join("\n"),this.strRequest},t}(UtilsLoggerByDefault),FormatsXLSLocationUtilityServiceReverseGeocodeRequest=function(e,t,o){function r(e){if(!(this instanceof r))throw new TypeError("ReverseGeocodeRequest constructor cannot be called as a function.");this.options=e||{};for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);this.CLASSNAME="ReverseGeocodeRequest"}return r.prototype={strRequest:null,oPosition:null,oPreference:null,constructor:r,template:'__POSITION____PREFERENCE__',addPosition:function(e){e instanceof t&&(this.oPosition=e)},addPreferences:function(e){e instanceof o&&(this.oPreference=e)},toString:function(){var e="";if(e=this.template,!this.oPreference&&(this.oPreference=new o(this.options.filterOptions.type||["StreetAddress"]),!this.oPreference))throw new Error("Les preferences ne sont pas definies !?");if(e=e.replace(/__PREFERENCE__/g,this.oPreference.toString()),!this.oPosition){var r={position:this.options.position,filter:{}};if(this.options.filterOptions&&(r.filter=this.options.filterOptions,delete r.filter.type),this.oPosition=new t(r),!this.oPosition)throw new Error("La position et ses filtres ne sont pas definis !?")}return e=e.replace(/__POSITION__/g,this.oPosition.toString()),e=e.replace(/__RETURNFREEFORM__/g,this.options.returnFreeForm?"true":"false"),this.strRequest=e,this.strRequest}},r}(UtilsLoggerByDefault,FormatsXLSLocationUtilityServiceModelPosition,FormatsXLSLocationUtilityServiceModelPreference),FormatsXLSLocationUtilityService=function(e,t,o,r,s){function n(e){if(!(this instanceof n))throw new TypeError("LocationUtilityService constructor cannot be called as a function.");this.CLASSNAME="LocationUtilityService",this.CLASSTYPE=null,t.apply(this,arguments),this.options&&(this.CLASSTYPE=this.options.location?"GeocodeRequest":this.options.position?"ReverseGeocodeRequest":null)}return n.prototype=Object.create(t.prototype,{}),n.prototype.constructor=n,n.prototype.addRequest=function(e){switch(this.CLASSTYPE=e.CLASSNAME,this.CLASSTYPE){case"GeocodeRequest":case"ReverseGeocodeRequest":this.oRequest=e;break;default:throw new Error("Ce n'est pas un objet de type 'LUS Request' !?")}},n.prototype.addFilter=function(e){e instanceof s&&(this.oFilter=e)},n.prototype.toString=function(){if(!this.oRequest){if(!this.options)throw new Error("Les options ne sont pas renseignées, impossible de construire la requête !");if("GeocodeRequest"===this.CLASSTYPE){var e={location:this.options.location,returnFreeForm:this.options.returnFreeForm,filterOptions:this.options.filterOptions||{}};this.oRequest=new o(e),this.oFilter&&this.oRequest.addFilter(this.oFilter)}else if("ReverseGeocodeRequest"===this.CLASSTYPE){var t={position:this.options.position,returnFreeForm:this.options.returnFreeForm,filterOptions:this.options.filterOptions||{}};this.oRequest=new r(t)}}if(!this.oRequest)throw new Error("Type de Geocodage indefini !");return this.strRequest=this.oRequest.toString(),this.strRequest},n}(UtilsLoggerByDefault,FormatsXLSAbstractService,FormatsXLSLocationUtilityServiceGeocodeRequest,FormatsXLSLocationUtilityServiceReverseGeocodeRequest,FormatsXLSLocationUtilityServiceGeocodeFilterExtension),ServicesGeocodeRequestGeocodeLocation=function(){function e(){if(!(this instanceof e))throw new TypeError("GeocodeLocation constructor cannot be called as a function.");this.placeAttributes={},this.attributesList=[],this.serviceAttributes=[]}return e.prototype={constructor:e},e}(),ServicesGeocodeRequestModelStreetAddress=function(e){function t(){if(!(this instanceof t))throw new TypeError("StreetAddress constructor cannot be called as a function.");e.apply(this,arguments),this.CLASSNAME="StreetAddress",this.attributesList=["bbox","ID","IDTR","quality","territory","commune","department","insee","municipality"],this.serviceAttributes=["bbox","ID","IDTR","Qualite","Territoire","Commune","Departement","INSEE","Municipality"]}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t}(ServicesGeocodeRequestGeocodeLocation),ServicesGeocodeRequestModelPositionOfInterest=function(e){function t(){if(!(this instanceof t))throw new TypeError("PositionOfInterest constructor cannot be called as a function.");e.apply(this,arguments),this.CLASSNAME="PositionOfInterest",this.attributesList=["bbox","importance","nature","territory","commune","department","insee","municipality"],this.serviceAttributes=["bbox","Importance","Nature","Territoire","Commune","Departement","INSEE","Municipality"]}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t}(ServicesGeocodeRequestGeocodeLocation),ServicesGeocodeRequestModelCadastralParcel=function(e){function t(){if(!(this instanceof t))throw new TypeError("CadastralParcel constructor cannot be called as a function.");e.apply(this,arguments),this.CLASSNAME="CadastralParcel",this.attributesList=["absorbedCity","sheet","number","section","commune","department","insee","municipality","origin"],this.serviceAttributes=["CommuneAbsorbee","Feuille","Numero","Section","Commune","Departement","INSEE","Municipality","Type"]}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t}(ServicesGeocodeRequestGeocodeLocation),ServicesGeocodeRequestModelAdministratif=function(e){function t(){if(!(this instanceof t))throw new TypeError("Administratif constructor cannot be called as a function.");e.apply(this,arguments),this.CLASSNAME="Administratif",this.attributesList=["bbox","prefecture","inseeRegion","inseeDepartment","municipality"],this.serviceAttributes=["bbox","Prefecture","InseeRegion","InseeDepartement","Municipality"]}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t}(ServicesGeocodeRequestGeocodeLocation),ServicesGeocodeRequestDirectGeocodeRequestFactory=function(e,t,o,r,s,n,i,a){var c={build:function(e){var c=null,l=new r;l.addFilterExtensions(new a),l.addFilterExtensions(new s),l.addFilterExtensions(new n),l.addFilterExtensions(new i);var u=new o({location:e.location,returnFreeForm:e.returnFreeForm,filterOptions:e.filterOptions});u.addFilter(l);var p=new t({srsName:e.srs,maximumResponses:e.maximumResponses});if(p.namespace=!0,p.setService(u),c=p.build(),"GET"==e.httpMethod){var h="qxml="+encodeURIComponent(c).replace(/\-/g,"%2D").replace(/\_/g,"%5F").replace(/\./g,"%2E").replace(/\!/g,"%21").replace(/\~/g,"%7E").replace(/\*/g,"%2A").replace(/\'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29");c=h}return c}};return c}(UtilsLoggerByDefault,FormatsXLS,FormatsXLSLocationUtilityService,FormatsXLSLocationUtilityServiceGeocodeFilterExtension,ServicesGeocodeRequestModelStreetAddress,ServicesGeocodeRequestModelPositionOfInterest,ServicesGeocodeRequestModelCadastralParcel,ServicesGeocodeRequestModelAdministratif),ServicesGeocodeResponseModelGeocodeResponse=function(){function e(){if(!(this instanceof e))throw new TypeError("GeocodeResponse constructor cannot be called as a function.");this.locations=[]}return e.prototype={constructor:e},e}(),ServicesGeocodeResponseModelGeocodedLocation=function(){function e(){if(!(this instanceof e))throw new TypeError("GeocodedLocation constructor cannot be called as a function.");this.position={x:null,y:null},this.matchType=null,this.placeAttributes={},this.type=null}return e.prototype={constructor:e},e}(),ServicesGeocodeResponseModelDirectGeocodedLocation=function(e){function t(){if(!(this instanceof t))throw new TypeError("DirectGeocodedLocation constructor cannot be called as a function.");e.apply(this,arguments),this.CLASSNAME="DirectGeocodedLocation",this.accuracy=null}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t}(ServicesGeocodeResponseModelGeocodedLocation),ServicesGeocodeFormatsDirectGeocodeResponseReader=function(e,t,o,r,s){function n(e){if(e.attributes.length>0){for(var t={},o=e.attributes,r=0;r0){var t=n(e);for(var o in t)if(t.hasOwnProperty(o)){if("version"===o&&t.version!==l.VERSION)return void console.log("[DirectGeocodeResponseReader] geocode version is not the expected one : there may be errors in parsing");if("xmlns"===o){if(t[o]!==l.NAMESPACES[l.DEFAULTPREFIX])return void console.log("[DirectGeocodeResponseReader] geocode response default namespace is not the expected one");continue}var r=o.split(":")[0],s=o.split(":")[1];if("xmlns"===r&&s&&l.NAMESPACES[s]&&l.NAMESPACES[s]!==t[o])return void console.log("[DirectGeocodeResponseReader] geocode response "+o+" namespace is not the expected one");if("schemaLocation"===s&&l.SCHEMALOCATION!==t[o])return void console.log("[DirectGeocodeResponseReader] geocode response schema location is not the expected one")}}}var l={};return l.VERSION="1.2",l.NAMESPACES={xmlns:"http://www.opengis.net/xls",gml:"http://www.opengis.net/gml",xls:"http://www.opengis.net/xls",xlsext:"http://www.opengis.net/xlsext",xsi:"http://www.w3.org/2001/XMLSchema-instance"},l.SCHEMALOCATION="http://wxs.ign.fr/schemas/olsAll.xsd",l.DEFAULTPREFIX="xls",l.READERS={xls:{XLS:function(e){var t=new r;return c(e),i(e,t),t},GeocodedAddress:function(e,t){var o=new s;i(e,o),t&&Array.isArray(t.locations)&&t.locations.push(o)},GeocodeMatchCode:function(e,t){var o=e.getAttribute("accuracy");o&&t&&(t.accuracy=parseFloat(o));var r=e.getAttribute("matchType");r&&t&&(t.matchType=r)},Address:function(e,t){var o=e.getAttribute("countryCode");t&&o&&(t.type=o),i(e,t)},freeFormAddress:function(e,t){t&&t.hasOwnProperty("placeAttributes")&&(t.placeAttributes.freeform=a(e))},Building:function(e,t){var o=e.getAttribute("number");t&&t.hasOwnProperty("placeAttributes")&&(o?t.placeAttributes.number=o:e.getAttribute("buildingName")?t.placeAttributes.number=e.getAttribute("buildingName"):e.getAttribute("subdivision")&&(t.placeAttributes.number=e.getAttribute("subdivision")))},Street:function(e,t){t&&t.hasOwnProperty("placeAttributes")&&("StreetAddress"===t.type?t.placeAttributes.street=a(e):"CadastralParcel"===t.type&&(t.placeAttributes.cadastralParcel=a(e)))},Place:function(e,t){var o=e.getAttribute("type"),r=a(e);if(t&&t.hasOwnProperty("placeAttributes"))if("Municipality"===o)t.placeAttributes.municipality=r;else if("Bbox"===o){var s=r.split(";");4===s.length&&(t.placeAttributes.bbox={left:parseFloat(s[0]),right:parseFloat(s[2]),top:parseFloat(s[1]),bottom:parseFloat(s[3])})}else"Commune"===o?t.placeAttributes.commune=r:"Departement"===o?t.placeAttributes.department=r:"INSEE"===o?t.placeAttributes.insee=r:"Qualite"===o?t.placeAttributes.quality=r:"Territoire"===o?t.placeAttributes.territory=r:"ID"===o?t.placeAttributes.ID=r:"ID_TR"===o?t.placeAttributes.IDTR=r:"Importance"===o?t.placeAttributes.importance=parseInt(r,10):"Nature"===o?t.placeAttributes.nature=r:"Numero"===o?t.placeAttributes.number=r:"Feuille"===o?t.placeAttributes.sheet=r:"Section"===o?t.placeAttributes.section=r:"CommuneAbsorbee"===o?t.placeAttributes.absorbedCity=r:"Arrondissement"===o?r&&(t.placeAttributes.arrondissement=r):"Type"===o?t.placeAttributes.origin=r:"Prefecture"===o?t.placeAttributes.prefecture=r:"InseeRegion"===o?t.placeAttributes.inseeRegion=r:"InseeDepartment"===o&&(t.placeAttributes.inseeDepartment=r)},PostalCode:function(e,t){t&&t.hasOwnProperty("placeAttributes")&&(t.placeAttributes.postalCode=a(e))},Error:function(e){var r=e.getAttribute("message"),s=e.getAttribute("errorCode"),n=t.getMessage("SERVICE_RESPONSE_EXCEPTION","("+s+") : "+r);throw new o({message:n,type:o.TYPE_SRVERR})}},gml:{pos:function(e,t){var o=a(e);t&&o&&(t.position={x:parseFloat(o.split(" ")[0]),y:parseFloat(o.split(" ")[1])})}},ExceptionReport:function(e){var t={};if(e.hasChildNodes())for(var o,r=e.childNodes,s=0;s0){for(var t={},o=e.attributes,r=0;r0){var t=n(e);for(var o in t)if(t.hasOwnProperty(o)){if("version"===o&&t.version!==l.VERSION)return void console.log("[ReverseGeocodeResponseReader] geocode version is not the expected one : there may be errors in parsing");if("xmlns"===o){if(t[o]!==l.NAMESPACES[l.DEFAULTPREFIX])return void console.log("[ReverseGeocodeResponseReader] geocode response default namespace is not the expected one");continue}var r=o.split(":")[0],s=o.split(":")[1];if("xmlns"===r&&s&&l.NAMESPACES[s]&&l.NAMESPACES[s]!==t[o])return void console.log("[ReverseGeocodeResponseReader] geocode response "+o+" namespace is not the expected one");if("schemaLocation"===s&&l.SCHEMALOCATION!==t[o])return void console.log("[ReverseGeocodeResponseReader] geocode response schema location is not the expected one")}}}var l={};return l.VERSION="1.2",l.NAMESPACES={xmlns:"http://www.opengis.net/xls",gml:"http://www.opengis.net/gml",xls:"http://www.opengis.net/xls",xlsext:"http://www.opengis.net/xlsext",xsi:"http://www.w3.org/2001/XMLSchema-instance"},l.SCHEMALOCATION="http://wxs.ign.fr/schemas/olsAll.xsd",l.DEFAULTPREFIX="xls",l.READERS={xls:{XLS:function(e){var t=new r;return c(e),i(e,t),t},ReverseGeocodedLocation:function(e,t){var o=new s;i(e,o),t&&Array.isArray(t.locations)&&t.locations.push(o)},Address:function(e,t){var o=e.getAttribute("countryCode");t&&o&&(t.type=o),i(e,t)},Building:function(e,t){var o=e.getAttribute("number");t&&t.hasOwnProperty("placeAttributes")&&(o?t.placeAttributes.number=o:e.getAttribute("buildingName")?t.placeAttributes.number=e.getAttribute("buildingName"):e.getAttribute("subdivision")&&(t.placeAttributes.number=e.getAttribute("subdivision")))},Street:function(e,t){"StreetAddress"===t.type?t.placeAttributes.street=a(e):"CadastralParcel"===t.type&&(t.placeAttributes.cadastralParcel=a(e))},Place:function(e,t){var o=e.getAttribute("type"),r=a(e);if(t&&t.hasOwnProperty("placeAttributes"))if("Municipality"===o)t.placeAttributes.municipality=r;else if("Bbox"===o){var s=r.split(";");4===s.length&&(t.placeAttributes.bbox={left:parseFloat(s[0]),right:parseFloat(s[2]),top:parseFloat(s[1]),bottom:parseFloat(s[3])})}else"Commune"===o?t.placeAttributes.commune=r:"Departement"===o?t.placeAttributes.department=r:"INSEE"===o?t.placeAttributes.insee=r:"Qualite"===o?t.placeAttributes.quality=r:"Territoire"===o?t.placeAttributes.territory=r:"ID"===o?t.placeAttributes.ID=r:"ID_TR"===o?t.placeAttributes.IDTR=r:"Importance"===o?t.placeAttributes.importance=parseInt(r,10):"Nature"===o?t.placeAttributes.nature=r:"Numero"===o?t.placeAttributes.number=r:"Feuille"===o?t.placeAttributes.sheet=r:"Section"===o?t.placeAttributes.section=r:"CommuneAbsorbee"===o?t.placeAttributes.absorbedCity=r:"Arrondissement"===o?r&&(t.placeAttributes.arrondissement=r):"Type"===o?t.placeAttributes.origin=r:"Prefecture"===o?t.placeAttributes.prefecture=r:"InseeRegion"===o?t.placeAttributes.inseeRegion=r:"InseeDepartment"===o&&(t.placeAttributes.inseeDepartment=r)},PostalCode:function(e,t){t&&t.hasOwnProperty("placeAttributes")&&(t.placeAttributes.postalCode=a(e))},SearchCentreDistance:function(e,t){t&&(t.searchCenterDistance=parseFloat(e.getAttribute("value")))},Error:function(e){var r=e.getAttribute("message"),s=e.getAttribute("errorCode"),n=t.getMessage("SERVICE_RESPONSE_EXCEPTION","("+s+") : "+r);throw new o({message:n,type:o.TYPE_SRVERR})}},gml:{pos:function(e,t){var o=a(e);t&&o&&(t.position={x:parseFloat(o.split(" ")[0]),y:parseFloat(o.split(" ")[1])})}},xlsext:{ExtendedGeocodeMatchCode:function(e,t){t&&(t.matchType=a(e))}},ExceptionReport:function(e){var t={};if(e.hasChildNodes())for(var o,r=e.childNodes,s=0;s__ROUTEPREFERENCE____GRAPH____WAYPOINTLIST____AVOIDLIST__",routePreference:"__VALUEROUTEPREFERENCE__",graph:'',wayPointList:{container:"__STARTPOINT____VIAPOINT____ENDPOINT__",point:'__X__ __Y__',startPoint:"__POINT__",endPoint:"__POINT__",viaPoint:"__POINT__"},avoidList:{container:"__AVOIDFEATURE__",avoidFeature:"__VALUEAVOIDFEATURE__"}},toString:function(){var e="";if(e=this.template.routePlan,this.options.routePreference){var t=this.template.routePreference;t=t.replace(/__VALUEROUTEPREFERENCE__/,this.options.routePreference),e=e.replace(/__ROUTEPREFERENCE__/g,t)}if(e=e.replace(/__ROUTEPREFERENCE__/g,""),this.options.avoidFeature){for(var o=this.template.avoidList.container,r=[],s=0;s__ROUTEPLAN____ROUTEINSTRUCTIONREQUEST____ROUTEGEOMETRYREQUEST____ROUTEMAPREQUEST__',routeInstructionRequest:'',routeGeometryRequest:"",routeMapRequest:""},addRoute:function(e){e instanceof t&&(this.oRoutePlan=e)},constructor:o,toString:function(){var e="";if(e=this.template.determineRouteRequest,e=e.replace(/__DISTANCEUNIT__/g,this.options.distanceUnit||"KM"),!this.oRoutePlan){var o=this.options.route;if(this.oRoutePlan=new t(o),!this.oRoutePlan)throw new Error("La construction du calcul d'initineraire n'est pas correctement definie !?")}e=e.replace(/__ROUTEPLAN__/g,this.oRoutePlan.toString());var r=this.template.routeInstructionRequest;r=r.replace(/__PROVIDEGEOMETRY__/g,this.options.provideGeometry||!1),r=r.replace(/__PROVIDEBBOX__/g,this.options.provideBoundingBox||!1),e=e.replace(/__ROUTEINSTRUCTIONREQUEST__/g,r);var s=this.template.routeGeometryRequest;e=e.replace(/__ROUTEGEOMETRYREQUEST__/g,s);var n=this.template.routeMapRequest;return e=e.replace(/__ROUTEMAPREQUEST__/g,n),this.strRequest=e,this.strRequest}},o}(UtilsLoggerByDefault,FormatsXLSRouteServiceModelRoutePlan),FormatsXLSRouteServiceRouteRequestExtension=void 0,FormatsXLSRouteService=function(e,t,o,r){function s(e){if(!(this instanceof s))throw new TypeError("RouteService constructor cannot be called as a function.");this.CLASSNAME="RouteService",this.CLASSTYPE="RouteRequest",t.apply(this,arguments)}return s.prototype=Object.create(t.prototype,{}),s.prototype.constructor=s,s.prototype.addRequest=function(e){if("DetermineRouteRequest"!==e.CLASSNAME)throw new Error("Ce n'est pas un objet de type 'Route Request' !?");this.oRequest=e},s.prototype.addFilter=function(e){e instanceof r&&(this.oFilter=e)},s.prototype.toString=function(){if(!this.oRequest){if(!this.options)throw new Error("Les options ne sont pas renseignées, impossible de construire la requête !");if("RouteRequest"===this.CLASSTYPE){var e={distanceUnit:this.options.distanceUnit||null,provideGeometry:this.options.provideGeometry||null,provideBoundingBox:this.options.provideBoundingBox||null,route:{routePreference:this.options.routePreference||null,startPoint:this.options.startPoint,viaPoint:this.options.viaPoint||null,endPoint:this.options.endPoint,avoidFeature:this.options.avoidFeature||null,graph:this.options.graph||null,expectedStartTime:this.options.expectedStartTime||null}};this.oRequest=new o(e),this.oFilter&&this.oRequest.addFilter(this.oFilter)}}if(!this.oRequest)throw new Error("Type de requête indefini !");return this.strRequest=this.oRequest.toString(),this.strRequest},s}(UtilsLoggerByDefault,FormatsXLSAbstractService,FormatsXLSRouteServiceDetermineRouteRequest,FormatsXLSRouteServiceRouteRequestExtension),ServicesRouteRequestRouteRequestOLS=function(e,t,o){var r={build:function(e){var r=null,s={startPoint:e.startPoint,endPoint:e.endPoint,viaPoint:e.viaPoints,provideBoundingBox:e.provideBbox,avoidFeature:e.exclusions,expectedStartTime:e.expectedStartTime,distanceUnit:e.distanceUnit,graph:e.graph,provideGeometry:e.geometryInInstructions,routePreference:e.routePreference},n=new o(s),i=new t({srsName:e.srs,maximumResponses:e.maximumResponses});if(i.namespace=!0,i.setService(n),r=i.build(),"GET"==e.httpMethod){var a="qxml="+encodeURIComponent(r).replace(/\-/g,"%2D").replace(/\_/g,"%5F").replace(/\./g,"%2E").replace(/\!/g,"%21").replace(/\~/g,"%7E").replace(/\*/g,"%2A").replace(/\'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29");r=a}return r}};return r}(UtilsLoggerByDefault,FormatsXLS,FormatsXLSRouteService),ServicesRouteRequestModelRouteParamREST=function(e){function t(e){if(!(this instanceof t))throw new TypeError("RouteParamREST constructor cannot be called as a function.");if(this.options=e||{},this.origin=this.options.startPoint.x+","+this.options.startPoint.y,this.destination=this.options.endPoint.x+","+this.options.endPoint.y,this.waypoints=this.options.viaPoints||null,this.startDateTime=this.options.expectedStartTime||null,this.graphName=this.options.graph,this.srs=this.options.srs,this.exclusions=this.options.exclusions,this.method="TIME",this.options.routePreference){var o=this.options.routePreference;switch(o){case"fastest":this.method="TIME";break;case"shortest":this.method="DISTANCE";break;default:this.method="TIME"}}this.format=this.options.geometryInInstructions?"STANDARDEXT":"STANDARD",this.tolerance=10,this.profileId=null,this.profileName=null}return t.CLASSNAME="RouteParamREST",t.prototype={constructor:t,getWaypoints:function(){if(this.waypoints){for(var e=[],t=0;t\n\n__ID__ \n __X__\n __Y__\n \n __SRS__\n __GRAPHNAME__\n__PROFIL____EXCLUSIONS__ __METHOD__\n__TIME____DISTANCE__ __REVERSE__\n __SMOOTHING__\n __HOLES__\n',id:" __IDVALUE__\n",profil:" __PROFILID__\n __PROFILNAME__\n",exclusions:{container:" \n__EXCLUSIONFEATURE__\n \n",feature:" __EXCLUSIONVALUE__"},time:" \n",distance:" __DISTANCEVALUE__\n"},processRequestString:function(){var e="";switch(this.mode){case"GET":var t=new o(this.settings),r=t.getParams();for(var s in r)e&&(e+="&"),e+=r[s].k+"="+r[s].v;break;case"POST":if(e=this.template.container,e=e.replace(/__ID__/g,""),e=e.replace(/__PROFIL__/g,""),e=e.replace(/__X__/g,this.settings.position.x),e=e.replace(/__Y__/g,this.settings.position.y),e=e.replace(/__GRAPHNAME__/g,this.settings.graph),e=e.replace(/__SRS__/g,this.settings.srs),e=e.replace(/__SMOOTHING__/g,this.settings.smoothing),e=e.replace(/__HOLES__/g,this.settings.holes),e=e.replace(/__REVERSE__/g,this.settings.reverse),this.settings.exclusions){for(var n=this.template.exclusions.container,i=[],a=0;an;n++){"undefined"==typeof s[r[n]]&&(s[r[n]]={});var i=o-1;n===i&&(s[r[n]]=t),s=s[r[n]]}return this}};return O.extend("Protocols",{}),O.extend("Protocols.XHR",e),O.extend("Services",t),O.extend("Services.AltiResponse",o),O.extend("Services.Alti.Elevation",r),O.extend("Services.AutoCompleteResponse",s),O.extend("Services.AutoComplete.SuggestedLocation",n),O.extend("Services.GetConfigResponse",i),O.extend("Services.Config.Constraint",a),O.extend("Services.Config.Format",c),O.extend("Services.Config.Layer",l),O.extend("Services.Config.Legend",u),O.extend("Services.Config.Metadata",p),O.extend("Services.Config.Originator",h),O.extend("Services.Config.Service",f),O.extend("Services.Config.Style",d),O.extend("Services.Config.Territory",g),O.extend("Services.Config.Thematic",n),O.extend("Services.Config.TileMatrix",R),O.extend("Services.Config.TileMatrixLimit",v),O.extend("Services.Config.TileMatrixSet",S),O.extend("Services.GeocodeResponse",E),O.extend("Services.Geocode.GeocodedLocation",_),O.extend("Services.Geocode.DirectGeocodedLocation",y),O.extend("Services.Geocode.ReverseGeocodedLocation",w),O.extend("Services.IsoCurveResponse",A),O.extend("Services.RouteResponse",P),O.extend("Services.Route.RouteInstruction",T),O.extend("Error",M),C.Gp=O,C.Gp}(ProtocolsXHR,ServicesServices,ServicesAltiResponseModelAltiResponse,ServicesAltiResponseModelElevation,ServicesAutoCompleteResponseModelAutoCompleteResponse,ServicesAutoCompleteResponseModelSuggestedLocation,ServicesAutoConfResponseModelAutoConfResponse,ServicesAutoConfResponseModelConstraint,ServicesAutoConfResponseModelFormat,ServicesAutoConfResponseModelLayer,ServicesAutoConfResponseModelLegend,ServicesAutoConfResponseModelMetadata,ServicesAutoConfResponseModelOriginator,ServicesAutoConfResponseModelService,ServicesAutoConfResponseModelStyle,ServicesAutoConfResponseModelTerritory,ServicesAutoConfResponseModelThematic,ServicesAutoConfResponseModelTileMatrix,ServicesAutoConfResponseModelTileMatrixLimit,ServicesAutoConfResponseModelTileMatrixSet,ServicesGeocodeResponseModelGeocodeResponse,ServicesGeocodeResponseModelGeocodedLocation,ServicesGeocodeResponseModelDirectGeocodedLocation,ServicesGeocodeResponseModelReverseGeocodedLocation,ServicesProcessIsoCurveResponseModelProcessIsoCurveResponse,ServicesRouteResponseModelRouteResponse,ServicesRouteResponseModelRouteInstruction,ExceptionsErrorService); +e.wps.identifier="gs:WPSLineElevation",n=new s(e.param);break;default:throw new Error(t.getMessage("PARAM_TYPE","type (Elevation or Profil)"))}var i={data:n,method:e.method,param:e.wps},a=new o(i);if(!a.processRequestString())throw new Error("Enable to process request !");return a.requestString}};return n}(UtilsLoggerByDefault,UtilsMessagesResources,FormatsWPS,ServicesAltiRequestModelAltiElevationRequest,ServicesAltiRequestModelAltiProfilRequest),ServicesAltiRequestAltiRequestFactory=function(e,t,o,r){var s={build:function(e){var s=null,n={type:e.sampling?"Profil":"Elevation",method:e.httpMethod,param:{positions:null,delimiter:null,indent:null,crs:null,format:null,sampling:null,zonly:null}};n.param.positions=e.positions,n.param.format=e.outputFormat,n.param.sampling=e.sampling,n.param.zonly=e.zonly;var i=null!==e.onError&&"function"==typeof e.onError?!0:!1,a=null!==e.onSuccess&&"function"==typeof e.onSuccess?!0:!1,c=null;switch(e.api){case"REST":var l=new o(n);if(!l.processRequestString()){if(c="Error in process request (rest) !",i)return void e.onError.call(e.scope,new t(c));throw new Error(c)}s=l.requestString;break;case"WPS":if(n.wps={service:null,version:null,identifier:null,rawdataoutput:null,request:null},s=r.build(n),!s){if(c="Error in process request (wps) !",i)return void e.onError.call(e.scope,new t(c));throw new Error(c)}break;default:if(c="Type of API is not supported by service (REST or WPS) !",i)return void e.onError.call(e.scope,new t(c));throw new Error(c)}return a&&e.onSuccess.call(e.scope,s),s}};return s}(UtilsLoggerByDefault,ExceptionsErrorService,ServicesAltiRequestAltiRequestREST,ServicesAltiRequestAltiRequestWPS),FormatsXML=function(e){function t(e){if(!(this instanceof t))throw new TypeError("XML constructor cannot be called as a function.");this.xmlString=null,this.xmlDoc=null,this.reader=null,e&&(e.xmlString&&"string"==typeof e.xmlString&&(this.xmlString=e.xmlString,this.xmlDoc=o(e.xmlString)),e.reader&&this.setReader(e.reader))}function o(e){if("object"==typeof exports){var t=xmldom.DOMParser;return(new t).parseFromString(e,"text/xml")}var o,r,s="Erreur lors du parsing de la réponse du service : XML non conforme";if(window.ActiveXObject){r=new window.ActiveXObject("Microsoft.XMLDOM"),r.async=!1,r.loadXML(e);var n=r.parseError;if(n.errorCode)throw n.line&&n.linepos&&(s+="( ligne "+n.line+", colonne "+n.linepos),n.reason&&(s+=": "+n.reason+")"),new Error(s);return r}if(window.DOMParser){o=new window.DOMParser;try{r=o.parseFromString(e,"text/xml")}catch(i){throw"SyntaxError"===i.message?new Error(s):new Error("Erreur lors du parsing de la réponse du service : "+i.message)}if(r.getElementsByTagName("parsererror").length>0)for(var a=r.getElementsByTagName("parsererror"),c=0;c0){var o=n(e);t.attributes=o}if(e.hasChildNodes())for(var r,i={},a=e.childNodes,c=0;c0){for(var t={},o=e.attributes,r=0;r0){for(var t={},o=e.attributes,r=0;r0){var t=g(e);for(var o in t)if(t.hasOwnProperty(o)){if("version"===o&&t.version!==S.VERSION)return void console.log("[AutoConfResponseReader] autoconf version is not the expected one : there may be errors in parsing");if("xmlns"===o){if(t[o]!==S.NAMESPACES.xmlns)return void console.log("[AutoConfResponseReader] autoconf response default namespace is not the expected one");continue}var r=o.split(":")[0],s=o.split(":")[1];if("xmlns"===r&&s&&S.NAMESPACES[s]&&S.NAMESPACES[s]!==t[o])return void console.log("[AutoConfResponseReader] autoconf response "+o+" namespace is not the expected one");if("schemaLocation"===s&&t[o]!==S.SCHEMALOCATION[0]&&t[o]!==S.SCHEMALOCATION[1])return void console.log("[AutoConfResponseReader] autoconf response schema location is not the expected one")}}}var S={};return S.VERSION="1.1.0",S.NAMESPACES={xmlns:"http://www.opengis.net/context",gpp:"http://api.ign.fr/geoportail",ows:"http://www.opengis.net/ows/1.1",sld:"http://www.opengis.net/sld",wmts:"http://www.opengis.net/wmts/1.0",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},S.SCHEMALOCATION=["http://www.opengis.net/context http://gpp3-wxs.ign.fr/schemas/extContext.xsd http://api.ign.fr/geoportail http://wxs.ign.fr/schemas/autoconf/autoconf.xsd","http://www.opengis.net/context http://gpp3-wxs.ign.fr/schemas/extContext.xsd http://api.ign.fr/geoportail http://gpp3-wxs.ign.fr/schemas/autoconf.xsd"],S.DEFAULTPREFIX="context",S.READERS={context:{ViewContext:function(e){v(e);var o=new t;return m(e,o),o},Title:function(e,t){t&&t.generalOptions?t.generalOptions.title=R(e):t&&t.lyr&&(t.lyr.title=R(e))},Abstract:function(e,t){t&&t.lyr&&(t.lyr.description=R(e))},Server:function(e,t){var o=e.getAttribute("service"),r=e.getAttribute("title"),s=e.getAttribute("version");if(o)if(t&&t.services&&"object"==typeof t.services&&!t.services[o]){var n=new c;n.title=r,n.version=s,m(e,n),t.services[o]=n}else t&&t.lyr&&(t.lyr.serviceParams||(t.lyr.serviceParams={}),t.lyr.serviceParams.id=o,t.lyr.serviceParams.version=s)},OnlineResource:function(e,t){t&&t.hasOwnProperty("serverUrl")&&(t.serverUrl=e.getAttribute("xlink:href"))},LayerList:function(e,t){if(m(e,t),t&&t.layers&&t.generalOptions&&t.services)for(var o in t.layers)if(t.layers.hasOwnProperty(o)){var r=t.layers[o],s=r.apiKeys;if(s&&Array.isArray(s))for(var n=0;n0?this.options.serverUrl=o.apiKeys:this.options.serverUrl=o.apiKey}"XHR"===this.options.protocol&&"POST"===this.options.httpMethod&&(this.options.httpMethod="GET"),this.options.outputFormat="xml"}return a.prototype=Object.create(n.prototype,{}),a.prototype.constructor=a,a.prototype.buildRequest=function(e,t){var o="undefined"!=typeof window?window:{};if(o.Gp&&o.Gp.Config&&o.Gp.Config.generalOptions&&o.Gp.Config.layers&&o.Gp.Config.generalOptions.apiKeys[this.options.apiKey]){if(!this.options.layerId)return void this.options.onSuccess.call(this,o.Gp.Config);if(o.Gp.Config.layers[this.options.layerId]&&o.Gp.Config.layers[this.options.layerId].aggregatedLayers)return void this.options.onSuccess.call(this,o.Gp.Config)}this.request="";var s;s=-1===this.options.serverUrl.indexOf("http://")?!0:!1,!s&&this.layerId&&(this.request=r.normalyzeParameters({layerId:this.layerId})),t.call(this,this.request)},a.prototype.analyzeResponse=function(e,r){if(this.response){var s={layerId:this.options.layerId,response:this.response,rawResponse:this.options.rawResponse,onSuccess:r,onError:e,scope:this};i.build(s)}else e.call(this,new o(t.getMessage("SERVICE_RESPONSE_EMPTY")))},a}(UtilsLoggerByDefault,UtilsMessagesResources,ExceptionsErrorService,UtilsHelper,ServicesDefaultUrlService,ServicesCommonService,ServicesAutoConfResponseAutoConfResponseFactory),FormatsXLSRequestHeader=function(e){function t(e){if(!(this instanceof t))throw new TypeError("RequestHeader constructor cannot be called as a function.");this.options=e||{srsName:"EPSG:4326"};for(var o in e)e.hasOwnProperty(o)&&(this.options[o]=e[o])}return t.prototype={requestString:null,template:'',constructor:t,toString:function(){var e=null;return e=this.template,e=e.replace(/__SRSNAME__/g,this.options.srsName),this.requestString=e,this.requestString}},t}(UtilsLoggerByDefault),FormatsXLSRequest=function(e){function t(e){if(!(this instanceof t))throw new TypeError("Request constructor cannot be called as a function.");this.options=e||{maximumResponses:25,methodName:null,version:"1.2"};for(var o in e)e.hasOwnProperty(o)&&(this.options[o]=e[o])}return t.prototype={requestString:null,template:'',constructor:t,guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0,o="x"===e?t:3&t|8;return o.toString(16)})},toString:function(){var e=null;return e=this.template,e=e.replace(/__MAXRESPONSES__/g,this.options.maximumResponses),e=e.replace(/__METHODNAME__/g,this.options.methodName),e=e.replace(/__UUID__/g,this.guid()),e=e.replace(/__VERSION__/g,this.options.version),this.requestString=e,this.requestString}},t}(UtilsLoggerByDefault),FormatsXLSAbstractService=function(e){function t(e){if(!(this instanceof t))throw new TypeError("AbstractService constructor cannot be called as a function.");this.options=e||{};for(var o in e)e.hasOwnProperty(o)&&(this.options[o]=e[o])}return t.prototype={strRequest:null,oRequest:null,oFilter:null,constructor:t,addRequest:function(e){},addFilter:function(e){},toString:function(){}},t}(UtilsLoggerByDefault),FormatsXLS=function(e,t,o,r){function s(e){if(!(this instanceof s))throw new TypeError("XLS constructor cannot be called as a function.");this.options={srsName:"EPSG:4326",maximumResponses:25};for(var t in e)e.hasOwnProperty(t)&&e[t]&&(this.options[t]=e[t])}return s.VERSION="1.2",s.prototype={requestString:null,namespace:!1,oService:null,constructor:s,template:'\n\n__REQUESTHEADER__\n__REQUEST__\n\n',namespaceByDefault:function(){var e=['xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"','xmlns:xls="http://www.opengis.net/xls"','xmlns:gml="http://www.opengis.net/gml"'];return e.join(" ")},schemaLocationByDefault:function(){return'xsi:schemaLocation="http://www.opengis.net/xls http://schemas.opengis.net/ols/1.2/olsAll.xsd"'},setService:function(e){e&&e instanceof r&&(this.oService=e)},getService:function(){return this.oService}},s.prototype.addNamespace=function(e,t){for(var o=e.key,r=!1,s=this.namespaceByDefault().split(" "),n=0;n])/g,u="<"+o+":$1",t=t.replace(l,u),l=/<\/(\w+[\s>])/g,u="/g,this.getService().toString())),r?(this.namespace&&(r=this.addNamespace({key:"xls",url:"http://www.opengis.net/xls"},r)),this.requestString=r,this.requestString):void 0},s}(UtilsLoggerByDefault,FormatsXLSRequestHeader,FormatsXLSRequest,FormatsXLSAbstractService),FormatsXLSLocationUtilityServiceModelAddress=function(e,t){function o(e){if(!(this instanceof o))throw new TypeError("Address constructor cannot be called as a function.");if(this.options=e||{location:{},type:["StreetAddress"],filter:{}},!e.location)throw new Error("l'option 'location' n'est pas renseignée !");for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t])}return o.prototype={constructor:o,requestString:null,template:{address:'
__LOCATION____PLACE____POSTALCODE____ENVELOPE__
',location:{freeFormAddress:"__FREEFORMADDRESSVALUE__",streetAddress:{container:"__STREET____BUILDING__",building:'',street:"__STREETVALUE__"}},place:'__PLACEVALUE__',postalCode:"__POSTALCODEVALUE__",envelope:"__LEFT__ __BOTTOM____RIGHT__ __TOP__"}},o.prototype.toString=function(){var e=null;if(e=this.template.address,e=e.replace(/__COUNTRYCODE__/g,this.options.type),"string"==typeof this.options.location){var t=this.template.location.freeFormAddress;t=t.replace(/__FREEFORMADDRESSVALUE__/g,this.options.location),e=e.replace(/__LOCATION__/g,t)}else{var o="",r="";this.options.location.number&&(o=this.template.location.streetAddress.building,o=o.replace(/__BUILDINGVALUE__/g,this.options.location.number)),this.options.location.street&&(r=this.template.location.streetAddress.street,r=r.replace(/__STREETVALUE__/g,this.options.location.street));var s=this.template.location.streetAddress.container;s=s.replace(/__STREET__/g,r),s=s.replace(/__BUILDING__/g,o),e=e.replace(/__LOCATION__/g,s)}var n="";this.options.location.postalCode&&(n=this.template.postalCode,n=n.replace(/__POSTALCODEVALUE__/g,this.options.location.postalCode));var i="";if(this.options.filter){var a=this.options.filter.bbox;a&&(i=this.template.envelope,i=i.replace(/__LEFT__/g,a.left),i=i.replace(/__BOTTOM__/g,a.bottom),i=i.replace(/__RIGHT__/g,a.right),i=i.replace(/__TOP__/g,a.top))}var c=[],l="";if(this.options.filter){var u=this.options.filter;for(var p in u)"bbox"!==p&&(l=this.template.place,l=l.replace(/__PLACETYPE__/g,p),l=l.replace(/__PLACEVALUE__/g,u[p]),c.push(l))}var h="";return this.options.location.city&&(h=this.template.place,h=h.replace(/__PLACETYPE__/g,"Municipality"),h=h.replace(/__PLACEVALUE__/g,this.options.location.city),c.push(h)),e=e.replace(/__POSTALCODE__/g,n),e=e.replace(/__PLACE__/g,c.join("\n")),e=e.replace(/__ENVELOPE__/g,i),this.requestString=e,this.requestString},o}(Gp,UtilsLoggerByDefault),FormatsXLSLocationUtilityServiceGeocodeFilterExtension=function(e){function t(){if(!(this instanceof t))throw new TypeError("GeocodeFilterExtension constructor cannot be called as a function.");this.filters=[]}return t.prototype={constructor:t,addFilterExtensions:function(e){e&&this.filters.push(e)},getNames:function(){var e=[];for(var t in this.filters)e.push(this.filters[t].CLASSNAME);return e},getFilter:function(e){var t=null;for(var o in this.filters)this.filters[o].CLASSNAME==e&&(t=this.filters[o]);return t},getFilters:function(){return this.filters},getAttributs:function(e){var t=[];for(var o in this.filters)this.filters[o].CLASSNAME==e&&(t=this.filters[o].attributesList);return t},setPlaceAttributs:function(e,t){var o=this.getFilter(e),r=this.getAttributs(e);for(var s in r){var n=r[s];t[n]&&(o.placeAttributes[n]=t[n])}},getPlaceAttributs:function(e){var t={};for(var o in this.filters)this.filters[o].CLASSNAME==e&&(t=this.filters[o].placeAttributes);return t}},t}(UtilsLoggerByDefault),FormatsXLSLocationUtilityServiceGeocodeRequest=function(e,t,o){function r(e){if(!(this instanceof r))throw new TypeError("GeocodeRequest constructor cannot be called as a function.");this.options=e||{};for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);this.CLASSNAME="GeocodeRequest"}return r.prototype={strRequest:null,oAddress:null,oFilter:null,template:'__ADDRESS__',addAddress:function(e){e instanceof t&&(this.oAddress=e)},addFilter:function(e){e instanceof o&&(this.oFilter=e)},constructor:r,toString:function(){var e="";if(e=this.template,!this.oAddress){var o={};if(o.location=this.options.location,o.type=this.options.filterOptions.type||["StreetAddress"],o.filter=this.options.filterOptions,delete o.filter.type,this.oFilter){o.filter={};for(var r in o.type){var s=o.type[r],n=this.oFilter.getFilter(s);if(n){for(var i=this.options.filterOptions,a=n.attributesList,c=0;c__GMLPOINT____GMLFILTER__",gml:{point:'__X__ __Y__',pos:null,filter:{bbox:'__LEFT__ __BOTTOM____RIGHT__ __TOP__',circle:'__X__ __Y____RADIUS__',polygon:'__XY__',multipolygon:null}}}},t.prototype.toString=function(){var e=this.template.position,t=this.template.gml.point;t=t.replace(/__X__/g,this.options.position.x),t=t.replace(/__Y__/g,this.options.position.y);var o="";if(this.options.filter){var r=this.options.filter;for(var s in r)switch(s){case"circle":o=this.template.gml.filter[s],o=o.replace(/__X__/g,r[s].x),o=o.replace(/__Y__/g,r[s].y),o=o.replace(/__RADIUS__/g,r[s].radius);break;case"bbox":o=this.template.gml.filter[s],o=o.replace(/__LEFT__/g,r[s].left),o=o.replace(/__BOTTOM__/g,r[s].bottom),o=o.replace(/__RIGHT__/g,r[s].right),o=o.replace(/__TOP__/g,r[s].top);break;case"polygon":o=this.template.gml.filter[s];for(var n="",i=r[s],a=0;a__TYPE__"},t.prototype.toString=function(){var e=[],t="";for(var o in this.type)t=this.template,t=t.replace(/__TYPE__/g,this.type[o]),e.push(t);return this.strRequest=e.join("\n"),this.strRequest},t}(UtilsLoggerByDefault),FormatsXLSLocationUtilityServiceReverseGeocodeRequest=function(e,t,o){function r(e){if(!(this instanceof r))throw new TypeError("ReverseGeocodeRequest constructor cannot be called as a function.");this.options=e||{};for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);this.CLASSNAME="ReverseGeocodeRequest"}return r.prototype={strRequest:null,oPosition:null,oPreference:null,constructor:r,template:'__POSITION____PREFERENCE__',addPosition:function(e){e instanceof t&&(this.oPosition=e)},addPreferences:function(e){e instanceof o&&(this.oPreference=e)},toString:function(){var e="";if(e=this.template,!this.oPreference&&(this.oPreference=new o(this.options.filterOptions.type||["StreetAddress"]),!this.oPreference))throw new Error("Les preferences ne sont pas definies !?");if(e=e.replace(/__PREFERENCE__/g,this.oPreference.toString()),!this.oPosition){var r={position:this.options.position,filter:{}};if(this.options.filterOptions&&(r.filter=this.options.filterOptions,delete r.filter.type),this.oPosition=new t(r),!this.oPosition)throw new Error("La position et ses filtres ne sont pas definis !?")}return e=e.replace(/__POSITION__/g,this.oPosition.toString()),e=e.replace(/__RETURNFREEFORM__/g,this.options.returnFreeForm?"true":"false"),this.strRequest=e,this.strRequest}},r}(UtilsLoggerByDefault,FormatsXLSLocationUtilityServiceModelPosition,FormatsXLSLocationUtilityServiceModelPreference),FormatsXLSLocationUtilityService=function(e,t,o,r,s){function n(e){if(!(this instanceof n))throw new TypeError("LocationUtilityService constructor cannot be called as a function.");this.CLASSNAME="LocationUtilityService",this.CLASSTYPE=null,t.apply(this,arguments),this.options&&(this.CLASSTYPE=this.options.location?"GeocodeRequest":this.options.position?"ReverseGeocodeRequest":null)}return n.prototype=Object.create(t.prototype,{}),n.prototype.constructor=n,n.prototype.addRequest=function(e){switch(this.CLASSTYPE=e.CLASSNAME,this.CLASSTYPE){case"GeocodeRequest":case"ReverseGeocodeRequest":this.oRequest=e;break;default:throw new Error("Ce n'est pas un objet de type 'LUS Request' !?")}},n.prototype.addFilter=function(e){e instanceof s&&(this.oFilter=e)},n.prototype.toString=function(){if(!this.oRequest){if(!this.options)throw new Error("Les options ne sont pas renseignées, impossible de construire la requête !");if("GeocodeRequest"===this.CLASSTYPE){var e={location:this.options.location,returnFreeForm:this.options.returnFreeForm,filterOptions:this.options.filterOptions||{}};this.oRequest=new o(e),this.oFilter&&this.oRequest.addFilter(this.oFilter)}else if("ReverseGeocodeRequest"===this.CLASSTYPE){var t={position:this.options.position,returnFreeForm:this.options.returnFreeForm,filterOptions:this.options.filterOptions||{}};this.oRequest=new r(t)}}if(!this.oRequest)throw new Error("Type de Geocodage indefini !");return this.strRequest=this.oRequest.toString(),this.strRequest},n}(UtilsLoggerByDefault,FormatsXLSAbstractService,FormatsXLSLocationUtilityServiceGeocodeRequest,FormatsXLSLocationUtilityServiceReverseGeocodeRequest,FormatsXLSLocationUtilityServiceGeocodeFilterExtension),ServicesGeocodeRequestGeocodeLocation=function(){function e(){if(!(this instanceof e))throw new TypeError("GeocodeLocation constructor cannot be called as a function.");this.placeAttributes={},this.attributesList=[],this.serviceAttributes=[]}return e.prototype={constructor:e},e}(),ServicesGeocodeRequestModelStreetAddress=function(e){function t(){if(!(this instanceof t))throw new TypeError("StreetAddress constructor cannot be called as a function.");e.apply(this,arguments),this.CLASSNAME="StreetAddress",this.attributesList=["bbox","ID","IDTR","quality","territory","commune","department","insee","municipality"],this.serviceAttributes=["bbox","ID","IDTR","Qualite","Territoire","Commune","Departement","INSEE","Municipality"]}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t}(ServicesGeocodeRequestGeocodeLocation),ServicesGeocodeRequestModelPositionOfInterest=function(e){function t(){if(!(this instanceof t))throw new TypeError("PositionOfInterest constructor cannot be called as a function.");e.apply(this,arguments),this.CLASSNAME="PositionOfInterest",this.attributesList=["bbox","importance","nature","territory","commune","department","insee","municipality"],this.serviceAttributes=["bbox","Importance","Nature","Territoire","Commune","Departement","INSEE","Municipality"]}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t}(ServicesGeocodeRequestGeocodeLocation),ServicesGeocodeRequestModelCadastralParcel=function(e){function t(){if(!(this instanceof t))throw new TypeError("CadastralParcel constructor cannot be called as a function.");e.apply(this,arguments),this.CLASSNAME="CadastralParcel",this.attributesList=["absorbedCity","sheet","number","section","commune","department","insee","municipality","origin"],this.serviceAttributes=["CommuneAbsorbee","Feuille","Numero","Section","Commune","Departement","INSEE","Municipality","Type"]}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t}(ServicesGeocodeRequestGeocodeLocation),ServicesGeocodeRequestModelAdministratif=function(e){function t(){if(!(this instanceof t))throw new TypeError("Administratif constructor cannot be called as a function.");e.apply(this,arguments),this.CLASSNAME="Administratif",this.attributesList=["bbox","prefecture","inseeRegion","inseeDepartment","municipality"],this.serviceAttributes=["bbox","Prefecture","InseeRegion","InseeDepartement","Municipality"]}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t}(ServicesGeocodeRequestGeocodeLocation),ServicesGeocodeRequestDirectGeocodeRequestFactory=function(e,t,o,r,s,n,i,a){var c={build:function(e){var c=null,l=new r;l.addFilterExtensions(new a),l.addFilterExtensions(new s),l.addFilterExtensions(new n),l.addFilterExtensions(new i);var u=new o({location:e.location,returnFreeForm:e.returnFreeForm,filterOptions:e.filterOptions});u.addFilter(l);var p=new t({srsName:e.srs,maximumResponses:e.maximumResponses});if(p.namespace=!0,p.setService(u),c=p.build(),"GET"==e.httpMethod){var h="qxml="+encodeURIComponent(c).replace(/\-/g,"%2D").replace(/\_/g,"%5F").replace(/\./g,"%2E").replace(/\!/g,"%21").replace(/\~/g,"%7E").replace(/\*/g,"%2A").replace(/\'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29");c=h}return c}};return c}(UtilsLoggerByDefault,FormatsXLS,FormatsXLSLocationUtilityService,FormatsXLSLocationUtilityServiceGeocodeFilterExtension,ServicesGeocodeRequestModelStreetAddress,ServicesGeocodeRequestModelPositionOfInterest,ServicesGeocodeRequestModelCadastralParcel,ServicesGeocodeRequestModelAdministratif),ServicesGeocodeResponseModelGeocodeResponse=function(){function e(){if(!(this instanceof e))throw new TypeError("GeocodeResponse constructor cannot be called as a function.");this.locations=[]}return e.prototype={constructor:e},e}(),ServicesGeocodeResponseModelGeocodedLocation=function(){function e(){if(!(this instanceof e))throw new TypeError("GeocodedLocation constructor cannot be called as a function.");this.position={x:null,y:null},this.matchType=null,this.placeAttributes={},this.type=null}return e.prototype={constructor:e},e}(),ServicesGeocodeResponseModelDirectGeocodedLocation=function(e){function t(){if(!(this instanceof t))throw new TypeError("DirectGeocodedLocation constructor cannot be called as a function.");e.apply(this,arguments),this.CLASSNAME="DirectGeocodedLocation",this.accuracy=null}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t}(ServicesGeocodeResponseModelGeocodedLocation),ServicesGeocodeFormatsDirectGeocodeResponseReader=function(e,t,o,r,s){function n(e){if(e.attributes.length>0){for(var t={},o=e.attributes,r=0;r0){var t=n(e);for(var o in t)if(t.hasOwnProperty(o)){if("version"===o&&t.version!==l.VERSION)return void console.log("[DirectGeocodeResponseReader] geocode version is not the expected one : there may be errors in parsing");if("xmlns"===o){if(t[o]!==l.NAMESPACES[l.DEFAULTPREFIX])return void console.log("[DirectGeocodeResponseReader] geocode response default namespace is not the expected one");continue}var r=o.split(":")[0],s=o.split(":")[1];if("xmlns"===r&&s&&l.NAMESPACES[s]&&l.NAMESPACES[s]!==t[o])return void console.log("[DirectGeocodeResponseReader] geocode response "+o+" namespace is not the expected one");if("schemaLocation"===s&&l.SCHEMALOCATION!==t[o])return void console.log("[DirectGeocodeResponseReader] geocode response schema location is not the expected one")}}}var l={};return l.VERSION="1.2",l.NAMESPACES={xmlns:"http://www.opengis.net/xls",gml:"http://www.opengis.net/gml",xls:"http://www.opengis.net/xls",xlsext:"http://www.opengis.net/xlsext",xsi:"http://www.w3.org/2001/XMLSchema-instance"},l.SCHEMALOCATION="http://wxs.ign.fr/schemas/olsAll.xsd",l.DEFAULTPREFIX="xls",l.READERS={xls:{XLS:function(e){var t=new r;return c(e),i(e,t),t},GeocodedAddress:function(e,t){var o=new s;i(e,o),t&&Array.isArray(t.locations)&&t.locations.push(o)},GeocodeMatchCode:function(e,t){var o=e.getAttribute("accuracy");o&&t&&(t.accuracy=parseFloat(o));var r=e.getAttribute("matchType");r&&t&&(t.matchType=r)},Address:function(e,t){var o=e.getAttribute("countryCode");t&&o&&(t.type=o),i(e,t)},freeFormAddress:function(e,t){t&&t.hasOwnProperty("placeAttributes")&&(t.placeAttributes.freeform=a(e))},Building:function(e,t){var o=e.getAttribute("number");t&&t.hasOwnProperty("placeAttributes")&&(o?t.placeAttributes.number=o:e.getAttribute("buildingName")?t.placeAttributes.number=e.getAttribute("buildingName"):e.getAttribute("subdivision")&&(t.placeAttributes.number=e.getAttribute("subdivision")))},Street:function(e,t){t&&t.hasOwnProperty("placeAttributes")&&("StreetAddress"===t.type?t.placeAttributes.street=a(e):"CadastralParcel"===t.type&&(t.placeAttributes.cadastralParcel=a(e)))},Place:function(e,t){var o=e.getAttribute("type"),r=a(e);if(t&&t.hasOwnProperty("placeAttributes"))if("Municipality"===o)t.placeAttributes.municipality=r;else if("Bbox"===o){var s=r.split(";");4===s.length&&(t.placeAttributes.bbox={left:parseFloat(s[0]),right:parseFloat(s[2]),top:parseFloat(s[1]),bottom:parseFloat(s[3])})}else"Commune"===o?t.placeAttributes.commune=r:"Departement"===o?t.placeAttributes.department=r:"INSEE"===o?t.placeAttributes.insee=r:"Qualite"===o?t.placeAttributes.quality=r:"Territoire"===o?t.placeAttributes.territory=r:"ID"===o?t.placeAttributes.ID=r:"ID_TR"===o?t.placeAttributes.IDTR=r:"Importance"===o?t.placeAttributes.importance=parseInt(r,10):"Nature"===o?t.placeAttributes.nature=r:"Numero"===o?t.placeAttributes.number=r:"Feuille"===o?t.placeAttributes.sheet=r:"Section"===o?t.placeAttributes.section=r:"CommuneAbsorbee"===o?t.placeAttributes.absorbedCity=r:"Arrondissement"===o?r&&(t.placeAttributes.arrondissement=r):"Type"===o?t.placeAttributes.origin=r:"Prefecture"===o?t.placeAttributes.prefecture=r:"InseeRegion"===o?t.placeAttributes.inseeRegion=r:"InseeDepartment"===o&&(t.placeAttributes.inseeDepartment=r)},PostalCode:function(e,t){t&&t.hasOwnProperty("placeAttributes")&&(t.placeAttributes.postalCode=a(e))},Error:function(e){var r=e.getAttribute("message"),s=e.getAttribute("errorCode"),n=t.getMessage("SERVICE_RESPONSE_EXCEPTION","("+s+") : "+r);throw new o({message:n,type:o.TYPE_SRVERR})}},gml:{pos:function(e,t){var o=a(e);t&&o&&(t.position={x:parseFloat(o.split(" ")[0]),y:parseFloat(o.split(" ")[1])})}},ExceptionReport:function(e){var t={};if(e.hasChildNodes())for(var o,r=e.childNodes,s=0;s0){for(var t={},o=e.attributes,r=0;r0){var t=n(e);for(var o in t)if(t.hasOwnProperty(o)){if("version"===o&&t.version!==l.VERSION)return void console.log("[ReverseGeocodeResponseReader] geocode version is not the expected one : there may be errors in parsing");if("xmlns"===o){if(t[o]!==l.NAMESPACES[l.DEFAULTPREFIX])return void console.log("[ReverseGeocodeResponseReader] geocode response default namespace is not the expected one");continue}var r=o.split(":")[0],s=o.split(":")[1];if("xmlns"===r&&s&&l.NAMESPACES[s]&&l.NAMESPACES[s]!==t[o])return void console.log("[ReverseGeocodeResponseReader] geocode response "+o+" namespace is not the expected one");if("schemaLocation"===s&&l.SCHEMALOCATION!==t[o])return void console.log("[ReverseGeocodeResponseReader] geocode response schema location is not the expected one")}}}var l={};return l.VERSION="1.2",l.NAMESPACES={xmlns:"http://www.opengis.net/xls",gml:"http://www.opengis.net/gml",xls:"http://www.opengis.net/xls",xlsext:"http://www.opengis.net/xlsext",xsi:"http://www.w3.org/2001/XMLSchema-instance"},l.SCHEMALOCATION="http://wxs.ign.fr/schemas/olsAll.xsd",l.DEFAULTPREFIX="xls",l.READERS={xls:{XLS:function(e){var t=new r;return c(e),i(e,t),t},ReverseGeocodedLocation:function(e,t){var o=new s;i(e,o),t&&Array.isArray(t.locations)&&t.locations.push(o)},Address:function(e,t){var o=e.getAttribute("countryCode");t&&o&&(t.type=o),i(e,t)},Building:function(e,t){var o=e.getAttribute("number");t&&t.hasOwnProperty("placeAttributes")&&(o?t.placeAttributes.number=o:e.getAttribute("buildingName")?t.placeAttributes.number=e.getAttribute("buildingName"):e.getAttribute("subdivision")&&(t.placeAttributes.number=e.getAttribute("subdivision")))},Street:function(e,t){"StreetAddress"===t.type?t.placeAttributes.street=a(e):"CadastralParcel"===t.type&&(t.placeAttributes.cadastralParcel=a(e))},Place:function(e,t){var o=e.getAttribute("type"),r=a(e);if(t&&t.hasOwnProperty("placeAttributes"))if("Municipality"===o)t.placeAttributes.municipality=r;else if("Bbox"===o){var s=r.split(";");4===s.length&&(t.placeAttributes.bbox={left:parseFloat(s[0]),right:parseFloat(s[2]),top:parseFloat(s[1]),bottom:parseFloat(s[3])})}else"Commune"===o?t.placeAttributes.commune=r:"Departement"===o?t.placeAttributes.department=r:"INSEE"===o?t.placeAttributes.insee=r:"Qualite"===o?t.placeAttributes.quality=r:"Territoire"===o?t.placeAttributes.territory=r:"ID"===o?t.placeAttributes.ID=r:"ID_TR"===o?t.placeAttributes.IDTR=r:"Importance"===o?t.placeAttributes.importance=parseInt(r,10):"Nature"===o?t.placeAttributes.nature=r:"Numero"===o?t.placeAttributes.number=r:"Feuille"===o?t.placeAttributes.sheet=r:"Section"===o?t.placeAttributes.section=r:"CommuneAbsorbee"===o?t.placeAttributes.absorbedCity=r:"Arrondissement"===o?r&&(t.placeAttributes.arrondissement=r):"Type"===o?t.placeAttributes.origin=r:"Prefecture"===o?t.placeAttributes.prefecture=r:"InseeRegion"===o?t.placeAttributes.inseeRegion=r:"InseeDepartment"===o&&(t.placeAttributes.inseeDepartment=r)},PostalCode:function(e,t){t&&t.hasOwnProperty("placeAttributes")&&(t.placeAttributes.postalCode=a(e))},SearchCentreDistance:function(e,t){t&&(t.searchCenterDistance=parseFloat(e.getAttribute("value")))},Error:function(e){var r=e.getAttribute("message"),s=e.getAttribute("errorCode"),n=t.getMessage("SERVICE_RESPONSE_EXCEPTION","("+s+") : "+r);throw new o({message:n,type:o.TYPE_SRVERR})}},gml:{pos:function(e,t){var o=a(e);t&&o&&(t.position={x:parseFloat(o.split(" ")[0]),y:parseFloat(o.split(" ")[1])})}},xlsext:{ExtendedGeocodeMatchCode:function(e,t){t&&(t.matchType=a(e))}},ExceptionReport:function(e){var t={};if(e.hasChildNodes())for(var o,r=e.childNodes,s=0;s__ROUTEPREFERENCE____GRAPH____WAYPOINTLIST____AVOIDLIST__",routePreference:"__VALUEROUTEPREFERENCE__",graph:'',wayPointList:{container:"__STARTPOINT____VIAPOINT____ENDPOINT__",point:'__X__ __Y__',startPoint:"__POINT__",endPoint:"__POINT__",viaPoint:"__POINT__"},avoidList:{container:"__AVOIDFEATURE__",avoidFeature:"__VALUEAVOIDFEATURE__"}},toString:function(){var e="";if(e=this.template.routePlan,this.options.routePreference){var t=this.template.routePreference;t=t.replace(/__VALUEROUTEPREFERENCE__/,this.options.routePreference),e=e.replace(/__ROUTEPREFERENCE__/g,t)}if(e=e.replace(/__ROUTEPREFERENCE__/g,""),this.options.avoidFeature){for(var o=this.template.avoidList.container,r=[],s=0;s__ROUTEPLAN____ROUTEINSTRUCTIONREQUEST____ROUTEGEOMETRYREQUEST____ROUTEMAPREQUEST__',routeInstructionRequest:'',routeGeometryRequest:"",routeMapRequest:""},addRoute:function(e){e instanceof t&&(this.oRoutePlan=e)},constructor:o,toString:function(){var e="";if(e=this.template.determineRouteRequest,e=e.replace(/__DISTANCEUNIT__/g,this.options.distanceUnit||"KM"),!this.oRoutePlan){var o=this.options.route;if(this.oRoutePlan=new t(o),!this.oRoutePlan)throw new Error("La construction du calcul d'initineraire n'est pas correctement definie !?")}e=e.replace(/__ROUTEPLAN__/g,this.oRoutePlan.toString());var r=this.template.routeInstructionRequest;r=r.replace(/__PROVIDEGEOMETRY__/g,this.options.provideGeometry||!1),r=r.replace(/__PROVIDEBBOX__/g,this.options.provideBoundingBox||!1),e=e.replace(/__ROUTEINSTRUCTIONREQUEST__/g,r);var s=this.template.routeGeometryRequest;e=e.replace(/__ROUTEGEOMETRYREQUEST__/g,s);var n=this.template.routeMapRequest;return e=e.replace(/__ROUTEMAPREQUEST__/g,n),this.strRequest=e,this.strRequest}},o}(UtilsLoggerByDefault,FormatsXLSRouteServiceModelRoutePlan),FormatsXLSRouteServiceRouteRequestExtension=void 0,FormatsXLSRouteService=function(e,t,o,r){function s(e){if(!(this instanceof s))throw new TypeError("RouteService constructor cannot be called as a function.");this.CLASSNAME="RouteService",this.CLASSTYPE="RouteRequest",t.apply(this,arguments)}return s.prototype=Object.create(t.prototype,{}),s.prototype.constructor=s,s.prototype.addRequest=function(e){if("DetermineRouteRequest"!==e.CLASSNAME)throw new Error("Ce n'est pas un objet de type 'Route Request' !?");this.oRequest=e},s.prototype.addFilter=function(e){e instanceof r&&(this.oFilter=e)},s.prototype.toString=function(){if(!this.oRequest){if(!this.options)throw new Error("Les options ne sont pas renseignées, impossible de construire la requête !");if("RouteRequest"===this.CLASSTYPE){var e={distanceUnit:this.options.distanceUnit||null,provideGeometry:this.options.provideGeometry||null,provideBoundingBox:this.options.provideBoundingBox||null,route:{routePreference:this.options.routePreference||null,startPoint:this.options.startPoint,viaPoint:this.options.viaPoint||null,endPoint:this.options.endPoint,avoidFeature:this.options.avoidFeature||null,graph:this.options.graph||null,expectedStartTime:this.options.expectedStartTime||null}};this.oRequest=new o(e),this.oFilter&&this.oRequest.addFilter(this.oFilter)}}if(!this.oRequest)throw new Error("Type de requête indefini !");return this.strRequest=this.oRequest.toString(),this.strRequest},s}(UtilsLoggerByDefault,FormatsXLSAbstractService,FormatsXLSRouteServiceDetermineRouteRequest,FormatsXLSRouteServiceRouteRequestExtension),ServicesRouteRequestRouteRequestOLS=function(e,t,o){var r={build:function(e){var r=null,s={startPoint:e.startPoint,endPoint:e.endPoint,viaPoint:e.viaPoints,provideBoundingBox:e.provideBbox,avoidFeature:e.exclusions,expectedStartTime:e.expectedStartTime,distanceUnit:e.distanceUnit,graph:e.graph,provideGeometry:e.geometryInInstructions,routePreference:e.routePreference},n=new o(s),i=new t({srsName:e.srs,maximumResponses:e.maximumResponses});if(i.namespace=!0,i.setService(n),r=i.build(),"GET"==e.httpMethod){var a="qxml="+encodeURIComponent(r).replace(/\-/g,"%2D").replace(/\_/g,"%5F").replace(/\./g,"%2E").replace(/\!/g,"%21").replace(/\~/g,"%7E").replace(/\*/g,"%2A").replace(/\'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29");r=a}return r}};return r}(UtilsLoggerByDefault,FormatsXLS,FormatsXLSRouteService),ServicesRouteRequestModelRouteParamREST=function(e){function t(e){if(!(this instanceof t))throw new TypeError("RouteParamREST constructor cannot be called as a function.");if(this.options=e||{},this.origin=this.options.startPoint.x+","+this.options.startPoint.y,this.destination=this.options.endPoint.x+","+this.options.endPoint.y,this.waypoints=this.options.viaPoints||null,this.startDateTime=this.options.expectedStartTime||null,this.graphName=this.options.graph,this.srs=this.options.srs,this.exclusions=this.options.exclusions,this.method="TIME",this.options.routePreference){var o=this.options.routePreference;switch(o){case"fastest":this.method="TIME";break;case"shortest":this.method="DISTANCE";break;default:this.method="TIME"}}this.format=this.options.geometryInInstructions?"STANDARDEXT":"STANDARD",this.tolerance=10,this.profileId=null,this.profileName=null}return t.CLASSNAME="RouteParamREST",t.prototype={constructor:t,getWaypoints:function(){if(this.waypoints){for(var e=[],t=0;t\n\n__ID__ \n __X__\n __Y__\n \n __SRS__\n __GRAPHNAME__\n__PROFIL____EXCLUSIONS__ __METHOD__\n__TIME____DISTANCE__ __REVERSE__\n __SMOOTHING__\n __HOLES__\n',id:" __IDVALUE__\n",profil:" __PROFILID__\n __PROFILNAME__\n",exclusions:{container:" \n__EXCLUSIONFEATURE__\n \n",feature:" __EXCLUSIONVALUE__"},time:" \n",distance:" __DISTANCEVALUE__\n"},processRequestString:function(){var e="";switch(this.mode){case"GET":var t=new o(this.settings),r=t.getParams();for(var s in r)e&&(e+="&"),e+=r[s].k+"="+r[s].v;break;case"POST":if(e=this.template.container,e=e.replace(/__ID__/g,""),e=e.replace(/__PROFIL__/g,""),e=e.replace(/__X__/g,this.settings.position.x),e=e.replace(/__Y__/g,this.settings.position.y),e=e.replace(/__GRAPHNAME__/g,this.settings.graph),e=e.replace(/__SRS__/g,this.settings.srs),e=e.replace(/__SMOOTHING__/g,this.settings.smoothing),e=e.replace(/__HOLES__/g,this.settings.holes),e=e.replace(/__REVERSE__/g,this.settings.reverse),this.settings.exclusions){for(var n=this.template.exclusions.container,i=[],a=0;an;n++){"undefined"==typeof s[r[n]]&&(s[r[n]]={});var i=o-1;n===i&&(s[r[n]]=t),s=s[r[n]]}return this}};return O.extend("Protocols",{}),O.extend("Protocols.XHR",e),O.extend("Services",t),O.extend("Services.AltiResponse",o),O.extend("Services.Alti.Elevation",r),O.extend("Services.AutoCompleteResponse",s),O.extend("Services.AutoComplete.SuggestedLocation",n),O.extend("Services.GetConfigResponse",i),O.extend("Services.Config.Constraint",a),O.extend("Services.Config.Format",c),O.extend("Services.Config.Layer",l),O.extend("Services.Config.Legend",u),O.extend("Services.Config.Metadata",p),O.extend("Services.Config.Originator",h),O.extend("Services.Config.Service",f),O.extend("Services.Config.Style",d),O.extend("Services.Config.Territory",g),O.extend("Services.Config.Thematic",n),O.extend("Services.Config.TileMatrix",R),O.extend("Services.Config.TileMatrixLimit",v),O.extend("Services.Config.TileMatrixSet",S),O.extend("Services.GeocodeResponse",E),O.extend("Services.Geocode.GeocodedLocation",_),O.extend("Services.Geocode.DirectGeocodedLocation",y),O.extend("Services.Geocode.ReverseGeocodedLocation",w),O.extend("Services.IsoCurveResponse",A),O.extend("Services.RouteResponse",P),O.extend("Services.Route.RouteInstruction",T),O.extend("Error",M),C.Gp=O,C.Gp}(ProtocolsXHR,ServicesServices,ServicesAltiResponseModelAltiResponse,ServicesAltiResponseModelElevation,ServicesAutoCompleteResponseModelAutoCompleteResponse,ServicesAutoCompleteResponseModelSuggestedLocation,ServicesAutoConfResponseModelAutoConfResponse,ServicesAutoConfResponseModelConstraint,ServicesAutoConfResponseModelFormat,ServicesAutoConfResponseModelLayer,ServicesAutoConfResponseModelLegend,ServicesAutoConfResponseModelMetadata,ServicesAutoConfResponseModelOriginator,ServicesAutoConfResponseModelService,ServicesAutoConfResponseModelStyle,ServicesAutoConfResponseModelTerritory,ServicesAutoConfResponseModelThematic,ServicesAutoConfResponseModelTileMatrix,ServicesAutoConfResponseModelTileMatrixLimit,ServicesAutoConfResponseModelTileMatrixSet,ServicesGeocodeResponseModelGeocodeResponse,ServicesGeocodeResponseModelGeocodedLocation,ServicesGeocodeResponseModelDirectGeocodedLocation,ServicesGeocodeResponseModelReverseGeocodedLocation,ServicesProcessIsoCurveResponseModelProcessIsoCurveResponse,ServicesRouteResponseModelRouteResponse,ServicesRouteResponseModelRouteInstruction,ExceptionsErrorService); return Gp; })); diff --git a/samples/Services/Geocode/amd-xhr.html b/samples/Services/Geocode/amd-xhr.html index 227bae2e..e5b87218 100644 --- a/samples/Services/Geocode/amd-xhr.html +++ b/samples/Services/Geocode/amd-xhr.html @@ -29,10 +29,12 @@ onSuccess : function (response) {console.log(response.locations);}, onFailure : function (error) {console.log(error);}, // spécifique au service - location: "2 avenue de paris, 94166 Saint-Mandée", + // location: "2 avenue de paris, 94166 Saint-Mandée", + location: "brie", returnFreeForm : false, filterOptions :{ - type : ["StreetAddress"] + type : ["StreetAddress"], + department : 77 }, maximumResponses : 25, srs : 'EPSG:4326' diff --git a/samples/Services/ReverseGeocode/amd-xhr.html b/samples/Services/ReverseGeocode/amd-xhr.html index 66f8fe5f..94da5b26 100644 --- a/samples/Services/ReverseGeocode/amd-xhr.html +++ b/samples/Services/ReverseGeocode/amd-xhr.html @@ -27,14 +27,19 @@ httpMethod : 'POST', // GET|POST onSuccess : function (response) {console.log(response);}, onFailure : function (error) {console.log(error);}, - // spécifique au service - position: { - x : 2, - y : 48 - }, - filterOptions :{ - type : ['PositionOfInterest'] - } + // spécifique au service + // position: { + // x : 2, + // y : 48 + // }, + position: { + x : 48, + y : 2 + }, + srs : "EPSG:4326", + filterOptions :{ + type : ['PositionOfInterest'] + } }; var obj = new ReverseGeocode(options); diff --git a/src/Services/AutoConf/Response/model/AutoConfResponse.js b/src/Services/AutoConf/Response/model/AutoConfResponse.js index 26337377..db611bd0 100644 --- a/src/Services/AutoConf/Response/model/AutoConfResponse.js +++ b/src/Services/AutoConf/Response/model/AutoConfResponse.js @@ -7,7 +7,7 @@ define([], function () { * Response object for {@link module:Services~getConfig Gp.Services.getConfig()} invocation when successful. Received as the argument of onSuccess callback function. * * @property {Object} generalOptions - General properties for default map configuration resources. - * @property {Object} generalOptions.apiKeys - Object that associates apiKey(s) with an array of resources IDs availables with that key. + * @property {Object} generalOptions.apiKeys - Object that associates apiKey(s) with an array of resources IDs availables with that key. * @property {String} generalOptions.title - Underlying web service Title. * @property {String} generalOptions.defaultGMLGFIStyle - XSL URL used by default to translate an XML GetFeatureInfo response into an HTML array. * @property {String} generalOptions.theme - default theme (FIXME : for what ?) @@ -34,14 +34,14 @@ define([], function () { wgs84Resolutions : [] }; - this.layers = {}; + this.layers = {}; this.territories = {}; this.tileMatrixSets = {}; - + this.services = {}; - + } AutoConfResponse.prototype = { @@ -88,9 +88,11 @@ define([], function () { getLayersConf : function (apiKey) { var layers = {}; var layersIdArray = this.getLayersId(apiKey); - for ( var i = 0; i < layersIdArray.length; i++ ) { - var lyrId = layersIdArray[i]; - layers[lyrId] = this.layers[lyrId]; + if ( layersIdArray ) { + for ( var i = 0; i < layersIdArray.length; i++ ) { + var lyrId = layersIdArray[i]; + layers[lyrId] = this.layers[lyrId]; + } } return layers; }, @@ -102,13 +104,16 @@ define([], function () { * @return {Object} layer - Layer configuration : instance of {@link Gp.Services.Config.Layer} */ getLayerConf : function (layerId) { + if ( !this.layers ) { + return; + } return this.layers[layerId]; }, /** * Returns an associative array of Tile Matrix Sets configurations. * - * @return {Object} tileMatrixSets - Object which properties are TMS identifiers, + * @return {Object} tileMatrixSets - Object which properties are TMS identifiers, * and corresponding values are instances of {@link Gp.Services.Config.TileMatrixSet}. */ getTileMatrixSets : function () { @@ -119,16 +124,19 @@ define([], function () { * Returns a Tile Matrix Sets configuration, given its identifier. * * @param {String} tmsID - Tile Matrix Set identifier (e.g. : "PM") - * @return {Object} tileMatrixSet - Tile Matrix Set configuration, instance of {@link Gp.Services.Config.TileMatrixSet} + * @return {Object} tileMatrixSet - Tile Matrix Set configuration, instance of {@link Gp.Services.Config.TileMatrixSet} */ getTMSConf : function (tmsID) { + if ( !this.tileMatrixSets ) { + return; + } return this.tileMatrixSets[tmsID]; }, /** * Returns an associative array of territories configurations. * - * @return {Object} territories - Object which properties are territory identifiers, + * @return {Object} territories - Object which properties are territory identifiers, * and corresponding values are instances of {@link Gp.Services.Config.Territory}. */ getTerritories : function () { @@ -142,13 +150,16 @@ define([], function () { * @return {Object} territory - Territory configuration, instance of {@link Gp.Services.Config.Territory} */ getTerritoryConf : function (territoryID) { + if ( !this.territories ) { + return; + } return this.territories[territoryID]; }, /** * Returns an associative array of services configurations. * - * @return {Object} services - Object which properties are services identifiers, + * @return {Object} services - Object which properties are services identifiers, * and corresponding values are instances of {@link Gp.Services.Config.Service}. */ getServices : function () { @@ -159,13 +170,16 @@ define([], function () { * Returns a service configuration, given its identifier. * * @param {String} serviceID - service identifier (e.g. "OGC:WMTS") - * @return {Object} service - service configuration, instance of {@link Gp.Services.Config.Service} + * @return {Object} service - service configuration, instance of {@link Gp.Services.Config.Service} */ getServiceConf : function (serviceID) { + if ( !this.services ) { + return; + } return this.services[serviceID]; } }; - + return AutoConfResponse; }); diff --git a/src/Services/AutoConf/Response/model/Layer.js b/src/Services/AutoConf/Response/model/Layer.js index 4c1a6b72..0a991f73 100644 --- a/src/Services/AutoConf/Response/model/Layer.js +++ b/src/Services/AutoConf/Response/model/Layer.js @@ -16,7 +16,7 @@ define([], function () { * @property {Object} serviceParams.serverUrl - Associative array mapping geoportal access key (keys) with their properties (URLs of the web service, with the geoportal access key). * @property {String} serviceParams.version - webservice version. * @property {String} defaultProjection - coordinates system ID used by default for the resource (WMS or WFS layer) or of the TileMatrixSet used by the WMTS layer. - * @property {Array.} additionalProjections - additional coordinates systems IDs availables for the resource, others than the default one (see defaultProjection) (WMS and WFS layers only). + * @property {Array.} additionalProjections - additional coordinates systems IDs availables for the resource, others than the default one (see defaultProjection) (WMS and WFS layers only). * @property {Array.} formats - Formats availables for the resource. * @property {Array.} legends - Informations about legends associated to the resource. * @property {Array.} metadata - Informations about metadata associated to the resource. @@ -35,11 +35,11 @@ define([], function () { * @property {Array.} apiKeys - Array of access keys that grant access to that resource. * @property {Object} dimensions - Dimensions informations associated with the resource. * @property {String} dimensions.type - * @property {String} dimensions.visibilityRange + * @property {String} dimensions.visibilityRange * @property {String} dimensions.visibilityMode * @property {String} dimensions.noDataValue * @property {String} dimensions.geometricType - * + * * @namespace * @alias Gp.Services.Config.Layer */ @@ -47,20 +47,20 @@ define([], function () { if (!(this instanceof Layer)) { throw new TypeError("Layer constructor cannot be called as a function."); - } + } // info: une instance de la classe Layer n'a aucune propriété au départ,. - // les attributs possibles sont documentés ci-dessus, + // les attributs possibles sont documentés ci-dessus, // et seront implémentés au fur et à mesure de la lecture de la réponse de l'autoconf, lorsque l'information est rencontrée. } - + Layer.prototype = { constructor : Layer, /** - * Returns the layer name + * Returns the layer name * * @returns {String} name - name of the resource to use with the webservice that serves it (eg : "GEOGRAPHICALGRIDSYSTEMS.MAPS"). */ @@ -69,43 +69,43 @@ define([], function () { }, /** - * Returns the layer title + * Returns the layer title * * @returns {String} title - Human readable name for the resource. */ getTitle : function () { return this.title; - }, + }, /** - * Returns the layer description + * Returns the layer description * * @returns {String} description - Resource description. */ getDescription : function () { return this.description; - }, + }, /** - * Returns the layer identifier + * Returns the layer identifier * * @returns {String} layerId - Unique resource Identifier (eg : "GEOGRAPHICALGRIDSYSTEMS.MAPS$GEOPORTAIL:OGC:WMTS") */ getLayerId : function () { return this.layerId; - }, + }, /** - * Returns the layer quicklookUrl + * Returns the layer quicklookUrl * * @returns {String} quicklookUrl - Image URL for the resource. */ getQuicklookUrl : function () { return this.quicklookUrl; - }, + }, /** - * Returns the layer default projection + * Returns the layer default projection * * @returns {String} defaultProjection - coordinates system ID used by default for the resource (WMS or WFS layer) or of the TileMatrixSet used by the WMTS layer. */ @@ -114,9 +114,9 @@ define([], function () { }, /** - * Returns the layer projections + * Returns the layer projections * - * @returns {Array.} projections - coordinates systems IDs availables for the resource, including the default one. + * @returns {Array.} projections - coordinates systems IDs availables for the resource, including the default one. */ getProjections : function () { var projections = []; @@ -126,7 +126,7 @@ define([], function () { }, /** - * Returns the global BBOX + * Returns the global BBOX * * @returns {Gp.BBox} bbox - the layer global bounding box, expressed in CRS system. */ @@ -138,7 +138,7 @@ define([], function () { }, /** - * Returns the layer minimum scale denominator + * Returns the layer minimum scale denominator * * @returns {Number} minScaleDenominator - minimum scale denominator for this layer */ @@ -150,7 +150,7 @@ define([], function () { }, /** - * Returns the layer maximum scale denominator + * Returns the layer maximum scale denominator * * @returns {Number} maxScaleDenominator - maximum scale denominator for this layer */ @@ -162,7 +162,7 @@ define([], function () { }, /** - * Returns layer Tile Matrix Set identifier if exists + * Returns layer Tile Matrix Set identifier if exists * * @returns {String} tileMatrixSetLink - Tile Matrix Set identifier (for instance : "PM") */ @@ -174,7 +174,7 @@ define([], function () { }, /** - * Returns information about the webservice that serves the resource + * Returns information about the webservice that serves the resource * * @returns {Object} serviceParams - Information about the webservice that serves the resource (OpenLS, WFS, WMTS) */ @@ -183,7 +183,7 @@ define([], function () { }, /** - * Returns Geoportal server url for a given key + * Returns Geoportal server url for a given key * * @param {String} apiKey - Access key to Geoportal platform * @returns {String} serverUrl - general URL of the web service (with the geoportal access key) @@ -196,7 +196,7 @@ define([], function () { }, /** - * Returns information about legends associated to the resource. + * Returns information about legends associated to the resource. * * @returns {Array.} legends - Informations about legends associated to the resource. */ @@ -205,7 +205,7 @@ define([], function () { }, /** - * Returns information about metadata associated to the resource. + * Returns information about metadata associated to the resource. * * @returns {Array.} metadata - Informations about metadata associated to the resource. */ @@ -214,7 +214,7 @@ define([], function () { }, /** - * Returns information about styles availables for the resources (WMS, WFS and WMTS only). + * Returns information about styles availables for the resources (WMS, WFS and WMTS only). * * @returns {Array.} styles - Informations about styles availables for the resources (WMS, WFS and WMTS only). */ @@ -223,11 +223,14 @@ define([], function () { }, /** - * Returns layer default style + * Returns layer default style * * @returns {String} styleName - style identifier (eg: "normal", "bdparcellaire", ...) */ getDefaultStyle : function () { + if ( !this.styles ) { + return; + } var style; var s = this.styles; for ( var i = 0; i < s.length; i++ ) { @@ -240,7 +243,7 @@ define([], function () { }, /** - * Returns information about thematics associated to the resource. + * Returns information about thematics associated to the resource. * * @returns {Array.} thematics - Informations about thematics associated to the resource. */ @@ -249,11 +252,14 @@ define([], function () { }, /** - * Returns layer default format + * Returns layer default format * * @returns {String} formatName - Format mime-type. (eg. "image/jpeg") */ getDefaultFormat : function () { + if ( !this.formats ) { + return; + } var format; var f = this.formats; for ( var i = 0; i < f.length; i++ ) { @@ -266,7 +272,7 @@ define([], function () { }, /** - * Returns information about geographical or temporal constraints for the resource + * Returns information about geographical or temporal constraints for the resource * * @returns {Array.} constraints - Informations about geographical or temporal constraints for the resource */ @@ -275,7 +281,7 @@ define([], function () { }, /** - * Returns information about originators of this resource + * Returns information about originators of this resource * * @returns {Array.} originators - Informations about originators of this resource */ @@ -284,7 +290,7 @@ define([], function () { }, /** - * Returns information about dimensions associated with this resource + * Returns information about dimensions associated with this resource * * @returns {Object} dimensions - Dimensions informations associated with the resource. */ @@ -293,7 +299,7 @@ define([], function () { }, /** - * Returns information about aggregated layers composing the being described layer, in case the resource is an aggregate of other resources. + * Returns information about aggregated layers composing the being described layer, in case the resource is an aggregate of other resources. * * @returns {Object} aggregatedLayers - Layers IDs composing the being described aggregated layer. */ @@ -306,6 +312,6 @@ define([], function () { } }; - + return Layer; }); diff --git a/src/Services/Geocode/Formats/DirectGeocodeResponseReader.js b/src/Services/Geocode/Formats/DirectGeocodeResponseReader.js index a54b467f..1cf1120f 100644 --- a/src/Services/Geocode/Formats/DirectGeocodeResponseReader.js +++ b/src/Services/Geocode/Formats/DirectGeocodeResponseReader.js @@ -1,6 +1,6 @@ /** - * Fonction retournant un objet contenant des clés de lecture (readers) + * Fonction retournant un objet contenant des clés de lecture (readers) * qui permettent de parser des réponses XML du service de géocodage direct du Géoportail * afin de récupérer les résultats retournés. * @module DirectGeocodeResponseReader @@ -14,7 +14,7 @@ define([ "Exceptions/ErrorService", "Services/Geocode/Response/model/GeocodeResponse", "Services/Geocode/Response/model/DirectGeocodedLocation" -], +], function ( Logger, MR, ErrSrv, @@ -23,7 +23,7 @@ function ( ) { "use strict"; - + /** * @member DirectGeocodeResponseReader */ @@ -51,11 +51,11 @@ function ( DirectGeocodeResponseReader.SCHEMALOCATION = "http://wxs.ign.fr/schemas/olsAll.xsd"; /** - * Namespace par défaut du format + * Namespace par défaut du format */ DirectGeocodeResponseReader.DEFAULTPREFIX = "xls"; - /** + /** * Objet contenant des fonctions de lecture, appelées "READERS" * dont chaque clé correspond au nom d'un tag du XML que l'on souhaite lire * et la valeur associée est une fonction (node, data) @@ -170,7 +170,7 @@ function ( bottom : parseFloat(values[3]) }; } - + } else if ( placeType === "Commune" ) { geocodedLocation.placeAttributes.commune = placeName; @@ -209,7 +209,7 @@ function ( } else if ( placeType === "CommuneAbsorbee" ) { geocodedLocation.placeAttributes.absorbedCity = placeName; - + } else if ( placeType === "Arrondissement" ) { if ( placeName ) { geocodedLocation.placeAttributes.arrondissement = placeName; @@ -277,7 +277,7 @@ function ( child = children[i]; if ( child.nodeName === "Exception" ) { response.exceptionReport = DirectGeocodeResponseReader.READERS["Exception"](child); - } + } } } return response; @@ -301,11 +301,11 @@ function ( return exceptionReport; } - + }; /** - * Méthode permettant de lancer la lecture d'une réponse XML du service de géocodage, + * Méthode permettant de lancer la lecture d'une réponse XML du service de géocodage, * à l'aide des READERS de la classe. * * @method DirectGeocodeResponseReader.read @@ -316,12 +316,12 @@ function ( * @memberof DirectGeocodeResponseReader */ DirectGeocodeResponseReader.read = function (root) { - + if ( root.nodeName === "XLS" ) { var nsPrefix = root.prefix; if ( !nsPrefix ) { nsPrefix = DirectGeocodeResponseReader.DEFAULTPREFIX; - } + } var geocodeResponse = DirectGeocodeResponseReader.READERS[nsPrefix][root.nodeName](root); return geocodeResponse; @@ -367,7 +367,7 @@ function ( * @memberof DirectGeocodeResponseReader * @method __getChildNodes * @param {DOMElement} node - a DOM node - * @param {Array|Object} [data] - an object to be filled with node data + * @param {Array|Object} [data] - an object to be filled with node data */ function __getChildNodes (node, data) { diff --git a/src/Services/Geocode/Formats/ReverseGeocodeResponseReader.js b/src/Services/Geocode/Formats/ReverseGeocodeResponseReader.js index 87909372..88ec15d3 100644 --- a/src/Services/Geocode/Formats/ReverseGeocodeResponseReader.js +++ b/src/Services/Geocode/Formats/ReverseGeocodeResponseReader.js @@ -1,6 +1,6 @@ /** - * Fonction retournant un objet contenant des clés de lecture (readers) + * Fonction retournant un objet contenant des clés de lecture (readers) * qui permettent de parser des réponses XML du service de géocodage inverse du Géoportail * afin de récupérer les résultats retournés. * @module ReverseGeocodeResponseReader @@ -14,7 +14,7 @@ define([ "Exceptions/ErrorService", "Services/Geocode/Response/model/GeocodeResponse", "Services/Geocode/Response/model/ReverseGeocodedLocation" -], +], function ( Logger, MR, ErrSrv, @@ -22,7 +22,7 @@ function ( ) { "use strict"; - + /** * Objet ReverseGeocodeResponseReader * @member {Object} ReverseGeocodeResponseReader @@ -33,7 +33,7 @@ function ( * * @property {String} ReverseGeocodeResponseReader.SCHEMALOCATION - Localisation (URL) du schema de définition du XML (XSD) * - * @property {String} ReverseGeocodeResponseReader.DEFAULTPREFIX - Namespace par défaut du format + * @property {String} ReverseGeocodeResponseReader.DEFAULTPREFIX - Namespace par défaut du format * * @property {Object} ReverseGeocodeResponseReader.READERS - Objet contenant des fonctions de lecture, appelées "READERS" * dont chaque clé correspond au nom d'un tag du XML que l'on souhaite lire @@ -41,7 +41,7 @@ function ( * où node est un noeud du document DOM * et data est un objet où l'on stocke les informations lues dans le XML. * - * @property {Method} ReverseGeocodeResponseReader.read - Méthode permettant de lancer la lecture d'une réponse XML du service de géocodage, + * @property {Method} ReverseGeocodeResponseReader.read - Méthode permettant de lancer la lecture d'une réponse XML du service de géocodage, * à l'aide des READERS de la classe. * */ @@ -70,11 +70,11 @@ function ( ReverseGeocodeResponseReader.SCHEMALOCATION = "http://wxs.ign.fr/schemas/olsAll.xsd"; /** - * Namespace par défaut du format + * Namespace par défaut du format */ ReverseGeocodeResponseReader.DEFAULTPREFIX = "xls"; - /** + /** * Objet contenant des fonctions de lecture, appelées "READERS" * dont chaque clé correspond au nom d'un tag du XML que l'on souhaite lire * et la valeur associée est une fonction (node, data) @@ -168,7 +168,7 @@ function ( bottom : parseFloat(values[3]) }; } - + } else if ( placeType === "Commune" ) { reverseGeocodedLocation.placeAttributes.commune = placeName; @@ -290,7 +290,7 @@ function ( child = children[i]; if ( child.nodeName === "Exception" ) { response.exceptionReport = ReverseGeocodeResponseReader.READERS["Exception"](child); - } + } } } return response; @@ -314,11 +314,11 @@ function ( return exceptionReport; } - + }; /** - * Méthode permettant de lancer la lecture d'une réponse XML du service de géocodage, + * Méthode permettant de lancer la lecture d'une réponse XML du service de géocodage, * à l'aide des READERS de la classe. * * @method ReverseGeocodeResponseReader.read @@ -329,12 +329,12 @@ function ( * @memberof ReverseGeocodeResponseReader */ ReverseGeocodeResponseReader.read = function (root) { - + if ( root.nodeName === "XLS" ) { var nsPrefix = root.prefix; if ( !nsPrefix ) { nsPrefix = ReverseGeocodeResponseReader.DEFAULTPREFIX; - } + } var geocodeResponse = ReverseGeocodeResponseReader.READERS[nsPrefix][root.nodeName](root); return geocodeResponse; @@ -375,7 +375,7 @@ function ( * @memberof ReverseGeocodeResponseReader * @method __getChildNodes * @param {DOMElement} node - a DOM node - * @param {Array|Object} [data] - an object to be filled with node data + * @param {Array|Object} [data] - an object to be filled with node data */ function __getChildNodes (node, data) { @@ -415,7 +415,7 @@ function ( */ function __getChildValue (node) { - var textNode; + var textNode; var value = ""; if ( node.hasChildNodes() ) { diff --git a/src/Services/Geocode/Geocode.js b/src/Services/Geocode/Geocode.js index b15c1190..64c278f0 100644 --- a/src/Services/Geocode/Geocode.js +++ b/src/Services/Geocode/Geocode.js @@ -149,6 +149,10 @@ function ( var filter = Object.keys(options.filterOptions); for (var i = 0; i < filter.length; i++) { var key = filter[i]; + var filtersCouldBeNumberList = ["department", "number", "postalCode", "insee", "importance", "ID", "IDTR", "absorbedCity", "sheet", "section", "inseeRegion", "inseeDepartment"]; + if ( filtersCouldBeNumberList.indexOf(key) !== -1 && typeof options.filterOptions[key] !== "string" ) { + options.filterOptions[key] = options.filterOptions[key].toString(); + } if (! options.filterOptions[key] || Object.keys(options.filterOptions[key]).length === 0) { delete this.options.filterOptions[key]; } diff --git a/src/Services/Geocode/Response/ReverseGeocodeResponseFactory.js b/src/Services/Geocode/Response/ReverseGeocodeResponseFactory.js index 1ae45bfc..b3af4bc0 100644 --- a/src/Services/Geocode/Response/ReverseGeocodeResponseFactory.js +++ b/src/Services/Geocode/Response/ReverseGeocodeResponseFactory.js @@ -72,7 +72,7 @@ function ( } catch (e) { // on relaye l'erreur reçue e.status = 200 ; - options.onError.call(options.scope, e) ; + options.onError.call(options.scope, e); return; } @@ -86,6 +86,28 @@ function ( })); return; } + + // dans le cas d'un srs non EPSG géographique, il faut réinverser les coordonnées (lat,lon => lon,lat) + if ( options.scope && options.scope.options && options.scope.options.srs && options.scope.options.srs !== "EPSG:4326" ) { + var location; + var pos; + if ( data || data.locations || data.locations.length ) { + for ( var i = 0; i < data.locations.length; i++ ) { + location = data.locations[i]; + if ( location ) { + pos = location.position; + if ( pos ) { + // on inverse les 2 coordonnées + location.position = { + x : pos.y, + y : pos.x + }; + } + } + } + } + } + } } else { options.onError.call(options.scope, new ErrorService({ diff --git a/src/Services/Geocode/ReverseGeocode.js b/src/Services/Geocode/ReverseGeocode.js index 764e8313..4ac473e7 100644 --- a/src/Services/Geocode/ReverseGeocode.js +++ b/src/Services/Geocode/ReverseGeocode.js @@ -31,8 +31,8 @@ function ( * @param {Object} options - options spécifiques au service (+ les options heritées) * * @param {Object} options.position - Position du point de référence pour le calcul de proximité exprimée dans le système de référence spécifié par le srs. - * @param {Float} options.position.x - Abcisse du point de référence pour le calcul de proximité exprimée dans le système de référence spécifié par le srs. - * @param {Float} options.position.y - Ordonnée du point de référence pour le calcul de proximité exprimée dans le système de référence spécifié par le srs. + * @param {Float} options.position.x - Abcisse du point de référence pour le calcul de proximité exprimée dans le système de référence spécifié par le srs. (= longitude si srs = "CRS:84", latitude si srs = "EPSG:4326") + * @param {Float} options.position.y - Ordonnée du point de référence pour le calcul de proximité exprimée dans le système de référence spécifié par le srs. (= latitude si srs = "CRS:84", longitude si srs = "EPSG:4326") * * @param {Object} [options.filterOptions] - Les propriétés possibles de cet objet sont décrites ci-après. * @param {Object} [options.filterOptions.bbox] - Emprise dans laquelle on souhaite effectuer la recherche. @@ -60,9 +60,9 @@ function ( * @param {Number} [options.maximumResponses] - Nombre de réponses maximal que l'on souhaite recevoir. * Pas de valeur par défaut. Si le serveur consulté est celui du Géoportail, la valeur par défaut sera donc celle du service : 25. * - * @param {String} [options.srs = EPSG:4326] - Système de coordonnées dans lequel les paramètres géographiques en entrée et la réponse du service sont exprimés. + * @param {String} [options.srs = CRS:84] - Système de coordonnées dans lequel les paramètres géographiques en entrée et la réponse du service sont exprimés. * Pas de valeur par défaut. - * Si le serveur consulté est celui du Géoportail, la valeur par défaut sera donc celle du service : 'EPSG:4326'. + * Si le serveur consulté est celui du Géoportail, la valeur par défaut est : "CRS:84". * * @example * var options = { @@ -163,11 +163,13 @@ function ( // FIXME: cet attribut (returnFreeForm) n'est pas spécifié dans la doc du constructeur ? // Il est inutile en effet, mais présent dans les specs... this.options.returnFreeForm = options.returnFreeForm || false; - this.options.srs = options.srs || "EPSG:4326"; + // info: en réalité le service ne reconnait que EPSG:4326. this.options.srs permet essentiellement de différencier EPSG:4326 (lat,lon) et CRS:84 (lon,lat) + this.options.srs = options.srs || "CRS:84"; - // si le systeme de coordonnées est géographique, et EPSG, il faut inverser les coordonnées - // (le service attend une position "lat lon") - if ( ReverseGeocode.geoEPSG.indexOf(this.options.srs) !== -1 ) { + // si on n'a pas un systeme de coordonnées EPSG géographique, il faut inverser les coordonnées + // (car elles sont en lon, lat alors que le service attend une position en lat, lon). + // dans le cas d'EPSG:4326 par exemple, les coordonnées sont bien en lat, lon donc on ne fait rien. + if ( ReverseGeocode.geoEPSG.indexOf(this.options.srs) === -1 ) { // pour la position this.options.position = { x : this.options.position.y, @@ -228,7 +230,7 @@ function ( position : this.options.position, returnFreeForm : this.options.returnFreeForm, filterOptions : this.options.filterOptions, - srs : this.options.srs, + srs : "EPSG:4326", // info: en réalité le service ne reconnait que EPSG:4326. this.options.srs permet essentiellement de différencier EPSG:4326 (lat,lon) et CRS:84 (lon,lat) maximumResponses : this.options.maximumResponses }; diff --git a/src/Services/Services.js b/src/Services/Services.js index 7869aee5..501f6661 100644 --- a/src/Services/Services.js +++ b/src/Services/Services.js @@ -96,7 +96,7 @@ define([ * @param {Gp.BBox} [options.filterOptions.bbox] - bounding box where to perform the search. Properties expressed in options.srs coordinates system. * @param {Array.} [options.filterOptions.type] - geographical identifier types to search. Values currently availables are : "PositionOfInterest" for place names, "StreetAddress" for address search, "CadastralParcel" for Cadastral parcels search. Default is "StreetAddress". * - * @param {String} [options.filterOptions.[prop]] - Additionnal properties to filter search. Properties depends on options.filterOptions.type. + * @param {String} [options.filterOptions.[prop]] - Additionnal properties to filter search. Properties depends on options.filterOptions.type, and values type should be "String". *

* Common Properties availables for all search types :
* "municipality", "insee", "department". @@ -132,7 +132,7 @@ define([ * @method reverseGeocode * @param {Object} options - options for function call. * @param {String} options.apiKey - access key to Geoportal platform, obtained [here]{@link http://professionnels.ign.fr/geoservices-ign}. - * @param {Gp.Point} options.position - Reference position where to search geographical identifiers. Its coordinates are expressed in the coordinates system given with options.srs parameter. + * @param {Gp.Point} options.position - Reference position where to search geographical identifiers. Its coordinates are expressed in the coordinates system given with options.srs parameter. (default is CRS:84, that means position.x corresponds to longitude and position.y corresponds to latitude) * @param {Object} [options.filterOptions] - Additional filters to apply to search. The following properties may be given. * @param {Array.} [options.filterOptions.type] - geographical identifier types to search. Values currently availables are : "PositionOfInterest" for place names, "StreetAddress" for address search, "CadastralParcel" for Cadastral parcels search. Default is "StreetAddress". * @param {Gp.BBox} [options.filterOptions.bbox] - bounding box where to perform the search. Expressed in options.srs coordinates system. @@ -140,7 +140,7 @@ define([ * @param {Array.} [options.filterOptions.polygon] - Polygon where to perform the search. Expressed in options.srs coordinates system. * @param {Number} [options.maximumResponses] - Maximum number of responses. Default underlying service value applies (25) if not provided. * @param {Boolean} [options.returnFreeForm] - Set this parameter to true if you wish to have an address returned in a single String (unstructured). If unset, default underlying service value (false) applies. - * @param {String} [options.srs] - Coordinates System used to expres coordinates for parameters and responses. Default underlying service value (EPSG:4326) applies. + * @param {String} [options.srs] - Coordinates System used to expres coordinates for parameters and responses. Default is CRS:84. * @param {Function} options.onSuccess - callback function for getting successful service response. Takes a {@link Gp.Services.GeocodeResponse} object as a parameter. Except if "rawResponse" is set to true. * @param {Function} [options.onFailure] - callback function for handling unsuccessful service responses (timeOut, missing rights, ...). Takes a {@link Gp.Exceptions.ErrorService} object as parameter. * @param {Number} [options.timeOut=0] - Number of milliseconds above which a timeOut response will be returned with onFailure callback (see above). Default value is 0 which means timeOut will not be handled. @@ -186,9 +186,9 @@ define([ * @param {Object} options - options for function call. * @param {String} options.apiKey - access key to Geoportal platform, obtained [here]{@link http://professionnels.ign.fr/geoservices-ign}. * @param {String} [options.routePreference = "fastest"] - Indicates the way to compute the route : "fastest" (time optimisation) or "shortest" (distance optimisation). - * @param {Gp.Point} options.startPoint - Start point of the route. Expressed in EPSG:4326 coordinates system. - * @param {Gp.Point} options.endPoint - End point of the route. Expressed in EPSG:4326 coordinates system. - * @param {Array.} [options.viaPoints] - Ordered via Points of the route. Expressed in EPSG:4326 coordinates system. + * @param {Gp.Point} options.startPoint - Start point of the route. Expressed in CRS:84 coordinates system (Gp.Point.x corresponds to longitude, Gp.Point.y corresponds to latitude). + * @param {Gp.Point} options.endPoint - End point of the route. Expressed in CRS:84 coordinates system (Gp.Point.x corresponds to longitude, Gp.Point.y corresponds to latitude). + * @param {Array.} [options.viaPoints] - Ordered via Points of the route. Expressed in CRS:84 coordinates system (Gp.Point.x corresponds to longitude, Gp.Point.y corresponds to latitude). * @param {String} [options.graph = "Voiture"] - User profile to use to compute the route : "Voiture" (using a vehicule) or "Pieton" (pedestrian). Has an influence on the kind of roads the route may use and the average speed. * @param {Array.} [options.exclusions] - Indicates if route has to avoid some features ("toll", "bridge" or "tunnel"). * @param {Boolean} [options.geometryInInstructions = false] - Indicates if route geometry has to be also returned with route instructions. @@ -215,8 +215,7 @@ define([ * @method isoCurve * @param {Object} options - options for function call. * @param {String} options.apiKey - access key to Geoportal platform, obtained [here]{@link http://professionnels.ign.fr/geoservices-ign}. - * @param {Gp.Point} options.position - Start or Arrival (options.reverse==true) Point for the computing. Expressed in the coordinates system given with options.srs. - * @param {String} [options.srs] - Coordinates System used to express coordinates for parameters and responses. Default underlying service value (EPSG:4326) applies. + * @param {Gp.Point} options.position - Start or Arrival (options.reverse==true) Point for the computing. Expressed in CRS:84 coordinates system (Gp.Point.x corresponds to longitude, Gp.Point.y corresponds to latitude). * @param {String} [options.graph = "Voiture"] - User profile to use to compute the isoCurve : "Voiture" (using a vehicule) or "Pieton" (pedestrian). Has an influence on the kind of roads to use and the average speed. * @param {Array.} [options.exclusions] - (FIXME : options.avoidFeature) Indicates if route has to avoid some features ("toll", "bridge" or "tunnel"). * @param {String} [options.method = "time"] - Computing method to use : "time" (using a duration as a constraint) or "distance" (using a distance as a constraint).