36 #include "qgis_core.h" 62 LabelInfo(
int num,
double height,
double maxinangle = 20.0,
double maxoutangle = -20.0 )
64 max_char_angle_inside = maxinangle;
66 max_char_angle_outside = maxoutangle > 0 ? -maxoutangle : maxoutangle;
67 label_height = height;
132 std::size_t maximumPointCandidates()
const;
137 std::size_t maximumLineCandidates()
const;
142 std::size_t maximumPolygonCandidates()
const;
147 std::vector<std::unique_ptr<LabelPosition> > createCandidates(
Pal *
pal );
157 std::size_t createCandidatesAroundPoint(
double x,
double y, std::vector<std::unique_ptr<LabelPosition> > &lPos,
double angle );
167 std::size_t createCandidatesOverPoint(
double x,
double y, std::vector<std::unique_ptr<LabelPosition> > &lPos,
double angle );
177 std::size_t createCandidateCenteredOverPoint(
double x,
double y, std::vector<std::unique_ptr<LabelPosition> > &lPos,
double angle );
185 std::unique_ptr< LabelPosition > createCandidatePointOnSurface(
PointSet *mapShape );
195 std::size_t createCandidatesAtOrderedPositionsOverPoint(
double x,
double y, std::vector<std::unique_ptr<LabelPosition> > &lPos,
double angle );
205 std::size_t createCandidatesAlongLine( std::vector<std::unique_ptr<LabelPosition> > &lPos,
PointSet *mapShape,
bool allowOverrun,
Pal *pal );
214 std::size_t createHorizontalCandidatesAlongLine( std::vector<std::unique_ptr<LabelPosition> > &lPos,
PointSet *mapShape,
Pal *pal );
224 std::size_t createCandidatesAlongLineNearStraightSegments( std::vector<std::unique_ptr<LabelPosition> > &lPos,
PointSet *mapShape,
Pal *pal );
236 std::size_t createCandidatesAlongLineNearMidpoint( std::vector<std::unique_ptr<LabelPosition> > &lPos,
PointSet *mapShape,
double initialCost = 0.0,
Pal *pal =
nullptr );
248 std::unique_ptr< LabelPosition > curvedPlacementAtOffset(
PointSet *path_positions,
double *path_distances,
249 int &orientation,
double distance,
bool &reversed,
bool &flip );
259 std::size_t createCurvedCandidatesAlongLine( std::vector<std::unique_ptr<LabelPosition> > &lPos,
PointSet *mapShape,
bool allowOverrun,
Pal *pal );
268 std::size_t createCandidatesForPolygon( std::vector<std::unique_ptr<LabelPosition> > &lPos,
PointSet *mapShape,
Pal *pal );
276 bool hasSameLabelFeatureAs(
FeaturePart *part )
const;
291 double getLabelWidth(
double angle = 0.0 )
const {
return mLF->size( angle ).width(); }
297 double getLabelHeight(
double angle = 0.0 )
const {
return mLF->size( angle ).height(); }
346 void addSizePenalty( std::vector<std::unique_ptr<LabelPosition> > &lPos,
double bbx[4],
double bby[4] );
352 double calculatePriority()
const;
355 bool showUprightLabels()
const;
358 bool nextCharPosition(
double charWidth,
double segmentLength,
PointSet *path_positions,
int &index,
double ¤tDistanceAlongSegment,
359 double &characterStartX,
double &characterStartY,
double &characterEndX,
double &characterEndY )
const;
365 int totalRepeats()
const;
371 void setTotalRepeats(
int repeats );
379 void extractCoords(
const GEOSGeometry *geom );
385 int mTotalRepeats = 0;
387 mutable std::size_t mCachedMaxLineCandidates = 0;
388 mutable std::size_t mCachedMaxPolygonCandidates = 0;
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)
Contains settings related to how the label engine treats features as obstacles.
double repeatDistance() const
Returns the distance between repeating labels for this feature.
Optional additional info about label (for curved labels)
const QgsLabelObstacleSettings & obstacleSettings() const
Returns the feature's obstacle settings.
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.