QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Static Public Member Functions | List of all members
QgsSymbolLayerV2Utils Class Reference

#include <qgssymbollayerv2utils.h>

Static Public Member Functions

static QString encodeColor (QColor color)
 
static QColor decodeColor (QString str)
 
static QString encodeSldAlpha (int alpha)
 
static int decodeSldAlpha (QString str)
 
static QString encodeSldFontStyle (QFont::Style style)
 
static QFont::Style decodeSldFontStyle (QString str)
 
static QString encodeSldFontWeight (int weight)
 
static int decodeSldFontWeight (QString str)
 
static QString encodePenStyle (Qt::PenStyle style)
 
static Qt::PenStyle decodePenStyle (QString str)
 
static QString encodePenJoinStyle (Qt::PenJoinStyle style)
 
static Qt::PenJoinStyle decodePenJoinStyle (QString str)
 
static QString encodePenCapStyle (Qt::PenCapStyle style)
 
static Qt::PenCapStyle decodePenCapStyle (QString str)
 
static QString encodeSldLineJoinStyle (Qt::PenJoinStyle style)
 
static Qt::PenJoinStyle decodeSldLineJoinStyle (QString str)
 
static QString encodeSldLineCapStyle (Qt::PenCapStyle style)
 
static Qt::PenCapStyle decodeSldLineCapStyle (QString str)
 
static QString encodeBrushStyle (Qt::BrushStyle style)
 
static Qt::BrushStyle decodeBrushStyle (QString str)
 
static QString encodeSldBrushStyle (Qt::BrushStyle style)
 
static Qt::BrushStyle decodeSldBrushStyle (QString str)
 
static QString encodePoint (QPointF point)
 
static QPointF decodePoint (QString str)
 
static QString encodeMapUnitScale (const QgsMapUnitScale &mapUnitScale)
 
static QgsMapUnitScale decodeMapUnitScale (const QString &str)
 
static QString encodeRealVector (const QVector< qreal > &v)
 
static QVector< qreal > decodeRealVector (const QString &s)
 
static QString encodeSldRealVector (const QVector< qreal > &v)
 
static QVector< qreal > decodeSldRealVector (const QString &s)
 
static QString encodeOutputUnit (QgsSymbolV2::OutputUnit unit)
 
static QgsSymbolV2::OutputUnit decodeOutputUnit (QString str)
 
static QString encodeSldUom (QgsSymbolV2::OutputUnit unit, double *scaleFactor)
 
static QgsSymbolV2::OutputUnit decodeSldUom (QString str, double *scaleFactor)
 
static QString encodeScaleMethod (QgsSymbolV2::ScaleMethod scaleMethod)
 
static QgsSymbolV2::ScaleMethod decodeScaleMethod (QString str)
 
static QPainter::CompositionMode decodeBlendMode (const QString &s)
 
static QIcon symbolPreviewIcon (QgsSymbolV2 *symbol, QSize size)
 
static QIcon symbolLayerPreviewIcon (QgsSymbolLayerV2 *layer, QgsSymbolV2::OutputUnit u, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale())
 
static QIcon colorRampPreviewIcon (QgsVectorColorRampV2 *ramp, QSize size)
 
static void drawStippledBackround (QPainter *painter, QRect rect)
 
static QPixmap symbolPreviewPixmap (QgsSymbolV2 *symbol, QSize size)
 
static QPixmap colorRampPreviewPixmap (QgsVectorColorRampV2 *ramp, QSize size)
 
static double estimateMaxSymbolBleed (QgsSymbolV2 *symbol)
 Returns the maximum estimated bleed for the symbol. More...
 
static QgsSymbolV2loadSymbol (QDomElement &element)
 
static QgsSymbolLayerV2loadSymbolLayer (QDomElement &element)
 
static QDomElement saveSymbol (QString symbolName, QgsSymbolV2 *symbol, QDomDocument &doc)
 
static bool createSymbolLayerV2ListFromSld (QDomElement &element, QGis::GeometryType geomType, QgsSymbolLayerV2List &layers)
 
static QgsSymbolLayerV2createFillLayerFromSld (QDomElement &element)
 
static QgsSymbolLayerV2createLineLayerFromSld (QDomElement &element)
 
static QgsSymbolLayerV2createMarkerLayerFromSld (QDomElement &element)
 
static bool convertPolygonSymbolizerToPointMarker (QDomElement &element, QgsSymbolLayerV2List &layerList)
 
