2016-11-22 82 views
0

所以,如果我有firstPath,secondPath和thirdPath,我能做出這樣的新路徑:你可以結合(追加)路徑到對方嗎?

finalPath = firstPath 
finalPath.append(secondPath) 
finalPath.append(thirdPath) 

謝謝!

我覺得這樣做是隻用走的唯一的其他方式:

for coord in firstPath 
{ 
finalPath.add(coord) 
} 

for coord in secondPath 
{ 
finalPath.add(coord) 
} 

for coord in thirdPath 
{ 
finalPath.add(coord) 
} 

而且似乎只是單調乏味

+0

什麼類型是'firstPath'?由於缺乏背景,大多數能夠回答您的問題的人將無法做到。我們大多數人都不熟悉google maps sdk。 – Alexander

+0

所有的「路徑」都是GMSMutablePath類型 – skyleguy

回答

0

可以嵌套的循環:

for path in [firstPath, secondPath, thirdPath] { 
    for coord in path { 
     finalPath.add(coord) 
    } 
} 
相關問題