当前位置: 首页>>代码示例>>Python>>正文


Python QgsApplication.svgCache方法代码示例

本文整理汇总了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))
开发者ID:phborba,项目名称:QGIS,代码行数:15,代码来源:test_qgssvgcache.py

示例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))
开发者ID:phborba,项目名称:QGIS,代码行数:16,代码来源:test_qgssvgcache.py

示例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))
开发者ID:phborba,项目名称:QGIS,代码行数:9,代码来源:test_qgssvgcache.py

示例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())
开发者ID:jonnyforestGIS,项目名称:QGIS,代码行数:18,代码来源:test_qgsnoapplication.py

示例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)
开发者ID:phborba,项目名称:QGIS,代码行数:7,代码来源:test_qgssvgcache.py

示例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))
开发者ID:CS-SI,项目名称:QGIS,代码行数:8,代码来源:test_qgssvgcache.py


注:本文中的qgis.core.QgsApplication.svgCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。