static bool hasExternalGraphic (QDomElement &element)
 
static bool hasWellKnownMark (QDomElement &element)
 
static bool needFontMarker (QDomElement &element)
 
static bool needSvgMarker (QDomElement &element)
 
static bool needEllipseMarker (QDomElement &element)
 
static bool needMarkerLine (QDomElement &element)
 
static bool needLinePatternFill (QDomElement &element)
 
static bool needPointPatternFill (QDomElement &element)
 
static bool needSvgFill (QDomElement &element)
 
static void fillToSld (QDomDocument &doc, QDomElement &element, Qt::BrushStyle brushStyle, QColor color=QColor())
 
static bool fillFromSld (QDomElement &element, Qt::BrushStyle &brushStyle, QColor &color)
 
static void lineToSld (QDomDocument &doc, QDomElement &element, Qt::PenStyle penStyle, QColor color, double width=-1, const Qt::PenJoinStyle *penJoinStyle=0, const Qt::PenCapStyle *penCapStyle=0, const QVector< qreal > *customDashPattern=0, double dashOffset=0.0)
 
static bool lineFromSld (QDomElement &element, Qt::PenStyle &penStyle, QColor &color, double &width, Qt::PenJoinStyle *penJoinStyle=0, Qt::PenCapStyle *penCapStyle=0, QVector< qreal > *customDashPattern=0, double *dashOffset=0)
 
static void externalGraphicToSld (QDomDocument &doc, QDomElement &element, QString path, QString mime, QColor color, double size=-1)
 
static bool externalGraphicFromSld (QDomElement &element, QString &path, QString &mime, QColor &color, double &size)
 
static Q_DECL_DEPRECATED void wellKnownMarkerToSld (QDomDocument &doc, QDomElement &element, QString name, QColor color, QColor borderColor=QColor(), double borderWidth=-1, double size=-1)
 
static void wellKnownMarkerToSld (QDomDocument &doc, QDomElement &element, QString name, QColor color, QColor borderColor, Qt::PenStyle borderStyle, double borderWidth=-1, double size=-1)
 
static Q_DECL_DEPRECATED bool wellKnownMarkerFromSld (QDomElement &element, QString &name, QColor &color, QColor &borderColor, double &borderWidth, double &size)
 
static bool wellKnownMarkerFromSld (QDomElement &element, QString &name, QColor &color, QColor &borderColor, Qt::PenStyle &borderStyle, double &borderWidth, double &size)
 
static void externalMarkerToSld (QDomDocument &doc, QDomElement &element, QString path, QString format, int *markIndex=0, QColor color=QColor(), double size=-1)
 
static bool externalMarkerFromSld (QDomElement &element, QString &path, QString &format, int &markIndex, QColor &color, double &size)
 
static void labelTextToSld (QDomDocument &doc, QDomElement &element, QString label, QFont font, QColor color=QColor(), double size=-1)
 
static QString ogrFeatureStylePen (double width, double mmScaleFactor, double mapUnitsScaleFactor, const QColor &c, Qt::PenJoinStyle joinStyle=Qt::MiterJoin, Qt::PenCapStyle capStyle=Qt::FlatCap, double offset=0.0, const QVector< qreal > *dashPattern=0)
 Create ogr feature style string for pen. More...
 
static QString ogrFeatureStyleBrush (const QColor &fillColr)
 Create ogr feature style string for brush. More...
 
static void createRotationElement (QDomDocument &doc, QDomElement &element, QString rotationFunc)
 
static bool rotationFromSldElement (QDomElement &element, QString &rotationFunc)
 
static void createOpacityElement (QDomDocument &doc, QDomElement &element, QString alphaFunc)
 
static bool opacityFromSldElement (QDomElement &element, QString &alphaFunc)
 
static void createDisplacementElement (QDomDocument &doc, QDomElement &element, QPointF offset)
 
static bool displacementFromSldElement (QDomElement &element, QPointF &offset)
 
static void createOnlineResourceElement (QDomDocument &doc, QDomElement &element, QString path, QString format)
 
static bool onlineResourceFromSldElement (QDomElement &element, QString &path, QString &format)
 
static void createGeometryElement (QDomDocument &doc, QDomElement &element, QString geomFunc)
 
static bool geometryFromSldElement (QDomElement &element, QString &geomFunc)
 
static bool createFunctionElement (QDomDocument &doc, QDomElement &element, QString function)
 
static bool functionFromSldElement (QDomElement &element, QString &function)
 
