36 #include "qgis_core.h" 63 LabelInfo(
int num,
double height,
double maxinangle = 20.0,
double maxoutangle = -20.0 )
65 max_char_angle_inside = maxinangle;
67 max_char_angle_outside = maxoutangle > 0 ? -maxoutangle : maxoutangle;
68 label_height = height;
137 QList<LabelPosition *> createCandidates(
const GEOSPreparedGeometry *mapBoundary,
PointSet *mapShape, RTree<LabelPosition *, double, 2, double> *candidates );
147 int createCandidatesAroundPoint(
double x,
double y, QList<LabelPosition *> &lPos,
double angle );
157 int createCandidatesOverPoint(
double x,
double y, QList<LabelPosition *> &lPos,
double angle );
165 std::unique_ptr< LabelPosition > createCandidatePointOnSurface(
PointSet *mapShape );
175 int createCandidatesAtOrderedPositionsOverPoint(
double x,
double y, QList<LabelPosition *> &lPos,
double angle );
184 int createCandidatesAlongLine( QList<LabelPosition *> &lPos,
PointSet *mapShape,
bool allowOverrun =
false );
193 int createCandidatesAlongLineNearStraightSegments( QList<LabelPosition *> &lPos,
PointSet *mapShape );
204 int createCandidatesAlongLineNearMidpoint( QList<LabelPosition *> &lPos,
PointSet *mapShape,
double initialCost = 0.0 );
217 int &orientation,
double distance,
bool &reversed,
bool &flip );
226 int createCurvedCandidatesAlongLine( QList<LabelPosition *> &lPos,
PointSet *mapShape,
bool allowOverrun =
false );
234 int createCandidatesForPolygon( QList<LabelPosition *> &lPos,
PointSet *mapShape );
242 bool hasSameLabelFeatureAs(
FeaturePart *part )
const;
257 double getLabelWidth(
double angle = 0.0 )
const {
return mLF->size( angle ).width(); }
263 double getLabelHeight(
double angle = 0.0 )
const {
return mLF->size( angle ).height(); }
311 void addSizePenalty(
int nbp, QList<LabelPosition *> &lPos,
double bbx[4],
double bby[4] );
317 double calculatePriority()
const;
320 bool showUprightLabels()
const;
323 bool nextCharPosition(
double charWidth,
double segmentLength,
PointSet *path_positions,
int &index,
double ¤tDistanceAlongSegment,
324 double &characterStartX,
double &characterStartY,
double &characterEndX,
double &characterEndY )
const;
330 int totalRepeats()
const;
336 void setTotalRepeats(
int repeats );
344 void extractCoords(
const GEOSGeometry *geom );
350 int mTotalRepeats = 0;
double obstacleFactor() const
Returns the feature's obstacle factor, which represents the penalty incurred for a label to overlap t...
double fixedAngle() const
Returns the fixed angle for the feature's label.
double max_char_angle_outside
QgsLabelFeature * feature()
Returns the parent feature.
bool hasFixedRotation() const
Returns true if the feature's label has a fixed rotation.
A set of features which influence the labeling process.
bool alwaysShow() const
Returns true if the feature's label should always been shown, even when it collides with other labels...
int getNumSelfObstacles() const
Gets number of holes (inner rings) - they are considered as obstacles.
LabelInfo(int num, double height, double maxinangle=20.0, double maxoutangle=-20.0)
double getLabelDistance() const
Returns the distance from the anchor point to the label.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
double repeatDistance() const
Returns the distance between repeating labels for this feature.
bool isObstacle() const
Returns true if the feature should act as an obstacle to labels.
Optional additional info about label (for curved labels)
Main class to handle feature.
bool hasFixedPosition() const
Returns true if the feature's label has a fixed position.
The QgsLabelFeature class describes a feature that should be used within the labeling engine...
QList< FeaturePart * > mHoles
double max_char_angle_inside
FeaturePart * getSelfObstacle(int i)
Gets hole (inner ring) - considered as obstacle.
LabelPosition is a candidate feature label position.
Quadrant
Position of label candidate relative to feature.
double getLabelWidth(double angle=0.0) const
Returns the width of the label, optionally taking an angle into account.
double getLabelHeight(double angle=0.0) const
Returns the height of the label, optionally taking an angle into account.