|
QGIS API Documentation
2.8.6-Wien
|
A cache for images / pictures derived from svg files. More...
#include <qgssvgcache.h>

Signals | |
| void | statusChanged (const QString &theStatusQString) |
| Emit a signal to be caught by qgisapp and display a msg on status bar. More... | |
Public Member Functions | |
| ~QgsSvgCache () | |
| void | containsParams (const QString &path, bool &hasFillParam, QColor &defaultFillColor, bool &hasOutlineParam, QColor &defaultOutlineColor, bool &hasOutlineWidthParam, double &defaultOutlineWidth) const |
| Tests if an svg file contains parameters for fill, outline color, outline width. More... | |
| QByteArray | getImageData (const QString &path) const |
| Get image data. More... | |
| const QImage & | svgAsImage (const QString &file, double size, const QColor &fill, const QColor &outline, double outlineWidth, double widthScaleFactor, double rasterScaleFactor, bool &fitsInCache) |
| Get SVG as QImage. More... | |
| const QPicture & | svgAsPicture (const QString &file, double size, const QColor &fill, const QColor &outline, double outlineWidth, double widthScaleFactor, double rasterScaleFactor, bool forceVectorOutput=false) |
| Get SVG as QPicture&. More... | |
| const QByteArray & | svgContent (const QString &file, double size, const QColor &fill, const QColor &outline, double outlineWidth, double widthScaleFactor, double rasterScaleFactor) |
| Get SVG content. More... | |
Static Public Member Functions | |
| static QgsSvgCache * | instance () |
Protected Member Functions | |
| QgsSvgCache (QObject *parent=0) | |
| protected constructor More... | |
| QgsSvgCacheEntry * | cacheEntry (const QString &file, double size, const QColor &fill, const QColor &outline, double outlineWidth, double widthScaleFactor, double rasterScaleFactor) |
| Returns entry from cache or creates a new entry if it does not exist already. More... | |
| void | cacheImage (QgsSvgCacheEntry *entry) |
| void | cachePicture (QgsSvgCacheEntry *entry, bool forceVectorOutput=false) |
| QgsSvgCacheEntry * | insertSVG (const QString &file, double size, const QColor &fill, const QColor &outline, double outlineWidth, double widthScaleFactor, double rasterScaleFactor) |
| Creates new cache entry and returns pointer to it. More... | |
| void | replaceParamsAndCacheSvg (QgsSvgCacheEntry *entry) |
| void | takeEntryFromList (QgsSvgCacheEntry *entry) |
| void | trimToMaximumSize () |
| Removes the least used items until the maximum size is under the limit. More... | |
A cache for images / pictures derived from svg files.
This class supports parameter replacement in svg files according to the svg params specification (http://www.w3.org/TR/2009/WD-SVGParamPrimer-20090616/). Supported are the parameters 'fill-color', 'pen-color', 'outline-width', 'stroke-width'. E.g. <circle fill="param(fill-color red)" stroke="param(pen-color black)" stroke-width="param(outline-width 1)"
Definition at line 77 of file qgssvgcache.h.
| QgsSvgCache::~QgsSvgCache | ( | ) |
Definition at line 112 of file qgssvgcache.cpp.
|
protected |
protected constructor
Definition at line 103 of file qgssvgcache.cpp.
|
protected |
Returns entry from cache or creates a new entry if it does not exist already.
Definition at line 465 of file qgssvgcache.cpp.
|
protected |
Definition at line 383 of file qgssvgcache.cpp.
|
protected |
Definition at line 432 of file qgssvgcache.cpp.
| void QgsSvgCache::containsParams | ( | const QString & | path, |
| bool & | hasFillParam, | ||
| QColor & | defaultFillColor, | ||
| bool & | hasOutlineParam, | ||
| QColor & | defaultOutlineColor, | ||
| bool & | hasOutlineWidthParam, | ||
| double & | defaultOutlineWidth | ||
| ) | const |
Tests if an svg file contains parameters for fill, outline color, outline width.
If yes, possible default values are returned. If there are several default values in the svg file, only the first one is considered
Definition at line 227 of file qgssvgcache.cpp.
| QByteArray QgsSvgCache::getImageData | ( | const QString & | path | ) | const |
Get image data.
Definition at line 268 of file qgssvgcache.cpp.
|
protected |
Creates new cache entry and returns pointer to it.
| file | Absolute or relative path to SVG file. If the path is relative the file is searched by QgsSymbolLayerV2Utils::symbolNameToPath() in SVG paths. in settings svg/searchPathsForSVG |
| size | size of cached image |
| fill | color of fill |
| outline | color of outline |
| outlineWidth | width of outline |
| widthScaleFactor | width scale factor |
| rasterScaleFactor | raster scale factor |
Definition at line 195 of file qgssvgcache.cpp.
|
static |
Definition at line 97 of file qgssvgcache.cpp.
|
protected |
Definition at line 247 of file qgssvgcache.cpp.
|
signal |
Emit a signal to be caught by qgisapp and display a msg on status bar.
| const QImage & QgsSvgCache::svgAsImage | ( | const QString & | file, |
| double | size, | ||
| const QColor & | fill, | ||
| const QColor & | outline, | ||
| double | outlineWidth, | ||
| double | widthScaleFactor, | ||
| double | rasterScaleFactor, | ||
| bool & | fitsInCache | ||
| ) |
Get SVG as QImage.
| file | Absolute or relative path to SVG file. |
| size | size of cached image |
| fill | color of fill |
| outline | color of outline |
| outlineWidth | width of outline |
| widthScaleFactor | width scale factor |
| rasterScaleFactor | raster scale factor |
| fitsInCache |
Definition at line 122 of file qgssvgcache.cpp.
| const QPicture & QgsSvgCache::svgAsPicture | ( | const QString & | file, |
| double | size, | ||
| const QColor & | fill, | ||
| const QColor & | outline, | ||
| double | outlineWidth, | ||
| double | widthScaleFactor, | ||
| double | rasterScaleFactor, | ||
| bool | forceVectorOutput = false |
||
| ) |
Get SVG as QPicture&.
| file | Absolute or relative path to SVG file. |
| size | size of cached image |
| fill | color of fill |
| outline | color of outline |
| outlineWidth | width of outline |
| widthScaleFactor | width scale factor |
| rasterScaleFactor | raster scale factor |
| forceVectorOutput |
Definition at line 167 of file qgssvgcache.cpp.
| const QByteArray & QgsSvgCache::svgContent | ( | const QString & | file, |
| double | size, | ||
| const QColor & | fill, | ||
| const QColor & | outline, | ||
| double | outlineWidth, | ||
| double | widthScaleFactor, | ||
| double | rasterScaleFactor | ||
| ) |
Get SVG content.
Definition at line 185 of file qgssvgcache.cpp.
|
protected |
Definition at line 737 of file qgssvgcache.cpp.
|
protected |
Removes the least used items until the maximum size is under the limit.
Definition at line 717 of file qgssvgcache.cpp.
1.8.11