static QDomElement createSvgParameterElement (QDomDocument &doc, QString name, QString value)
 
static QgsStringMap getSvgParameterList (QDomElement &element)
 
static QDomElement createVendorOptionElement (QDomDocument &doc, QString name, QString value)
 
static QgsStringMap getVendorOptionList (QDomElement &element)
 
static QgsStringMap parseProperties (QDomElement &element)
 
static void saveProperties (QgsStringMap props, QDomDocument &doc, QDomElement &element)
 
static QgsSymbolV2Map loadSymbols (QDomElement &element)
 
static QDomElement saveSymbols (QgsSymbolV2Map &symbols, QString tagName, QDomDocument &doc)
 
static void clearSymbolMap (QgsSymbolV2Map &symbols)
 
static QgsVectorColorRampV2loadColorRamp (QDomElement &element)
 
static QDomElement saveColorRamp (QString name, QgsVectorColorRampV2 *ramp, QDomDocument &doc)
 
static QString colorToName (const QColor &color)
 Returns a friendly display name for a color. More...
 
static QList< QColor > parseColorList (const QString colorStr)
 Attempts to parse a string as a list of colors using a variety of common formats, including hex codes, rgb and rgba strings. More...
 
static QMimeData * colorToMimeData (const QColor color)
 Creates mime data from a color. More...
 
static QColor colorFromMimeData (const QMimeData *data, bool &hasAlpha)
 Attempts to parse mime data as a color. More...
 
static QgsNamedColorList colorListFromMimeData (const QMimeData *data)
 Attempts to parse mime data as a list of named colors. More...
 
static QMimeData * colorListToMimeData (const QgsNamedColorList colorList, const bool allFormats=true)
 Creates mime data from a list of named colors. More...
 
static bool saveColorsToGpl (QFile &file, const QString paletteName, QgsNamedColorList colors)
 Exports colors to a gpl GIMP palette file. More...
 
static QgsNamedColorList importColorsFromGpl (QFile &file, bool &ok)
 Imports colors from a gpl GIMP palette file. More...
 
static QColor parseColor (QString colorStr, bool strictEval=false)
 Attempts to parse a string as a color using a variety of common formats, including hex codes, rgb and rgba strings. More...
 
static QColor parseColorWithAlpha (const QString colorStr, bool &containsAlpha, bool strictEval=false)
 Attempts to parse a string as a color using a variety of common formats, including hex codes, rgb and rgba strings. More...
 
static double lineWidthScaleFactor (const QgsRenderContext &c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale &scale=QgsMapUnitScale())
 Returns the line width scale factor depending on the unit and the paint device. More...
 
static double pixelSizeScaleFactor (const QgsRenderContext &c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale &scale=QgsMapUnitScale())
 Returns scale factor painter units -> pixel dimensions. More...
 
static QgsRenderContext createRenderContext (QPainter *p)
 Creates a render context for a pixel based device. More...
 
static void multiplyImageOpacity (QImage *image, qreal alpha)
 Multiplies opacity of image pixel values with a (global) transparency value. More...
 
static void blurImageInPlace (QImage &image, const QRect &rect, int radius, bool alphaOnly)
 Blurs an image in place, e.g. More...
 
static void premultiplyColor (QColor &rgb, int alpha)
 Converts a QColor into a premultiplied ARGB QColor value using a specified alpha value. More...
 
static void sortVariantList (QList< QVariant > &list, Qt::SortOrder order)
 Sorts the passed list in requested order. More...
 
static QPointF pointOnLineWithDistance (const QPointF &startPoint, const QPointF &directionPoint, double distance)
 Returns a point on the line from startPoint to directionPoint that is a certain distance away from the starting point. More...
 
static QStringList listSvgFiles ()
 Return a list of all available svg files. More...
 
static QStringList listSvgFilesAt (QString directory)
 Return a list of svg files at the specified directory. More...
 
static QString symbolNameToPath (QString name)
 Get symbol's path from its name. More...
 
static QString symbolPathToName (QString path)
 Get symbols's name from its path. More...
 
static QPointF polygonCentroid (const QPolygonF &points)
 Calculate the centroid point of a QPolygonF. More...
 
static QPointF polygonPointOnSurface (const QPolygonF &points)
 Calculate a point within of a QPolygonF. More...
 
static bool pointInPolygon (const QPolygonF &points, const QPointF &point)
 Calculate whether a point is within of a QPolygonF. More...
 
