本文整理汇总了C++中ConstOsmMapPtr::calculateEnvelope方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstOsmMapPtr::calculateEnvelope方法的具体用法?C++ ConstOsmMapPtr::calculateEnvelope怎么用?C++ ConstOsmMapPtr::calculateEnvelope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstOsmMapPtr
的用法示例。
在下文中一共展示了ConstOsmMapPtr::calculateEnvelope方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _calculateHilbertValue
int64_t AddHilbertReviewSortOrderOp::_calculateHilbertValue(const ConstOsmMapPtr &map,
const set<ElementId> eids)
{
auto_ptr<Envelope> env;
for (set<ElementId>::const_iterator it = eids.begin(); it != eids.end(); ++it)
{
Envelope::AutoPtr te(map->getElement(*it)->getEnvelope(map));
if (env.get() == 0)
{
env.reset(new Envelope(*te));
}
else
{
env->expandToInclude(te.get());
}
}
if (_mapEnvelope.get() == 0)
{
_mapEnvelope.reset(new Envelope(map->calculateEnvelope()));
}
Coordinate center;
env->centre(center);
Meters cellSize = 10.0;
int xorder = max(1.0, ceil(log(_mapEnvelope->getWidth() / cellSize) / log(2.0)));
int yorder = max(1.0, ceil(log(_mapEnvelope->getHeight() / cellSize) / log(2.0)));
// 31 bits is the most supported for 2 dimensions.
int order = min(31, max(xorder, yorder));
// always 2 dimensions.
Tgs::HilbertCurve c(2, order);
int64_t maxRange = 1 << order;
int point[2];
point[0] = max<int64_t>(0, min<int64_t>(maxRange - 1,
round((center.x - _mapEnvelope->getMinX()) / cellSize)));
point[1] = max<int64_t>(0, min<int64_t>(maxRange - 1,
round((center.y - _mapEnvelope->getMinY()) / cellSize)));
// pad with zeros to make sorting a little easier.
return c.encode(point);
}