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
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)
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.
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...