static QgsExpressionfieldOrExpressionToExpression (const QString &fieldOrExpression)
 Return a new valid expression instance for given field or expression string. More...
 
static QString fieldOrExpressionFromExpression (QgsExpression *expression)
 Return a field name if the whole expression is just a name of the field . More...
 

Member Function Documentation

void QgsSymbolLayerV2Utils::blurImageInPlace ( QImage &  image,
const QRect &  rect,
int  radius,
bool  alphaOnly 
)
static

Blurs an image in place, e.g.

creating Qt-independent drop shadows

Note
added in 1.9
void QgsSymbolLayerV2Utils::clearSymbolMap ( QgsSymbolV2Map symbols)
static
QColor QgsSymbolLayerV2Utils::colorFromMimeData ( const QMimeData *  data,
bool &  hasAlpha 
)
static

Attempts to parse mime data as a color.

Parameters
datamime data to parse
hasAlphawill be set to true if mime data was interpreted as a color containing an explicit alpha value
Returns
valid color if mimedata could be interpreted as a color, otherwise an invalid color
Note
added in 2.5
QgsNamedColorList QgsSymbolLayerV2Utils::colorListFromMimeData ( const QMimeData *  data)
static

Attempts to parse mime data as a list of named colors.

Parameters
datamime data to parse
Returns
list of parsed colors
Note
added in 2.5
QMimeData * QgsSymbolLayerV2Utils::colorListToMimeData ( const QgsNamedColorList  colorList,
const bool  allFormats = true 
)
static

Creates mime data from a list of named colors.

Parameters
colorListlist of named colors
allFormatsset to true to include additional mime formats, include text/plain and application/x-color
Returns
mime data containing encoded colors
Note
added in 2.5
QIcon QgsSymbolLayerV2Utils::colorRampPreviewIcon ( QgsVectorColorRampV2 ramp,
QSize  size 
)
static
QPixmap QgsSymbolLayerV2Utils::colorRampPreviewPixmap ( QgsVectorColorRampV2 ramp,
QSize  size 
)
static
QMimeData * QgsSymbolLayerV2Utils::colorToMimeData ( const QColor  color)
static

Creates mime data from a color.

Sets both the mime data's color data, and the mime data's text with the color's hex code.

Parameters
colorcolor to encode as mime data
See also
colorFromMimeData
Note
added in 2.5
QString QgsSymbolLayerV2Utils::colorToName ( const QColor &  color)
static

Returns a friendly display name for a color.

Parameters
colorsource color
Returns
display name for color
Note
added in 2.5
bool QgsSymbolLayerV2Utils::convertPolygonSymbolizerToPointMarker ( QDomElement &  element,
QgsSymbolLayerV2List layerList 
)
static
void QgsSymbolLayerV2Utils::createDisplacementElement ( QDomDocument &  doc,
QDomElement &  element,
QPointF  offset 
)
static
QgsSymbolLayerV2 * QgsSymbolLayerV2Utils::createFillLayerFromSld ( QDomElement &  element)
static
bool QgsSymbolLayerV2Utils::createFunctionElement ( QDomDocument &  doc,
QDomElement &  element,
QString  function 
)
static
void QgsSymbolLayerV2Utils::createGeometryElement ( QDomDocument &  doc,
QDomElement &  element,
QString  geomFunc 
)
static
QgsSymbolLayerV2 * QgsSymbolLayerV2Utils::createLineLayerFromSld ( QDomElement &  element)
static
QgsSymbolLayerV2 * QgsSymbolLayerV2Utils::createMarkerLayerFromSld ( QDomElement &  element)
static
void QgsSymbolLayerV2Utils::createOnlineResourceElement ( QDomDocument &  doc,
QDomElement &  element,
QString  path,
QString  format 
)
static
void QgsSymbolLayerV2Utils::createOpacityElement ( QDomDocument &  doc,
QDomElement &  element,
QString  alphaFunc 
)
static
QgsRenderContext QgsSymbolLayerV2Utils::createRenderContext ( QPainter *  p)
static

Creates a render context for a pixel based device.

