本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}