36 #include "qgis_core.h" 41 #include <QLinkedList> 110 const int size = mHashtable.size();
112 return static_cast< std::size_t
>( mPal->globalCandidatesLimitPoint() > 0 ? std::min( mPal->globalCandidatesLimitPoint(), 4 ) : 4 );
113 else if ( size > 500 )
114 return static_cast< std::size_t
>( mPal->globalCandidatesLimitPoint() > 0 ? std::min( mPal->globalCandidatesLimitPoint(), 6 ) : 6 );
115 else if ( size > 200 )
116 return static_cast< std::size_t
>( mPal->globalCandidatesLimitPoint() > 0 ? std::min( mPal->globalCandidatesLimitPoint(), 8 ) : 8 );
117 else if ( size > 100 )
118 return static_cast< std::size_t
>( mPal->globalCandidatesLimitPoint() > 0 ? std::min( mPal->globalCandidatesLimitPoint(), 12 ) : 12 );
120 return static_cast< std::size_t
>( std::max( mPal->globalCandidatesLimitPoint(), 0 ) );
131 const int size = mHashtable.size();
133 return static_cast< std::size_t
>( mPal->globalCandidatesLimitLine() > 0 ? std::min( mPal->globalCandidatesLimitLine(), 5 ) : 5 );
134 else if ( size > 500 )
135 return static_cast< std::size_t
>( mPal->globalCandidatesLimitLine() > 0 ? std::min( mPal->globalCandidatesLimitLine(), 10 ) : 10 );
136 else if ( size > 200 )
137 return static_cast< std::size_t
>( mPal->globalCandidatesLimitLine() > 0 ? std::min( mPal->globalCandidatesLimitLine(), 20 ) : 20 );
138 else if ( size > 100 )
139 return static_cast< std::size_t
>( mPal->globalCandidatesLimitLine() > 0 ? std::min( mPal->globalCandidatesLimitLine(), 40 ) : 40 );
141 return static_cast< std::size_t
>( std::max( mPal->globalCandidatesLimitLine(), 0 ) );
152 const int size = mHashtable.size();
154 return static_cast< std::size_t
>( mPal->globalCandidatesLimitPolygon() > 0 ? std::min( mPal->globalCandidatesLimitPolygon(), 5 ) : 5 );
155 else if ( size > 500 )
156 return static_cast< std::size_t
>( mPal->globalCandidatesLimitPolygon() > 0 ? std::min( mPal->globalCandidatesLimitPolygon(), 15 ) : 15 );
157 else if ( size > 200 )
158 return static_cast< std::size_t
>( mPal->globalCandidatesLimitPolygon() > 0 ? std::min( mPal->globalCandidatesLimitPolygon(), 20 ) : 20 );
159 else if ( size > 100 )
160 return static_cast< std::size_t
>( mPal->globalCandidatesLimitPolygon() > 0 ? std::min( mPal->globalCandidatesLimitPolygon(), 25 ) : 25 );
162 return static_cast< std::size_t
>( std::max( mPal->globalCandidatesLimitPolygon(), 0 ) );
171 QString
name()
const {
return mName; }
245 void setPriority(
double priority );
252 double priority()
const {
return mDefaultPriority; }
308 void joinConnectedFeatures();
318 void chopFeaturesAtRepeatDistance();
358 void addFeaturePart(
FeaturePart *fpart,
const QString &labelText = QString() );
bool labelLayer() const
Returns whether the layer will be labeled or not.
QgsAbstractLabelProvider * provider() const
Returns pointer to the associated provider.
bool centroidInside() const
Returns whether labels placed at the centroid of features within the layer are forced to be placed in...
QList< FeaturePart * > mObstacleParts
List of obstacle parts.
QHash< QgsFeatureId, int > mConnectedFeaturesIds
bool mergeConnectedLines() const
Returns whether connected lines will be merged before labeling.
std::size_t maximumPointLabelCandidates() const
Returns the maximum number of point label candidates to generate for features in this layer...
QHash< QgsFeatureId, QgsLabelFeature * > mHashtable
Lookup table of label features (owned by the label feature provider that created them) ...
Arranges candidates following the curvature of a line feature. Applies to line layers only...
A set of features which influence the labeling process.
std::size_t maximumPolygonLabelCandidates() const
Returns the maximum number of polygon label candidates to generate for features in this layer...
std::size_t maximumLineLabelCandidates() const
Returns the maximum number of line label candidates to generate for features in this layer...
void setUpsidedownLabels(UpsideDownLabels ud)
Sets how upside down labels will be handled within the layer.
UpsideDownLabels upsidedownLabels() const
Returns how upside down labels are handled within the layer.
void setCentroidInside(bool forceInside)
Sets whether labels placed at the centroid of features within the layer are forced to be placed insid...
QHash< QString, QVector< FeaturePart * > > mConnectedHashtable
double priority() const
Returns the layer's priority, between 0 and 1.
ObstacleType
Valid obstacle types, which affect how features within the layer will act as obstacles for labels...
void setArrangement(QgsPalLayerSettings::Placement arrangement)
Sets the layer's arrangement policy.
QgsPalLayerSettings::Placement arrangement() const
Returns the layer's arrangement policy.
int featureCount()
Returns the number of features in layer.
void setObstacleType(QgsLabelObstacleSettings::ObstacleType obstacleType)
Sets the obstacle type, which controls how features within the layer act as obstacles for labels...
Main class to handle feature.
The QgsAbstractLabelProvider class is an interface class.
Placement
Placement modes which determine how label candidates are generated for a feature. ...
QgsLabelObstacleSettings::ObstacleType obstacleType() const
Returns the obstacle type, which controls how features within the layer act as obstacles for labels...
void setActive(bool active)
Sets whether the layer is currently active.
void setLabelLayer(bool toLabel)
Sets whether the layer will be labeled.
QgsAbstractLabelProvider * mProvider
The QgsLabelFeature class describes a feature that should be used within the labeling engine...
QLinkedList< FeaturePart * > mFeatureParts
List of feature parts.
QString name() const
Returns the layer's name.
bool active() const
Returns whether the layer is currently active.
LabelPosition is a candidate feature label position.
Representation of a labeling problem.
std::vector< geos::unique_ptr > mGeosObstacleGeometries
QgsPalLayerSettings::Placement mArrangement
Optional flags used for some placement methods.
Arranges candidates following the curvature of a polygon's boundary. Applies to polygon layers only...
bool isCurved() const
Returns true if the layer has curved labels.
UpsideDownLabels mUpsidedownLabels
void setMergeConnectedLines(bool merge)
Sets whether connected lines should be merged before labeling.