void QgsSymbolLayerV2Utils::createRotationElement ( QDomDocument &  doc,
QDomElement &  element,
QString  rotationFunc 
)
static
QDomElement QgsSymbolLayerV2Utils::createSvgParameterElement ( QDomDocument &  doc,
QString  name,
QString  value 
)
static
bool QgsSymbolLayerV2Utils::createSymbolLayerV2ListFromSld ( QDomElement &  element,
QGis::GeometryType  geomType,
QgsSymbolLayerV2List layers 
)
static
QDomElement QgsSymbolLayerV2Utils::createVendorOptionElement ( QDomDocument &  doc,
QString  name,
QString  value 
)
static
QPainter::CompositionMode QgsSymbolLayerV2Utils::decodeBlendMode ( const QString &  s)
static
Qt::BrushStyle QgsSymbolLayerV2Utils::decodeBrushStyle ( QString  str)
static
QColor QgsSymbolLayerV2Utils::decodeColor ( QString  str)
static
QgsMapUnitScale QgsSymbolLayerV2Utils::decodeMapUnitScale ( const QString &  str)
static
QgsSymbolV2::OutputUnit QgsSymbolLayerV2Utils::decodeOutputUnit ( QString  str)
static
Qt::PenCapStyle QgsSymbolLayerV2Utils::decodePenCapStyle ( QString  str)
static
Qt::PenJoinStyle QgsSymbolLayerV2Utils::decodePenJoinStyle ( QString  str)
static
Qt::PenStyle QgsSymbolLayerV2Utils::decodePenStyle ( QString  str)
static
QPointF QgsSymbolLayerV2Utils::decodePoint ( QString  str)
static
QVector< qreal > QgsSymbolLayerV2Utils::decodeRealVector ( const QString &  s)
static
QgsSymbolV2::ScaleMethod QgsSymbolLayerV2Utils::decodeScaleMethod ( QString  str)
static
int QgsSymbolLayerV2Utils::decodeSldAlpha ( QString  str)
static
Qt::BrushStyle QgsSymbolLayerV2Utils::decodeSldBrushStyle ( QString  str)
static
QFont::Style QgsSymbolLayerV2Utils::decodeSldFontStyle ( QString  str)
static
int QgsSymbolLayerV2Utils::decodeSldFontWeight ( QString  str)
static
Qt::PenCapStyle QgsSymbolLayerV2Utils::decodeSldLineCapStyle ( QString  str)
static
Qt::PenJoinStyle QgsSymbolLayerV2Utils::decodeSldLineJoinStyle ( QString  str)
static
QVector< qreal > QgsSymbolLayerV2Utils::decodeSldRealVector ( const QString &  s)
static
QgsSymbolV2::OutputUnit QgsSymbolLayerV2Utils::decodeSldUom ( QString  str,
double *  scaleFactor 
)
static
bool QgsSymbolLayerV2Utils::displacementFromSldElement ( QDomElement &  element,
QPointF &  offset 
)
static
void QgsSymbolLayerV2Utils::drawStippledBackround ( QPainter *  painter,
QRect  rect 
)
static
QString QgsSymbolLayerV2Utils::encodeBrushStyle ( Qt::BrushStyle  style)
static
QString QgsSymbolLayerV2Utils::encodeColor ( QColor  color)
static
QString QgsSymbolLayerV2Utils::encodeMapUnitScale ( const QgsMapUnitScale mapUnitScale)
static
QString QgsSymbolLayerV2Utils::encodeOutputUnit ( QgsSymbolV2::OutputUnit  unit)
static
QString QgsSymbolLayerV2Utils::encodePenCapStyle ( Qt::PenCapStyle  style)
static
QString QgsSymbolLayerV2Utils::encodePenJoinStyle ( Qt::PenJoinStyle  style)
static
QString QgsSymbolLayerV2Utils::encodePenStyle ( Qt::PenStyle  style)
static
QString QgsSymbolLayerV2Utils::encodePoint ( QPointF  point)
static
QString QgsSymbolLayerV2Utils::encodeRealVector ( const QVector< qreal > &  v)
static
QString QgsSymbolLayerV2Utils::encodeScaleMethod ( QgsSymbolV2::ScaleMethod  scaleMethod)
static
QString QgsSymbolLayerV2Utils::encodeSldAlpha ( int  alpha)
static
QString QgsSymbolLayerV2Utils::encodeSldBrushStyle ( Qt::BrushStyle  style)
static
QString QgsSymbolLayerV2Utils::encodeSldFontStyle ( QFont::Style  style)
static
QString QgsSymbolLayerV2Utils::encodeSldFontWeight ( int  weight)
static
QString QgsSymbolLayerV2Utils::encodeSldLineCapStyle ( Qt::PenCapStyle  style)
static
QString QgsSymbolLayerV2Utils::encodeSldLineJoinStyle ( Qt::PenJoinStyle  style)
static
QString QgsSymbolLayerV2Utils::encodeSldRealVector ( const QVector< qreal > &  v)
static
QString QgsSymbolLayerV2Utils::encodeSldUom ( QgsSymbolV2::OutputUnit  unit,
double *  scaleFactor 
)
static
double QgsSymbolLayerV2Utils::estimateMaxSymbolBleed ( QgsSymbolV2 symbol)
static

