36 double c_min[2]; c_min[0] = p.
x() - 0.1; c_min[1] = p.
y() - 0.1;
37 double c_max[2]; c_max[0] = p.
x() + 0.1; c_max[1] = p.
y() + 0.1;
40 mSpatialIndex.Search( c_min, c_max,
searchCallback, &searchResults );
45 for ( ; resultIt != searchResults.
constEnd(); ++resultIt )
47 if (( *resultIt )->labelRect.contains( p ) )
60 mSpatialIndex.Search( c_min, c_max,
searchCallback, &searchResults );
64 for ( ; resultIt != searchResults.
constEnd(); ++resultIt )
83 for (
int i = 0; i < 4; ++i )
89 mSpatialIndex.Insert( c_min, c_max, newEntry );
90 mOwnedPositions << newEntry;
96 mSpatialIndex.RemoveAll();
99 qDeleteAll( mOwnedPositions );
100 mOwnedPositions.
clear();
A rectangle specified with double values.
void label(const QgsPoint &p, QList< QgsLabelPosition * > &posList) const
Returns label position(s) at a given point.
void push_back(const T &value)
double yMaximum() const
Get the y maximum value (top side of rectangle)
double x() const
Get the x value of the point.
void getBoundingBox(double amin[2], double amax[2]) const
Return bounding box - amin: xmin,ymin - amax: xmax,ymax.
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
double getY(int i=0) const
get the down-left y coordinate
double xMaximum() const
Get the x maximum value (right side of rectangle)
double getAlpha() const
get alpha
bool searchCallback(QgsLabelPosition *pos, void *context)
A class to represent a point.
bool insertLabel(LabelPosition *labelPos, int featureId, const QString &layerName, const QString &labeltext, const QFont &labelfont, bool diagram=false, bool pinned=false)
Inserts label position.
bool getUpsideDown() const
void clear()
Removes and deletes all the entries.
LabelPosition is a candidate feature label position.
void push_back(const T &value)
double y() const
Get the y value of the point.
double getX(int i=0) const
get the down-left x coordinate
const_iterator constEnd() const
const_iterator constBegin() const
void labelsInRect(const QgsRectangle &r, QList< QgsLabelPosition * > &posList) const
Returns label position(s) in given rectangle.
double xMinimum() const
Get the x minimum value (left side of rectangle)