From 539ca5aa3be88569964479fa0e47b3de554fc9e3 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Mon, 6 Aug 2018 16:55:00 -0700 Subject: [PATCH] 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. --- common/origin_viewitem.cpp | 10 +--------- include/geometry/shape_index.h | 12 ++++++------ include/view/view_rtree.h | 2 +- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/common/origin_viewitem.cpp b/common/origin_viewitem.cpp index 0c81fab5c2..0e05597f27 100644 --- a/common/origin_viewitem.cpp +++ b/common/origin_viewitem.cpp @@ -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; } diff --git a/include/geometry/shape_index.h b/include/geometry/shape_index.h index 94703ce903..5f50f104b0 100644 --- a/include/geometry/shape_index.h +++ b/include/geometry/shape_index.h @@ -110,7 +110,7 @@ class SHAPE_INDEX class Iterator { private: - typedef typename RTree::Iterator RTreeIterator; + typedef typename RTree::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* aTree ) + void Init( RTree* aTree ) { aTree->GetFirst( iterator ); } @@ -287,7 +287,7 @@ class SHAPE_INDEX Iterator Begin(); private: - RTree* m_tree; + RTree* m_tree; }; /* @@ -297,7 +297,7 @@ class SHAPE_INDEX template SHAPE_INDEX::SHAPE_INDEX() { - this->m_tree = new RTree(); + this->m_tree = new RTree(); } template @@ -335,8 +335,8 @@ void SHAPE_INDEX::RemoveAll() template void SHAPE_INDEX::Reindex() { - RTree* newTree; - newTree = new RTree(); + RTree* newTree; + newTree = new RTree(); Iterator iter = this->Begin(); diff --git a/include/view/view_rtree.h b/include/view/view_rtree.h index b9ddb58a4b..2de860aa2a 100644 --- a/include/view/view_rtree.h +++ b/include/view/view_rtree.h @@ -31,7 +31,7 @@ namespace KIGFX { -typedef RTree VIEW_RTREE_BASE; +typedef RTree VIEW_RTREE_BASE; /** * Class VIEW_RTREE -