@@ -194,12 +194,12 @@ <h5 class='panel-title text-center' data-i18n="resources.text_findPath"></h5></d
194
194
195
195
//以动画效果显示分析结果
196
196
function addPath ( result ) {
197
- if ( routeCompsIndex < result . pathList [ pathListIndex ] . route . components . length ) {
197
+ if ( routeCompsIndex < result . pathList [ pathListIndex ] . route . components [ 0 ] . components . length ) {
198
198
var pathFeature = new SuperMap . Feature . Vector ( ) ;
199
199
var points = [ ] ;
200
200
for ( var k = 0 ; k < 2 ; k ++ ) {
201
- if ( result . pathList [ pathListIndex ] . route . components [ routeCompsIndex + k ] ) {
202
- points . push ( new SuperMap . Geometry . Point ( result . pathList [ pathListIndex ] . route . components [ routeCompsIndex + k ] . x , result . pathList [ pathListIndex ] . route . components [ routeCompsIndex + k ] . y ) ) ;
201
+ if ( result . pathList [ pathListIndex ] . route . components [ 0 ] . components [ routeCompsIndex + k ] ) {
202
+ points . push ( new SuperMap . Geometry . Point ( result . pathList [ pathListIndex ] . route . components [ 0 ] . components [ routeCompsIndex + k ] . x , result . pathList [ pathListIndex ] . route . components [ 0 ] . components [ routeCompsIndex + k ] . y ) ) ;
203
203
}
204
204
}
205
205
var curLine = new SuperMap . Geometry . LinearRing ( points ) ;
@@ -220,20 +220,18 @@ <h5 class='panel-title text-center' data-i18n="resources.text_findPath"></h5></d
220
220
}
221
221
222
222
function addPathGuideItems ( result ) {
223
- vectorLayer . removeAllFeatures ( ) ;
223
+ // vectorLayer.removeAllFeatures();
224
224
//显示每个pathGuideItem和对应的描述信息
225
225
for ( var k = 0 ; k < result . pathList . length ; k ++ ) {
226
226
var pathGuideItems = result . pathList [ pathListIndex ] . pathGuideItems , len = pathGuideItems . length ;
227
227
for ( var m = 0 ; m < len ; m ++ ) {
228
+ if ( pathGuideItems [ m ] . geometry . CLASS_NAME !== "SuperMap.Geometry.Point" ) {
229
+ continue ;
230
+ }
228
231
var guideFeature = new SuperMap . Feature . Vector ( ) ;
229
232
guideFeature . geometry = pathGuideItems [ m ] . geometry ;
230
233
guideFeature . attributes = { description : pathGuideItems [ m ] . description } ;
231
- if ( guideFeature . geometry . CLASS_NAME === "SuperMap.Geometry.Point" ) {
232
- guideFeature . style = styleGuidePoint ;
233
- }
234
- else {
235
- guideFeature . style = style ;
236
- }
234
+ guideFeature . style = styleGuidePoint ;
237
235
vectorLayer . addFeatures ( guideFeature ) ;
238
236
}
239
237
}
0 commit comments