Skip to content

Commit eba35da

Browse files
author
caoxinke
committed
添加OL3网络分析、交通换乘分析模块
1 parent e30950f commit eba35da

File tree

8 files changed

+424
-3
lines changed

8 files changed

+424
-3
lines changed

build/deps.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,29 @@ var deps = {
192192
"./src/OL3/SuperMap/iServer/GetGridCellInfosService.js"
193193
]
194194
},
195+
"NetworkAnalyst": {
196+
"name": "网络分析服务",
197+
"src": [
198+
"./src/OL3/SuperMap/iServer/NetworkAnalystService.js"
199+
]
200+
},
201+
"NetworkAnalyst3D": {
202+
"name": "3D网络分析服务",
203+
"src": [
204+
"./src/OL3/SuperMap/iServer/NetworkAnalyst3DService.js"
205+
]
206+
},
195207
"SpatialAnalyst": {
196208
"name": "空间分析服务",
197209
"src": [
198210
"./src/OL3/SuperMap/iServer/SpatialAnalystService.js"
199211
]
212+
},
213+
"TrafficTransferAnalyst": {
214+
"name": "交通换乘分析服务",
215+
"src": [
216+
"./src/OL3/SuperMap/iServer/TrafficTransferAnalystService.js"
217+
]
200218
}
201219
},
202220
"Visual": {

src/OL3/SuperMap/iServer/ChartQueryService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ol.supermap.ChartQueryService.prototype._processParams = function (params) {
3030
}
3131
params.returnContent = (params.returnContent == null) ? true : params.returnContent;
3232
if (params.filter) {
33-
params.chartQueryFilterParameters = Object.prototype.toString.call(params.filter) === '[object Array]' ? params.filter : [params.filter];
33+
params.chartQueryFilterParameters = ol.supermap.Util.isArray(params.filter) ? params.filter : [params.filter];
3434
}
3535
if (params.bounds) {
3636
params.bounds = new SuperMap.Bounds(

src/OL3/SuperMap/iServer/EditFeaturesService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ ol.supermap.EditFeaturesService.prototype._processParams = function (params) {
4242
}
4343
if (params.features) {
4444
var features = [];
45-
if ((Object.prototype.toString.call(params.features) === '[object Array]')) {
45+
if (ol.supermap.Util.isArray(params.features)) {
4646
params.features.map(function (feature) {
4747
features.push(me._createServerFeature(feature));
4848
});
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/**
2+
* Class: NetworkAnalyst3DService
3+
* 3D网络分析服务类
4+
*/
5+
require('../../../Core/iServer/FacilityAnalystSinks3DService');
6+
require('../../../Core/iServer/FacilityAnalystSources3DService');
7+
require('../../../Core/iServer/FacilityAnalystTraceup3DService');
8+
require('../../../Core/iServer/FacilityAnalystTracedown3DService');
9+
require('../../../Core/iServer/FacilityAnalystUpstream3DService');
10+
require('./ServiceBase');
11+
12+
ol.supermap.NetworkAnalyst3DService = function (url, options) {
13+
ol.supermap.ServiceBase.call(this, url, options);
14+
}
15+
ol.inherits(ol.supermap.NetworkAnalyst3DService, ol.supermap.ServiceBase);
16+
17+
ol.supermap.NetworkAnalyst3DService.prototype.sinksFacilityAnalyst = function (params) {
18+
var me = this;
19+
var facilityAnalystSinks3DParams = new SuperMap.REST.FacilityAnalystSinks3DParameters(param);
20+
var facilityAnalystSinks3DService = new SuperMap.REST.FacilityAnalystSinks3DService(me.options.url, {
21+
eventListeners: {
22+
scope: me,
23+
processCompleted: me.processCompleted,
24+
processFailed: me.processFailed
25+
}
26+
});
27+
facilityAnalystSinks3DService.processAsync(facilityAnalystSinks3DParams);
28+
return me;
29+
};
30+
31+
ol.supermap.NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst = function (params) {
32+
var me = this;
33+
var facilityAnalystSources3DParams = new SuperMap.REST.FacilityAnalystSources3DParameters(param);
34+
var facilityAnalystSources3DService = new SuperMap.REST.FacilityAnalystSources3DService(me.options.url, {
35+
eventListeners: {
36+
scope: me,
37+
processCompleted: me.processCompleted,
38+
processFailed: me.processFailed
39+
}
40+
});
41+
facilityAnalystSources3DService.processAsync(facilityAnalystSources3DParams);
42+
return me;
43+
};
44+
45+
ol.supermap.NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst = function (params) {
46+
var me = this;
47+
var facilityAnalystTraceup3DParams = new SuperMap.REST.FacilityAnalystTraceup3DParameters(param);
48+
var facilityAnalystTraceup3DService = new SuperMap.REST.FacilityAnalystTraceup3DService(me.options.url, {
49+
eventListeners: {
50+
scope: me,
51+
processCompleted: me.processCompleted,
52+
processFailed: me.processFailed
53+
}
54+
});
55+
facilityAnalystTraceup3DService.processAsync(facilityAnalystTraceup3DParams);
56+
return me;
57+
};
58+
59+
ol.supermap.NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst = function (params) {
60+
var me = this;
61+
var facilityAnalystTracedown3DParames = new SuperMap.REST.FacilityAnalystTracedown3DParameters(param);
62+
var facilityAnalystTracedown3DService = new SuperMap.REST.FacilityAnalystTracedown3DService(me.options.url, {
63+
eventListeners: {
64+
scope: me,
65+
processCompleted: me.processCompleted,
66+
processFailed: me.processFailed
67+
}
68+
});
69+
facilityAnalystTracedown3DService.processAsync(facilityAnalystTracedown3DParames);
70+
return me;
71+
};
72+
73+
ol.supermap.NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst = function (params) {
74+
var me = this;
75+
var facilityAnalystUpstream3DParams = new SuperMap.REST.FacilityAnalystUpstream3DParameters(param);
76+
var facilityAnalystUpstream3DService = new SuperMap.REST.FacilityAnalystUpstream3DService(me.options.url, {
77+
eventListeners: {
78+
scope: me,
79+
processCompleted: me.processCompleted,
80+
processFailed: me.processFailed
81+
}
82+
});
83+
facilityAnalystUpstream3DService.processAsync(facilityAnalystUpstream3DParams);
84+
return me;
85+
};
86+
87+
module.exports = ol.supermap.NetworkAnalyst3DService;
Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
/**
2+
* Class: NetworkAnalystService
3+
* 网络分析服务类
4+
*/
5+
require('../../../Core/iServer/BurstPipelineAnalystService');
6+
require('../../../Core/iServer/ComputeWeightMatrixService');
7+
require('../../../Core/iServer/FacilityAnalystStreamService');
8+
require('../../../Core/iServer/FindClosestFacilitiesService');
9+
require('../../../Core/iServer/FindLocationService');
10+
require('../../../Core/iServer/FindMTSPPathsService');
11+
require('../../../Core/iServer/FindPathService');
12+
require('../../../Core/iServer/FindServiceAreasService');
13+
require('../../../Core/iServer/FindTSPPathsService');
14+
require('../../../Core/iServer/UpdateEdgeWeightService');
15+
require('../../../Core/iServer/UpdateTurnNodeWeightService');
16+
require('./ServiceBase');
17+
18+
ol.supermap.NetworkAnalystService = function (url, options) {
19+
ol.supermap.ServiceBase.call(this, url, options);
20+
}
21+
ol.inherits(ol.supermap.NetworkAnalystService, ol.supermap.ServiceBase);
22+
23+
ol.supermap.NetworkAnalystService.prototype.burstPipelineAnalyst = function (params) {
24+
var me = this, param = me._processParams(params);
25+
var burstPipelineAnalystParams = new SuperMap.REST.BurstPipelineAnalystParameters(param);
26+
var burstPipelineAnalystService = new SuperMap.REST.BurstPipelineAnalystService(me.options.url, {
27+
eventListeners: {
28+
scope: me,
29+
processCompleted: me.processCompleted,
30+
processFailed: me.processFailed
31+
}
32+
});
33+
burstPipelineAnalystService.processAsync(burstPipelineAnalystParams);
34+
return me;
35+
};
36+
37+
ol.supermap.NetworkAnalystService.prototype.computeWeightMatrix = function (params) {
38+
var me = this, param = me._processParams(params);
39+
var computeWeightMatrixParams = new SuperMap.REST.ComputeWeightMatrixParameters(param);
40+
var computeWeightMatrixService = new SuperMap.REST.ComputeWeightMatrixService(me.options.url, {
41+
eventListeners: {
42+
scope: me,
43+
processCompleted: me.processCompleted,
44+
processFailed: me.processFailed
45+
}
46+
});
47+
computeWeightMatrixService.processAsync(computeWeightMatrixParams);
48+
return me;
49+
};
50+
51+
ol.supermap.NetworkAnalystService.prototype.findClosestFacilities = function (params) {
52+
var me = this, param = me._processParams(params);
53+
var findClosestFacilitiesParams = new SuperMap.REST.FindClosestFacilitiesParameters(param);
54+
var findClosestFacilitiesService = new SuperMap.REST.FindClosestFacilitiesService(me.options.url, {
55+
eventListeners: {
56+
scope: me,
57+
processCompleted: me.processCompleted,
58+
processFailed: me.processFailed
59+
}
60+
});
61+
findClosestFacilitiesService.processAsync(findClosestFacilitiesParams);
62+
return me;
63+
};
64+
65+
ol.supermap.NetworkAnalystService.prototype.streamFacilityAnalyst = function (params) {
66+
var me = this, param = me._processParams(params);
67+
var facilityAnalystStreamParams = new SuperMap.REST.FacilityAnalystStreamParameters(param);
68+
var facilityAnalystStreamService = new SuperMap.REST.FacilityAnalystStreamService(me.options.url, {
69+
eventListeners: {
70+
scope: me,
71+
processCompleted: me.processCompleted,
72+
processFailed: me.processFailed
73+
}
74+
});
75+
facilityAnalystStreamService.processAsync(facilityAnalystStreamParams);
76+
return me;
77+
};
78+
79+
ol.supermap.NetworkAnalystService.prototype.findLocation = function (params) {
80+
var me = this, param = me._processParams(params);
81+
var findLocationParams = new SuperMap.REST.FindLocationParameters(param);
82+
var findLocationService = new SuperMap.REST.FindLocationService(me.options.url, {
83+
eventListeners: {
84+
scope: me,
85+
processCompleted: me.processCompleted,
86+
processFailed: me.processFailed
87+
}
88+
});
89+
findLocationService.processAsync(findLocationParams);
90+
return me;
91+
};
92+
93+
ol.supermap.NetworkAnalystService.prototype.findPath = function (params) {
94+
var me = this, param = me._processParams(params);
95+
var findPathParams = new SuperMap.REST.FindPathParameters(param);
96+
var findPathService = new SuperMap.REST.FindPathService(me.options.url, {
97+
eventListeners: {
98+
scope: me,
99+
processCompleted: me.processCompleted,
100+
processFailed: me.processFailed
101+
}
102+
});
103+
findPathService.processAsync(findPathParams);
104+
return me;
105+
};
106+
107+
ol.supermap.NetworkAnalystService.prototype.findTSPPaths = function (params) {
108+
var me = this, param = me._processParams(params);
109+
var findTSPPathsParams = new SuperMap.REST.FindTSPPathsParameters(param);
110+
var findTSPPathsService = new SuperMap.REST.FindTSPPathsService(me.options.url, {
111+
eventListeners: {
112+
scope: me,
113+
processCompleted: me.processCompleted,
114+
processFailed: me.processFailed
115+
}
116+
});
117+
findTSPPathsService.processAsync(findTSPPathsParams);
118+
return me;
119+
};
120+
121+
ol.supermap.NetworkAnalystService.prototype.findMTSPPaths = function (params) {
122+
var me = this, param = me._processParams(params);
123+
var findMTSPPathsParams = new SuperMap.REST.FindMTSPPathsParameters(param);
124+
var findMTSPPathsService = new SuperMap.REST.FindMTSPPathsService(me.options.url, {
125+
eventListeners: {
126+
scope: me,
127+
processCompleted: me.processCompleted,
128+
processFailed: me.processFailed
129+
}
130+
});
131+
findMTSPPathsService.processAsync(findMTSPPathsParams);
132+
return me;
133+
};
134+
135+
ol.supermap.NetworkAnalystService.prototype.findServiceAreas = function (params) {
136+
var me = this, param = me._processParams(params);
137+
var findServiceAreasParams = new SuperMap.REST.FindServiceAreasParameters(param);
138+
var findServiceAreasService = new SuperMap.REST.FindServiceAreasService(me.options.url, {
139+
eventListeners: {
140+
scope: me,
141+
processCompleted: me.processCompleted,
142+
processFailed: me.processFailed
143+
}
144+
});
145+
findServiceAreasService.processAsync(findServiceAreasParams);
146+
return me;
147+
};
148+
149+
ol.supermap.NetworkAnalystService.prototype.updateEdgeWeight = function (params) {
150+
var me = this;
151+
var updateEdgeWeightParams = new SuperMap.REST.UpdateEdgeWeightParameters(params);
152+
var updateEdgeWeightService = new SuperMap.REST.UpdateEdgeWeightService(me.options.url, {
153+
eventListeners: {
154+
scope: me,
155+
processCompleted: me.processCompleted,
156+
processFailed: me.processFailed
157+
}
158+
});
159+
updateEdgeWeightService.processAsync(updateEdgeWeightParams);
160+
return me;
161+
};
162+
163+
ol.supermap.NetworkAnalystService.prototype.updateTurnNodeWeight = function (params) {
164+
var me = this;
165+
var updateTurnNodeWeightParams = new SuperMap.REST.UpdateTurnNodeWeightParameters(params);
166+
var updateTurnNodeWeightService = new SuperMap.REST.UpdateTurnNodeWeightService(me.options.url, {
167+
eventListeners: {
168+
scope: me,
169+
processCompleted: me.processCompleted,
170+
processFailed: me.processFailed
171+
}
172+
});
173+
updateTurnNodeWeightService.processAsync(updateTurnNodeWeightParams);
174+
return me;
175+
};
176+
177+
ol.supermap.NetworkAnalystService.prototype._processParams = function (params) {
178+
if (!params) {
179+
return {};
180+
}
181+
182+
if (params.centers && ol.supermap.Util.isArray(params.centers)) {
183+
params.centers.map(function (point, key) {
184+
params.centers[key] = (point instanceof ol.geom.Point) ? {
185+
x: point.flatCoordinates[0],
186+
y: point.flatCoordinates[1]
187+
} : point;
188+
});
189+
}
190+
191+
if (params.nodes && ol.supermap.Util.isArray(params.nodes)) {
192+
params.nodes.map(function (point, key) {
193+
params.nodes[key] = (point instanceof ol.geom.Point) ? {
194+
x: point.flatCoordinates[0],
195+
y: point.flatCoordinates[1]
196+
} : point;
197+
});
198+
}
199+
200+
if (params.event && params.event instanceof ol.geom.Point) {
201+
params.event = {x: point.flatCoordinates[0], y: params.flatCoordinates[1]};
202+
}
203+
204+
if (params.facilities && ol.supermap.Util.isArray(params.facilities)) {
205+
params.facilities.map(function (point, key) {
206+
params.facilities[key] = (point instanceof ol.geom.Point) ? {
207+
x: point.flatCoordinates[0],
208+
y: params.flatCoordinates[1]
209+
} : point;
210+
});
211+
}
212+
213+
if (params.parameter) {
214+
var param = params.parameter;
215+
if (param.barrierPoints && ol.supermap.Util.isArray(param.barrierPoints)) {
216+
param.barrierPoints.map(function (point, key) {
217+
params.parameter.barrierPoints[key] = (point instanceof ol.geom.Point) ? {
218+
x: point.flatCoordinates[0],
219+
y: params.flatCoordinates[1]
220+
} : point;
221+
});
222+
}
223+
if (param.resultSetting) {
224+
params.parameter.resultSetting = new SuperMap.REST.TransportationAnalystResultSetting(param.resultSetting);
225+
}
226+
}
227+
228+
if (params.supplyCenters && ol.supermap.Util.isArray(params.supplyCenters)) {
229+
params.supplyCenters.map(function (supplyCenter, key) {
230+
params.supplyCenters[key] = new SuperMap.REST.SupplyCenter(supplyCenter);
231+
})
232+
}
233+
return params;
234+
235+
}
236+
237+
module.exports = ol.supermap.NetworkAnalystService;

src/OL3/SuperMap/iServer/QueryService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ ol.supermap.QueryService.prototype._processParams = function (params) {
7676
return {};
7777
}
7878
params.returnContent = (params.returnContent == null) ? true : params.returnContent;
79-
params.queryParams = Object.prototype.toString.call(params.filter) == '[object Array]' ? params.filter : [params.filter];
79+
params.queryParams = ol.supermap.Util.isArray(params.filter) ? params.filter : [params.filter];
8080
if (params.bounds) {
8181
params.bounds = new SuperMap.Bounds(
8282
params.bounds[0],

0 commit comments

Comments
 (0)