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


Python QgsMarkerSymbolV2.createSimple方法代码示例

本文整理汇总了Python中qgis.core.QgsMarkerSymbolV2.createSimple方法的典型用法代码示例。如果您正苦于以下问题:Python QgsMarkerSymbolV2.createSimple方法的具体用法?Python QgsMarkerSymbolV2.createSimple怎么用?Python QgsMarkerSymbolV2.createSimple使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qgis.core.QgsMarkerSymbolV2的用法示例。


在下文中一共展示了QgsMarkerSymbolV2.createSimple方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update_syms

# 需要导入模块: from qgis.core import QgsMarkerSymbolV2 [as 别名]
# 或者: from qgis.core.QgsMarkerSymbolV2 import createSimple [as 别名]
    def update_syms(self, catalogue):
        self.syms = {}

        for flag in set(catalogue.data['Cluster_Flag'].tolist()):
            for index in set(catalogue.data['Cluster_Index'].tolist()):

                # main shock
                point = QgsMarkerSymbolV2.createSimple(
                    {'color': 'blue', 'name': 'square'})

                if index:  # belongs to a cluster
                    color = self.catalogue_model.cluster_color(index)

                    # non poissonian
                    if flag:
                        point = QgsMarkerSymbolV2.createSimple(
                            {'color': 'blue', 'name': 'triangle'})
                    color.setAlpha(125 + 125 * abs(flag))
                    point.setSize(3)
                    point.setColor(color)
                else:
                    point = QgsSymbolV2.defaultSymbol(QGis.Point)
                    point.setColor(QtGui.QColor("0,0,0,125"))
                    point.setSize(1.5)
                self.syms[self.Cluster(index, flag)] = point
开发者ID:gem,项目名称:qt-experiments,代码行数:27,代码来源:styles.py

示例2: legend_test

# 需要导入模块: from qgis.core import QgsMarkerSymbolV2 [as 别名]
# 或者: from qgis.core.QgsMarkerSymbolV2 import createSimple [as 别名]
    def legend_test(self):
        self.mAtlasMap.setAtlasDriven(True)
        self.mAtlasMap.setAtlasScalingMode(QgsComposerMap.Auto)
        self.mAtlasMap.setAtlasMargin(0.10)

        # add a point layer
        ptLayer = QgsVectorLayer("Point?crs=epsg:4326&field=attr:int(1)&field=label:string(20)", "points", "memory")

        pr = ptLayer.dataProvider()
        f1 = QgsFeature(1)
        f1.initAttributes(2)
        f1.setAttribute(0, 1)
        f1.setAttribute(1, "Test label 1")
        f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(-0.638, 48.954)))
        f2 = QgsFeature(2)
        f2.initAttributes(2)
        f2.setAttribute(0, 2)
        f2.setAttribute(1, "Test label 2")
        f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(-1.682, 48.550)))
        pr.addFeatures([f1, f2])

        # categorized symbology
        r = QgsCategorizedSymbolRendererV2("attr", [QgsRendererCategoryV2(1, QgsMarkerSymbolV2.createSimple({"color": "255,0,0"}), "red"),
                                                    QgsRendererCategoryV2(2, QgsMarkerSymbolV2.createSimple({"color": "0,0,255"}), "blue")])
        ptLayer.setRendererV2(r)

        QgsMapLayerRegistry.instance().addMapLayer(ptLayer)

        # add the point layer to the map settings
        layers = self.mapSettings.layers()
        layers = [ptLayer.id()] + layers
        self.mapSettings.setLayers(layers)

        # add a legend
        legend = QgsComposerLegend(self.mComposition)
        legend.moveBy(200, 100)
        # sets the legend filter parameter
        legend.setComposerMap(self.mAtlasMap)
        legend.setLegendFilterOutAtlas(True)
        self.mComposition.addComposerLegend(legend)

        self.mAtlas.beginRender()

        self.mAtlas.prepareForFeature(0)
        self.mLabel1.adjustSizeToText()

        checker = QgsCompositionChecker('atlas_legend', self.mComposition)
        myTestResult, myMessage = checker.testComposition()
        assert myTestResult

        self.mAtlas.endRender()

        # restore state
        self.mapSettings.setLayers([layers[1]])
        self.mComposition.removeComposerItem(legend)
        QgsMapLayerRegistry.instance().removeMapLayer(ptLayer.id())
