51 QgsSvgCacheEntry(
const QString &path,
double size,
double strokeWidth,
double widthScaleFactor,
const QColor &fill,
const QColor &stroke,
52 double fixedAspectRatio = 0,
const QMap<QString, QString> ¶meters = QMap<QString, QString>() ) ;
55 QgsSvgCacheEntry(
const QgsSvgCacheEntry &rh ) =
delete;
57 QgsSvgCacheEntry &
operator=(
const QgsSvgCacheEntry &rh ) =
delete;
60 double strokeWidth = 0;
61 double widthScaleFactor = 1.0;
64 double fixedAspectRatio = 0;
72 QColor fill = Qt::black;
73 QColor stroke = Qt::black;
74 QMap<QString, QString> parameters;
76 std::unique_ptr< QImage > image;
77 std::unique_ptr< QPicture > picture;
79 QByteArray svgContent;
86 bool isMissingImage =
false;
90 void dump()
const override;
151 QImage svgAsImage(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
152 double widthScaleFactor,
bool &fitsInCache,
double fixedAspectRatio = 0,
bool blocking =
false,
153 const QMap<QString, QString> ¶meters = QMap<QString, QString>() );
177 QPicture svgAsPicture(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
178 double widthScaleFactor,
bool forceVectorOutput =
false,
double fixedAspectRatio = 0,
bool blocking =
false,
179 const QMap<QString, QString> ¶meters = QMap<QString, QString>() );
199 QSizeF svgViewboxSize(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
200 double widthScaleFactor,
double fixedAspectRatio = 0,
bool blocking =
false,
const QMap<QString, QString> ¶meters = QMap<QString, QString>() );
208 void containsParams(
const QString &path,
bool &hasFillParam, QColor &defaultFillColor,
bool &hasStrokeParam, QColor &defaultStrokeColor,
bool &hasStrokeWidthParam,
209 double &defaultStrokeWidth,
bool blocking =
false )
const;
239 void containsParams(
const QString &path,
bool &hasFillParam,
bool &hasDefaultFillParam, QColor &defaultFillColor,
240 bool &hasFillOpacityParam,
bool &hasDefaultFillOpacity,
double &defaultFillOpacity,
241 bool &hasStrokeParam,
bool &hasDefaultStrokeColor, QColor &defaultStrokeColor,
242 bool &hasStrokeWidthParam,
bool &hasDefaultStrokeWidth,
double &defaultStrokeWidth,
243 bool &hasStrokeOpacityParam,
bool &hasDefaultStrokeOpacity,
double &defaultStrokeOpacity,
244 bool blocking =
false )
const SIP_PYNAME( containsParamsV3 );
260 QByteArray getImageData(
const QString &path,
bool blocking =
false )
const;
278 QByteArray svgContent(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
279 double widthScaleFactor,
double fixedAspectRatio = 0,
bool blocking =
false,
const QMap<QString, QString> ¶meters = QMap<QString, QString>(),
bool *isMissingImage =
nullptr );
281 QByteArray svgContent(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
282 double widthScaleFactor,
double fixedAspectRatio = 0,
bool blocking =
false,
const QMap<QString, QString> ¶meters = QMap<QString, QString>() );
301 bool checkReply( QNetworkReply *reply,
const QString &path )
const override;
305 void replaceParamsAndCacheSvg( QgsSvgCacheEntry *entry,
bool blocking =
false );
306 void cacheImage( QgsSvgCacheEntry *entry );
307 void cachePicture( QgsSvgCacheEntry *entry,
bool forceVectorOutput =
false );
309 QgsSvgCacheEntry *cacheEntry(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
310 double widthScaleFactor,
double fixedAspectRatio = 0,
const QMap<QString, QString> ¶meters = QMap<QString, QString>(),
bool blocking =
false,
bool *isMissingImage =
nullptr );
313 void replaceElemParams( QDomElement &elem,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
const QMap<QString, QString> ¶meters );
315 void containsElemParams(
const QDomElement &elem,
316 bool &hasFillParam,
bool &hasDefaultFill, QColor &defaultFill,
317 bool &hasFillOpacityParam,
bool &hasDefaultFillOpacity,
double &defaultFillOpacity,
318 bool &hasStrokeParam,
bool &hasDefaultStroke, QColor &defaultStroke,
319 bool &hasStrokeWidthParam,
bool &hasDefaultStrokeWidth,
double &defaultStrokeWidth,
320 bool &hasStrokeOpacityParam,
bool &hasDefaultStrokeOpacity,
double &defaultStrokeOpacity )
const SIP_PYNAME( containsParamsV3 );
323 double calcSizeScaleFactor( QgsSvgCacheEntry *entry,
const QDomElement &docElem, QSizeF &viewboxSize )
const;
329 QSize sizeForImage(
const QgsSvgCacheEntry &entry, QSizeF &viewBoxSize, QSizeF &scaledSize )
const;
334 QImage imageFromCachedPicture(
const QgsSvgCacheEntry &entry )
const;
337 QByteArray mMissingSvg;
339 QByteArray mFetchingSvg;
341 friend class TestQgsSvgCache;
A QObject derived base class for QgsAbstractContentCache.
Base class for entries in a QgsAbstractContentCache.
virtual int dataSize() const =0
Returns the memory usage in bytes for the entry.
virtual void dump() const =0
Dumps debugging strings containing the item's properties.
QgsAbstractContentCacheEntry & operator=(const QgsAbstractContentCacheEntry &rh)=delete
QgsAbstractContentCacheEntry cannot be copied.
virtual bool isEqual(const QgsAbstractContentCacheEntry *other) const =0
Tests whether this entry matches another entry.
Abstract base class for file content caches, such as SVG or raster image caches.
A cache for images / pictures derived from SVG files.
Q_DECL_DEPRECATED void statusChanged(const QString &statusQString)
Emit a signal to be caught by qgisapp and display a msg on status bar.
void remoteSvgFetched(const QString &url)
Emitted when the cache has finished retrieving an SVG file from a remote url.