Silverlight - 如何实现地图

发布于 2024-08-29 20:27:56 字数 294 浏览 2 评论 0原文

您将如何在 Silverlight 中实现这种类型的地图?地图将是交互式的,并且车站将是可点击的。

http://www.afn.org/~alplatt/tube.html

会你用混合画它吗?导入矢量图像?我想这个选择非常重要,因为寻路算法需要能够计算车站之间的距离/票价(基于它们的 XY 位置,大概还没有决定)。

只是寻找不同的想法和意见。

谢谢

How would you go about implementing a map of this type in Silverlight? The map would be interactive and stations would be clickable.

http://www.afn.org/~alplatt/tube.html

Would you draw it in blend? Import a vector image? I guess the choice is very important because pathfinding algorithms need to be able to calculate distances/fares between stations (based on their XY location, presumably, haven't decided yet).

Just looking for different ideas and opinions.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

她如夕阳 2024-09-05 20:27:56

我会采用矢量方法。将车站的 x,y 坐标和铁路线路径的控制点捕获为代码中的静态数据。为每个铁路线段和车站创建轻量级对象(不是用户控件),并让它们自行渲染并处理自己的鼠标单击。将铁路线定义为铁路段和车站的集合。

对于寻路,你最不想看到的就是使用像素来计算如何从 A 到 B。你只需要一棵表示站点之间连接的连接节点树,然后使用树遍历来查找两个站点之间的所有路径。对于数量有限的车站和路径,您还可以预先计算有效的车站组合和路径 - 就像火车时刻表一样。

I'd take the vector approach. Capture the x,y coordinates of the stations and the control points for the paths of the rail lines into static data in the code. Create lightweight objects (not UserControls) for each rail line segment and station, and let them render themselves and handle their own mouse clicks. Define a rail line as a collection of rail segments and stations.

For pathfinding, the last thing you want is to use pixels to figure out how to get from A to B. You only need a tree of connected nodes representing the connections between stations, then use tree traversal to find all paths between two stations. For a limited number of stations & paths, you could also precalculate the valid station combinations and paths - just like the train schedule tables.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文