35 class PalRtree :
public RTree<T *, float, 2, float>
44 : mXMin( maxBounds.xMinimum() )
45 , mYMin( maxBounds.yMinimum() )
46 , mXRes( ( std::numeric_limits< float >::max() - 1 ) / ( maxBounds.xMaximum() - maxBounds.xMinimum() ) )
47 , mYRes( ( std::numeric_limits< float >::max() - 1 ) / ( maxBounds.yMaximum() - maxBounds.yMinimum() ) )
48 , mMaxBounds( maxBounds )
61 std::array< float, 4 > scaledBounds = scaleBounds( bounds );
64 scaledBounds[0], scaledBounds[ 1]
67 scaledBounds[2], scaledBounds[3]
80 std::array< float, 4 > scaledBounds = scaleBounds( bounds );
83 scaledBounds[0], scaledBounds[ 1]
86 scaledBounds[2], scaledBounds[3]
98 std::array< float, 4 > scaledBounds = scaleBounds( bounds );
101 scaledBounds[0], scaledBounds[ 1]
104 scaledBounds[2], scaledBounds[3]
118 std::array<float, 4> scaleBounds(
const QgsRectangle &bounds )
const
122 static_cast< float >( ( std::max( bounds.
xMinimum(), mMaxBounds.
xMinimum() ) - mXMin ) / mXRes ),
123 static_cast< float >( ( std::max( bounds.
yMinimum(), mMaxBounds.
yMinimum() ) - mYMin ) / mYRes ),
124 static_cast< float >( ( std::min( bounds.
xMaximum(), mMaxBounds.
xMaximum() ) - mXMin ) / mXRes ),
125 static_cast< float >( ( std::min( bounds.
yMaximum(), mMaxBounds.
yMaximum() ) - mYMin ) / mYRes )
A rtree spatial index for use in the pal labeling engine.
void insert(T *data, const QgsRectangle &bounds)
Inserts new data into the spatial index, with the specified bounds.
void remove(T *data, const QgsRectangle &bounds)
Removes existing data from the spatial index, with the specified bounds.
PalRtree(const QgsRectangle &maxBounds)
Constructor for PalRtree.
bool intersects(const QgsRectangle &bounds, const std::function< bool(T *data)> &callback) const
Performs an intersection check against the index, for data intersecting the specified bounds.
A rectangle specified with double values.
double yMaximum() const SIP_HOLDGIL
Returns the y maximum value (top side of rectangle).
double xMaximum() const SIP_HOLDGIL
Returns the x maximum value (right side of rectangle).
double xMinimum() const SIP_HOLDGIL
Returns the x minimum value (left side of rectangle).
double yMinimum() const SIP_HOLDGIL
Returns the y minimum value (bottom side of rectangle).