我正在使用Unfolding Maps在Google地图上显示某些位置数据。我有几个位置,我需要逐个显示,就像一个人的旅行路径。我尝试使用延迟和程序冻结。你能建议我一个正确的方法来实现这个目标吗?感谢。
答案 0 :(得分:0)
试试这个:
import de.fhpotsdam.unfolding.*;
import de.fhpotsdam.unfolding.geo.*;
import de.fhpotsdam.unfolding.utils.*;
UnfoldingMap map;
ArrayList<Location> locations = new ArrayList<Location>();
int locationIndex = -1;
void setup() {
size(800, 600);
map = new UnfoldingMap(this);
// Test data. Load your actual data, instead:
locations.add(new Location(53, 0));
locations.add(new Location(12, 50));
}
void draw() {
map.draw();
// Simple animation: Every 60 frames show next location
if (frameCount % 60 == 0) {
// Increase only if more data exists
if (locationIndex < locations.size() - 1) {
locationIndex++;
}
}
// Show all currently visible locations (i.e. 0 - index)
for (int i = 0; i <= locationIndex; i++) {
Location location = locations.get(i);
ScreenPosition pos = map.getScreenPosition(location);
ellipse(pos.x, pos.y, 10, 10);
}
}