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 ;
0 commit comments