16 #ifndef QGSLABELINGENGINEV2_H
17 #define QGSLABELINGENGINEV2_H
57 DrawAllLabels = 1 << 2,
58 MergeConnectedLines = 1 << 3,
59 CentroidMustBeInside = 1 << 4,
60 LabelPerFeaturePart = 1 << 6,
62 Q_DECLARE_FLAGS( Flags, Flag )
80 Flags
flags()
const {
return mFlags; }
119 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsAbstractLabelProvider::Flags )
159 QgsLabelingEngineV2();
161 ~QgsLabelingEngineV2();
165 UseAllLabels = 1 << 1,
166 UsePartialCandidates = 1 << 2,
167 RenderOutlineLabels = 1 << 3,
168 DrawLabelRectOnly = 1 << 4,
169 DrawCandidates = 1 << 5,
170 DrawShadowRects = 1 << 6,
172 Q_DECLARE_FLAGS( Flags, Flag )
175 void setMapSettings( const
QgsMapSettings& mapSettings ) { mMapSettings = mapSettings; }
195 void setFlags(
const Flags& flags ) { mFlags = flags; }
197 Flags
flags()
const {
return mFlags; }
201 void setFlag(
Flag f,
bool enabled =
true ) {
if ( enabled ) mFlags |= f;
else mFlags &= ~f; }
204 void numCandidatePositions(
int& candPoint,
int& candLine,
int& candPolygon ) { candPoint = mCandPoint; candLine = mCandLine; candPolygon = mCandPolygon; }
206 void setNumCandidatePositions(
int candPoint,
int candLine,
int candPolygon ) { mCandPoint = candPoint; mCandLine = candLine; mCandPolygon = candPolygon; }
214 void readSettingsFromProject();
216 void writeSettingsToProject();
239 QgsLabelingEngineV2(
const QgsLabelingEngineV2& rh );
240 QgsLabelingEngineV2& operator=(
const QgsLabelingEngineV2& rh );
243 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsLabelingEngineV2::Flags )
274 #endif // QGSLABELINGENGINEV2_H
QString name() const
Name of the layer (for statistics, debugging etc.) - does not need to be unique.
QgsPalLayerSettings::Placement mPlacement
Placement strategy.
unsigned int linePlacementFlags() const
For layers with linestring geometries - extra placement flags (or-ed combination of QgsPalLayerSettin...
double mPriority
Default priority of labels.
Contains helper utilities for working with QGIS' labeling engine.
void setFlags(const Flags &flags)
Set flags of the labeling engine.
Main Pal labelling class.
The QgsLabelingEngineV2 class provides map labeling functionality.
QgsPalLayerSettings::UpsideDownLabels upsidedownLabels() const
How to handle labels that would be upside down.
void setNumCandidatePositions(int candPoint, int candLine, int candPolygon)
Set number of candidate positions that will be generated for each label feature.
The QgsMapSettings class contains configuration for rendering of the map.
QgsLabelingResults * results() const
For internal use by the providers.
void setSearchMethod(QgsPalLabeling::Search s)
Set which search method to use for removal collisions between labels.
QgsPalLayerSettings::Placement placement() const
What placement strategy to use for the labels.
QgsMapSettings mMapSettings
Associated map settings instance.
QList< QgsAbstractLabelProvider * > mProviders
List of providers (the are owned by the labeling engine)
unsigned int mLinePlacementFlags
Extra placement flags for linestring geometries.
const QgsMapSettings & mapSettings() const
Get associated map settings.
Flags flags() const
Get flags of the labeling engine.
Flags mFlags
Flags altering drawing and registration of features.
QgsPalLabeling::Search mSearchMethod
search method to use for removal collisions between labels
double priority() const
Default priority of labels (may be overridden by individual labels)
const QgsLabelingEngineV2 * mEngine
Associated labeling engine.
QgsLabelingResults * mResults
Resulting labeling layout.
Flags flags() const
Flags associated with the provider.
void setEngine(const QgsLabelingEngineV2 *engine)
Associate provider with a labeling engine (should be only called internally from QgsLabelingEngineV2)...
The QgsAbstractLabelProvider class is an interface class.
bool testFlag(Flag f) const
Test whether a particular flag is enabled.
QString layerId() const
Returns ID of associated layer, or empty string if no layer is associated with the provider...
Placement
Placement modes which determine how label candidates are generated for a feature. ...
Contains information about the context of a rendering operation.
The QgsLabelFeature class describes a feature that should be used within the labeling engine...
QString mName
Name of the layer.
QgsPalLayerSettings::ObstacleType obstacleType() const
How the feature geometries will work as obstacles.
virtual ~QgsAbstractLabelProvider()
Vritual destructor.
QgsPalLabeling::Search searchMethod() const
Which search method to use for removal collisions between labels.
QgsPalLayerSettings::ObstacleType mObstacleType
Type of the obstacle of feature geometries.
QgsPalLayerSettings::UpsideDownLabels mUpsidedownLabels
How to handle labels that would be upside down.
Class that stores computed placement from labeling engine.
QString mLayerId
Associated layer's ID, if applicable.
void setFlag(Flag f, bool enabled=true)
Set whether a particual flag is enabled.
QList< QgsAbstractLabelProvider * > mSubProviders
void numCandidatePositions(int &candPoint, int &candLine, int &candPolygon)
Get number of candidate positions that will be generated for each label feature (default to 8) ...
ObstacleType
Valid obstacle types, which affect how features within the layer will act as obstacles for labels...