如何在加工图上一一显示标记?
How to display markers one by one on processing maps?
我正在使用 Unfolding Maps 在 Google 地图上可视化一些位置数据。我有几个位置,我需要像一个人的行进路径一样一个一个地显示。我尝试使用延迟,程序被冻结了。你能建议我一个正确的方法来实现这个目标吗?谢谢
试试这个:
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);
}
}
我正在使用 Unfolding Maps 在 Google 地图上可视化一些位置数据。我有几个位置,我需要像一个人的行进路径一样一个一个地显示。我尝试使用延迟,程序被冻结了。你能建议我一个正确的方法来实现这个目标吗?谢谢
试试这个:
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);
}
}