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 177 178 | 6x 6x 6x 6x 6x 17x 17x 6x 1x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x | import Logger from "../../../Utils/LoggerByDefault"; import Position from "./model/Position"; import Preference from "./model/Preference"; /** * @classdesc * * Requête de geocodage inverse * * XSD * ``` * Geocodage inverse (balise xsd) : * element ref="RequestHeader" [ (attribute name="clientName" attribute name="clientPassword" attribute name="sessionID" attribute name="srsName" attribute name="MSID") ] * element name="Request" attribute name="methodName" attribute name="version" attribute name="requestID" [ attribute name="maximumResponses" ] * element name="ReverseGeocodeRequest" * element ref="xls:Position" * element name="ReverseGeocodePreference" (enumeration) * ``` * * @example * // creation de l"objet ReverseGeocode * req = new ReverseGeocodeRequest (); * req.addPosition (new Position (position:{x: , y: })); * req.addPreference (["StreetAddress"]); * req.toString(); * // out -> * // <ReverseGeocodeRequest> * // <Position> * // <gml:Point xmlns:gml="http://www.opengis.net/gml"> * // <gml:pos>50.347775 3.205098</gml:pos> * // </gml:Point> * // </Position> * // <ReverseGeocodePreference>StreetAddress</ReverseGeocodePreference> * // </ReverseGeocodeRequest> * @constructor * @alias Gp.Formats.XLS.ReverseGeocodeRequest * @param {Object} options - options * @param {Object} options.position - position * @param {String} options.returnFreeForm - returnFreeForm * @param {String} options.filterOptions - filtres * @param {Function} options.onsuccess - function callback success (TODO) * @param {Function} options.onerror - function callback error (TODO) * * @private */ function ReverseGeocodeRequest (options) { this.logger = Logger.getLogger(); this.logger.trace("[Constructeur ReverseGeocodeRequest ()]"); Iif (!(this instanceof ReverseGeocodeRequest)) { throw new TypeError("ReverseGeocodeRequest constructor cannot be called as a function."); } // options par defaut this.options = options || {}; // et on ajoute les options en paramètre aux options par défaut for (var opt in options) { Eif (options.hasOwnProperty(opt)) { this.options[opt] = options[opt]; } } /** * Nom de la classe (heritage) */ this.CLASSNAME = "ReverseGeocodeRequest"; } ReverseGeocodeRequest.prototype = { /** * @lends module:ReverseGeocodeRequest# */ /** * request (out) * @type {String} */ strRequest : null, /** * Position * @type {Position} */ oPosition : null, /** * Preference * @type {Preference} */ oPreference : null, /** * Constructeur (alias) */ constructor : ReverseGeocodeRequest, /** * Template de la requête. * substitution des valeurs suivantes : * __POSITION__, __PREFERENCE__, __RETURNFREEFORM__ */ template : "<ReverseGeocodeRequest returnFreeForm=\"__RETURNFREEFORM__\">" + "__POSITION__" + "__PREFERENCE__" + "</ReverseGeocodeRequest>", /** * Ajout d"un objet de type Position * * @param {Object} oPosition - Position */ addPosition : function (oPosition) { if (oPosition instanceof Position) { this.oPosition = oPosition; } }, /** * Ajout d"une liste de table de référence LUS : * [StreetAddress, PointOfInterest, CadastralParcel, Administrativ] * * @param {Object} oPreference - Preference */ addPreferences : function (oPreference) { if (oPreference instanceof Preference) { this.oPreference = oPreference; } }, /** * toString * @returns {String} requête */ toString : function () { var template = ""; template = this.template; // si on a déjà un objet Preference instancié, // sinon, on le fabrique via les options Eif (!this.oPreference) { this.oPreference = new Preference(this.options.filterOptions.type || ["StreetAddress"]); Iif (!this.oPreference) { throw new Error("Les preferences ne sont pas definies !?"); } } template = template.replace(/__PREFERENCE__/g, this.oPreference.toString()); // si on a déjà un objet Position instancié, // sinon, on le fabrique via les options Eif (!this.oPosition) { var settings = { position : this.options.position, filter : {} }; // FIXME gestion des filtres ? Eif (this.options.filterOptions) { settings.filter = this.options.filterOptions; delete settings.filter.type; // pas besoin ? } this.oPosition = new Position(settings); Iif (!this.oPosition) { throw new Error("La position et ses filtres ne sont pas definis !?"); } } template = template.replace(/__POSITION__/g, this.oPosition.toString()); template = template.replace(/__RETURNFREEFORM__/g, (this.options.returnFreeForm) ? "true" : "false"); this.strRequest = template; return this.strRequest; } }; export default ReverseGeocodeRequest; |