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 )
85 Flags
flags()
const {
return mFlags; }
126 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsAbstractLabelProvider::Flags )
166 QgsLabelingEngineV2();
168 ~QgsLabelingEngineV2();
172 UseAllLabels = 1 << 1,
173 UsePartialCandidates = 1 << 2,
174 RenderOutlineLabels = 1 << 3,
175 DrawLabelRectOnly = 1 << 4,
176 DrawCandidates = 1 << 5,
177 DrawShadowRects = 1 << 6,
179 Q_DECLARE_FLAGS( Flags,
Flag )
182 void setMapSettings( const
QgsMapSettings& mapSettings ) { mMapSettings = mapSettings; }
202 void setFlags(
const Flags& flags ) { mFlags = flags; }
204 Flags
flags()
const {
return mFlags; }
208 void setFlag(
Flag f,
bool enabled =
true ) {
if ( enabled ) mFlags |= f;
else mFlags &= ~f; }
211 void numCandidatePositions(
int& candPoint,
int& candLine,
int& candPolygon ) { candPoint = mCandPoint; candLine = mCandLine; candPolygon = mCandPolygon; }
213 void setNumCandidatePositions(
int candPoint,
int candLine,
int candPolygon ) { mCandPoint = candPoint; mCandLine = candLine; mCandPolygon = candPolygon; }
221 void readSettingsFromProject();
223 void writeSettingsToProject();
246 QgsLabelingEngineV2(
const QgsLabelingEngineV2& rh );
247 QgsLabelingEngineV2& operator=(
const QgsLabelingEngineV2& rh );
250 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsLabelingEngineV2::Flags )
281 #endif // QGSLABELINGENGINEV2_H
QgsPalLayerSettings::Placement mPlacement
Placement strategy.
double mPriority
Default priority of labels.
Contains helper utilities for working with QGIS' labeling engine.
QgsPalLayerSettings::ObstacleType obstacleType() const
How the feature geometries will work as obstacles.
void setFlags(const Flags &flags)
Set flags of the labeling engine.
Main Pal labelling class.
The QgsLabelingEngineV2 class provides map labeling functionality.
void setNumCandidatePositions(int candPoint, int candLine, int candPolygon)
Set number of candidate positions that will be generated for each label feature.
const QgsMapSettings & mapSettings() const
Get associated map settings.
virtual QList< QgsAbstractLabelProvider * > subProviders()
Return list of child providers - useful if the provider needs to put labels into more layers with dif...
The QgsMapSettings class contains configuration for rendering of the map.
unsigned int linePlacementFlags() const
For layers with linestring geometries - extra placement flags (or-ed combination of QgsPalLayerSettin...
void setSearchMethod(QgsPalLabeling::Search s)
Set which search method to use for removal collisions between 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.
Flags mFlags
Flags altering drawing and registration of features.
QgsPalLabeling::Search mSearchMethod
search method to use for removal collisions between labels
const QgsLabelingEngineV2 * mEngine
Associated labeling engine.
QgsLabelingResults * mResults
Resulting labeling layout.
void setEngine(const QgsLabelingEngineV2 *engine)
Associate provider with a labeling engine (should be only called internally from QgsLabelingEngineV2)...
QgsPalLayerSettings::Placement placement() const
What placement strategy to use for the labels.
QgsPalLabeling::Search searchMethod() const
Which search method to use for removal collisions between labels.
The QgsAbstractLabelProvider class is an interface class.
QString layerId() const
Returns ID of associated layer, or empty string if no layer is associated with the provider...
QgsPalLayerSettings::UpsideDownLabels upsidedownLabels() const
How to handle labels that would be upside down.
QgsLabelingResults * results() const
For internal use by the providers.
Flags flags() const
Get flags of the labeling engine.
Flags flags() const
Flags 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.
QString name() const
Name of the layer (for statistics, debugging etc.) - does not need to be unique.
QString mName
Name of the layer.
virtual ~QgsAbstractLabelProvider()
Vritual destructor.
bool testFlag(Flag f) const
Test whether a particular flag is enabled.
double priority() const
Default priority of labels (may be overridden by individual labels)
QString mProviderId
Associated provider ID (one layer may have multiple providers, e.g. in rule-based labeling) ...
LabelPosition is a candidate feature label position.
QgsPalLayerSettings::ObstacleType mObstacleType
Type of the obstacle of feature geometries.
QgsPalLayerSettings::UpsideDownLabels mUpsidedownLabels
How to handle labels that would be upside down.
QString providerId() const
Returns provider ID - useful in case there is more than one label provider within a layer (e...
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...