ym4r-mapstraction 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/.gitignore +2 -0
- data/LICENSE +20 -0
- data/README.rdoc +158 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/javascript/clusterer.js +410 -0
- data/javascript/mapquest-js/mqcommon.js +1740 -0
- data/javascript/mapquest-js/mqexec.js +977 -0
- data/javascript/mapquest-js/mqobjects.js +10733 -0
- data/javascript/mapquest-js/mqutils.js +1001 -0
- data/javascript/mapstraction-geocode.js +179 -0
- data/javascript/mapstraction-route.js +200 -0
- data/javascript/mapstraction.js +3570 -0
- data/javascript/ym4r-mapstraction.js +105 -0
- data/lib/mapstraction_plugin/helper.rb +14 -0
- data/lib/mapstraction_plugin/mapping.rb +120 -0
- data/lib/mapstraction_plugin/mapstraction.rb +309 -0
- data/lib/mapstraction_plugin/overlay.rb +105 -0
- data/lib/mapstraction_plugin/routing.rb +56 -0
- data/lib/ym4r_mapstraction.rb +43 -0
- data/tasks/ym4r_mapstraction_tasks.rake +4 -0
- data/test/ym4r_mapstraction_test.rb +8 -0
- data/ym4r-mapstraction.gemspec +69 -0
- metadata +84 -0
@@ -0,0 +1,977 @@
|
|
1
|
+
try{
|
2
|
+
var testCommons = new MQObject();
|
3
|
+
testCommons = null;
|
4
|
+
}catch(error){
|
5
|
+
throw "You must include mqcommon.js or toolkit api script prior to mqexec.js.";
|
6
|
+
}
|
7
|
+
/**
|
8
|
+
* Constructs new MQExec Object
|
9
|
+
*
|
10
|
+
* @class Provides communication layer for requests to a server. Most, but
|
11
|
+
* not all, of the functions generate actual requests to the MapQuest
|
12
|
+
* Server. Within the context of this object, a Session object is used
|
13
|
+
* to maintain information concerning the current client's requests.
|
14
|
+
*
|
15
|
+
* @param {String/MQExec} strServerNameORmqeObj MapQuest Server name (or) MQExec
|
16
|
+
* object to copy the server information.
|
17
|
+
* @param {String} strPathToServer Path to the Server
|
18
|
+
* @param {int} nServerPort HTTP Port of the Server
|
19
|
+
* @param {String} strProxyServerName Name of the server hosting the Proxy page
|
20
|
+
* @param (String} strPathToProxyServerPage Path to the Proxy Server page
|
21
|
+
* @param {int} nProxyServerPort Port of the Server hosting the Proxy page
|
22
|
+
*
|
23
|
+
* strServerName, strPathToServer, and nServerPort are required properties
|
24
|
+
* that need to be set before the first request. If these properties are not
|
25
|
+
* specified, the defaults used for initialization are:
|
26
|
+
*
|
27
|
+
* MapServer = localhost
|
28
|
+
* PathToServer = mq
|
29
|
+
* HTTPPort = 80
|
30
|
+
*
|
31
|
+
* Please Note: These defaults are not likely to match your configuration.
|
32
|
+
*
|
33
|
+
* If MQExec object is provided as the first parameter, remaining parameters
|
34
|
+
* will be ignored and server information will be copied from the provided object.
|
35
|
+
*
|
36
|
+
*
|
37
|
+
* @see MQDBLayerQueryCollection
|
38
|
+
* @see MQDTCollection
|
39
|
+
* @see MQFeatureCollection
|
40
|
+
* @see MQLocation
|
41
|
+
* @see MQLocationCollection
|
42
|
+
* @see MQMapState
|
43
|
+
* @see MQLatLng
|
44
|
+
* @see MQPoint
|
45
|
+
* @see MQSession
|
46
|
+
* @see MQRouteOptions
|
47
|
+
* @see MQRouteResults
|
48
|
+
* @see MQGeocodeOptionsCollection
|
49
|
+
* @see MQStringCollection
|
50
|
+
* @see MQRecordSet
|
51
|
+
* @see MQLatLngCollection
|
52
|
+
* @see MQPointCollection
|
53
|
+
* @see MQSearchCriteria
|
54
|
+
* @see MQMapCommand
|
55
|
+
* @see MQQualityType
|
56
|
+
* @see MQMatchType
|
57
|
+
*/
|
58
|
+
function MQExec ( strServerNameORmqeObj, strPathToServer, nServerPort,
|
59
|
+
strProxyServerName, strPathToProxyServerPage, nProxyServerPort )
|
60
|
+
{
|
61
|
+
|
62
|
+
|
63
|
+
var m_strServerName;
|
64
|
+
var m_strServerPath;
|
65
|
+
var m_nServerPort;
|
66
|
+
var m_strProxyServerPath ;
|
67
|
+
var m_strProxyServerName;
|
68
|
+
var m_nProxyServerPort;
|
69
|
+
var m_lSocketTimeout;
|
70
|
+
var m_strXInfo = "";
|
71
|
+
|
72
|
+
if( typeof strServerNameORmqeObj == "string" ) {
|
73
|
+
m_strServerName = strServerNameORmqeObj || "localhost";
|
74
|
+
m_strServerPath = strPathToServer || "mq";
|
75
|
+
m_nServerPort = nServerPort || 80;
|
76
|
+
m_strProxyServerPath = strPathToProxyServerPage || "";
|
77
|
+
m_strProxyServerName = strProxyServerName || "";
|
78
|
+
m_nProxyServerPort = nProxyServerPort || 0;
|
79
|
+
m_lSocketTimeout = 0;
|
80
|
+
|
81
|
+
} else if(strServerNameORmqeObj.getClassName() &&
|
82
|
+
strServerNameORmqeObj.getClassName() == "MQExec" ) {
|
83
|
+
m_strServerName = strServerNameORmqeObj.getServerName();
|
84
|
+
m_strServerPath = strServerNameORmqeObj.getServerPath();
|
85
|
+
m_nServerPort = strServerNameORmqeObj.getServerPort();
|
86
|
+
m_strProxyServerName = strServerNameORmqeObj.getProxyServerName();
|
87
|
+
m_nProxyServerPort = strServerNameORmqeObj.getProxyServerPort();
|
88
|
+
m_strProxyServerPath = strServerNameORmqeObj.getProxyServerPath();
|
89
|
+
m_lSocketTimeout = strServerNameORmqeObj.m_lSocketTimeout;
|
90
|
+
}
|
91
|
+
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Sets the name of the server which is to be used to satisfy this request.
|
95
|
+
* @param {String} strServerName The name of the MapQuest Server which is to
|
96
|
+
* be used to satisfy this request.
|
97
|
+
* @type void
|
98
|
+
*/
|
99
|
+
|
100
|
+
this.setServerName = function(strServerName) {
|
101
|
+
m_strServerName = strServerName;
|
102
|
+
|
103
|
+
};
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Returns the name of the server which will be used to satisfy this
|
107
|
+
* request.
|
108
|
+
*
|
109
|
+
* @return The name of the server which will be used to satisfy
|
110
|
+
* this request.
|
111
|
+
* @type String
|
112
|
+
*/
|
113
|
+
|
114
|
+
this.getServerName= function() {
|
115
|
+
return m_strServerName;
|
116
|
+
};
|
117
|
+
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Sets the path to the server which is to be used to satisfy this request.
|
121
|
+
*
|
122
|
+
* @param {String} strServerPath The path to the server which is to be used
|
123
|
+
* to satisfy this request.
|
124
|
+
* @type void
|
125
|
+
*/
|
126
|
+
|
127
|
+
this.setServerPath = function(strServerPath) {
|
128
|
+
m_strServerPath = strServerPath;
|
129
|
+
};
|
130
|
+
|
131
|
+
|
132
|
+
/**
|
133
|
+
* Returns the path to the server which will be used to satisfy this
|
134
|
+
* request.
|
135
|
+
*
|
136
|
+
* @return The path to the server which will be used to satisfy this
|
137
|
+
* request.
|
138
|
+
* @type String
|
139
|
+
*/
|
140
|
+
|
141
|
+
this.getServerPath= function() {
|
142
|
+
return m_strServerPath;
|
143
|
+
};
|
144
|
+
|
145
|
+
|
146
|
+
/**
|
147
|
+
* Sets the port number to the server which is to be used to satisfy this
|
148
|
+
* request.
|
149
|
+
*
|
150
|
+
* @param {int} nServerPort The port number of the server which is to be
|
151
|
+
* used to satisfy this request.
|
152
|
+
* @type void
|
153
|
+
*/
|
154
|
+
|
155
|
+
this.setServerPort = function(nServerPort) {
|
156
|
+
m_nServerPort = nServerPort;
|
157
|
+
|
158
|
+
};
|
159
|
+
|
160
|
+
/**
|
161
|
+
* Returns the port number of the server which will be used to satisfy
|
162
|
+
* this request.
|
163
|
+
*
|
164
|
+
* @return The port number of the server which will be used to satisfy
|
165
|
+
* this request.
|
166
|
+
* @type int
|
167
|
+
*/
|
168
|
+
|
169
|
+
this.getServerPort= function() {
|
170
|
+
return m_nServerPort;
|
171
|
+
};
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
/**
|
176
|
+
* Sets the name or IP of the proxy server to connect to.
|
177
|
+
* The name should not contain any leading or trailing slashes ("/").
|
178
|
+
*
|
179
|
+
* @param {String} strProxyServerName The name of the proxy server.
|
180
|
+
* @type void
|
181
|
+
*/
|
182
|
+
|
183
|
+
this.setProxyServerName = function(strProxyServerName) {
|
184
|
+
m_strProxyServerName = strProxyServerName;
|
185
|
+
|
186
|
+
};
|
187
|
+
|
188
|
+
/**
|
189
|
+
* Returns the name or IP of the proxy server to connect to.
|
190
|
+
*
|
191
|
+
* @return The name of the proxy server.
|
192
|
+
* @type String
|
193
|
+
*/
|
194
|
+
|
195
|
+
this.getProxyServerName = function() {
|
196
|
+
|
197
|
+
return m_strProxyServerName;
|
198
|
+
|
199
|
+
};
|
200
|
+
|
201
|
+
/**
|
202
|
+
* Sets the path to the proxy server which is to be used to satisfy this request.
|
203
|
+
*
|
204
|
+
* @param (String} strProxyServerPath The path to the server which is to be used
|
205
|
+
* to satisfy this request.
|
206
|
+
* @type void
|
207
|
+
*/
|
208
|
+
|
209
|
+
this.setProxyServerPath = function(strProxyServerPath) {
|
210
|
+
m_strProxyServerPath = strProxyServerPath;
|
211
|
+
|
212
|
+
};
|
213
|
+
|
214
|
+
|
215
|
+
/**
|
216
|
+
* Returns the path to the proxy server page which will be used to satisfy this
|
217
|
+
* request.
|
218
|
+
*
|
219
|
+
* @return The path to the proxy server page which will be used to satisfy this
|
220
|
+
* request.
|
221
|
+
* @type String
|
222
|
+
*/
|
223
|
+
|
224
|
+
this.getProxyServerPath = function() {
|
225
|
+
return m_strProxyServerPath;
|
226
|
+
};
|
227
|
+
|
228
|
+
/**
|
229
|
+
* Sets the port to connect to the proxy server with.
|
230
|
+
*
|
231
|
+
* @param {int} nProxyServerPort The proxy server port number.
|
232
|
+
* @type void
|
233
|
+
*/
|
234
|
+
|
235
|
+
this.setProxyServerPort = function(nProxyServerPort) {
|
236
|
+
m_nProxyServerPort = nProxyServerPort;
|
237
|
+
|
238
|
+
};
|
239
|
+
|
240
|
+
/**
|
241
|
+
* Returns the port number to connect to the proxy server with.
|
242
|
+
*
|
243
|
+
* @return The proxy server port number.
|
244
|
+
* @type int
|
245
|
+
*/
|
246
|
+
|
247
|
+
this.getProxyServerPort = function() {
|
248
|
+
return m_nProxyServerPort;
|
249
|
+
};
|
250
|
+
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Sets data to be passed to the server to be logged with any
|
254
|
+
* subsequent requests in the transaction log. (Max 8 characters)
|
255
|
+
*
|
256
|
+
* @param {String} strXInfo Transaction Info.
|
257
|
+
*
|
258
|
+
* @type void
|
259
|
+
*/
|
260
|
+
|
261
|
+
this.setTransactionInfo = function(strXInfo) {
|
262
|
+
if (strXInfo.length > 32)
|
263
|
+
m_strXInfo = strXInfo.substring(0, 32);
|
264
|
+
else
|
265
|
+
m_strXInfo = strXInfo;
|
266
|
+
|
267
|
+
};
|
268
|
+
|
269
|
+
|
270
|
+
/**
|
271
|
+
* Gets data to be passed to the server to be logged with any
|
272
|
+
* subsequent requests in the transaction log.
|
273
|
+
*
|
274
|
+
* @return Transaction Information
|
275
|
+
* @type String
|
276
|
+
*/
|
277
|
+
|
278
|
+
this.getTransactionInfo = function() {
|
279
|
+
return m_strXInfo;
|
280
|
+
};
|
281
|
+
|
282
|
+
|
283
|
+
}
|
284
|
+
|
285
|
+
/* Defined transaction versions */
|
286
|
+
MQExec.prototype.ROUTE_VERSION = "2";
|
287
|
+
MQExec.prototype.SEARCH_VERSION = "0";
|
288
|
+
MQExec.prototype.GEOCODE_VERSION = "1";
|
289
|
+
MQExec.prototype.ROUTEMATRIX_VERSION = "0";
|
290
|
+
MQExec.prototype.GETRECORDINFO_VERSION = "0";
|
291
|
+
MQExec.prototype.REVERSEGEOCODE_VERSION = "0";
|
292
|
+
MQExec.prototype.GETSESSION_VERSION = "1";
|
293
|
+
|
294
|
+
|
295
|
+
/**
|
296
|
+
* Prepares request XML data to be sent to the server for a given transaction
|
297
|
+
* and set of request objects.
|
298
|
+
*
|
299
|
+
* @param {String} strTransaction Name of the transaction
|
300
|
+
*
|
301
|
+
* @param {Array} arrRequest Array of request objects to form the XML
|
302
|
+
*
|
303
|
+
* @param {String} strVersion Version of the transaction implementation
|
304
|
+
*
|
305
|
+
* @type void
|
306
|
+
*
|
307
|
+
* @private
|
308
|
+
*/
|
309
|
+
MQExec.prototype.getRequestXml = function(strTransaction, arrRequest, strVersion) {
|
310
|
+
|
311
|
+
var arrXmlBuf = new Array();
|
312
|
+
var version = strVersion || "0";
|
313
|
+
arrXmlBuf.push("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
|
314
|
+
arrXmlBuf.push("<" + strTransaction + " Version=\"" + version + "\">\n");
|
315
|
+
for (var i=0; i < arrRequest.length; i++) {
|
316
|
+
arrXmlBuf.push(arrRequest[i].saveXml());
|
317
|
+
arrXmlBuf.push("\n");
|
318
|
+
}
|
319
|
+
arrXmlBuf.push("</" + strTransaction + ">");
|
320
|
+
return arrXmlBuf.join("");
|
321
|
+
|
322
|
+
};
|
323
|
+
|
324
|
+
/**
|
325
|
+
* Performs the given transaction by making AJAX call to the Proxy Server page.
|
326
|
+
*
|
327
|
+
* @param {String} strTransaction Name of the transaction
|
328
|
+
*
|
329
|
+
* @param {Array} arrRequest Array of request objects
|
330
|
+
*
|
331
|
+
* @type void
|
332
|
+
*
|
333
|
+
* @private
|
334
|
+
*/
|
335
|
+
MQExec.prototype.doTransaction = function(strTransaction, arrRequest, strVersion ) {
|
336
|
+
|
337
|
+
var xmlDoc;
|
338
|
+
var strResXml;
|
339
|
+
var http_request = mqXMLHttpRequest();
|
340
|
+
var strUrl = "";
|
341
|
+
arrRequest.push( new MQAuthentication(this.getTransactionInfo()));
|
342
|
+
var strReqXml = this.getRequestXml(strTransaction, arrRequest, strVersion);
|
343
|
+
|
344
|
+
if(this.getProxyServerName() != "") {
|
345
|
+
strUrl += "http://" + this.getProxyServerName();
|
346
|
+
if(this.getProxyServerPort() != 0) {
|
347
|
+
strUrl += ":" + this.getProxyServerPort();
|
348
|
+
}
|
349
|
+
strUrl += "/";
|
350
|
+
}
|
351
|
+
|
352
|
+
strUrl += this.getProxyServerPath();
|
353
|
+
strUrl += "?sname=" + this.getServerName();
|
354
|
+
strUrl += "&spath=" + this.getServerPath();
|
355
|
+
strUrl += "&sport=" + this.getServerPort();
|
356
|
+
display("mqXmlLogs", "Request URL: ", strUrl, "rURL", "mqDisplay");
|
357
|
+
display("mqXmlLogs", "Request XML: ", strReqXml, "", "mqDisplay");
|
358
|
+
|
359
|
+
http_request.open("POST", strUrl, false);
|
360
|
+
http_request.send(strReqXml);
|
361
|
+
if (http_request.status == 200) {
|
362
|
+
xmlDoc= http_request.responseXML;
|
363
|
+
}
|
364
|
+
else {
|
365
|
+
alert( "HTTP Status: " + http_request.status +
|
366
|
+
" (" + http_request.statusText + ")\n" +
|
367
|
+
"Details: \n" + http_request.responseText
|
368
|
+
);
|
369
|
+
xmlDoc = null;
|
370
|
+
}
|
371
|
+
display("mqXmlLogs", "Response XML: ", mqXmlToStr(xmlDoc), "resXML", "mqDisplay");
|
372
|
+
return xmlDoc;
|
373
|
+
};
|
374
|
+
|
375
|
+
|
376
|
+
/**
|
377
|
+
* Method to geocode an address or an intersection. Geocode options supply
|
378
|
+
* the QualityType and MatchType.
|
379
|
+
*
|
380
|
+
* @param {MQAddress} mqaAddress The Address object containing the necessary info for
|
381
|
+
* the address.
|
382
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
383
|
+
*
|
384
|
+
* @param {MQLocationCollection} mqlcLocations The LocationCollection to hold the results of the
|
385
|
+
* geocode.
|
386
|
+
*
|
387
|
+
* @param {MQAutoGeocodeCovSwitch/MQGeocodeOptionsCollection} theOptions
|
388
|
+
* The AutoGeocodeCovSwitch or MQGeocodeOptionsCollection to select a set of
|
389
|
+
* options stored on the server.
|
390
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
391
|
+
*
|
392
|
+
* @type void
|
393
|
+
*/
|
394
|
+
|
395
|
+
MQExec.prototype.geocode = function(mqaAddress, mqlcLocations, theOptions) {
|
396
|
+
|
397
|
+
var xmlDoc;
|
398
|
+
var strXml;
|
399
|
+
var arrRequest = new Array();
|
400
|
+
|
401
|
+
if(mqaAddress == null || (mqaAddress.getClassName() !== "MQAddress" && mqaAddress.getClassName() !== "MQSingleLineAddress")) {
|
402
|
+
throw "Null or Illegal Argument passed for MQAddress";
|
403
|
+
} else {
|
404
|
+
arrRequest.push(mqaAddress);
|
405
|
+
}
|
406
|
+
|
407
|
+
if(mqlcLocations == null || mqlcLocations.getClassName() !== "MQLocationCollection") {
|
408
|
+
throw "Null or Illegal Argument passed for MQLocationCollection";
|
409
|
+
}
|
410
|
+
|
411
|
+
if(theOptions != null) {
|
412
|
+
if(theOptions.getClassName() !== "MQAutoGeocodeCovSwitch" &&
|
413
|
+
theOptions.getClassName() !== "MQGeocodeOptionsCollection" ) {
|
414
|
+
throw "Illegal Argument passed for Geocode Options";
|
415
|
+
} else {
|
416
|
+
arrRequest.push(theOptions);
|
417
|
+
}
|
418
|
+
}
|
419
|
+
|
420
|
+
mqLogTime("MQExec.geocode: Transaction Start");
|
421
|
+
xmlDoc = this.doTransaction("Geocode", arrRequest, this.GEOCODE_VERSION);
|
422
|
+
mqLogTime("MQExec.geocode: Transaction End");
|
423
|
+
|
424
|
+
mqLogTime("MQExec.geocode: Loading of GeocodeResponse Start");
|
425
|
+
strXml = mqXmlToStr(mqGetNode(xmlDoc, "/GeocodeResponse/LocationCollection"));
|
426
|
+
mqlcLocations.loadXml(strXml);
|
427
|
+
mqLogTime("MQExec.geocode: Loading of GeocodeResponse End");
|
428
|
+
|
429
|
+
display("results", "Response", mqXmlToStr(xmlDoc), "", "mqDisplay");
|
430
|
+
|
431
|
+
};
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
/**
|
436
|
+
* Method to batch geocode a collection of locations. Geocode options supply
|
437
|
+
* the QualityType and MatchType.
|
438
|
+
*
|
439
|
+
* @param {MQLocationCollection} mqlcLocations The LocationCollection containing the
|
440
|
+
* necessary info for the addresses to be geocode.
|
441
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
442
|
+
*
|
443
|
+
* @param {MQLocationCollectionCollection} mqlccLocations The LocationCollectionCollection
|
444
|
+
* used to hold the results of the geocode.
|
445
|
+
*
|
446
|
+
* @param {MQAutoGeocodeCovSwitch/MQGeocodeOptionsCollection} theOptions
|
447
|
+
* The AutoGeocodeCovSwitch or MQGeocodeOptionsCollection to select a set of
|
448
|
+
* options stored on the server.
|
449
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
450
|
+
*
|
451
|
+
* @type void
|
452
|
+
*/
|
453
|
+
|
454
|
+
MQExec.prototype.batchGeocode = function(mqlcLocations, mqlccLocations, theOptions) {
|
455
|
+
|
456
|
+
var xmlDoc;
|
457
|
+
var strXml;
|
458
|
+
var arrRequest = new Array();
|
459
|
+
|
460
|
+
if(mqlcLocations == null || mqlcLocations.getClassName() !== "MQLocationCollection") {
|
461
|
+
throw "Null or Illegal Argument passed for MQLocationCollection";
|
462
|
+
} else {
|
463
|
+
arrRequest.push(mqlcLocations);
|
464
|
+
}
|
465
|
+
|
466
|
+
if(mqlccLocations == null || mqlccLocations.getClassName() !== "MQLocationCollectionCollection") {
|
467
|
+
throw "Null or Illegal Argument passed for MQLocationCollectionCollection";
|
468
|
+
}
|
469
|
+
|
470
|
+
if(theOptions != null) {
|
471
|
+
if(theOptions.getClassName() !== "MQAutoGeocodeCovSwitch" &&
|
472
|
+
theOptions.getClassName() !== "MQGeocodeOptionsCollection" ) {
|
473
|
+
throw "Illegal Argument passed for Geocode Options";
|
474
|
+
} else {
|
475
|
+
arrRequest.push(theOptions);
|
476
|
+
}
|
477
|
+
}
|
478
|
+
|
479
|
+
mqLogTime("MQExec.batchGeocode: Transaction Start");
|
480
|
+
xmlDoc = this.doTransaction("BatchGeocode", arrRequest, this.GEOCODE_VERSION);
|
481
|
+
mqLogTime("MQExec.batchGeocode: Transaction End");
|
482
|
+
|
483
|
+
mqLogTime("MQExec.batchGeocode: Loading of GeocodeResponse Start");
|
484
|
+
strXml = mqXmlToStr(mqGetNode(xmlDoc, "/BatchGeocodeResponse/LocationCollectionCollection"));
|
485
|
+
mqlccLocations.loadXml(strXml);
|
486
|
+
mqLogTime("MQExec.batchGeocode: Loading of GeocodeResponse End");
|
487
|
+
|
488
|
+
display("results", "Response", mqXmlToStr(xmlDoc), "", "mqDisplay");
|
489
|
+
|
490
|
+
};
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
/**
|
495
|
+
* Calculates a route using a collection of locations as origin and
|
496
|
+
* destination. These locations can be Address, GeoAddress,
|
497
|
+
* Intersection, or GeoIntersection objects.
|
498
|
+
*
|
499
|
+
* @param {MQLocationCollection} mqlcLocations Collection of locations.
|
500
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
501
|
+
*
|
502
|
+
* @param {MQRouteOptions} mqroOptions Route options object, to modify
|
503
|
+
* behavior of route.
|
504
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
505
|
+
*
|
506
|
+
* @param {MQRouteResults} mqrrResults The results of the route request.
|
507
|
+
*
|
508
|
+
* @param {String} strSessionUID The unique Session ID.
|
509
|
+
*
|
510
|
+
* @param {MQRectLL} mqRectLL The bounding box to provide to the TileMap
|
511
|
+
* ToolKit. This parameter is optional
|
512
|
+
*
|
513
|
+
* @type void
|
514
|
+
*/
|
515
|
+
|
516
|
+
MQExec.prototype.doRoute = function(mqlcLocations, mqroOptions, mqrrResults, strSessionUID, mqRectLL) {
|
517
|
+
|
518
|
+
var xmlDoc;
|
519
|
+
var strXml;
|
520
|
+
var arrRequest = new Array();
|
521
|
+
|
522
|
+
if(mqlcLocations == null || mqlcLocations.getClassName() !== "MQLocationCollection") {
|
523
|
+
throw "Null or Illegal Argument passed for MQLocationCollection";
|
524
|
+
} else {
|
525
|
+
arrRequest.push(mqlcLocations);
|
526
|
+
}
|
527
|
+
if(mqroOptions == null || mqroOptions.getClassName() !== "MQRouteOptions") {
|
528
|
+
throw "Null or Illegal Argument passed for MQRouteOptions";
|
529
|
+
} else {
|
530
|
+
arrRequest.push(mqroOptions);
|
531
|
+
}
|
532
|
+
if(mqrrResults == null || mqrrResults.getClassName() !== "MQRouteResults") {
|
533
|
+
throw "Null or Illegal Argument passed for MQRouteResults";
|
534
|
+
} else {
|
535
|
+
var sessionId = strSessionUID || "";
|
536
|
+
arrRequest.push(new MQXmlNodeObject("SessionID",sessionId) );
|
537
|
+
}
|
538
|
+
|
539
|
+
mqLogTime("MQExec.doRoute: Transaction Start");
|
540
|
+
xmlDoc = this.doTransaction("DoRoute", arrRequest, this.ROUTE_VERSION);
|
541
|
+
mqLogTime("MQExec.doRoute: Transaction End");
|
542
|
+
|
543
|
+
mqLogTime("MQExec.doRoute: Loading of RouteResults Start");
|
544
|
+
strXml = mqXmlToStr(mqGetNode(xmlDoc, "/DoRouteResponse/RouteResults"));
|
545
|
+
mqrrResults.loadXml(strXml);
|
546
|
+
mqLogTime("MQExec.doRoute: Loading of RouteResults End");
|
547
|
+
|
548
|
+
display("results", "Response", mqXmlToStr(xmlDoc), "", "mqDisplay");
|
549
|
+
|
550
|
+
if(mqRectLL !== null && sessionId !== ""){
|
551
|
+
this.getRouteBoundingBoxFromSessionResponse(sessionId, mqRectLL);
|
552
|
+
}
|
553
|
+
|
554
|
+
};
|
555
|
+
|
556
|
+
/**
|
557
|
+
* Generates a request to the MapQuest server (as specified by the
|
558
|
+
* server name, path, and port number) to create a user Session.
|
559
|
+
* The Session is assigned a unique identifier which is used to
|
560
|
+
* access and update the Session information.
|
561
|
+
*
|
562
|
+
* @param {MQSession} mqsSession Object containing objects for the session.
|
563
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
564
|
+
*
|
565
|
+
* @return The unique Session identifier.
|
566
|
+
*
|
567
|
+
* @type String
|
568
|
+
*/
|
569
|
+
|
570
|
+
MQExec.prototype.createSessionEx = function(mqsSession) {
|
571
|
+
|
572
|
+
var xmlDoc;
|
573
|
+
var strSessId;
|
574
|
+
var arrRequest = new Array();
|
575
|
+
if(mqsSession == null || mqsSession.getClassName() !== "MQSession") {
|
576
|
+
throw "Null or Illegal Argument passed for MQSession";
|
577
|
+
} else {
|
578
|
+
arrRequest.push(mqsSession);
|
579
|
+
}
|
580
|
+
|
581
|
+
xmlDoc = this.doTransaction("CreateSession", arrRequest);
|
582
|
+
strSessId = mqGetNodeText(mqGetNode(xmlDoc, "/CreateSessionResponse/SessionID"));
|
583
|
+
|
584
|
+
return strSessId;
|
585
|
+
};
|
586
|
+
|
587
|
+
|
588
|
+
MQExec.prototype.getSession = function(strSessionID, mqObj) {
|
589
|
+
|
590
|
+
// TO-DO: do class name validations.
|
591
|
+
var xmlDoc;
|
592
|
+
var strXml;
|
593
|
+
var sessionId = strSessionID || "";
|
594
|
+
var arrRequest = new Array();
|
595
|
+
arrRequest.push(new MQXmlNodeObject("SessionID",sessionId) );
|
596
|
+
|
597
|
+
xmlDoc = this.doTransaction("GetSession", arrRequest, this.GETSESSION_VERSION);
|
598
|
+
if(mqObj.getClassName()==="MQMapState"){
|
599
|
+
strXml = mqXmlToStr(mqGetNode(xmlDoc, "/GetSessionResponse/Session/MapState"));
|
600
|
+
mqObj.loadXml(strXml);
|
601
|
+
} else if(mqObj.getClassName()==="MQSession"){
|
602
|
+
strXml = mqXmlToStr(mqGetNode(xmlDoc, "/GetSessionResponse/Session"));
|
603
|
+
mqObj.loadXml(strXml);
|
604
|
+
}
|
605
|
+
};
|
606
|
+
|
607
|
+
|
608
|
+
/**
|
609
|
+
* Calculates a route matrix. Either a drive time (many-to-many) or a
|
610
|
+
* multi-destination (one-to-many) route.
|
611
|
+
*
|
612
|
+
* @param {MQLocationCollection} mqlcLocations Collection of location objects.
|
613
|
+
* The first member of the collection is the origin. If allToAll is true then
|
614
|
+
* the last member is the destination. Each location must be a GeoAddress
|
615
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
616
|
+
*
|
617
|
+
* @param {boolean} bAllToAll If true then a matrix of time and distance from
|
618
|
+
* each location to all others is found. If false, time and distance from the
|
619
|
+
* first location (origin) to all others is found.
|
620
|
+
*
|
621
|
+
* @param {MQRouteOptions} mqroOptions Specifies options for the route (fastest vs.
|
622
|
+
* shortest, coverage to use, roads to avoid, etc.).
|
623
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
624
|
+
*
|
625
|
+
* @param {MQRouteMatrixResults} mqrmrResults Contains the time and distance matrix as
|
626
|
+
* well as the status of the call (success, failure, partial success)
|
627
|
+
*
|
628
|
+
* @type void
|
629
|
+
*
|
630
|
+
*/
|
631
|
+
|
632
|
+
MQExec.prototype.doRouteMatrix = function(mqlcLocations, bAllToAll, mqroOptions, mqrmrResults) {
|
633
|
+
|
634
|
+
var xmlDoc;
|
635
|
+
var strXml;
|
636
|
+
var arrRequest = new Array();
|
637
|
+
|
638
|
+
if(mqlcLocations == null || mqlcLocations.getClassName() !== "MQLocationCollection") {
|
639
|
+
throw "Null or Illegal Argument passed for MQLocationCollection";
|
640
|
+
} else {
|
641
|
+
arrRequest.push(mqlcLocations);
|
642
|
+
}
|
643
|
+
if( bAllToAll == null || typeof bAllToAll != "boolean") {
|
644
|
+
throw "Null or Illegal Argument passed for bAllToAll";
|
645
|
+
} else {
|
646
|
+
var iAllToAll = bAllToAll ? 1 : 0;
|
647
|
+
arrRequest.push(new MQXmlNodeObject("AllToAll", iAllToAll));
|
648
|
+
}
|
649
|
+
if(mqroOptions == null || mqroOptions.getClassName() !== "MQRouteOptions") {
|
650
|
+
throw "Null or Illegal Argument passed for MQRouteOptions";
|
651
|
+
} else {
|
652
|
+
arrRequest.push(mqroOptions);
|
653
|
+
}
|
654
|
+
if(mqrmrResults == null || mqrmrResults.getClassName() !== "MQRouteMatrixResults") {
|
655
|
+
throw "Null or Illegal Argument passed for MQRouteMatrixResults";
|
656
|
+
}
|
657
|
+
|
658
|
+
mqLogTime("MQExec.doRoute: Transaction Start");
|
659
|
+
xmlDoc = this.doTransaction("DoRouteMatrix", arrRequest, this.ROUTEMATRIX_VERSION);
|
660
|
+
mqLogTime("MQExec.doRoute: Transaction End");
|
661
|
+
|
662
|
+
mqLogTime("MQExec.doRoute: Loading of RouteResults Start");
|
663
|
+
strXml = mqXmlToStr(mqGetNode(xmlDoc, "/DoRouteMatrixResponse/RouteMatrixResults"));
|
664
|
+
mqrmrResults.loadXml(strXml);
|
665
|
+
mqLogTime("MQExec.doRoute: Loading of RouteResults End");
|
666
|
+
|
667
|
+
display("results", "Response", mqXmlToStr(xmlDoc), "", "mqDisplay");
|
668
|
+
|
669
|
+
};
|
670
|
+
|
671
|
+
|
672
|
+
/**
|
673
|
+
* Generates a request to the MapQuest server (as specified by the server
|
674
|
+
* name, path, and port number) to perform a DB Search based on either the
|
675
|
+
* recordIds received or the extraCriteria info of the dblayerquery. The
|
676
|
+
* resulting recordset contains fields specified by the scFieldNames param.
|
677
|
+
*
|
678
|
+
* @param {MQStringCollection} mqscFieldNames containing the names of the fields
|
679
|
+
* to return, or blank for all fields.
|
680
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
681
|
+
*
|
682
|
+
* @param {MQDBLayerQuery} mqdlqQuery Contains the name of the dblayer/table to query.
|
683
|
+
* Optionally contains ExtraCriteria. Utilized only if RecordIds are empty.
|
684
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
685
|
+
*
|
686
|
+
* @param {MQRecordSet} mqrsResults The Returned RecordSet containg the records and
|
687
|
+
* fields matching the input parameters.
|
688
|
+
*
|
689
|
+
* @param {MQStringCollection} mqscRecIds RecordIdentifiers of the records to return
|
690
|
+
* stored in a StringCollection.
|
691
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
692
|
+
*
|
693
|
+
* @type void
|
694
|
+
*
|
695
|
+
*/
|
696
|
+
|
697
|
+
MQExec.prototype.getRecordInfo = function(mqscFieldNames, mqdlqQuery, mqrsResults, mqscRecIds) {
|
698
|
+
|
699
|
+
var xmlDoc;
|
700
|
+
var strXml;
|
701
|
+
var arrRequest = new Array();
|
702
|
+
|
703
|
+
if( mqscFieldNames == null || mqscFieldNames.getClassName() !== "MQStringCollection" ) {
|
704
|
+
throw "Null or Illegal Argument passed for MQStringCollection";
|
705
|
+
} else {
|
706
|
+
var fields = new MQStringCollection();
|
707
|
+
fields.setM_Xpath("Fields");
|
708
|
+
fields.append(mqscFieldNames);
|
709
|
+
arrRequest.push(fields);
|
710
|
+
}
|
711
|
+
if( mqdlqQuery == null || mqdlqQuery.getClassName() !== "MQDBLayerQuery" ) {
|
712
|
+
throw "Null or Illegal Argument passed for MQDBLayerQuery";
|
713
|
+
} else {
|
714
|
+
arrRequest.push(mqdlqQuery);
|
715
|
+
}
|
716
|
+
if( mqrsResults == null || mqrsResults.getClassName() !== "MQRecordSet" ) {
|
717
|
+
throw "Null or Illegal Argument passed for MQRecordSet";
|
718
|
+
}
|
719
|
+
if( mqscRecIds == null || mqscRecIds.getClassName() !== "MQStringCollection") {
|
720
|
+
throw "Null or Illegal Argument passed for MQStringCollection";
|
721
|
+
} else {
|
722
|
+
var recordIds = new MQStringCollection();
|
723
|
+
recordIds.setM_Xpath("RecordIds");
|
724
|
+
recordIds.append(mqscRecIds);
|
725
|
+
arrRequest.push(recordIds);
|
726
|
+
}
|
727
|
+
|
728
|
+
mqLogTime("MQExec.getRecordInfo: Transaction Start");
|
729
|
+
xmlDoc = this.doTransaction("GetRecordInfo", arrRequest, this.GETRECORDINFO_VERSION);
|
730
|
+
mqLogTime("MQExec.getRecordInfo: Transaction End");
|
731
|
+
|
732
|
+
mqLogTime("MQExec.getRecordInfo: Loading of RecordSet Start");
|
733
|
+
strXml = mqXmlToStr(mqGetNode(xmlDoc, "/GetRecordInfoResponse/RecordSet"));
|
734
|
+
mqrsResults.loadXml(strXml);
|
735
|
+
mqLogTime("MQExec.getRecordInfo: Loading of RecordSet End");
|
736
|
+
|
737
|
+
display("results", "Response", mqXmlToStr(xmlDoc), "", "mqDisplay");
|
738
|
+
|
739
|
+
};
|
740
|
+
|
741
|
+
|
742
|
+
/**
|
743
|
+
* Finds the address at a given latitude/longitude position.
|
744
|
+
*
|
745
|
+
* @param {MQLatLng} mqllLatLng The latitude/longitude position to use for
|
746
|
+
* the reverse geocode.
|
747
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
748
|
+
*
|
749
|
+
* @param {MQLocationCollection} mqlcLocations A LocationCollection in
|
750
|
+
* which to return the results of the reverse geocode. It will contain
|
751
|
+
* only GeoAddress objects.
|
752
|
+
*
|
753
|
+
* @param {String} strMapCovName The name of the mapping coverage to be
|
754
|
+
* used for the reverse geocode.
|
755
|
+
*
|
756
|
+
* @param {String} strGeocodeCovName An optional parameter, specifies the
|
757
|
+
* geocode coverage to use for the reverse geocode. If specified, using
|
758
|
+
* this geocode coverage, a ZIP code lookup will be performed on the addresses
|
759
|
+
* found in the mapping data to verify and fill in the city/state information
|
760
|
+
* for the address. If not specified, only ZIP code and, if available, street
|
761
|
+
* information found in the mapping data will be returned.
|
762
|
+
*
|
763
|
+
* @type void
|
764
|
+
*
|
765
|
+
*/
|
766
|
+
|
767
|
+
MQExec.prototype.reverseGeocode = function(mqllLatLng, mqlcLocations, strMapCovName, strGeocodeCovName) {
|
768
|
+
|
769
|
+
var xmlDoc;
|
770
|
+
var strXml;
|
771
|
+
var arrRequest = new Array();
|
772
|
+
|
773
|
+
if( mqllLatLng == null || mqllLatLng.getClassName() !== "MQLatLng" ) {
|
774
|
+
throw "Null or Illegal Argument passed for MQLatLng";
|
775
|
+
} else {
|
776
|
+
arrRequest.push(mqllLatLng);
|
777
|
+
}
|
778
|
+
if( mqlcLocations == null || mqlcLocations.getClassName() !== "MQLocationCollection" ) {
|
779
|
+
throw "Null or Illegal Argument passed for MQLocationCollection";
|
780
|
+
}
|
781
|
+
var mapPool = strMapCovName || "";
|
782
|
+
arrRequest.push(new MQXmlNodeObject("MapPool", mapPool));
|
783
|
+
|
784
|
+
var geocodePool = strGeocodeCovName || "";
|
785
|
+
arrRequest.push(new MQXmlNodeObject("GeocodePool", geocodePool));
|
786
|
+
|
787
|
+
mqLogTime("MQExec.reverseGeocode: Transaction Start");
|
788
|
+
xmlDoc = this.doTransaction("ReverseGeocode", arrRequest, this.REVERSEGEOCODE_VERSION);
|
789
|
+
mqLogTime("MQExec.reverseGeocode: Transaction End");
|
790
|
+
|
791
|
+
mqLogTime("MQExec.reverseGeocode: Loading of Response Start");
|
792
|
+
strXml = mqXmlToStr(mqGetNode(xmlDoc, "/ReverseGeocodeResponse/LocationCollection"));
|
793
|
+
mqlcLocations.loadXml(strXml);
|
794
|
+
mqLogTime("MQExec.reverseGeocode: Loading of Response End");
|
795
|
+
|
796
|
+
display("results", "Response", mqXmlToStr(xmlDoc), "", "mqDisplay");
|
797
|
+
|
798
|
+
};
|
799
|
+
|
800
|
+
|
801
|
+
/**
|
802
|
+
* Generates a request to the MapQuest server (as specified by the
|
803
|
+
* server name, path, and port number) to perform a search and
|
804
|
+
* return the results in a FeatureCollection object.
|
805
|
+
*
|
806
|
+
* @param {MQSearchCriteria} mqscCriteria Spatial parameters for the search.
|
807
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
808
|
+
*
|
809
|
+
* @param {MQFeatureCollection} mqfcSearchResults Search results.
|
810
|
+
*
|
811
|
+
* @param {String} strCoverageName The name of the map data coverage if searching
|
812
|
+
* for features in the map data.
|
813
|
+
*
|
814
|
+
* @param {MQDBLayerQueryCollection} mqdlqcDbLayers Database parameters for the search.
|
815
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
816
|
+
*
|
817
|
+
* @param {MQFeatureCollection} mqfcFeatures A FeatureCollection to also be searched
|
818
|
+
* based on the spatial criteria.
|
819
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
820
|
+
*
|
821
|
+
* @param {MQDTCollection} mqdcDisplayTypes A DTCollection to narrow the search. Only those
|
822
|
+
* features with display types corresponding to those in this collection will be returned.
|
823
|
+
* (Please Note: This object will not be updated, it is simply used for the request.)
|
824
|
+
*
|
825
|
+
* @type void
|
826
|
+
*/
|
827
|
+
|
828
|
+
MQExec.prototype.search = function(mqscCriteria, mqfcSearchResults, strCoverageName,
|
829
|
+
mqdlqcDbLayers, mqfcFeatures, mqdcDisplayTypes) {
|
830
|
+
var xmlDoc;
|
831
|
+
var strXml;
|
832
|
+
var arrRequest = new Array();
|
833
|
+
var strName = mqscCriteria ? mqscCriteria.getClassName(): null;
|
834
|
+
|
835
|
+
if( strName == null || (strName !== "MQSearchCriteria" &&
|
836
|
+
strName !== "MQRadiusSearchCriteria" && strName !== "MQRectSearchCriteria" &&
|
837
|
+
strName !== "MQPolySearchCriteria" && strName !== "MQCorridorSearchCriteria" )) {
|
838
|
+
throw "Null or Illegal Argument passed for Search Criteria";
|
839
|
+
} else {
|
840
|
+
arrRequest.push(mqscCriteria);
|
841
|
+
}
|
842
|
+
if(mqfcSearchResults == null || mqfcSearchResults.getClassName() !== "MQFeatureCollection") {
|
843
|
+
throw "Null or Illegal Argument passed for MQFeatureCollection";
|
844
|
+
}
|
845
|
+
if( typeof strCoverageName !== "string" ) {
|
846
|
+
throw "Illegal Argument passed for strCoverageName";
|
847
|
+
} else {
|
848
|
+
arrRequest.push(new MQXmlNodeObject("CoverageName", strCoverageName));
|
849
|
+
}
|
850
|
+
|
851
|
+
if(mqdlqcDbLayers != null && mqdlqcDbLayers.getClassName() !== "MQDBLayerQueryCollection") {
|
852
|
+
throw "Illegal Argument passed for MQRouteOptions";
|
853
|
+
} else if(mqdlqcDbLayers == null) {
|
854
|
+
mqdlqcDbLayers = new MQDBLayerQueryCollection();
|
855
|
+
}
|
856
|
+
arrRequest.push(mqdlqcDbLayers);
|
857
|
+
|
858
|
+
if(mqfcFeatures != null && mqfcFeatures.getClassName() !== "MQFeatureCollection") {
|
859
|
+
throw "Illegal Argument passed for MQFeatureCollection";
|
860
|
+
} else if( mqfcFeatures == null ) {
|
861
|
+
mqfcFeatures = new MQFeatureCollection();
|
862
|
+
}
|
863
|
+
arrRequest.push(mqfcFeatures);
|
864
|
+
|
865
|
+
if(mqdcDisplayTypes != null && mqdcDisplayTypes.getClassName() !== "MQDTCollection") {
|
866
|
+
throw "Illegal Argument passed for MQDTCollection";
|
867
|
+
} else if(mqdcDisplayTypes == null ) {
|
868
|
+
mqdcDisplayTypes = new MQDTCollection();
|
869
|
+
}
|
870
|
+
arrRequest.push(mqdcDisplayTypes);
|
871
|
+
|
872
|
+
mqLogTime("MQExec.Search: Transaction Start");
|
873
|
+
xmlDoc = this.doTransaction("Search", arrRequest, this.SEARCH_VERSION);
|
874
|
+
mqLogTime("MQExec.Search: Transaction End");
|
875
|
+
|
876
|
+
mqLogTime("MQExec.Search: Loading of Search results Start");
|
877
|
+
strXml = mqXmlToStr(mqGetNode(xmlDoc, "/SearchResponse/FeatureCollection"));
|
878
|
+
mqfcSearchResults.loadXml(strXml);
|
879
|
+
mqLogTime("MQExec.Search: Loading of Search results End");
|
880
|
+
|
881
|
+
display("results", "Response", mqXmlToStr(xmlDoc), "", "mqDisplay");
|
882
|
+
|
883
|
+
};
|
884
|
+
|
885
|
+
/**
|
886
|
+
* Sets the mqRectLL appropriately for tilemaps routing
|
887
|
+
*
|
888
|
+
* @param {String} strSessionUID The unique Session ID.
|
889
|
+
*
|
890
|
+
* @param {MQRectLL} mqRectLL The bounding box for the route in the session.
|
891
|
+
*
|
892
|
+
* @type void
|
893
|
+
* @private
|
894
|
+
*/
|
895
|
+
|
896
|
+
MQExec.prototype.getRouteBoundingBoxFromSessionResponse = function(sessionId, mqRectLL) {
|
897
|
+
|
898
|
+
var xmlDoc;
|
899
|
+
var strXml;
|
900
|
+
var arrRequest = new Array();
|
901
|
+
|
902
|
+
if(mqRectLL == null) {
|
903
|
+
throw "Null or Illegal Argument passed for MQRectLL";
|
904
|
+
}
|
905
|
+
arrRequest.push(new MQXmlNodeObject("SessionID",sessionId) );
|
906
|
+
|
907
|
+
xmlDoc = this.doTransaction("GetRouteBoundingBoxFromSession", arrRequest);
|
908
|
+
|
909
|
+
mqLogTime("MQExec.doRoute: Loading of MQRectLL Start");
|
910
|
+
var nodes = xmlDoc.documentElement.childNodes;
|
911
|
+
var ul = new MQLatLng();
|
912
|
+
ul.loadXml(mqXmlToStr(nodes[0]));
|
913
|
+
var lr = new MQLatLng();
|
914
|
+
lr.loadXml(mqXmlToStr(nodes[1]));
|
915
|
+
mqRectLL.setUpperLeft(ul);
|
916
|
+
mqRectLL.setLowerRight(lr);
|
917
|
+
mqLogTime("MQExec.doRoute: Loading of MQRectLL End");
|
918
|
+
};
|
919
|
+
|
920
|
+
/**
|
921
|
+
* Returns a value indicating whether or not this object has been
|
922
|
+
* initialized to a map server and port number.
|
923
|
+
*
|
924
|
+
* @return <code><b>true</b></code> if the port number or the Server
|
925
|
+
* name is not equal to their uninitialized values, <code><b>
|
926
|
+
* false</b></code> otherwise.
|
927
|
+
*
|
928
|
+
* @type boolean
|
929
|
+
*
|
930
|
+
* @private
|
931
|
+
*/
|
932
|
+
|
933
|
+
MQExec.prototype.isAlive = function() {
|
934
|
+
|
935
|
+
if( this.getServerPort() == -1 || this.getServerName() == "" )
|
936
|
+
return false;
|
937
|
+
return true;
|
938
|
+
|
939
|
+
};
|
940
|
+
|
941
|
+
|
942
|
+
/**
|
943
|
+
* Returns the string which specifies the coverage information requested
|
944
|
+
* directly via an http request.
|
945
|
+
*
|
946
|
+
* @param {int} lType Type of info to return,
|
947
|
+
* 0=CoverageInfo, 1=MapDataSelectorInfo.
|
948
|
+
*
|
949
|
+
* @return The string which specifies the server information.
|
950
|
+
*
|
951
|
+
* @type Document
|
952
|
+
*/
|
953
|
+
|
954
|
+
MQExec.prototype.getServerInfo = function( lType ) {
|
955
|
+
|
956
|
+
if (!this.isAlive())
|
957
|
+
return null;
|
958
|
+
|
959
|
+
var strReqXml;
|
960
|
+
var xmlDoc;
|
961
|
+
var strXml;
|
962
|
+
var type = lType || 0;
|
963
|
+
var arrRequest = new Array();
|
964
|
+
if( typeof type !== "number" ) {
|
965
|
+
throw "Illegal Argument passed for lType";
|
966
|
+
} else {
|
967
|
+
arrRequest.push(new MQXmlNodeObject("Type", type));
|
968
|
+
}
|
969
|
+
|
970
|
+
mqLogTime("MQExec.GetServerInfo: Transaction Start");
|
971
|
+
xmlDoc = this.doTransaction("GetServerInfo", arrRequest);
|
972
|
+
mqLogTime("MQExec.GetServerInfo: Transaction End");
|
973
|
+
display("results", "Response", mqXmlToStr(xmlDoc), "", "mqDisplay");
|
974
|
+
return xmlDoc;
|
975
|
+
|
976
|
+
};
|
977
|
+
|