本文整理汇总了Python中qgis.core.QgsApplication.svgCache方法的典型用法代码示例。如果您正苦于以下问题:Python QgsApplication.svgCache方法的具体用法?Python QgsApplication.svgCache怎么用?Python QgsApplication.svgCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.core.QgsApplication
的用法示例。
在下文中一共展示了QgsApplication.svgCache方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testRemoteSvgBadMime
# 需要导入模块: from qgis.core import QgsApplication [as 别名]
# 或者: from qgis.core.QgsApplication import svgCache [as 别名]
def testRemoteSvgBadMime(self):
"""Test fetching remote svg with bad mime type"""
url = 'http://localhost:{}/qgis_local_server/logo.png'.format(str(TestQgsSvgCache.port))
image, in_cache = QgsApplication.svgCache().svgAsImage(url, 100, fill=QColor(0, 0, 0), stroke=QColor(0, 0, 0),
strokeWidth=0.1, widthScaleFactor=1)
# first should be waiting image
self.assertTrue(self.imageCheck('Remote SVG bad MIME type', 'waiting_svg', image))
# second should be correct image
self.waitForFetch()
image, in_cache = QgsApplication.svgCache().svgAsImage(url, 100, fill=QColor(0, 0, 0), stroke=QColor(0, 0, 0),
strokeWidth=0.1, widthScaleFactor=1)
self.assertTrue(self.imageCheck('Remote SVG bad MIME type', 'bad_svg', image))
示例2: testRemoteSvgAsText
# 需要导入模块: from qgis.core import QgsApplication [as 别名]
# 或者: from qgis.core.QgsApplication import svgCache [as 别名]
def testRemoteSvgAsText(self):
"""Test fetching remote svg with text mime format - e.g. github raw svgs"""
url = 'http://localhost:{}/qgis_local_server/svg_as_text.txt'.format(str(TestQgsSvgCache.port))
image, in_cache = QgsApplication.svgCache().svgAsImage(url, 100, fill=QColor(0, 0, 0), stroke=QColor(0, 0, 0),
strokeWidth=0.1, widthScaleFactor=1)
# first should be waiting image
self.assertTrue(self.imageCheck('Remote SVG as Text', 'waiting_svg', image))
self.waitForFetch()
# second should be correct image
image, in_cache = QgsApplication.svgCache().svgAsImage(url, 100, fill=QColor(0, 0, 0), stroke=QColor(0, 0, 0),
strokeWidth=0.1, widthScaleFactor=1)
# first should be waiting image
self.assertTrue(self.imageCheck('Remote SVG as Text', 'remote_svg', image))
示例3: testRemoteSvgMissing
# 需要导入模块: from qgis.core import QgsApplication [as 别名]
# 或者: from qgis.core.QgsApplication import svgCache [as 别名]
def testRemoteSvgMissing(self):
"""Test fetching remote svg with bad url"""
url = 'http://localhost:{}/qgis_local_server/xxx.svg'.format(str(TestQgsSvgCache.port)) # oooo naughty
image, in_cache = QgsApplication.svgCache().svgAsImage(url, 100, fill=QColor(0, 0, 0), stroke=QColor(0, 0, 0),
strokeWidth=0.1, widthScaleFactor=1)
self.assertTrue(self.imageCheck('Remote SVG missing', 'waiting_svg', image))
示例4: testMembers
# 需要导入模块: from qgis.core import QgsApplication [as 别名]
# 或者: from qgis.core.QgsApplication import svgCache [as 别名]
def testMembers(self):
self.assertTrue(QgsApplication.actionScopeRegistry())
# self.assertTrue(QgsApplication.annotationRegistry()) NOT AVAILABLE IN BINDINGS
self.assertTrue(QgsApplication.colorSchemeRegistry())
self.assertTrue(QgsApplication.fieldFormatterRegistry())
self.assertTrue(QgsApplication.gpsConnectionRegistry())
self.assertTrue(QgsApplication.messageLog())
self.assertTrue(QgsApplication.paintEffectRegistry())
self.assertTrue(QgsApplication.pluginLayerRegistry())
self.assertTrue(QgsApplication.processingRegistry())
self.assertTrue(QgsApplication.profiler())
# self.assertTrue(QgsApplication.rasterRendererRegistry()) NOT AVAILABLE IN BINDINGS
self.assertTrue(QgsApplication.rendererRegistry())
self.assertTrue(QgsApplication.svgCache())
self.assertTrue(QgsApplication.symbolLayerRegistry())
self.assertTrue(QgsApplication.taskManager())
示例5: setUp
# 需要导入模块: from qgis.core import QgsApplication [as 别名]
# 或者: from qgis.core.QgsApplication import svgCache [as 别名]
def setUp(self):
self.report = "<h1>Python QgsSvgCache Tests</h1>\n"
self.fetched = True
QgsApplication.svgCache().remoteSvgFetched.connect(self.svgFetched)
示例6: testRemoteSVG
# 需要导入模块: from qgis.core import QgsApplication [as 别名]
# 或者: from qgis.core.QgsApplication import svgCache [as 别名]
def testRemoteSVG(self):
"""Test fetching remote svg."""
url = 'http://localhost:{}/qgis_local_server/sample_svg.svg'.format(str(TestQgsSvgCache.port))
image, in_cache = QgsApplication.svgCache().svgAsImage(url, 100, fill=QColor(0, 0, 0), stroke=QColor(0, 0, 0),
strokeWidth=0.1, widthScaleFactor=1)
self.assertTrue(self.imageCheck('Remote SVG', 'remote_svg', image))