20 QList<QgsLabelPosition *> *list =
static_cast< QList<QgsLabelPosition *>*
>( context );
21 list->push_back( pos );
33 c_min[0] = p.
x() - 0.1;
34 c_min[1] = p.
y() - 0.1;
36 c_max[0] = p.
x() + 0.1;
37 c_max[1] = p.
y() + 0.1;
39 QList<QgsLabelPosition *> searchResults;
40 mSpatialIndex.Search( c_min, c_max,
searchCallback, &searchResults );
44 QList<QgsLabelPosition *>::const_iterator resultIt = searchResults.constBegin();
45 for ( ; resultIt != searchResults.constEnd(); ++resultIt )
47 if ( ( *resultIt )->labelRect.contains( p ) )
49 posList.push_back( *resultIt );
63 QList<QgsLabelPosition *> searchResults;
64 mSpatialIndex.Search( c_min, c_max,
searchCallback, &searchResults );
67 QList<QgsLabelPosition *>::const_iterator resultIt = searchResults.constBegin();
68 for ( ; resultIt != searchResults.constEnd(); ++resultIt )
70 posList.push_back( *resultIt );
85 QVector<QgsPointXY> cornerPoints;
86 cornerPoints.reserve( 4 );
87 for (
int i = 0; i < 4; ++i )
93 mSpatialIndex.Insert( c_min, c_max, newEntry );
94 mOwnedPositions << newEntry;
100 mSpatialIndex.RemoveAll();
103 qDeleteAll( mOwnedPositions );
104 mOwnedPositions.clear();
A rectangle specified with double values.
void getBoundingBox(double amin[2], double amax[2]) const
Returns bounding box - amin: xmin,ymin - amax: xmax,ymax.
double getY(int i=0) const
Returns the down-left y coordinate.
A class to represent a 2D point.
bool insertLabel(pal::LabelPosition *labelPos, int featureId, const QString &layerName, const QString &labeltext, const QFont &labelfont, bool diagram=false, bool pinned=false, const QString &providerId=QString())
Inserts label position.
void labelsInRect(const QgsRectangle &r, QList< QgsLabelPosition *> &posList) const
Returns label position(s) in given rectangle.
bool searchCallback(QgsLabelPosition *pos, void *context)
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
double xMaximum() const
Returns the x maximum value (right side of rectangle).
double getAlpha() const
Returns the angle to rotate text (in rad).
double getX(int i=0) const
Returns the down-left x coordinate.
void clear()
Removes and deletes all the entries.
LabelPosition is a candidate feature label position.
double xMinimum() const
Returns the x minimum value (left side of rectangle).
double yMaximum() const
Returns the y maximum value (top side of rectangle).
bool getUpsideDown() const
void label(const QgsPointXY &p, QList< QgsLabelPosition *> &posList) const
Returns label position(s) at a given point.