开发者ID:AM7000000,项目名称:QGIS,代码行数:58,代码来源:test_qgsatlascomposition.py

示例3: createMarkerSymbol

# 需要导入模块: from qgis.core import QgsMarkerSymbolV2 [as 别名]
# 或者: from qgis.core.QgsMarkerSymbolV2 import createSimple [as 别名]
def createMarkerSymbol():
    symbol = QgsMarkerSymbolV2.createSimple({
        "color": "100,150,50",
        "name": "square",
        "size": "3.0"
    })
    return symbol
开发者ID:Geoneer,项目名称:QGIS,代码行数:9,代码来源:test_qgsgraduatedsymbolrendererv2.py

示例4: setUp

# 需要导入模块: from qgis.core import QgsMarkerSymbolV2 [as 别名]
# 或者: from qgis.core.QgsMarkerSymbolV2 import createSimple [as 别名]
    def setUp(self):
        self.iface = get_iface()

        polys_shp = os.path.join(TEST_DATA_DIR, 'polys.shp')
        points_shp = os.path.join(TEST_DATA_DIR, 'points.shp')
        lines_shp = os.path.join(TEST_DATA_DIR, 'lines.shp')
        self.polys_layer = QgsVectorLayer(polys_shp, 'Polygons', 'ogr')
        self.points_layer = QgsVectorLayer(points_shp, 'Points', 'ogr')
        self.lines_layer = QgsVectorLayer(lines_shp, 'Lines', 'ogr')
        QgsMapLayerRegistry.instance().addMapLayer(self.polys_layer)
        QgsMapLayerRegistry.instance().addMapLayer(self.lines_layer)
        QgsMapLayerRegistry.instance().addMapLayer(self.points_layer)

        # Create style
        sym1 = QgsFillSymbolV2.createSimple({'color': '#fdbf6f'})
        sym2 = QgsLineSymbolV2.createSimple({'color': '#fdbf6f'})
        sym3 = QgsMarkerSymbolV2.createSimple({'color': '#fdbf6f'})

        self.polys_layer.setRendererV2(QgsSingleSymbolRendererV2(sym1))
        self.lines_layer.setRendererV2(QgsSingleSymbolRendererV2(sym2))
        self.points_layer.setRendererV2(QgsSingleSymbolRendererV2(sym3))

        self.mapsettings = self.iface.mapCanvas().mapSettings()
        self.mapsettings.setOutputSize(QSize(400, 400))
        self.mapsettings.setOutputDpi(96)
        self.mapsettings.setExtent(QgsRectangle(-133, 22, -70, 52))
开发者ID:Naisha634,项目名称:QGIS,代码行数:28,代码来源:test_qgsgeometrygeneratorsymbollayerv2.py

示例5: getmap

# 需要导入模块: from qgis.core import QgsMarkerSymbolV2 [as 别名]
# 或者: from qgis.core.QgsMarkerSymbolV2 import createSimple [as 别名]
    def getmap(self):
        if self.canvas:
            settings = self.canvas.mapSettings()
            layers = settings.layers()
            if GPS.isConnected:
                try:
                    gpslayer = QgsMapLayerRegistry.instance().mapLayersByName("__gps_layer")[0]
                except IndexError:
                    gpslayer = QgsVectorLayer("Point", "__gps_layer", "memory")
                    symbol = QgsMarkerSymbolV2.createSimple({'name': 'circle', 'color': 'blue', "size": '5'})
                    gpslayer.rendererV2().setSymbol(symbol)
                    QgsMapLayerRegistry.instance().addMapLayer(gpslayer, False)

                layers.append(gpslayer.id())
                settings.setLayers(layers)

                map_pos = QgsPoint(GPS.gpsinfo("longitude"), GPS.gpsinfo("latitude"))
                # map_pos = QgsPoint(115.72589,-32.29597)
                geom = QgsGeometry.fromPoint(map_pos)
                feature = QgsFeature()
                feature.setGeometry(geom)
                gpslayer.startEditing()
                gpslayer.addFeature(feature)
                # gpslayer.commitChanges()

            self.renderjob = QgsMapRendererParallelJob(settings)
            self.renderjob.finished.connect(self.rendermap)
            self.renderjob.start()
开发者ID:lydonchandra,项目名称:Roam,代码行数:30,代码来源:drawingpad.py

示例6: __init__

# 需要导入模块: from qgis.core import QgsMarkerSymbolV2 [as 别名]
# 或者: from qgis.core.QgsMarkerSymbolV2 import createSimple [as 别名]
 def __init__(self):
     QgsFeatureRendererV2.__init__(self, "CatalogueCompletenessRenderer")
     complete = QgsSymbolV2.defaultSymbol(QGis.Point)
     uncomplete = QgsMarkerSymbolV2.createSimple(
         {'color': 'blue', 'name': 'triangle'})
     uncomplete.setSize(3)
     complete.setSize(1.5)
     complete.setColor(QtGui.QColor(255, 0, 0, 125))
     self.syms = [complete, uncomplete]
开发者ID:gem,项目名称:qt-experiments,代码行数:11,代码来源:styles.py

示例7: create_qlayer

# 需要导入模块: from qgis.core import QgsMarkerSymbolV2 [as 别名]
# 或者: from qgis.core.QgsMarkerSymbolV2 import createSimple [as 别名]
 def create_qlayer(self):
     layer= QgsVectorLayer("Point"+self.crs, self.prefix+"-nodes", "memory")
     # nice clean black dot
     symbol = QgsMarkerSymbolV2.createSimple({'outline_style':'no',
                                              'name': 'circle', 
                                              'size_unit':'MM',
                                              'size':'1',
                                              'color': 'black'})
     layer.rendererV2().setSymbol(symbol)
     return layer
开发者ID:rustychris,项目名称:umbra,代码行数:12,代码来源:umbra_layer.py

示例8: addLayer

# 需要导入模块: from qgis.core import QgsMarkerSymbolV2 [as 别名]
# 或者: from qgis.core.QgsMarkerSymbolV2 import createSimple [as 别名]
 def addLayer(self):
     uri = QgsDataSourceURI()
     # set host name, port, database name, username and password
     #uri.setConnection("localhost", "5432", "jguelat", "jguelat", "")
     uri.setConnection("local_jguelat", "", "", "")
     # set database schema, table name, geometry column and optionally subset (WHERE clause)
     uri.setDataSource("public", self.tableCombo.currentText(), "geom", "species_id = " + self.speciesCombo.currentText())
     #vlayer = self.iface.addVectorLayer(uri.uri(), "Species " + self.speciesCombo.currentText(), "postgres")
     vlayer = QgsVectorLayer(uri.uri(), "Species " + self.speciesCombo.currentText(), "postgres")
     props = vlayer.rendererV2().symbol().symbolLayer(0).properties()
     props['size'] = '3'
     props['color'] = 'blue'
     vlayer.rendererV2().setSymbol(QgsMarkerSymbolV2.createSimple(props))
     QgsMapLayerRegistry.instance().addMapLayer(vlayer)
     QgsMessageLog.logMessage("Tout est OK", 'BirdChooser', QgsMessageLog.INFO)
开发者ID:jguelat,项目名称:BirdChooser,代码行数:17,代码来源:bird_chooser_dialog.py

示例9: test_point_ordered_symbol_bound_offset

# 需要导入模块: from qgis.core import QgsMarkerSymbolV2 [as 别名]
# 或者: from qgis.core.QgsMarkerSymbolV2 import createSimple [as 别名]
 def test_point_ordered_symbol_bound_offset(self):
     # Test ordered placements for point using symbol bounds offset
     self.layer = TestQgsPalLabeling.loadFeatureLayer('point_ordered_placement')
     # Make a big symbol
     symbol = QgsMarkerSymbolV2.createSimple({u'color': u'31,120,180,255',
                                              u'outline_color': u'0,0,0,0',
                                              u'outline_style': u'solid',
                                              u'size': u'10',
                                              u'name': u'rectangle',
                                              u'size_unit': u'MM'})
     renderer = QgsSingleSymbolRendererV2(symbol)
     self.layer.setRendererV2(renderer)
     self._TestMapSettings = self.cloneMapSettings(self._MapSettings)
     self.lyr.placement = QgsPalLayerSettings.OrderedPositionsAroundPoint
     self.lyr.dist = 2
     self.lyr.offsetType = QgsPalLayerSettings.FromSymbolBounds
     self.checkTest()
     self.removeMapLayer(self.layer)
     self.layer = None
开发者ID:Naisha634,项目名称:QGIS,代码行数:21,代码来源:test_qgspallabeling_placement.py

示例10: testInitialSizeSymbolMapUnits

# 需要导入模块: from qgis.core import QgsMarkerSymbolV2 [as 别名]
# 或者: from qgis.core.QgsMarkerSymbolV2 import createSimple [as 别名]
    def testInitialSizeSymbolMapUnits(self):
        """Test initial size of legend with a symbol size in map units"""

        point_path = os.path.join(TEST_DATA_DIR, 'points.shp')
        point_layer = QgsVectorLayer(point_path, 'points', 'ogr')
        QgsMapLayerRegistry.instance().addMapLayers([point_layer])

        marker_symbol = QgsMarkerSymbolV2.createSimple({'color': '#ff0000', 'outline_style': 'no', 'size': '5', 'size_unit': 'MapUnit'})

        point_layer.setRendererV2(QgsSingleSymbolRendererV2(marker_symbol))

        s = QgsMapSettings()
        s.setLayers([point_layer.id()])
        s.setCrsTransformEnabled(False)
        composition = QgsComposition(s)
        composition.setPaperSize(297, 210)

        composer_map = QgsComposerMap(composition, 20, 20, 80, 80)
        composer_map.setFrameEnabled(True)
        composition.addComposerMap(composer_map)
        composer_map.setNewExtent(point_layer.extent())

        legend = QgsComposerLegend(composition)
        legend.setSceneRect(QRectF(120, 20, 80, 80))
        legend.setFrameEnabled(True)
        legend.setFrameOutlineWidth(2)
        legend.setBackgroundColor(QColor(200, 200, 200))
        legend.setTitle('')
        composition.addComposerLegend(legend)
        legend.setComposerMap(composer_map)

        checker = QgsCompositionChecker(
            'composer_legend_mapunits', composition)
        checker.setControlPathPrefix("composer_legend")
        result, message = checker.testComposition()
        self.assertTrue(result, message)

        QgsMapLayerRegistry.instance().removeMapLayers([point_layer.id()])
开发者ID:NyakudyaA,项目名称:QGIS,代码行数:40,代码来源:test_qgscomposerlegend.py

示例11: setUp

# 需要导入模块: from qgis.core import QgsMarkerSymbolV2 [as 别名]
# 或者: from qgis.core.QgsMarkerSymbolV2 import createSimple [as 别名]
 def setUp(self):
     # Create some simple symbols
     self.fill_symbol = QgsFillSymbolV2.createSimple({"color": "#ffffff"})
     self.line_symbol = QgsLineSymbolV2.createSimple({"color": "#ffffff", "line_width": "3"})
     self.marker_symbol = QgsMarkerSymbolV2.createSimple({"color": "#ffffff", "size": "3"})
     self.report = "<h1>Python QgsSymbolV2 Tests</h1>\n"
开发者ID:Zakui,项目名称:QGIS,代码行数:8,代码来源:test_qgssymbolv2.py

示例12: QgsSizeScaleWidget

# 需要导入模块: from qgis.core import QgsMarkerSymbolV2 [as 别名]
# 或者: from qgis.core.QgsMarkerSymbolV2 import createSimple [as 别名]
# coding: utf-8
from qgis.core import QgsMarkerSymbolV2
from qgis.gui import QgsSizeScaleWidget
from qgis.utils import iface


layer = iface.activeLayer()
canvas = iface.mapCanvas()
marker_symbol_v2 = QgsMarkerSymbolV2.createSimple({"color": "blue", "name": "triangle"})

size_scale_widget = QgsSizeScaleWidget(layer, marker_symbol_v2)
size_scale_widget.setMapCanvas(canvas)

size_scale_widget.show()
开发者ID:GEO-IASS,项目名称:pyqgis-samples,代码行数:16,代码来源:qgis-sample-QgsSizeScaleWidget.py

示例13: apply

# 需要导入模块: from qgis.core import QgsMarkerSymbolV2 [as 别名]
# 或者: from qgis.core.QgsMarkerSymbolV2 import createSimple [as 别名]
 def apply(self, layer):
     symbol = QgsMarkerSymbolV2.createSimple({'name': self.shape,
                                              'color': self.color})
     self.renderer = QgsSingleSymbolRendererV2(symbol)
     super(SimpleSymbology, self).apply(layer)
开发者ID:ChrFr,项目名称:qgis_plugins,代码行数:7,代码来源:ui_elements.py


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