Class: FindTSPPathsService

SuperMap.FindTSPPathsService

旅行商分析服务类 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。 该类负责将客户端指定的旅行商分析参数传递给服务端,并接收服务端返回的结果数据。 旅行商分析结果通过该类支持的事件的监听函数参数获取

new SuperMap.FindTSPPathsService(url, options)

common/iServer/FindTSPPathsService.js, line 10
Name Type Description
url string

网络分析服务地址。请求网络分析服务,URL应为: http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}; 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。

options Object

参数。

Name Type Description
eventListeners Object

需要被注册的监听器对象。

crossOrigin boolean 可选

是否允许跨域请求。

headers Object 可选

请求头。

Example
(start code)
var myFindTSPPathsService = new SuperMap.FindTSPPathsService(url, {
    eventListeners: {
	      "processCompleted": findTSPPathsCompleted,
		  "processFailed": findTSPPathsError
		  }
 });
(end)

Extends

Members

查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"

Default Value:
SuperMap.DataFormat.GEOJSON

Methods

inherited ajaxPolling()

common/iServer/CommonServiceBase.js, line 247

请求失败后,如果剩余请求失败次数不为 0,重新获取 URL 发送请求

inherited calculatePollingTimes()

common/iServer/CommonServiceBase.js, line 265

计算剩余请求失败执行次数。

inherited destroy()

common/iServer/FindTSPPathsService.js, line 44

释放资源,将引用的资源属性置空。

inherited getCredential(url){SuperMap.Credential}

common/iServer/CommonServiceBase.js, line 189

获取凭据信息

Name Type Description
url string

服务地址。

Returns:
Type Description
SuperMap.Credential 凭据信息对象。

getNodesJson(params){string}

common/iServer/FindTSPPathsService.js, line 77

将节点对象转化为JSON字符串。

Name Type Description
params SuperMap.FindTSPPathsParameters

旅行商分析服务参数类。

Returns:
Type Description
string 转化后的JSON字符串。

inherited getUrlCompleted(result)

common/iServer/CommonServiceBase.js, line 220

请求成功后执行此方法。

Name Type Description
result Object

服务器返回的结果对象。

inherited getUrlFailed(result)

common/iServer/CommonServiceBase.js, line 231

请求失败后执行此方法。

Name Type Description
result Object

服务器返回的结果对象。

inherited isServiceSupportPolling()

common/iServer/CommonServiceBase.js, line 292

判断服务是否支持轮询。

processAsync(params)

common/iServer/FindTSPPathsService.js, line 52

负责将客户端的查询参数传递到服务端。

Name Type Description
params SuperMap.FindTSPPathsParameters

旅行商分析服务参数类。

inherited request(options)

common/iServer/CommonServiceBase.js, line 149
Name Type Description
options Object

参数。

Name Type Default Description
method string 'GET' 可选

请求方式,包括 "GET","POST","PUT","DELETE"。

url string 可选

发送请求的地址。

params Object 可选

作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。

data string 可选

发送到服务器的数据。

success function

请求成功后的回调函数。

failure function

请求失败后的回调函数。

scope Object 可选

如果回调函数是对象的一个公共方法,设定该对象的范围。

isInTheSameDomain boolean 可选

请求是否在当前域中。

withCredentials boolean false 可选

请求是否携带 cookie。

crossOrigin boolean 可选

是否允许跨域请求。

headers Object 可选

请求头。

inherited serviceProcessCompleted(result)

common/iServer/NetworkAnalystServiceBase.js, line 42

分析完成,执行此方法。

Name Type Description
result Object

服务器返回的结果对象。

inherited serviceProcessFailed(result)

common/iServer/CommonServiceBase.js, line 316

状态失败,执行此方法。

Name Type Description
result Object

服务器返回的结果对象。

toGeoJSONResult(result)

common/iServer/FindTSPPathsService.js, line 108

将含有 geometry 的数据转换为 GeoJSON 格式。

Name Type Description
result Object

服务器返回的结果对象。