50 QgsSvgCacheEntry(
const QString &path,
double size,
double strokeWidth,
double widthScaleFactor,
const QColor &fill,
const QColor &stroke,
51 double fixedAspectRatio = 0 ) ;
54 QgsSvgCacheEntry(
const QgsSvgCacheEntry &rh ) =
delete;
56 QgsSvgCacheEntry &
operator=(
const QgsSvgCacheEntry &rh ) =
delete;
59 double strokeWidth = 0;
60 double widthScaleFactor = 1.0;
63 double fixedAspectRatio = 0;
71 QColor fill = Qt::black;
72 QColor stroke = Qt::black;
73 std::unique_ptr< QImage > image;
74 std::unique_ptr< QPicture > picture;
76 QByteArray svgContent;
80 void dump()
const override;
126 QImage svgAsImage(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
127 double widthScaleFactor,
bool &fitsInCache,
double fixedAspectRatio = 0,
bool blocking =
false );
143 QPicture svgAsPicture(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
144 double widthScaleFactor,
bool forceVectorOutput =
false,
double fixedAspectRatio = 0,
bool blocking =
false );
161 QSizeF svgViewboxSize(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
162 double widthScaleFactor,
double fixedAspectRatio = 0,
bool blocking =
false );
169 void containsParams(
const QString &path,
bool &hasFillParam, QColor &defaultFillColor,
bool &hasStrokeParam, QColor &defaultStrokeColor,
bool &hasStrokeWidthParam,
170 double &defaultStrokeWidth,
bool blocking =
false )
const;
197 void containsParams(
const QString &path,
bool &hasFillParam,
bool &hasDefaultFillParam, QColor &defaultFillColor,
198 bool &hasFillOpacityParam,
bool &hasDefaultFillOpacity,
double &defaultFillOpacity,
199 bool &hasStrokeParam,
bool &hasDefaultStrokeColor, QColor &defaultStrokeColor,
200 bool &hasStrokeWidthParam,
bool &hasDefaultStrokeWidth,
double &defaultStrokeWidth,
201 bool &hasStrokeOpacityParam,
bool &hasDefaultStrokeOpacity,
double &defaultStrokeOpacity,
202 bool blocking =
false )
const SIP_PYNAME( containsParamsV3 );
217 QByteArray getImageData(
const QString &path,
bool blocking =
false )
const;
235 QByteArray svgContent(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
236 double widthScaleFactor,
double fixedAspectRatio = 0,
bool blocking =
false );
244 Q_DECL_DEPRECATED
void statusChanged(
const QString &statusQString )
SIP_DEPRECATED;
250 void remoteSvgFetched(
const QString &url );
254 bool checkReply( QNetworkReply *reply,
const QString &path )
const override;
258 void replaceParamsAndCacheSvg( QgsSvgCacheEntry *entry,
bool blocking =
false );
259 void cacheImage( QgsSvgCacheEntry *entry );
260 void cachePicture( QgsSvgCacheEntry *entry,
bool forceVectorOutput =
false );
262 QgsSvgCacheEntry *cacheEntry(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
263 double widthScaleFactor,
double fixedAspectRatio = 0,
bool blocking =
false );
266 void replaceElemParams( QDomElement &elem,
const QColor &fill,
const QColor &stroke,
double strokeWidth );
268 void containsElemParams(
const QDomElement &elem,
269 bool &hasFillParam,
bool &hasDefaultFill, QColor &defaultFill,
270 bool &hasFillOpacityParam,
bool &hasDefaultFillOpacity,
double &defaultFillOpacity,
271 bool &hasStrokeParam,
bool &hasDefaultStroke, QColor &defaultStroke,
272 bool &hasStrokeWidthParam,
bool &hasDefaultStrokeWidth,
double &defaultStrokeWidth,
273 bool &hasStrokeOpacityParam,
bool &hasDefaultStrokeOpacity,
double &defaultStrokeOpacity )
const SIP_PYNAME( containsParamsV3 );
276 double calcSizeScaleFactor( QgsSvgCacheEntry *entry,
const QDomElement &docElem, QSizeF &viewboxSize )
const;
282 QSize sizeForImage(
const QgsSvgCacheEntry &entry, QSizeF &viewBoxSize, QSizeF &scaledSize )
const;
287 QImage imageFromCachedPicture(
const QgsSvgCacheEntry &entry )
const;
290 QByteArray mMissingSvg;
292 QByteArray mFetchingSvg;
294 friend class TestQgsSvgCache;
297 #endif // QGSSVGCACHE_H
Abstract base class for file content caches, such as SVG or raster image caches.
A cache for images / pictures derived from svg files.
Base class for entries in a QgsAbstractContentCache.
virtual int dataSize() const =0
Returns the memory usage in bytes for the entry.
virtual bool isEqual(const QgsAbstractContentCacheEntry *other) const =0
Tests whether this entry matches another entry.
virtual void dump() const =0
Dumps debugging strings containing the item's properties.
QgsAbstractContentCacheEntry & operator=(const QgsAbstractContentCacheEntry &rh)=delete
QgsAbstractContentCacheEntry cannot be copied.
A QObject derived base class for QgsAbstractContentCache.
virtual bool checkReply(QNetworkReply *reply, const QString &path) const
Runs additional checks on a network reply to ensure that the reply content is consistent with that re...