示例#1
0
		std::vector<float>
		Accessibility::findNearestPOIs(int srcnode, float maxradius,
		    unsigned number, unsigned cat, int gno) {

			assert(cat >= 0 && cat < POI_MAXVAL);

			DistanceMap distances = ga[gno]->NearestPOI(cat,srcnode,maxradius,
			                                            number,
														omp_get_thread_num());
			std::vector<float> ret;

			accessibility_vars_t &vars = accessibilityVarsForPOIs[cat];

			/* need to account for the possibility of having
			   multiple locations at single node */
			for (DistanceMap::const_iterator itDist = distances.begin();
				 itDist != distances.end(); ++itDist) {

				int 	nodeid = itDist->first;
				double 	distance = itDist->second;

				for(int i = 0 ; i < vars[nodeid].size() ; i++) {

					if(vars[nodeid][i] == 0) continue;
					ret.push_back((float)distance);
				}
			}
			std::sort(ret.begin(),ret.end());

			return ret;
		}
示例#2
0
/** Print a distance map. */
static void printDistanceMap(ostream& out, const Graph& g,
		const ContigNode& u, const ContigPath& path)
{
	typedef map<ContigNode, int> DistanceMap;
	DistanceMap distanceMap = makeDistanceMap(g, u, path);
	for (DistanceMap::const_iterator it = distanceMap.begin();
			it != distanceMap.end(); ++it)
		out << get(edge_name, g, make_pair(u, it->first))
			<< " [d=" << it->second << "]\n";
}