简体   繁体   English

Car Anylogic 类型未定义方法 getDistanceByRoute(double, double, double, double)

[英]The method getDistanceByRoute(double, double, double, double) is undefined for the type Car Anylogic

i'm quite new in Anylogic and i'm working on a model where some cars of a population travell from a point A to a point B using a GIS route that I have created in the GIS map.我是 Anylogic 的新手,我正在研究 model,其中一些汽车使用我在 GIS map 中创建的 GIS 路线从 A 点行驶到 B 点。

I need to use the function getDistanceByRoute to make some calculations using latitude and longitude but it doesn't work and this error is given:我需要使用 function getDistanceByRoute 来使用纬度和经度进行一些计算,但它不起作用并且给出了此错误:

Description: The method getDistanceByRoute(double, double, double, double) is undefined for the type Car.说明:方法 getDistanceByRoute(double, double, double, double) 未针对 Car 类型定义。 Location: dinamic3/Car/moving_to_CS - State位置:dinamic3/Car/moving_to_CS - State

I' can't figure out how to fix the problem, i tried the function getDistanceGIS and it worked but i need to use getDistanceByRoute which is more precise with the distance measure.我不知道如何解决这个问题,我尝试了 function getDistanceGIS 并且它有效,但我需要使用 getDistanceByRoute,它对距离测量更精确。

    @AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
  public static final statechart_state at_Milano = statechart_state.at_Milano;
  @AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
  public static final statechart_state moving_to_Cortina = statechart_state.moving_to_Cortina;
  @AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
  public static final statechart_state moving_to_CS = statechart_state.moving_to_CS;
  @AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
  public static final statechart_state at_CS = statechart_state.at_CS;
  @AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
  public static final statechart_state state5 = statechart_state.state5;
  @AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
  public static final statechart_state at_Cortina = statechart_state.at_Cortina;
  @AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
  public static final statechart_state state4 = statechart_state.state4;
  @AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
  public static final statechart_state finalState = statechart_state.finalState;


  @AnyLogicInternalCodegenAPI
  private void enterState( statechart_state self, boolean _destination ) {
    switch( self ) {
      case at_Milano:
        logToDBEnterState(statechart, self);
        // (Simple state (not composite))
        statechart.setActiveState_xjal( at_Milano );
        transition2.start();
        return;
      case moving_to_Cortina:
        logToDBEnterState(statechart, self);
        // (Composite state)
        {
moveTo(main.cortina);
consumption_switch=1;
charging_switch=0;
time=time();
 
;}
        transition3.start();
        transition5.start();
        if ( _destination ) {
           enterState( state4, true );
        }
        return;
      case moving_to_CS:
        logToDBEnterState(statechart, self);
        // (Composite state)
        {
double a;
double b;
double c;
double d;

a=main.charging_stations.get(k+1).lat_cs;
b=main.charging_stations.get(k+1).lon_cs;

c=main.charging_stations.get(k).lat_cs;
d=main.charging_stations.get(k).lon_cs;
 

x=(getDistanceByRoute(lat_1,lon_1,a,b)*0.001);

For this function to work, you need to reference the map to which you want it to apply:要使这个 function 起作用,您需要引用您希望它应用到的 map:

map.getDistanceByRoute(double, double, double, double);

So make sure to add the "map."所以一定要加上“地图”。 to your code, if this is the name of your map object.到你的代码,如果这是你的名字 map object。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 方法 areEqualByThreeDecimalPlace(double, double) 对于 DecimalComparator 类型未定义 - The method areEqualByThreeDecimalPlace(double, double) is undefined for the type DecimalComparator 未定义Double类型的deposit(double)方法 - The method deposit(double) is undefined for the type Double 如何解决 main 类型中的方法 add(double, double, int, double) 不适用于参数 (double, double, double, double) - how to solve The method add(double, double, int, double) in the type main is not applicable for the arguments (double, double, double, double) 未为类型Loan?定义方法Loan(double,int,double)。 - The method Loan(double, int, double) is undefined for the type Loan? 未为类型Math定义IEEEremainder(double,double) - IEEEremainder(double, double) is undefined for the type Math “方法Double(String)未定义”(如何转换为Double?) - “The method Double(String) is undefined” (How to cast to Double?) Method(double, double) 不适用于参数 (double[], double[]) - Method(double, double) is not applicable for the arguments (double[], double[]) 对于类型为new ActionListener(){}的方法xy(double,…)未定义 - The method xy(double, …) is undefined for the type new ActionListener(){} 构造函数 Point(double, double) 未定义 - constructor Point(double, double) is undefined 错误:&lt; 运算符未定义参数类型 Double[], double - error: the < operator is undefined for the arguments type(s) Double[], double
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM