コード例 #1
0
 def test_mixed(self):
     sym = self.renderer.symbol()
     buffer_layer = QgsGeometryGeneratorSymbolLayerV2.create({'geometryModifier': 'buffer($geometry, "value"/15)'})
     buffer_layer.setSymbolType(QgsSymbolV2.Fill)
     buffer_layer.subSymbol()
     sym.appendSymbolLayer(buffer_layer)
     marker_layer = QgsGeometryGeneratorSymbolLayerV2.create({'geometryModifier': 'centroid($geometry)'})
     marker_layer.setSymbolType(QgsSymbolV2.Marker)
     sym.appendSymbolLayer(marker_layer)
     renderchecker = QgsMultiRenderChecker()
     renderchecker.setMapSettings(self.mapsettings)
     renderchecker.setControlName('expected_geometrygenerator_mixed')
     self.assertTrue(renderchecker.runTest('geometrygenerator_mixed'))
コード例 #2
0
 def test_marker(self):
     sym = self.renderer.symbol()
     sym_layer = QgsGeometryGeneratorSymbolLayerV2.create({'geometryModifier': 'centroid($geometry)'})
     sym_layer.setSymbolType(QgsSymbolV2.Marker)
     sym.changeSymbolLayer(0, sym_layer)
     renderchecker = QgsMultiRenderChecker()
     renderchecker.setMapSettings(self.mapsettings)
     renderchecker.setControlName('expected_geometrygenerator_marker')
     self.assertTrue(renderchecker.runTest('geometrygenerator_marker'))
コード例 #3
0
    def test_buffer_points(self):
        sym = self.points_layer.rendererV2().symbol()

        buffer_layer = QgsGeometryGeneratorSymbolLayerV2.create({'geometryModifier': 'buffer($geometry, "staff"/15)'})
        buffer_layer.setSymbolType(QgsSymbolV2.Fill)
        self.assertIsNotNone(buffer_layer.subSymbol())
        sym.appendSymbolLayer(buffer_layer)

        rendered_layers = [self.points_layer.id()]
        self.mapsettings.setLayers(rendered_layers)

        renderchecker = QgsMultiRenderChecker()
        renderchecker.setMapSettings(self.mapsettings)
        renderchecker.setControlName('expected_geometrygenerator_buffer_points')
        self.assertTrue(renderchecker.runTest('geometrygenerator_buffer_points'))