17 #ifndef QGSSYMBOLLAYERV2UTILS_H 18 #define QGSSYMBOLLAYERV2UTILS_H 55 static QString encodeSldAlpha(
int alpha );
56 static int decodeSldAlpha(
const QString& str );
58 static QString encodeSldFontStyle( QFont::Style style );
59 static QFont::Style decodeSldFontStyle(
const QString& str );
61 static QString encodeSldFontWeight(
int weight );
62 static int decodeSldFontWeight(
const QString& str );
64 static QString encodePenStyle( Qt::PenStyle style );
65 static Qt::PenStyle decodePenStyle(
const QString& str );
67 static QString encodePenJoinStyle( Qt::PenJoinStyle style );
68 static Qt::PenJoinStyle decodePenJoinStyle(
const QString& str );
70 static QString encodePenCapStyle( Qt::PenCapStyle style );
71 static Qt::PenCapStyle decodePenCapStyle(
const QString& str );
73 static QString encodeSldLineJoinStyle( Qt::PenJoinStyle style );
74 static Qt::PenJoinStyle decodeSldLineJoinStyle(
const QString& str );
76 static QString encodeSldLineCapStyle( Qt::PenCapStyle style );
77 static Qt::PenCapStyle decodeSldLineCapStyle(
const QString& str );
79 static QString encodeBrushStyle( Qt::BrushStyle style );
80 static Qt::BrushStyle decodeBrushStyle(
const QString& str );
82 static QString encodeSldBrushStyle( Qt::BrushStyle style );
83 static Qt::BrushStyle decodeSldBrushStyle(
const QString& str );
112 static double sizeInPixelsFromSldUom(
const QString &uom,
double size );
114 static QPainter::CompositionMode decodeBlendMode(
const QString& s );
130 static void drawStippledBackground(
QPainter* painter,
QRect rect );
137 static double estimateMaxSymbolBleed(
QgsSymbolV2* symbol );
154 SymbolType* symbolCastToType =
dynamic_cast<SymbolType*
>( tmpSymbol );
156 if ( symbolCastToType )
158 return symbolCastToType;
184 static bool hasExternalGraphic(
QDomElement &element );
185 static bool hasWellKnownMark(
QDomElement &element );
187 static bool needFontMarker(
QDomElement &element );
189 static bool needEllipseMarker(
QDomElement &element );
190 static bool needMarkerLine(
QDomElement &element );
191 static bool needLinePatternFill(
QDomElement &element );
192 static bool needPointPatternFill(
QDomElement &element );
196 Qt::BrushStyle brushStyle,
const QColor& color =
QColor() );
198 Qt::BrushStyle &brushStyle,
QColor &color );
202 Qt::PenStyle penStyle,
const QColor& color,
double width = -1,
203 const Qt::PenJoinStyle *penJoinStyle =
nullptr,
const Qt::PenCapStyle *penCapStyle =
nullptr,
204 const QVector<qreal> *customDashPattern =
nullptr,
double dashOffset = 0.0 );
206 Qt::PenStyle &penStyle,
QColor &color,
double &width,
207 Qt::PenJoinStyle *penJoinStyle =
nullptr, Qt::PenCapStyle *penCapStyle =
nullptr,
208 QVector<qreal> *customDashPattern =
nullptr,
double *dashOffset =
nullptr );
212 const QColor& color,
double size = -1 );
213 static bool externalGraphicFromSld(
QDomElement &element,
215 QColor &color,
double &size );
220 double borderWidth = -1,
double size = -1 );
222 const QString& name,
const QColor& color,
const QColor& borderColor, Qt::PenStyle borderStyle,
223 double borderWidth = -1,
double size = -1 );
225 Q_DECL_DEPRECATED
static bool wellKnownMarkerFromSld(
QDomElement &element,
227 double &borderWidth,
double &size );
230 static bool wellKnownMarkerFromSld(
QDomElement &element,
232 double &borderWidth,
double &size );
235 const QString& path,
const QString& format,
int *markIndex =
nullptr,
237 static bool externalMarkerFromSld(
QDomElement &element,
239 QColor &color,
double &size );
246 static QString ogrFeatureStylePen(
double width,
double mmScaleFactor,
double mapUnitsScaleFactor,
const QColor& c,
247 Qt::PenJoinStyle joinStyle = Qt::MiterJoin,
248 Qt::PenCapStyle capStyle = Qt::FlatCap,
253 static QString ogrFeatureStyleBrush(
const QColor& fillColr );
333 static QColor colorFromMimeData(
const QMimeData *data,
bool& hasAlpha );
380 static QColor parseColor(
const QString& colorStr,
bool strictEval =
false );
391 static QColor parseColorWithAlpha(
const QString& colorStr,
bool &containsAlpha,
bool strictEval =
false );
436 static void multiplyImageOpacity(
QImage* image, qreal alpha );
439 static void blurImageInPlace(
QImage& image,
QRect rect,
int radius,
bool alphaOnly );
444 static void premultiplyColor(
QColor& rgb,
int alpha );
447 static void sortVariantList(
QList<QVariant>& list, Qt::SortOrder order );
449 static QPointF pointOnLineWithDistance(
QPointF startPoint,
QPointF directionPoint,
double distance );
496 static QList<double> prettyBreaks(
double minimum,
double maximum,
int classes );
526 static void mergeScaleDependencies(
int mScaleMinDenom,
int mScaleMaxDenom,
QgsStringMap& props );
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.
Abstract base class for color ramps.