Returns the maximum estimated bleed for the symbol.

bool QgsSymbolLayerV2Utils::externalGraphicFromSld ( QDomElement &  element,
QString &  path,
QString &  mime,
QColor &  color,
double &  size 
)
static
void QgsSymbolLayerV2Utils::externalGraphicToSld ( QDomDocument &  doc,
QDomElement &  element,
QString  path,
QString  mime,
QColor  color,
double  size = -1 
)
static
bool QgsSymbolLayerV2Utils::externalMarkerFromSld ( QDomElement &  element,
QString &  path,
QString &  format,
int &  markIndex,
QColor &  color,
double &  size 
)
static
void QgsSymbolLayerV2Utils::externalMarkerToSld ( QDomDocument &  doc,
QDomElement &  element,
QString  path,
QString  format,
int *  markIndex = 0,
QColor  color = QColor(),
double  size = -1 
)
static
QString QgsSymbolLayerV2Utils::fieldOrExpressionFromExpression ( QgsExpression expression)
static

Return a field name if the whole expression is just a name of the field .

Returns full expression string if the expression is more complex than just one field. Using just expression->expression() method may return quoted field name, but that is not wanted for saving (due to backward compatibility) or display in GUI.

Note
added in 2.2
QgsExpression * QgsSymbolLayerV2Utils::fieldOrExpressionToExpression ( const QString &  fieldOrExpression)
static

Return a new valid expression instance for given field or expression string.

If the input is not a valid expression, it is assumed that it is a field name and gets properly quoted. If the string is empty, returns null pointer. This is useful when accepting input which could be either a non-quoted field name or expression.

Note
added in 2.2
bool QgsSymbolLayerV2Utils::fillFromSld ( QDomElement &  element,
Qt::BrushStyle &  brushStyle,
QColor &  color 
)
static
void QgsSymbolLayerV2Utils::fillToSld ( QDomDocument &  doc,
QDomElement &  element,
Qt::BrushStyle  brushStyle,
QColor  color = QColor() 
)
static
bool QgsSymbolLayerV2Utils::functionFromSldElement ( QDomElement &  element,
QString &  function 
)
static
bool QgsSymbolLayerV2Utils::geometryFromSldElement ( QDomElement &  element,
QString &  geomFunc 
)
static
QgsStringMap QgsSymbolLayerV2Utils::getSvgParameterList ( QDomElement &  element)
static
QgsStringMap QgsSymbolLayerV2Utils::getVendorOptionList ( QDomElement &  element)
static
bool QgsSymbolLayerV2Utils::hasExternalGraphic ( QDomElement &  element)
static
bool QgsSymbolLayerV2Utils::hasWellKnownMark ( QDomElement &  element)
static
QgsNamedColorList QgsSymbolLayerV2Utils::importColorsFromGpl ( QFile &  file,
bool &  ok 
)
static

Imports colors from a gpl GIMP palette file.

Parameters
filesource gpl file
okwill be true if file was successfully read
Returns
list of imported colors
See also
saveColorsToGpl
void QgsSymbolLayerV2Utils::labelTextToSld ( QDomDocument &  doc,
QDomElement &  element,
QString  label,
QFont  font,
QColor  color = QColor(),
double  size = -1 
)
static
bool QgsSymbolLayerV2Utils::lineFromSld ( QDomElement &  element,
Qt::PenStyle &  penStyle,
QColor &  color,
double &  width,
Qt::PenJoinStyle *  penJoinStyle = 0,
Qt::PenCapStyle *  penCapStyle = 0,
QVector< qreal > *  customDashPattern = 0,
double *  dashOffset = 0 
)
static
void QgsSymbolLayerV2Utils::lineToSld ( QDomDocument &  doc,
QDomElement &  element,
Qt::PenStyle  penStyle,
QColor  color,
double  width = -1,
const Qt::PenJoinStyle *  penJoinStyle = 0,
const Qt::PenCapStyle *  penCapStyle = 0,
const QVector< qreal > *  customDashPattern = 0,
double  dashOffset = 0.0 
)
static
Note
not available in python bindings
double QgsSymbolLayerV2Utils::lineWidthScaleFactor ( const QgsRenderContext c,
QgsSymbolV2::OutputUnit  u,
const QgsMapUnitScale scale = QgsMapUnitScale() 
)
static

