Adjust RTree default floating point to use double

This reverts the previous work-around 7d62f14dd for the RTree splitting
degeneracy that was placed prior to v5.  It appears not to have worked
for all systems.  In its place, we use doubles instead of floats to
calculate the bounding box when filling the RTree.  This keeps maximum
volume items from overlapping with the system boundary in test cases.
This commit is contained in:
Seth Hillbrand 2018-08-06 16:55:00 -07:00
parent 9aa043ef48
commit 539ca5aa3b
3 changed files with 8 additions and 16 deletions

View File

@ -53,15 +53,7 @@ ORIGIN_VIEWITEM* ORIGIN_VIEWITEM::Clone() const
const BOX2I ORIGIN_VIEWITEM::ViewBBox() const
{
BOX2I bbox;
// The origin item doesn't have a fixed size. It is constant on the screen but
// changes the effective BBox size based on the zoom level.
// But we can't simply set it to the maximum size as this causes a splitting degeneracy
// when compiling for Debian i386. By modestly adjusting the bbox, we avoid the degeneracy
// while keeping the origin visible at all zoom levels
bbox.SetSize( VECTOR2I( INT_MAX - 2, INT_MAX - 2 ) );
bbox.SetOrigin( VECTOR2I( INT_MIN / 2 + 1, INT_MIN / 2 + 1 ) );
bbox.SetMaximum();
return bbox;
}

View File

@ -110,7 +110,7 @@ class SHAPE_INDEX
class Iterator
{
private:
typedef typename RTree<T, int, 2, float>::Iterator RTreeIterator;
typedef typename RTree<T, int, 2, double>::Iterator RTreeIterator;
RTreeIterator iterator;
/**
@ -119,7 +119,7 @@ class SHAPE_INDEX
* Setup the internal tree iterator.
* @param aTree pointer to a RTREE object
*/
void Init( RTree<T, int, 2, float>* aTree )
void Init( RTree<T, int, 2, double>* aTree )
{
aTree->GetFirst( iterator );
}
@ -287,7 +287,7 @@ class SHAPE_INDEX
Iterator Begin();
private:
RTree<T, int, 2, float>* m_tree;
RTree<T, int, 2, double>* m_tree;
};
/*
@ -297,7 +297,7 @@ class SHAPE_INDEX
template <class T>
SHAPE_INDEX<T>::SHAPE_INDEX()
{
this->m_tree = new RTree<T, int, 2, float>();
this->m_tree = new RTree<T, int, 2, double>();
}
template <class T>
@ -335,8 +335,8 @@ void SHAPE_INDEX<T>::RemoveAll()
template <class T>
void SHAPE_INDEX<T>::Reindex()
{
RTree<T, int, 2, float>* newTree;
newTree = new RTree<T, int, 2, float>();
RTree<T, int, 2, double>* newTree;
newTree = new RTree<T, int, 2, double>();
Iterator iter = this->Begin();

View File

@ -31,7 +31,7 @@
namespace KIGFX
{
typedef RTree<VIEW_ITEM*, int, 2, float> VIEW_RTREE_BASE;
typedef RTree<VIEW_ITEM*, int, 2, double> VIEW_RTREE_BASE;
/**
* Class VIEW_RTREE -