Skip to content

Commit

Permalink
enable input coordinates to equal zero (but not to be null or undefined)
Browse files Browse the repository at this point in the history
  • Loading branch information
lboulanger committed Apr 18, 2016
1 parent e14a699 commit c03becb
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 38 deletions.
20 changes: 10 additions & 10 deletions dist/GpServices-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* copyright IGN
* @author IGN
* @version 1.0.0-beta2
* @date 2016-04-11
* @date 2016-04-18
*
*/
/*!
Expand Down Expand Up @@ -8081,10 +8081,10 @@ ServicesGeocodeReverseGeocode = function (Logger, _, ErrorService, CommonService
if (!options.position) {
throw new Error(_.getMessage('PARAM_MISSING', 'position'));
}
if (!options.position.x) {
if (options.position.x == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'position.x'));
}
if (!options.position.y) {
if (options.position.y == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'position.y'));
}
this.options.position = options.position;
Expand Down Expand Up @@ -9279,19 +9279,19 @@ ServicesRouteRoute = function (Logger, _, ErrorService, CommonService, DefaultUr
if (!options.startPoint) {
throw new Error(_.getMessage('PARAM_MISSING', 'startPoint'));
}
if (!options.startPoint.x) {
if (options.startPoint.x == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'startPoint.x'));
}
if (!options.startPoint.y) {
if (options.startPoint.y == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'startPoint.y'));
}
if (!options.endPoint) {
throw new Error(_.getMessage('PARAM_MISSING', 'endPoint'));
}
if (!options.endPoint.x) {
if (options.endPoint.x == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'endPoint.x'));
}
if (!options.endPoint.y) {
if (options.endPoint.y == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'endPoint.y'));
}
this.options.api = typeof options.api == 'string' ? options.api.toUpperCase() : 'REST';
Expand Down Expand Up @@ -9869,10 +9869,10 @@ ServicesProcessIsoCurveProcessIsoCurve = function (Logger, _, ErrorService, Comm
if (!options.position) {
throw new Error(_.getMessage('PARAM_MISSING', 'position'));
}
if (!options.position.x) {
if (options.position.x == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'position.x'));
}
if (!options.position.y) {
if (options.position.y == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'position.y'));
}
if (!options.time && !options.distance) {
Expand Down Expand Up @@ -9995,7 +9995,7 @@ Gp = function (Services, AltiResponse, Elevation, AutoCompleteResponse, Suggeste
var scope = typeof window !== 'undefined' ? window : {};
var Gp = scope.Gp || {
servicesVersion: '1.0.0-beta2',
servicesDate: '2016-04-11',
servicesDate: '2016-04-18',
extend: function (strNS, value) {
var parts = strNS.split('.');
var parent = this;
Expand Down
20 changes: 10 additions & 10 deletions dist/GpServices-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* copyright IGN
* @author IGN
* @version 1.0.0-beta2
* @date 2016-04-11
* @date 2016-04-18
*
*/
/*!
Expand Down Expand Up @@ -5349,10 +5349,10 @@ ServicesGeocodeReverseGeocode = function (Logger, _, ErrorService, CommonService
if (!options.position) {
throw new Error(_.getMessage('PARAM_MISSING', 'position'));
}
if (!options.position.x) {
if (options.position.x == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'position.x'));
}
if (!options.position.y) {
if (options.position.y == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'position.y'));
}
this.options.position = options.position;
Expand Down Expand Up @@ -6513,19 +6513,19 @@ ServicesRouteRoute = function (Logger, _, ErrorService, CommonService, DefaultUr
if (!options.startPoint) {
throw new Error(_.getMessage('PARAM_MISSING', 'startPoint'));
}
if (!options.startPoint.x) {
if (options.startPoint.x == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'startPoint.x'));
}
if (!options.startPoint.y) {
if (options.startPoint.y == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'startPoint.y'));
}
if (!options.endPoint) {
throw new Error(_.getMessage('PARAM_MISSING', 'endPoint'));
}
if (!options.endPoint.x) {
if (options.endPoint.x == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'endPoint.x'));
}
if (!options.endPoint.y) {
if (options.endPoint.y == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'endPoint.y'));
}
this.options.api = typeof options.api == 'string' ? options.api.toUpperCase() : 'REST';
Expand Down Expand Up @@ -7083,10 +7083,10 @@ ServicesProcessIsoCurveProcessIsoCurve = function (Logger, _, ErrorService, Comm
if (!options.position) {
throw new Error(_.getMessage('PARAM_MISSING', 'position'));
}
if (!options.position.x) {
if (options.position.x == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'position.x'));
}
if (!options.position.y) {
if (options.position.y == null) {
throw new Error(_.getMessage('PARAM_MISSING', 'position.y'));
}
if (!options.time && !options.distance) {
Expand Down Expand Up @@ -7207,7 +7207,7 @@ Gp = function (Services, AltiResponse, Elevation, AutoCompleteResponse, Suggeste
var scope = typeof window !== 'undefined' ? window : {};
var Gp = scope.Gp || {
servicesVersion: '1.0.0-beta2',
servicesDate: '2016-04-11',
servicesDate: '2016-04-18',
extend: function (strNS, value) {
var parts = strNS.split('.');
var parent = this;
Expand Down
6 changes: 3 additions & 3 deletions dist/GpServices.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Services/Geocode/ReverseGeocode.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ function (
}

// on lance une exception afin d'eviter au service de le faire...
if (!options.position.x) {
if ( options.position.x == null ) {
throw new Error(_.getMessage("PARAM_MISSING", "position.x"));
}

if (!options.position.y) {
if ( options.position.y == null ) {
throw new Error(_.getMessage("PARAM_MISSING", "position.y"));
}

Expand Down
6 changes: 3 additions & 3 deletions src/Services/ProcessIsoCurve/ProcessIsoCurve.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@ function (
this.logger = Logger.getLogger("Gp.Services.ProcessIsoCurve");
this.logger.trace("[Constructeur ProcessIsoCurve(options)]");

if (!options.position) {
if ( !options.position ) {
throw new Error(_.getMessage("PARAM_MISSING", "position"));
}

// on lance une exception afin d'eviter au service de le faire...
if (!options.position.x) {
if ( options.position.x == null ) {
throw new Error(_.getMessage("PARAM_MISSING", "position.x"));
}

if (!options.position.y) {
if ( options.position.y == null ) {
throw new Error(_.getMessage("PARAM_MISSING", "position.y"));
}

Expand Down
16 changes: 8 additions & 8 deletions src/Services/Route/Route.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ function (
* Détermine le profil de vitesses utilisé pour le calcul ainsi que les tronçons autorisés ou non.
* Par défaut, c'est la valeur "Voiture" qui sera utilisée.
*
* @param {String[]} [options.avoidFeature] - Critères d'avoidFeature à appliquer pour le calcul.
* @param {String[]} [options.exclusions] - Critères d'exclusions à appliquer pour le calcul. (correspond au paramètre "avoidFeature" d'OpenLS)
* On précise ici le type de tronçons que l'on ne veut pas que l'itinéraire emprunte
* (valeurs possibles : « toll » (éviter les péages), « bridge », « tunnel »).
*
* @param {Boolean} [options.geometryInInstructions = false] - Indique si la géométrie de l'itinéraire doit être reprise morceau par morceau dans les instructions.
* Par défaut : false.
* (correspond au paramètre "provideGeometry" d'OpenLS) Par défaut : false.
*
* @param {Boolean} [options.provideBoundingBox = true] - Indique si les instructions doivent être localisées par une bbox dans la réponse.
* Par défaut : true.
Expand Down Expand Up @@ -129,29 +129,29 @@ function (
this.logger = Logger.getLogger("Gp.Services.Route");
this.logger.trace("[Constructeur Route(options)]");

if (!options.startPoint) {
if ( !options.startPoint ) {
throw new Error(_.getMessage("PARAM_MISSING", "startPoint"));
}

// on lance une exception afin d'eviter au service de le faire...
if (!options.startPoint.x) {
if ( options.startPoint.x == null ) {
throw new Error(_.getMessage("PARAM_MISSING", "startPoint.x"));
}

if (!options.startPoint.y) {
if ( options.startPoint.y == null ) {
throw new Error(_.getMessage("PARAM_MISSING", "startPoint.y"));
}

if (!options.endPoint) {
if ( !options.endPoint ) {
throw new Error(_.getMessage("PARAM_MISSING", "endPoint"));
}

// on lance une exception afin d'eviter au service de le faire...
if (!options.endPoint.x) {
if ( options.endPoint.x == null ) {
throw new Error(_.getMessage("PARAM_MISSING", "endPoint.x"));
}

if (!options.endPoint.y) {
if ( options.endPoint.y == null ) {
throw new Error(_.getMessage("PARAM_MISSING", "endPoint.y"));
}

Expand Down
4 changes: 2 additions & 2 deletions src/Services/Services.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ define([
* @param {Gp.Point} options.endPoint - End point of the route. Expressed in EPSG:4326 coordinates system.
* @param {Array.<Gp.Point>} [options.viaPoints] - Ordered via Points of the route. Expressed in EPSG:4326 coordinates system.
* @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.<String>} [options.avoidFeature] - Indicates if route has to avoid some features ("toll", "bridges" or "tunnel").
* @param {Array.<String>} [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.
* @param {Boolean} [options.provideBoundingBox = true] - Indicates if route instructions has to be localised with a BBOX in the response.
* @param {String} [options.distanceUnit = "km"] - The unit used to provide distances in the response ("m" or "km").
Expand Down Expand Up @@ -218,7 +218,7 @@ define([
* @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 {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.<String>} [options.exclusions] - (FIXME : options.avoidFeature) Indicates if route has to avoid some features ("toll", "bridges" or "tunnel").
* @param {Array.<String>} [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).
* @param {Float} options.time - Maximum duration (expressed in seconds) to use when options.method is set to "time".
* @param {Float} options.distance - Maximum distance (expressed in meters) to use when options.method is set to "distance".
Expand Down

0 comments on commit c03becb

Please sign in to comment.