Returns the line width scale factor depending on the unit and the paint device.

QStringList QgsSymbolLayerV2Utils::listSvgFiles ( )
static

Return a list of all available svg files.

QStringList QgsSymbolLayerV2Utils::listSvgFilesAt ( QString  directory)
static

Return a list of svg files at the specified directory.

QgsVectorColorRampV2 * QgsSymbolLayerV2Utils::loadColorRamp ( QDomElement &  element)
static
QgsSymbolV2 * QgsSymbolLayerV2Utils::loadSymbol ( QDomElement &  element)
static
QgsSymbolLayerV2 * QgsSymbolLayerV2Utils::loadSymbolLayer ( QDomElement &  element)
static
QgsSymbolV2Map QgsSymbolLayerV2Utils::loadSymbols ( QDomElement &  element)
static
void QgsSymbolLayerV2Utils::multiplyImageOpacity ( QImage *  image,
qreal  alpha 
)
static

Multiplies opacity of image pixel values with a (global) transparency value.

bool QgsSymbolLayerV2Utils::needEllipseMarker ( QDomElement &  element)
static
bool QgsSymbolLayerV2Utils::needFontMarker ( QDomElement &  element)
static
bool QgsSymbolLayerV2Utils::needLinePatternFill ( QDomElement &  element)
static
bool QgsSymbolLayerV2Utils::needMarkerLine ( QDomElement &  element)
static
bool QgsSymbolLayerV2Utils::needPointPatternFill ( QDomElement &  element)
static
bool QgsSymbolLayerV2Utils::needSvgFill ( QDomElement &  element)
static
bool QgsSymbolLayerV2Utils::needSvgMarker ( QDomElement &  element)
static
QString QgsSymbolLayerV2Utils::ogrFeatureStyleBrush ( const QColor &  fillColr)
static

Create ogr feature style string for brush.

Parameters
fillColrfill color
QString QgsSymbolLayerV2Utils::ogrFeatureStylePen ( double  width,
double  mmScaleFactor,
double  mapUnitsScaleFactor,
const QColor &  c,
Qt::PenJoinStyle  joinStyle = Qt::MiterJoin,
Qt::PenCapStyle  capStyle = Qt::FlatCap,
double  offset = 0.0,
const QVector< qreal > *  dashPattern = 0 
)
static

Create ogr feature style string for pen.

bool QgsSymbolLayerV2Utils::onlineResourceFromSldElement ( QDomElement &  element,
QString &  path,
QString &  format 
)
static
bool QgsSymbolLayerV2Utils::opacityFromSldElement ( QDomElement &  element,
QString &  alphaFunc 
)
static
QColor QgsSymbolLayerV2Utils::parseColor ( QString  colorStr,
bool  strictEval = false 
)
static

Attempts to parse a string as a color using a variety of common formats, including hex codes, rgb and rgba strings.

Parameters
colorStrstring representing the color
strictEvalset to true for stricter color parsing rules
Returns
parsed color
Note
added in 2.3
QList< QColor > QgsSymbolLayerV2Utils::parseColorList ( const QString  colorStr)
static

Attempts to parse a string as a list of colors using a variety of common formats, including hex codes, rgb and rgba strings.

Parameters
colorStrstring representing the color list
Returns
list of parsed colors
Note
added in 2.5
QColor QgsSymbolLayerV2Utils::parseColorWithAlpha ( const QString  colorStr,
bool &  containsAlpha,
bool  strictEval = false 
)
static

Attempts to parse a string as a color using a variety of common formats, including hex codes, rgb and rgba strings.

Parameters
colorStrstring representing the color
containsAlphaif colorStr contains an explicit alpha value then containsAlpha will be set to true
strictEvalset to true for stricter color parsing rules
Returns
parsed color
Note
added in 2.3
QgsStringMap QgsSymbolLayerV2Utils::parseProperties ( QDomElement &  element)
static
double QgsSymbolLayerV2Utils::pixelSizeScaleFactor ( const QgsRenderContext c,
QgsSymbolV2::OutputUnit  u,
const QgsMapUnitScale scale = QgsMapUnitScale() 
)
static

