21 #ifndef QGSPALLABELING_H
22 #define QGSPALLABELING_H
35 #include <QFontDatabase>
175 FontLetterSpacing = 28,
176 FontWordSpacing = 29,
180 MultiLineWrapChar = 31,
181 MultiLineHeight = 32,
182 MultiLineAlignment = 33,
186 DirSymbPlacement = 37,
198 BufferJoinStyle = 44,
199 BufferBlendMode = 45,
209 ShapeRotationType = 52,
212 ShapeOffsetUnits = 55,
214 ShapeRadiiUnits = 57,
215 ShapeTransparency = 63,
218 ShapeBorderColor = 59,
219 ShapeBorderWidth = 60,
220 ShapeBorderWidthUnits = 61,
226 ShadowOffsetAngle = 67,
227 ShadowOffsetDist = 68,
228 ShadowOffsetUnits = 69,
230 ShadowRadiusUnits = 71,
231 ShadowTransparency = 72,
234 ShadowBlendMode = 75,
244 CurvedCharAngleInOut = 83,
253 ScaleVisibility = 23,
407 void calculateLabelSize(
const QFontMetricsF* fm, QString text,
double& labelX,
double& labelY,
QgsFeature* f = 0 );
424 bool active,
bool useExpr,
const QString& expr,
const QString& field );
432 QString updateDataDefinedString(
const QString& value );
487 QMap<QgsPalLayerSettings::DataDefinedProperties, QPair<QString, int> >
dataDefinedNames()
const {
return mDataDefinedNames; }
522 bool dataDefinedValEval(
const QString& valType,
526 void parseTextStyle( QFont& labelFont,
530 void parseTextBuffer();
532 void parseTextFormatting();
534 void parseShapeBackground();
536 void parseDropShadow();
569 , mUseOrigin( false )
571 , mRotationOffset( 0.0 )
572 , mUseRotation( false )
574 , mUseCenter( false )
578 , mPictureBuffer( 0.0 )
582 const QString&
text() {
return mText; }
583 void setText(
const QString& text ) { mText = text; }
612 const QPicture*
picture() {
return mPicture; }
671 void numCandidatePositions(
int& candPoint,
int& candLine,
int& candPolygon );
672 void setNumCandidatePositions(
int candPoint,
int candLine,
int candPolygon );
674 enum Search { Chain, Popmusic_Tabu, Popmusic_Chain, Popmusic_Tabu_Chain, Falp };
676 void setSearchMethod( Search s );
677 Search searchMethod()
const;
681 const QList<QgsLabelCandidate>&
candidates() {
return mCandidates; }
724 void drawLabelCandidateRect( pal::LabelPosition* lp, QPainter* painter,
const QgsMapToPixel* xform );
743 void loadEngineSettings();
744 void saveEngineSettings();
745 void clearEngineSettings();
752 const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
756 const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
760 const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
764 const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
768 const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
793 #endif // QGSPALLABELING_H
virtual void exit()=0
called when we're done with rendering
virtual int addDiagramLayer(QgsVectorLayer *layer, QgsDiagramLayerSettings *s)
adds a diagram layer to the labeling engine
QHash< QgsVectorLayer *, QgsPalLayerSettings > mActiveLayers
Class for parsing and evaluation of expressions (formerly called "search strings").
void setShowingCandidates(bool showing)
void setRotationOffset(double rotation)
virtual void clearActiveLayers()=0
clears all PAL layer settings for registered layers
A rectangle specified with double values.
double maxCurvedCharAngleOut
QString leftDirectionSymbol
QgsExpression * expression
virtual QList< QgsLabelPosition > labelsWithinRect(const QgsRectangle &r)=0
return infos about labels within a given (map) rectangle
A container class for data source field mapping or expression.
const QgsPoint & offset()
virtual QgsPalLayerSettings & layer(const QString &layerName)=0
returns PAL layer settings for a registered layer
A class to query the labeling structure at a given point (small wraper around pal RTree class) ...
void setShowingPartialsLabels(bool showing)
QPainter::CompositionMode bufferBlendMode
double rotationOffset() const
bool mShowingPartialsLabels
QuadrantPosition quadOffset
Container of fields for a vector layer.
MultiLineAlign multilineAlign
void setOffset(QgsPoint point)
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
A non GUI class for rendering a map layer set onto a QPainter.
QHash< QgsVectorLayer *, QgsDiagramLayerSettings > mActiveDiagramLayers
virtual void clearActiveLayer(QgsVectorLayer *layer)=0
clears data defined objects from PAL layer settings for a registered layer
double maxCurvedCharAngleIn
bool reverseDirectionSymbol
Qt::PenJoinStyle bufferJoinStyle
void setRotation(double rotation)
QgsMapRenderer * mMapRenderer
Perform transforms between map coordinates and device coordinates.
QList< QgsPalGeometry * > geometries
const QgsCoordinateTransform * ct
double rasterCompressFactor
bool bufferSizeInMapUnits
QgsPalLayerSettings mInvalidLayerSettings
virtual QgsLabelingEngineInterface * clone()=0
called when passing engine among map renderers
SizeUnit shapeBorderWidthUnits
QMap< QgsPalLayerSettings::DataDefinedProperties, QPair< QString, int > > mDataDefinedNames
QPainter::CompositionMode blendMode
const QgsPoint & center()
bool isStoredWithProject() const
virtual void registerDiagramFeature(QgsVectorLayer *layer, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext())
called for every diagram feature
void setUseCenter(bool use)
const QgsMapToPixel * xform
QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined * > dataDefinedProperties
Map of current data defined properties.
void setUseOrigin(bool use)
bool isShowingPartialsLabels() const
void setText(const QString &text)
virtual void registerFeature(QgsVectorLayer *layer, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext())=0
called for every feature
void setStoredWithProject(bool store)
void setDpiRatio(double ratio)
const QgsPoint & origin()
QPainter::CompositionMode shapeBlendMode
void setPictureBuffer(double buffer)
SizeUnit shadowOffsetUnits
SizeUnit
Units used for option sizes, before being converted to rendered sizes.
const QList< QgsLabelCandidate > & candidates()
A class to represent a point geometry.
Qt::PenJoinStyle shapeJoinStyle
unsigned int upsidedownLabels
virtual int prepareLayer(QgsVectorLayer *layer, QSet< int > &attrIndices, QgsRenderContext &ctx)=0
called when starting rendering of a layer
unsigned int placementFlags
void setSize(QgsPoint point)
QString rightDirectionSymbol
bool isShowingCandidates() const
Contains information about the context of a rendering operation.
const QPicture * picture()
void setShowingShadowRectangles(bool showing)
void setPicture(QPicture *picture)
void setUseRotation(bool use)
virtual void drawLabeling(QgsRenderContext &context)=0
called when the map is drawn and labels should be placed
virtual QList< QgsLabelPosition > labelsAtPosition(const QgsPoint &p)=0
return infos about labels at a given (map) position
bool shadowRadiusAlphaOnly
SizeUnit shadowRadiusUnits
QgsLabelCandidate(QRectF r, double c)
bool labelOffsetInMapUnits
double pictureBuffer() const
QPainter::CompositionMode shadowBlendMode
bool isExpression
Is this label made from a expression string eg FieldName || 'mm'.
virtual bool willUseLayer(QgsVectorLayer *layer)=0
called to find out whether the layer is used for labeling
bool isShowingAllLabels() const
void setShowingAllLabels(bool showing)
QMap< QgsPalLayerSettings::DataDefinedProperties, QPair< QString, int > > dataDefinedNames() const
Map of data defined enum to names and old-style indecies The QPair contains a new string for layer pr...
virtual void init(QgsMapRenderer *mp)=0
called when we're going to start with rendering
bool isShowingShadowRectangles() const
QList< QgsLabelCandidate > mCandidates
Labeling engine interface.
void setCenter(QgsPoint point)
SizeUnit shapeOffsetUnits
Represents a vector layer which manages a vector based data sets.
Maintains current state of more grainular and temporal values when creating/painting component parts ...
RotationType shapeRotationType
QMap< DataDefinedProperties, QVariant > dataDefinedValues
const QgsFields * mCurFields
QgsLabelSearchTree * mLabelSearchTree
void setOrigin(QgsPoint point)
DirectionSymbols placeDirectionSymbol