当前位置: 首页>>代码示例>>C++>>正文


C++ Airspaces::Add方法代码示例

本文整理汇总了C++中Airspaces::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ Airspaces::Add方法的具体用法?C++ Airspaces::Add怎么用?C++ Airspaces::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Airspaces的用法示例。


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

示例1: setup_airspaces

void setup_airspaces(Airspaces& airspaces, const GeoPoint& center, const unsigned n) {
    std::ofstream *fin = NULL;

    if (verbose) {
        Directory::Create(Path(_T("output/results")));
        fin = new std::ofstream("output/results/res-bb-in.txt");
    }

    for (unsigned i=0; i<n; i++) {
        AbstractAirspace* as;
        if (rand()%4!=0) {
            GeoPoint c;
            c.longitude = Angle::Degrees(fixed((rand()%1200-600)/1000.0))+center.longitude;
            c.latitude = Angle::Degrees(fixed((rand()%1200-600)/1000.0))+center.latitude;
            fixed radius(10000.0*(0.2+(rand()%12)/12.0));
            as = new AirspaceCircle(c,radius);
        } else {

            // just for testing, create a random polygon from a convex hull around
            // random points
            const unsigned num = rand()%10+5;
            GeoPoint c;
            c.longitude = Angle::Degrees(fixed((rand()%1200-600)/1000.0))+center.longitude;
            c.latitude = Angle::Degrees(fixed((rand()%1200-600)/1000.0))+center.latitude;

            std::vector<GeoPoint> pts;
            for (unsigned j=0; j<num; j++) {
                GeoPoint p=c;
                p.longitude += Angle::Degrees(fixed((rand()%200)/1000.0));
                p.latitude += Angle::Degrees(fixed((rand()%200)/1000.0));
                pts.push_back(p);
            }
            as = new AirspacePolygon(pts,true);
        }
        airspace_random_properties(*as);
        airspaces.Add(as);
        if (fin)
            *fin << *as;
    }

    delete fin;

    // try inserting nothing
    airspaces.Add(NULL);

    airspaces.Optimise();

}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:48,代码来源:harness_airspace.cpp

示例2: AddCircle

 void
 AddCircle(Airspaces &airspace_database)
 {
   AbstractAirspace *as = new AirspaceCircle(center, radius);
   as->SetProperties(std::move(name), type, base, top);
   as->SetRadio(radio);
   as->SetDays(days_of_operation);
   airspace_database.Add(as);
 }
开发者ID:Adrien81,项目名称:XCSoar,代码行数:9,代码来源:AirspaceParser.cpp

示例3: AddPolygon

 void
 AddPolygon(Airspaces &airspace_database)
 {
   AbstractAirspace *as = new AirspacePolygon(points);
   as->SetProperties(name, type, base, top);
   as->SetRadio(radio);
   as->SetDays(days_of_operation);
   airspace_database.Add(as);
 }
开发者ID:DRIZO,项目名称:xcsoar,代码行数:9,代码来源:AirspaceParser.cpp

示例4: AddPolygon

  void
  AddPolygon(Airspaces &airspace_database)
  {
    if (points.size() < 3)
      return;

    AbstractAirspace *as = new AirspacePolygon(points);
    as->SetProperties(std::move(name), type, base, top);
    as->SetRadio(radio);
    as->SetDays(days_of_operation);
    airspace_database.Add(as);
  }
开发者ID:Adrien81,项目名称:XCSoar,代码行数:12,代码来源:AirspaceParser.cpp

示例5: test_airspace_extra

bool test_airspace_extra(Airspaces &airspaces) {
    // try adding a null polygon

    AbstractAirspace* as;
    std::vector<GeoPoint> pts;
    as = new AirspacePolygon(pts);
    airspaces.Add(as);

    // try clearing now (we haven't called optimise())

    airspaces.Clear();
    return true;
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:13,代码来源:harness_airspace.cpp


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