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.

(cherry-picked from 539ca5aa3)
This commit is contained in:
Seth Hillbrand 2018-08-06 16:55:00 -07:00
parent 26cbdbf103
commit edbf34c2b2
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 const BOX2I ORIGIN_VIEWITEM::ViewBBox() const
{ {
BOX2I bbox; BOX2I bbox;
bbox.SetMaximum();
// 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 ) );
return bbox; return bbox;
} }

View File

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

View File

@ -31,7 +31,7 @@
namespace KIGFX 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 - * Class VIEW_RTREE -