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;
133 std::size_t maximumPointCandidates()
const;
138 std::size_t maximumLineCandidates()
const;
143 std::size_t maximumPolygonCandidates()
const;
148 std::vector<std::unique_ptr<LabelPosition> > createCandidates(
Pal *
pal );
158 std::size_t createCandidatesAroundPoint(
double x,
double y, std::vector<std::unique_ptr<LabelPosition> > &lPos,
double angle );
168 std::size_t createCandidatesOverPoint(
double x,
double y, std::vector<std::unique_ptr<LabelPosition> > &lPos,
double angle );
178 std::size_t createCandidateCenteredOverPoint(
double x,
double y, std::vector<std::unique_ptr<LabelPosition> > &lPos,
double angle );
186 std::unique_ptr< LabelPosition > createCandidatePointOnSurface(
PointSet *mapShape );
196 std::size_t createCandidatesAtOrderedPositionsOverPoint(
double x,
double y, std::vector<std::unique_ptr<LabelPosition> > &lPos,
double angle );
206 std::size_t createCandidatesAlongLine( std::vector<std::unique_ptr<LabelPosition> > &lPos,
PointSet *mapShape,
bool allowOverrun,
Pal *
pal );
215 std::size_t createHorizontalCandidatesAlongLine( std::vector<std::unique_ptr<LabelPosition> > &lPos,
PointSet *mapShape,
Pal *
pal );
225 std::size_t createCandidatesAlongLineNearStraightSegments( std::vector<std::unique_ptr<LabelPosition> > &lPos,
PointSet *mapShape,
Pal *
pal );
237 std::size_t createCandidatesAlongLineNearMidpoint( std::vector<std::unique_ptr<LabelPosition> > &lPos,
PointSet *mapShape,
double initialCost = 0.0,
Pal *
pal =
nullptr );
250 std::unique_ptr< LabelPosition > curvedPlacementAtOffset(
PointSet *path_positions,
double *path_distances,
251 int &orientation,
double distance,
bool &reversed,
bool &flip,
bool applyAngleConstraints );
261 std::size_t createCurvedCandidatesAlongLine( std::vector<std::unique_ptr<LabelPosition> > &lPos,
PointSet *mapShape,
bool allowOverrun,
Pal *
pal );
270 std::size_t createCandidatesForPolygon( std::vector<std::unique_ptr<LabelPosition> > &lPos,
PointSet *mapShape,
Pal *
pal );
278 std::size_t createCandidatesOutsidePolygon( std::vector<std::unique_ptr<LabelPosition> > &lPos,
Pal *
pal );
286 bool hasSameLabelFeatureAs(
FeaturePart *part )
const;
348 void addSizePenalty( std::vector<std::unique_ptr<LabelPosition> > &lPos,
double bbx[4],
double bby[4] );
354 double calculatePriority()
const;
357 bool showUprightLabels()
const;
360 bool nextCharPosition(
double charWidth,
double segmentLength,
PointSet *path_positions,
int &index,
double ¤tDistanceAlongSegment,
361 double &characterStartX,
double &characterStartY,
double &characterEndX,
double &characterEndY )
const;
367 int totalRepeats()
const;
373 void setTotalRepeats(
int repeats );
381 void extractCoords(
const GEOSGeometry *geom );
387 int mTotalRepeats = 0;
389 mutable std::size_t mCachedMaxLineCandidates = 0;
390 mutable std::size_t mCachedMaxPolygonCandidates = 0;
The QgsLabelFeature class describes a feature that should be used within the labeling engine.
Contains settings related to how the label engine treats features as obstacles.
Main class to handle feature.
bool hasFixedRotation() const
Returns true if the feature's label has a fixed rotation.
double getLabelHeight(double angle=0.0) const
Returns the height of the label, optionally taking an angle into account.
QList< FeaturePart * > mHoles
double getLabelDistance() const
Returns the distance from the anchor point to the label.
bool hasFixedPosition() const
Returns true if the feature's label has a fixed position.
double fixedAngle() const
Returns the fixed angle for the feature's label.
double repeatDistance() const
Returns the distance between repeating labels for this feature.
int getNumSelfObstacles() const
Gets number of holes (inner rings) - they are considered as obstacles.
const QgsLabelObstacleSettings & obstacleSettings() const
Returns the feature's obstacle settings.
double getLabelWidth(double angle=0.0) const
Returns the width of the label, optionally taking an angle into account.
bool alwaysShow() const
Returns true if the feature's label should always been shown, even when it collides with other labels...
FeaturePart * getSelfObstacle(int i)
Gets hole (inner ring) - considered as obstacle.
QgsLabelFeature * feature()
Returns the parent feature.
Optional additional info about label (for curved labels)
LabelInfo & operator=(const LabelInfo &rh)=delete
LabelInfo cannot be copied.
double max_char_angle_outside
LabelInfo(const LabelInfo &rh)=delete
LabelInfo cannot be copied.
LabelInfo(int num, double height, double maxinangle=20.0, double maxoutangle=-20.0)
double max_char_angle_inside
LabelPosition is a candidate feature label position.
Quadrant
Position of label candidate relative to feature.
A set of features which influence the labeling process.
The underlying raw pal geometry class.
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)
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features