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;
123 QImage svgAsImage(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
124 double widthScaleFactor,
bool &fitsInCache,
double fixedAspectRatio = 0 );
137 QPicture svgAsPicture(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
138 double widthScaleFactor,
bool forceVectorOutput =
false,
double fixedAspectRatio = 0 );
152 QSizeF svgViewboxSize(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
153 double widthScaleFactor,
double fixedAspectRatio = 0 );
158 void containsParams(
const QString &path,
bool &hasFillParam, QColor &defaultFillColor,
bool &hasStrokeParam, QColor &defaultStrokeColor,
bool &hasStrokeWidthParam,
159 double &defaultStrokeWidth )
const;
183 void containsParams(
const QString &path,
bool &hasFillParam,
bool &hasDefaultFillParam, QColor &defaultFillColor,
184 bool &hasFillOpacityParam,
bool &hasDefaultFillOpacity,
double &defaultFillOpacity,
185 bool &hasStrokeParam,
bool &hasDefaultStrokeColor, QColor &defaultStrokeColor,
186 bool &hasStrokeWidthParam,
bool &hasDefaultStrokeWidth,
double &defaultStrokeWidth,
187 bool &hasStrokeOpacityParam,
bool &hasDefaultStrokeOpacity,
double &defaultStrokeOpacity )
const SIP_PYNAME( containsParamsV3 );
190 QByteArray getImageData(
const QString &path )
const;
193 QByteArray svgContent(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
194 double widthScaleFactor,
double fixedAspectRatio = 0 );
202 Q_DECL_DEPRECATED
void statusChanged(
const QString &statusQString )
SIP_DEPRECATED;
208 void remoteSvgFetched(
const QString &url );
212 bool checkReply( QNetworkReply *reply,
const QString &path )
const override;
216 void replaceParamsAndCacheSvg( QgsSvgCacheEntry *entry );
217 void cacheImage( QgsSvgCacheEntry *entry );
218 void cachePicture( QgsSvgCacheEntry *entry,
bool forceVectorOutput =
false );
220 QgsSvgCacheEntry *cacheEntry(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
221 double widthScaleFactor,
double fixedAspectRatio = 0 );
224 void replaceElemParams( QDomElement &elem,
const QColor &fill,
const QColor &stroke,
double strokeWidth );
226 void containsElemParams(
const QDomElement &elem,
227 bool &hasFillParam,
bool &hasDefaultFill, QColor &defaultFill,
228 bool &hasFillOpacityParam,
bool &hasDefaultFillOpacity,
double &defaultFillOpacity,
229 bool &hasStrokeParam,
bool &hasDefaultStroke, QColor &defaultStroke,
230 bool &hasStrokeWidthParam,
bool &hasDefaultStrokeWidth,
double &defaultStrokeWidth,
231 bool &hasStrokeOpacityParam,
bool &hasDefaultStrokeOpacity,
double &defaultStrokeOpacity )
const SIP_PYNAME( containsParamsV3 );
234 double calcSizeScaleFactor( QgsSvgCacheEntry *entry,
const QDomElement &docElem, QSizeF &viewboxSize )
const;
240 QSize sizeForImage(
const QgsSvgCacheEntry &entry, QSizeF &viewBoxSize, QSizeF &scaledSize )
const;
245 QImage imageFromCachedPicture(
const QgsSvgCacheEntry &entry )
const;
248 QByteArray mMissingSvg;
250 QByteArray mFetchingSvg;
252 friend class TestQgsSvgCache;
255 #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...