Exemple #1
0
/**
 * @brief Equals operator for two TileIdentifiers.
 * 
 * @return True if TileIdentifiers have equal values.
 **/
bool operator==(const TileIdentifier &a, const TileIdentifier &b)
{
	return a.getX() == b.getX() &&
		a.getY() == b.getY() &&
		a.getZoom() == b.getZoom() &&
		a.getImageFormat() == b.getImageFormat() &&
		a.getStylesheetPath() == b.getStylesheetPath(); // ?
}
Exemple #2
0
/**
 * @brief Returns a hash for the TileIdentifier.
 * 
 * @return Hash usable for boost::unordered_map.
 **/
std::size_t hash_value(const TileIdentifier &ti)
{
	std::size_t seed = 0;
	boost::hash_combine(seed, ti.getX());
	boost::hash_combine(seed, ti.getY());
	boost::hash_combine(seed, ti.getZoom());
	boost::hash_combine(seed, ti.getImageFormat());
	boost::hash_combine(seed, ti.getStylesheetPath()); // ?
	return seed;
}
Exemple #3
0
MetaIdentifier::MetaIdentifier(const TileIdentifier& origin)
	: TileIdentifier(origin)
{
	// round to neared multiple of META_TILE_SIZE
	int x0 = origin.getX() / META_TILE_SIZE * META_TILE_SIZE;
	int y0 = origin.getY() / META_TILE_SIZE * META_TILE_SIZE;
	int x1 = x0 + META_TILE_SIZE;
	int y1 = y0 + META_TILE_SIZE;
	x1 = std::min(x1, (1 << origin.getZoom()));
	y1 = std::min(y1, (1 << origin.getZoom()));
	this->width  = x1 - x0;
	this->height = y1 - y0;
	this->x = x0;
	this->y = y0;

	for (int tx = x; tx < x1; tx++)
		for (int ty = y; ty < y1; ty++)
		{
			tids.push_back(
				boost::make_shared<TileIdentifier>(tx, ty, origin.getZoom(),
												   origin.getStylesheetPath(),
												   origin.getImageFormat())
			);
		}
}