本文整理汇总了C++中SiteList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ SiteList::push_back方法的具体用法?C++ SiteList::push_back怎么用?C++ SiteList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteList
的用法示例。
在下文中一共展示了SiteList::push_back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readSites
SiteList readSites(std::ifstream& ifs, double SF, double wc, double wt, double wv)
{
SiteList sites;
std::string line;
while (std::getline(ifs, line)) {
std::istringstream iss(line);
std::string type;
long id;
double lat, lon;
iss >> id;
iss >> lon;
iss >> lat;
iss >> type;
double weight = 0;
if (type == "city") {
weight = wc;
} else if (type == "town") {
weight = wt;
} else if (type == "village") {
weight = wv;
}
Site_2 site(Point_2(lon*SF, lat*SF), weight*SF, id);
sites.push_back(site);
}
return sites;
}
示例2: createArtificialSites
SiteList createArtificialSites(SiteList& sites, Iso_rectangle_2 crect)
{
SiteList artificialSites;
// add artificial sites
SiteList::iterator itr;
for (itr = sites.begin(); itr != sites.end(); ++itr) {
Site_2 site = *itr;
Point_2 point = site.point();
double weight = site.weight();
Point_2 apoint1(2 * crect.xmin() - point.x(), point.y());
Site_2 asite1(apoint1, weight);
Point_2 apoint2(2 * crect.xmax() - point.x(), point.y());
Site_2 asite2(apoint2, weight);
Point_2 apoint3(point.x(), 2 * crect.ymin() - point.y());
Site_2 asite3(apoint3, weight);
Point_2 apoint4(point.x(), 2 * crect.ymax() - point.y());
Site_2 asite4(apoint4, weight);
artificialSites.push_back(asite1);
artificialSites.push_back(asite2);
artificialSites.push_back(asite3);
artificialSites.push_back(asite4);
}
return artificialSites;
}