使用 dijktras 算法 (Java) 从航点到航点的 2 个机场之间的最短路径

Shortest path between 2 airports from waypoint to waypoint using dijktras algorithm (Java)

我正在做最后一年的计算项目,需要一些建议/帮助,因为我不是最自信的编码员。

该项目将创建一个软件,该软件使用 Dijkstra 算法的实现来查找机场之间的最短路径。该软件将允许用户输入欧洲航空 space 选定国家内的起始机场和目的地机场。然后,该软件将在交互式地图上绘制从航路点到航路点到目的地机场的最短路径,此外,该路线将以文本形式打印出来,包括所有相关的空中导航信息。另外不能输入飞行区,这样就可以在禁飞区周围绘制路径。

我正在考虑在 java 中执行此操作,但对如何执行此操作感到困惑,例如,我如何获得 google 地图之类的地图,然后如何添加机场和 waypoints 作为节点添加到图表中。

正如您提到的 Google 地图,我建议使用 HTML/CSS/JavaScript 将此作为网站制作。将这种东西组合在一起所需的一切都已经存在,而且也相对简单。

就您需要采取的步骤而言,大致如下:

1.获取您想要的机场信息列表

搜索查询示例:"JSON Airport information"

您至少需要他们的纬度、经度和机场代码。快速搜索找到了这个 great looking project. Filter out the airports you don't want. Save the result as JSON, or just straight use one that's JSON already.

通过执行 ajax 请求将此信息添加到您的网页 - 如果您是 JavaScript 的新手,大多数人 use jQuery for that.

2。确定您要使用的地图

您可以使用 Google 地图,但还有许多其他很棒的选项,例如 OpenLayers or anything that's based on it like MapBox. I'll be referencing OpenLayers because it's both free and a wonderfully easy project to get started with. Embed it on your site and then get to know its API。这些 API 很容易理解,并且提供了很多关于如何显示线和标记(针对实际机场)的示例。

3。显示您的机场

使用地图的 API 和您的 JSON 数据,将 markers on the map however you'd like to display it. There's examples for flights too. The same applies to your no-fly zones; these map API's allow you to display areas too.

4.执行您的 Dijkstra 路由

范围很广 graph libraries for JavaScript. If you can't use a library for this, you can at least use them for inspiration. Use your airport information with a graph library that suits you to perform the searches you need. Finding the correct grand-circle distance can also be done with the map API,避免了自己实施的需要。使用距离作为您的 dijkstra 权重。

5.添加对禁飞区的支持

问题的这一部分有点含糊,因为这里有很多选项,例如禁飞区的高度各不相同,车辆速度会影响路线的规划方式。例如,这取决于车辆是小型无人机还是商用飞机。一种简单的方法是只删除与禁飞区相交的所有路线;快速搜索显示 this answer 以寻求有关该部分的帮助。或者研究如何为目标车辆规划路线并模仿。