StelSphericalIndex.hpp   StelSphericalIndex.hpp 
skipping to change at line 54 skipping to change at line 54
{ {
rootNode->processContainedRegions(region, func); rootNode->processContainedRegions(region, func);
} }
//! Process all the objects intersecting the given region using the passed function object. //! Process all the objects intersecting the given region using the passed function object.
template<class FuncObject> void processAll(FuncObject& func) const template<class FuncObject> void processAll(FuncObject& func) const
{ {
rootNode->processAll(func); rootNode->processAll(func);
} }
//! Remove all the elements in the container.
void clear() void clear()
{ {
rootNode->clear(); rootNode->clear();
} }
//! Return the total number of elements in the container.
unsigned int count()
{
CountFunc func;
processAll<CountFunc>(func);
return func.nb;
}
private: private:
struct CountFunc
{
CountFunc() : nb(0) {;}
void operator()(const StelRegionObjectP&)
{
++nb;
}
unsigned int nb;
};
//! The elements stored in the container. //! The elements stored in the container.
struct NodeElem struct NodeElem
{ {
NodeElem() {;} NodeElem() {;}
NodeElem(StelRegionObjectP aobj) : obj(aobj), cap(obj->getRe gion()->getBoundingCap()) {;} NodeElem(StelRegionObjectP aobj) : obj(aobj), cap(obj->getRe gion()->getBoundingCap()) {;}
StelRegionObjectP obj; StelRegionObjectP obj;
SphericalCap cap; SphericalCap cap;
}; };
skipping to change at line 187 skipping to change at line 205
if (node.children.isEmpty()) if (node.children.isEmpty())
{ {
node.elements.append(el); node.elements.append(el);
// If we have too many objects in th e node, we split it. // If we have too many objects in th e node, we split it.
if (level<maxLevel && node.elements. size() > maxObjectsPerNode) if (level<maxLevel && node.elements. size() > maxObjectsPerNode)
{ {
node.split(); node.split();
const QVector<NodeElem> node Elems = node.elements; const QVector<NodeElem> node Elems = node.elements;
node.elements.clear(); node.elements.clear();
// Re-insert the elements // Re-insert the elements
for (QVector<NodeElem>::Cons tIterator iter = nodeElems.begin();iter != nodeElems.end(); ++iter) for (QVector<NodeElem>::Cons tIterator iter = nodeElems.constBegin();iter != nodeElems.constEnd(); ++ite r)
{ {
insert(node, *iter, level); insert(node, *iter, level);
} }
} }
return; return;
} }
// If we have children and one of them conta ins the element, store it in a sub-level // If we have children and one of them conta ins the element, store it in a sub-level
for (QVector<Node>::iterator iter = node.chi ldren.begin(); iter!=node.children.end(); ++iter) for (QVector<Node>::iterator iter = node.chi ldren.begin(); iter!=node.children.end(); ++iter)
{ {
 End of changes. 4 change blocks. 
1 lines changed or deleted 19 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/