Returns scale factor painter units -> pixel dimensions.

bool QgsSymbolLayerV2Utils::pointInPolygon ( const QPolygonF &  points,
const QPointF &  point 
)
static

Calculate whether a point is within of a QPolygonF.

QPointF QgsSymbolLayerV2Utils::pointOnLineWithDistance ( const QPointF &  startPoint,
const QPointF &  directionPoint,
double  distance 
)
static

Returns a point on the line from startPoint to directionPoint that is a certain distance away from the starting point.

QPointF QgsSymbolLayerV2Utils::polygonCentroid ( const QPolygonF &  points)
static

Calculate the centroid point of a QPolygonF.

QPointF QgsSymbolLayerV2Utils::polygonPointOnSurface ( const QPolygonF &  points)
static

Calculate a point within of a QPolygonF.

void QgsSymbolLayerV2Utils::premultiplyColor ( QColor &  rgb,
int  alpha 
)
static

Converts a QColor into a premultiplied ARGB QColor value using a specified alpha value.

Note
added in 2.3
bool QgsSymbolLayerV2Utils::rotationFromSldElement ( QDomElement &  element,
QString &  rotationFunc 
)
static
QDomElement QgsSymbolLayerV2Utils::saveColorRamp ( QString  name,
QgsVectorColorRampV2 ramp,
QDomDocument &  doc 
)
static
bool QgsSymbolLayerV2Utils::saveColorsToGpl ( QFile &  file,
const QString  paletteName,
QgsNamedColorList  colors 
)
static

Exports colors to a gpl GIMP palette file.

Parameters
filedestination file
paletteNamename of palette, which is stored in gpl file
colorscolors to export
Returns
true if export was successful
See also
importColorsFromGpl
void QgsSymbolLayerV2Utils::saveProperties ( QgsStringMap  props,
QDomDocument &  doc,
QDomElement &  element 
)
static
QDomElement QgsSymbolLayerV2Utils::saveSymbol ( QString  symbolName,
QgsSymbolV2 symbol,
QDomDocument &  doc 
)
static
QDomElement QgsSymbolLayerV2Utils::saveSymbols ( QgsSymbolV2Map symbols,
QString  tagName,
QDomDocument &  doc 
)
static
void QgsSymbolLayerV2Utils::sortVariantList ( QList< QVariant > &  list,
Qt::SortOrder  order 
)
static

Sorts the passed list in requested order.

QIcon QgsSymbolLayerV2Utils::symbolLayerPreviewIcon ( QgsSymbolLayerV2 layer,
QgsSymbolV2::OutputUnit  u,
QSize  size,
const QgsMapUnitScale scale = QgsMapUnitScale() 
)
static
QString QgsSymbolLayerV2Utils::symbolNameToPath ( QString  name)
static

Get symbol's path from its name.

If the name is not absolute path the file is searched in SVG paths specified in settings svg/searchPathsForSVG.

QString QgsSymbolLayerV2Utils::symbolPathToName ( QString  path)
static

Get symbols's name from its path.

QIcon QgsSymbolLayerV2Utils::symbolPreviewIcon ( QgsSymbolV2 symbol,
QSize  size 
)
static
QPixmap QgsSymbolLayerV2Utils::symbolPreviewPixmap ( QgsSymbolV2 symbol,
QSize  size 
)
static
bool QgsSymbolLayerV2Utils::wellKnownMarkerFromSld ( QDomElement &  element,
QString &  name,
QColor &  color,
QColor &  borderColor,
double &  borderWidth,
double &  size 
)
static
bool QgsSymbolLayerV2Utils::wellKnownMarkerFromSld ( QDomElement &  element,
QString &  name,
QColor &  color,
QColor &  borderColor,
Qt::PenStyle &  borderStyle,
double &  borderWidth,
double &  size 
)
static
void QgsSymbolLayerV2Utils::wellKnownMarkerToSld ( QDomDocument &  doc,
QDomElement &  element,
QString  name,
QColor  color,
QColor  borderColor = QColor(),
double  borderWidth = -1,
double  size = -1 
)
static
void QgsSymbolLayerV2Utils::wellKnownMarkerToSld ( QDomDocument &  doc,
QDomElement &  element,
QString  name,
QColor  color,
QColor  borderColor,
Qt::PenStyle  borderStyle,
double  borderWidth = -1,
double  size = -1 
)
static

The documentation for this class was generated from the following files: