Skip to content

Commit 00f445d

Browse files
committed
【fix】【examples】【classic】修复最短路径例子
1 parent d08a69e commit 00f445d

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

examples/classic/analysis_findPath.html

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,12 @@ <h5 class='panel-title text-center' data-i18n="resources.text_findPath"></h5></d
194194

195195
//以动画效果显示分析结果
196196
function addPath(result) {
197-
if (routeCompsIndex < result.pathList[pathListIndex].route.components.length) {
197+
if (routeCompsIndex < result.pathList[pathListIndex].route.components[0].components.length) {
198198
var pathFeature = new SuperMap.Feature.Vector();
199199
var points = [];
200200
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));
203203
}
204204
}
205205
var curLine = new SuperMap.Geometry.LinearRing(points);
@@ -220,20 +220,18 @@ <h5 class='panel-title text-center' data-i18n="resources.text_findPath"></h5></d
220220
}
221221

222222
function addPathGuideItems(result) {
223-
vectorLayer.removeAllFeatures();
223+
//vectorLayer.removeAllFeatures();
224224
//显示每个pathGuideItem和对应的描述信息
225225
for (var k = 0; k < result.pathList.length; k++) {
226226
var pathGuideItems = result.pathList[pathListIndex].pathGuideItems, len = pathGuideItems.length;
227227
for (var m = 0; m < len; m++) {
228+
if (pathGuideItems[m].geometry.CLASS_NAME !== "SuperMap.Geometry.Point") {
229+
continue;
230+
}
228231
var guideFeature = new SuperMap.Feature.Vector();
229232
guideFeature.geometry = pathGuideItems[m].geometry;
230233
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;
237235
vectorLayer.addFeatures(guideFeature);
238236
}
239237
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy