如何在处理地图上一一显示标记?
Posted
技术标签:
【中文标题】如何在处理地图上一一显示标记?【英文标题】:How to display markers one by one on processing maps? 【发布时间】:2015-07-14 01:17:40 【问题描述】:我正在使用Unfolding Maps 来可视化谷歌地图上的一些位置数据。我有几个位置需要像一个人的行进路径一样一一显示。我尝试使用延迟并且程序被冻结。你能建议我实现这一目标的正确方法吗?谢谢。
【问题讨论】:
展示你的尝试,如果你愿意的话。 你能告诉我如何在堆栈溢出中添加引号吗?它显示并错误提示代码格式不正确。请帮忙 见这里:***.com/help/formatting 不确定你到底想做什么,所以最好的是 - 就像 v.k.建议 - 举个例子。 我已经在这里上传了我的代码sendspace.com/file/dz7ck2 当您运行代码时,您会看到所有的标记都同时放置在地图上。这些位置在一个数组中。我需要一个一个地显示,以便我可以将其视为动画。谢谢,希望这能澄清我想要做的事情。 【参考方案1】:试试这个:
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);
【讨论】:
谢谢..这是我一直在寻找的类似的东西。感谢您的努力。以上是关于如何在处理地图上一一显示标记?的主要内容,如果未能解决你的问题,请参考以下文章