StelSphericalIndex.hpp   StelSphericalIndex.hpp 
skipping to change at line 78 skipping to change at line 78
{ {
CountFunc func; CountFunc func;
processAll<CountFunc>(func); processAll<CountFunc>(func);
return func.nb; return func.nb;
} }
private: private:
struct CountFunc struct CountFunc
{ {
CountFunc() : nb(0) {;} CountFunc() : nb(0) {;}
void operator()(const StelRegionObjectP&) void operator()(const StelRegionObject*)
{ {
++nb; ++nb;
} }
unsigned int nb; unsigned int nb;
}; };
//! The elements stored in the container. //! The elements stored in the container.
struct NodeElem struct NodeElem
{ {
NodeElem() {;} NodeElem() {;}
skipping to change at line 242 skipping to change at line 242
} }
// Else store it here // Else store it here
node.elements.append(el); node.elements.append(el);
} }
//! Process all the objects intersecting the given r egion using the passed function object. //! Process all the objects intersecting the given r egion using the passed function object.
template<class FuncObject> void processIntersectingR egions(const Node& node, const SphericalRegionP& region, FuncObject& func) const template<class FuncObject> void processIntersectingR egions(const Node& node, const SphericalRegionP& region, FuncObject& func) const
{ {
foreach (const NodeElem& el, node.elements) foreach (const NodeElem& el, node.elements)
{ {
// Optimization: We pass a plain poi
nter here, not smart pointer.
// As long as the FuncObject does no
t need to store the pointer,
// this isn't a problem.
if (region->intersects(el.obj->getRe gion().data())) if (region->intersects(el.obj->getRe gion().data()))
func(el.obj); func(&(*el.obj));
} }
foreach (const Node& child, node.children) foreach (const Node& child, node.children)
{ {
if (region->contains(child.triangle) ) if (region->contains(child.triangle) )
processAll(child, func); processAll(child, func);
else if (region->intersects(child.tr iangle)) else if (region->intersects(child.tr iangle))
processIntersectingRegions(c hild, region, func); processIntersectingRegions(c hild, region, func);
} }
} }
template<class FuncObject> void processBoundingCapIn tersectingRegions(const Node& node, const SphericalCap& cap, FuncObject& fu nc) const template<class FuncObject> void processBoundingCapIn tersectingRegions(const Node& node, const SphericalCap& cap, FuncObject& fu nc) const
{ {
foreach (const NodeElem& el, node.elements) foreach (const NodeElem& el, node.elements)
{ {
// Optimization: We pass a plain poi
nter here, not smart pointer.
// As long as the FuncObject does no
t need to store the pointer,
// this isn't a problem.
if (cap.intersects(el.cap)) if (cap.intersects(el.cap))
func(el.obj); func(&(*el.obj));
} }
foreach (const Node& child, node.children) foreach (const Node& child, node.children)
{ {
if (cap.contains(child.triangle)) if (cap.contains(child.triangle))
processAll(child, func); processAll(child, func);
else if (cap.intersects(child.triang le)) else if (cap.intersects(child.triang le))
processBoundingCapIntersecti ngRegions(child, cap, func); processBoundingCapIntersecti ngRegions(child, cap, func);
} }
} }
//! Process all the objects contained the given regi on using the passed function object. //! Process all the objects contained the given regi on using the passed function object.
template<class FuncObject> void processContainedRegi ons(const Node& node, const SphericalRegionP& region, FuncObject& func) con st template<class FuncObject> void processContainedRegi ons(const Node& node, const SphericalRegionP& region, FuncObject& func) con st
{ {
foreach (const NodeElem& el, node.elements) foreach (const NodeElem& el, node.elements)
{ {
// Optimization: We pass a plain poi
nter here, not smart pointer.
// As long as the FuncObject does no
t need to store the pointer,
// this isn't a problem.
if (region->contains(el.obj->getRegi on().data())) if (region->contains(el.obj->getRegi on().data()))
func(el.obj); func(&(*el.obj));
} }
foreach (const Node& child, node.children) foreach (const Node& child, node.children)
{ {
if (region->contains(child.triangle) ) if (region->contains(child.triangle) )
processAll(child, func); processAll(child, func);
else if (region->intersects(child.tr iangle)) else if (region->intersects(child.tr iangle))
processContainedRegions(chil d, region, func); processContainedRegions(chil d, region, func);
} }
} }
//! Process all the objects intersecting the given r egion using the passed function object. //! Process all the objects intersecting the given r egion using the passed function object.
template<class FuncObject> void processAll(const Nod e& node, FuncObject& func) const template<class FuncObject> void processAll(const Nod e& node, FuncObject& func) const
{ {
// Optimization: We pass a plain pointer her
e, not smart pointer.
// As long as the FuncObject does not need t
o store the pointer,
// this isn't a problem.
foreach (const NodeElem& el, node.elements) foreach (const NodeElem& el, node.elements)
func(el.obj); func(&(*el.obj));
foreach (const Node& child, node.children) foreach (const Node& child, node.children)
processAll(child, func); processAll(child, func);
} }
//! The maximum number of objects per node. //! The maximum number of objects per node.
int maxObjectsPerNode; int maxObjectsPerNode;
//! The maximum level of the grid. Prevents grid spl it into too small triangles if unecessary. //! The maximum level of the grid. Prevents grid spl it into too small triangles if unecessary.
int maxLevel; int maxLevel;
}; };
 End of changes. 9 change blocks. 
5 lines changed or deleted 25 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/