• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TrafficList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TrafficList的典型用法代码示例。如果您正苦于以下问题:C++ TrafficList类的具体用法?C++ TrafficList怎么用?C++ TrafficList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TrafficList类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ComputeFlarmTeam

static void
ComputeFlarmTeam(const GeoPoint &location, const GeoPoint &reference_location,
                 const TrafficList &traffic_list, const FlarmId target_id,
                 TeamInfo &teamcode_info)
{
  const FlarmTraffic *traffic = traffic_list.FindTraffic(target_id);
  if (traffic == NULL || !traffic->location_available) {
    teamcode_info.flarm_teammate_code_current = false;
    return;
  }

  // Set Teammate location to FLARM contact location
  teamcode_info.teammate_location = traffic->location;
  teamcode_info.teammate_vector = location.DistanceBearing(traffic->location);
  teamcode_info.teammate_available = true;

  // Calculate distance and bearing from teammate to reference waypoint

  GeoVector v = reference_location.DistanceBearing(traffic->location);

  // Calculate TeamCode and save it in Calculated
  teamcode_info.flarm_teammate_code.Update(v.bearing, v.distance);
  teamcode_info.flarm_teammate_code_available = true;
  teamcode_info.flarm_teammate_code_current = true;
}
开发者ID:snip,项目名称:XCSoar,代码行数:25,代码来源:GlideComputer.cpp


示例2: Complement

 /**
  * Adds data from the specified object, unless already present in
  * this one.
  */
 void Complement(const TrafficList &add) {
   if (IsEmpty() && !add.IsEmpty())
     *this = add;
 }
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:8,代码来源:List.hpp


示例3: ParsePFLAA

void
ParsePFLAA(NMEAInputLine &line, TrafficList &flarm, double clock)
{
    flarm.modified.Update(clock);

    // PFLAA,<AlarmLevel>,<RelativeNorth>,<RelativeEast>,<RelativeVertical>,
    //   <IDType>,<ID>,<Track>,<TurnRate>,<GroundSpeed>,<ClimbRate>,<AcftType>
    FlarmTraffic traffic;
    traffic.alarm_level = (FlarmTraffic::AlarmType)
                          line.Read((int)FlarmTraffic::AlarmType::NONE);

    double value;
    bool stealth = false;

    if (!line.ReadChecked(value))
        // Relative North is required !
        return;
    traffic.relative_north = value;

    if (!line.ReadChecked(value))
        // Relative East is required !
        return;
    traffic.relative_east = value;

    if (!line.ReadChecked(value))
        // Relative Altitude is required !
        return;
    traffic.relative_altitude = value;

    line.Skip(); /* id type */

    // 5 id, 6 digit hex
    char id_string[16];
    line.Read(id_string, 16);
    traffic.id = FlarmId::Parse(id_string, nullptr);

    Angle track;
    traffic.track_received = ReadBearing(line, track);
    if (!traffic.track_received) {
        // Field is empty in stealth mode
        stealth = true;
        traffic.track = Angle::Zero();
    } else
        traffic.track = track;

    traffic.turn_rate_received = line.ReadChecked(value);
    if (!traffic.turn_rate_received) {
        // Field is empty in stealth mode
        traffic.turn_rate = 0;
    } else
        traffic.turn_rate = value;

    traffic.speed_received = line.ReadChecked(value);
    if (!traffic.speed_received) {
        // Field is empty in stealth mode
        stealth = true;
        traffic.speed = 0;
    } else
        traffic.speed = value;

    traffic.climb_rate_received = line.ReadChecked(value);
    if (!traffic.climb_rate_received) {
        // Field is empty in stealth mode
        stealth = true;
        traffic.climb_rate = 0;
    } else
        traffic.climb_rate = value;

    traffic.stealth = stealth;

    unsigned type = line.Read(0);
    if (type > 15 || type == 14)
        traffic.type = FlarmTraffic::AircraftType::UNKNOWN;
    else
        traffic.type = (FlarmTraffic::AircraftType)type;

    FlarmTraffic *flarm_slot = flarm.FindTraffic(traffic.id);
    if (flarm_slot == nullptr) {
        flarm_slot = flarm.AllocateTraffic();
        if (flarm_slot == nullptr)
            // no more slots available
            return;

        flarm_slot->Clear();
        flarm_slot->id = traffic.id;

        flarm.new_traffic.Update(clock);
    }

    // set time of fix to current time
    flarm_slot->valid.Update(clock);

    flarm_slot->Update(traffic);
}
开发者ID:ahsparrow,项目名称:xcsoar,代码行数:94,代码来源:StaticParser.cpp


示例4: SetTarget

 void SetTarget(const FlarmId &id) {
   SetTarget(data.FindTraffic(id));
 }
开发者ID:damianob,项目名称:xcsoar,代码行数:3,代码来源:FlarmTrafficWindow.hpp


示例5: Expire

 void Expire(fixed clock) {
   error.Expire(clock);
   version.Expire(clock);
   status.Expire(clock);
   traffic.Expire(clock);
 }
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:6,代码来源:Data.hpp


示例6: Complement

 void Complement(const FlarmData &add) {
   error.Complement(add.error);
   version.Complement(add.version);
   status.Complement(add.status);
   traffic.Complement(add.traffic);
 }
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:6,代码来源:Data.hpp


示例7: Clear

 void Clear() {
   error.Clear();
   version.Clear();
   status.Clear();
   traffic.Clear();
 }
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:6,代码来源:Data.hpp


示例8: IsDetected

 bool IsDetected() const {
   return status.available || !traffic.IsEmpty();
 }
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:3,代码来源:Data.hpp



注:本文中的TrafficList类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TrafficState类代码示例发布时间:2022-05-31
下一篇:
C++ TradeItemModel类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap