Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 2x 2x 1x 2x 2x 2x 1x 2x 1x 1x 2x 2x 2x 2x 2x | import Logger from "../../../../Utils/LoggerByDefault"; /** * @classdesc * Classe de gestion des param. des requêtes du service de calcul d'itineraire (REST). * Permet le mapping avec les options du service. * @constructor * @alias Gp.Services.Route.Request.RouteParamREST * @param {Object} options - options * * @private */ function GeocodeParamREST (options) { Iif (!(this instanceof GeocodeParamREST)) { throw new TypeError("GeocodeParamREST constructor cannot be called as a function."); } this.logger = Logger.getLogger(); this.logger.trace("[Constructeur GeocodeParamREST ()]"); /** * Options en paramêtres du constructeur. */ this.options = options || {}; // methode de geocodage Iif (!this.options.geocodeMethod || (this.options.geocodeMethod !== "search" && this.options.geocodeMethod !== "reverse")) { throw new Error("Error geocodeMethod not valid"); } this.geocodeMethod = this.options.geocodeMethod; // mapping des options avec l'API REST this.query = (typeof this.options !== "undefined") ? this.options.query : null; this.searchGeometry = this.options.searchGeometry || null; this.index = this.options.index || null; this.lon = this.options.position && this.options.position.lon ? this.options.position.lon : null; this.lat = this.options.position && this.options.position.lat ? this.options.position.lat : null; this.maxResp = this.options.maxResp || null; this.returnTrueGeometry = this.options.returnTrueGeometry || null; this.filters = this.options.filters || {}; } /** * CLASSNAME */ GeocodeParamREST.CLASSNAME = "GeocodeParamREST"; GeocodeParamREST.prototype = { /** * @lends module:GeocodeParamREST# */ /** * Constructeur (alias) */ constructor : GeocodeParamREST, /** * Retourne les filtres * @returns {String} les filtres */ getFilters : function () { var filters = {}; for (var prop in this.filters) { if (this.filters.hasOwnProperty(prop)) { filters[prop] = this.filters[prop]; } } return filters; }, /** * Retourne l'index * @returns {String} l'index */ getIndex : function () { Iif (this.index === undefined) { return null; } Iif (this.index === "StreetAddress") { return "address"; } else Iif (this.index === "CadastralParcel") { return "parcel"; } else Eif (this.index === "PositionOfInterest") { return "poi"; } else if (this.index === "location") { return "location"; } return this.index; }, /** * Retourne la géométrie de recherche * @returns {String} la géométrie de recherche au format json */ getSearchGeometry : function () { return JSON.stringify(this.searchGeometry); } }; /** * Tableau de clefs/valeurs pour param. * * @returns {Array} liste de paramêtres */ GeocodeParamREST.prototype.getParams = function () { var map = []; if (this.geocodeMethod === "search") { map.push({ k : "q", v : this.query }); } Eif (this.index) { map.push({ k : "index", v : this.getIndex() }); } if (this.geocodeMethod === "reverse" && this.searchGeometry) { map.push({ k : "searchgeom", v : this.getSearchGeometry() }); } if (this.lon && this.lat) { map.push({ k : "lon", v : this.lon }); map.push({ k : "lat", v : this.lat }); } Iif (this.maxResp) { map.push({ k : "limit", v : this.maxResp }); } Iif (this.returnTrueGeometry) { map.push({ k : "returntruegeometry", v : this.returnTrueGeometry }); } const filters = this.getFilters(); for (var key in filters) { map.push({ k : key, v : filters[key] }); } return map; }; export default GeocodeParamREST; |