17 #ifndef QGSSYMBOLLAYERV2UTILS_H 18 #define QGSSYMBOLLAYERV2UTILS_H 52 static QString encodeSldAlpha(
int alpha );
53 static int decodeSldAlpha(
const QString& str );
55 static QString encodeSldFontStyle( QFont::Style style );
56 static QFont::Style decodeSldFontStyle(
const QString& str );
58 static QString encodeSldFontWeight(
int weight );
59 static int decodeSldFontWeight(
const QString& str );
61 static QString encodePenStyle( Qt::PenStyle style );
62 static Qt::PenStyle decodePenStyle(
const QString& str );
64 static QString encodePenJoinStyle( Qt::PenJoinStyle style );
65 static Qt::PenJoinStyle decodePenJoinStyle(
const QString& str );
67 static QString encodePenCapStyle( Qt::PenCapStyle style );
68 static Qt::PenCapStyle decodePenCapStyle(
const QString& str );
70 static QString encodeSldLineJoinStyle( Qt::PenJoinStyle style );
71 static Qt::PenJoinStyle decodeSldLineJoinStyle(
const QString& str );
73 static QString encodeSldLineCapStyle( Qt::PenCapStyle style );
74 static Qt::PenCapStyle decodeSldLineCapStyle(
const QString& str );
76 static QString encodeBrushStyle( Qt::BrushStyle style );
77 static Qt::BrushStyle decodeBrushStyle(
const QString& str );
79 static QString encodeSldBrushStyle( Qt::BrushStyle style );
80 static Qt::BrushStyle decodeSldBrushStyle(
const QString& str );
103 static QPainter::CompositionMode decodeBlendMode(
const QString& s );
119 static void drawStippledBackground(
QPainter* painter,
QRect rect );
126 static double estimateMaxSymbolBleed(
QgsSymbolV2* symbol );
143 SymbolType* symbolCastToType =
dynamic_cast<SymbolType*
>( tmpSymbol );
145 if ( symbolCastToType )
147 return symbolCastToType;
173 static bool hasExternalGraphic(
QDomElement &element );
174 static bool hasWellKnownMark(
QDomElement &element );
176 static bool needFontMarker(
QDomElement &element );
178 static bool needEllipseMarker(
QDomElement &element );
179 static bool needMarkerLine(
QDomElement &element );
180 static bool needLinePatternFill(
QDomElement &element );
181 static bool needPointPatternFill(
QDomElement &element );
185 Qt::BrushStyle brushStyle,
const QColor& color =
QColor() );
187 Qt::BrushStyle &brushStyle,
QColor &color );
191 Qt::PenStyle penStyle,
const QColor& color,
double width = -1,
192 const Qt::PenJoinStyle *penJoinStyle =
nullptr,
const Qt::PenCapStyle *penCapStyle =
nullptr,
193 const QVector<qreal> *customDashPattern =
nullptr,
double dashOffset = 0.0 );
195 Qt::PenStyle &penStyle,
QColor &color,
double &width,
196 Qt::PenJoinStyle *penJoinStyle =
nullptr, Qt::PenCapStyle *penCapStyle =
nullptr,
197 QVector<qreal> *customDashPattern =
nullptr,
double *dashOffset =
nullptr );
201 const QColor& color,
double size = -1 );
202 static bool externalGraphicFromSld(
QDomElement &element,
204 QColor &color,
double &size );
209 double borderWidth = -1,
double size = -1 );
211 const QString& name,
const QColor& color,
const QColor& borderColor, Qt::PenStyle borderStyle,
212 double borderWidth = -1,
double size = -1 );
214 Q_DECL_DEPRECATED
static bool wellKnownMarkerFromSld(
QDomElement &element,
216 double &borderWidth,
double &size );
219 static bool wellKnownMarkerFromSld(
QDomElement &element,
221 double &borderWidth,
double &size );
224 const QString& path,
const QString& format,
int *markIndex =
nullptr,
226 static bool externalMarkerFromSld(
QDomElement &element,
228 QColor &color,
double &size );
235 static QString ogrFeatureStylePen(
double width,
double mmScaleFactor,
double mapUnitsScaleFactor,
const QColor& c,
236 Qt::PenJoinStyle joinStyle = Qt::MiterJoin,
237 Qt::PenCapStyle capStyle = Qt::FlatCap,
242 static QString ogrFeatureStyleBrush(
const QColor& fillColr );
314 static QColor colorFromMimeData(
const QMimeData *data,
bool& hasAlpha );
361 static QColor parseColor(
const QString& colorStr,
bool strictEval =
false );
372 static QColor parseColorWithAlpha(
const QString& colorStr,
bool &containsAlpha,
bool strictEval =
false );
405 static void multiplyImageOpacity(
QImage* image, qreal alpha );
408 static void blurImageInPlace(
QImage& image,
QRect rect,
int radius,
bool alphaOnly );
413 static void premultiplyColor(
QColor& rgb,
int alpha );
416 static void sortVariantList(
QList<QVariant>& list, Qt::SortOrder order );
418 static QPointF pointOnLineWithDistance(
QPointF startPoint,
QPointF directionPoint,
double distance );
465 static QList<double> prettyBreaks(
double minimum,
double maximum,
int classes );
Class for parsing and evaluation of expressions (formerly called "search strings").
OutputUnit
The unit of the output.
QMap< QString, QgsSymbolV2 * > QgsSymbolV2Map
QList< QPolygonF > offsetLine(const QPolygonF &polyline, double dist)
static QgsSymbolV2 * loadSymbol(const QDomElement &element)
Attempts to load a symbol from a DOM element.
QMap< QString, QString > QgsStringMap
Contains information about the context of a rendering operation.
Struct for storing maximum and minimum scales for measurements in map units.
QList< QPair< QColor, QString > > QgsNamedColorList
static SymbolType * loadSymbol(const QDomElement &element)
Attempts to load a symbol from a DOM element and cast it to a particular symbol type.