区分存在且在任何方面都没有发现的铁路路线

发布于 2025-01-29 07:52:43 字数 146 浏览 2 评论 0原文

我正在尝试以Anylogic模拟从零售商到美国客户的路线,并想知道铁路可以完成哪些路线。但是,如果不存在铁路路线,我会遇到错误,并且模拟停止。我希望模拟运行,如果路由不存在,则将其保存在变量中(例如布尔变量,如果该路由存在,则它是真实的,如果不存在,则是错误的)。感谢您的帮助!

I'm trying to simulate routes from the retailer to the customer in the US in Anylogic and wanted to know what routes could be done by rail. But, if a rail route does not exist I get an error, and the simulation stops. I want the simulation to run and if the route does not exist, it saves in a variable (like a boolean variable, if the route exists it's true and if not is false). Thanks for the help!

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

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

发布评论

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

评论(1

枯叶蝶 2025-02-05 07:52:43

您应该具有一个将道路类型设置为导轨的地图对象,并且将路线设置为导轨

输入映像”


try {
    GISRoute route = map.getRoute(fromLatitude, fromLongitude, toLatitude, 
    toLatitude);
} catch (Exception e) {
    traceln("Error - no route found - from " + fromLatitude) + ", " + 
    fromLongitude + " to " + toLatitude + ", " + toLongitude);
    traceln("Exception " + e);
    // Maybe look for a road route?
 }

You should have a map object that has the road type set to rail and one that has the road type set to rail

enter image description here

Then with some simple code, you can check if there is a rail that exists and if not do something else.


try {
    GISRoute route = map.getRoute(fromLatitude, fromLongitude, toLatitude, 
    toLatitude);
} catch (Exception e) {
    traceln("Error - no route found - from " + fromLatitude) + ", " + 
    fromLongitude + " to " + toLatitude + ", " + toLongitude);
    traceln("Exception " + e);
    // Maybe look for a road route?
 }

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