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


Python QGis.QGIS_VERSION_INT属性代码示例

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


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

示例1: defineCharacteristics

# 需要导入模块: from qgis.core import QGis [as 别名]
# 或者: from qgis.core.QGis import QGIS_VERSION_INT [as 别名]
def defineCharacteristics(self):
        self.name = 'Add 3 word address field to points layer'
        self.i18n_name = self.name
        self.group = 'what3words tools'
        self.i18n_group = self.group

        if QGis.QGIS_VERSION_INT < 29900:
            self.addParameter(ParameterVector(self.INPUT,
                                              'Input layer', [ParameterVector.VECTOR_TYPE_POINT]))
        else:
            self.addParameter(ParameterVector(self.INPUT,
                                              'Input layer', [dataobjects.TYPE_VECTOR_POINT]))

        self.addOutput(OutputVector(self.OUTPUT, 'Output', True)) 
开发者ID:boundlessgeo,项目名称:qgis-what3words-plugin,代码行数:16,代码来源:add3wordsfield.py

示例2: load_isochrone_map

# 需要导入模块: from qgis.core import QGis [as 别名]
# 或者: from qgis.core.QGis import QGIS_VERSION_INT [as 别名]
def load_isochrone_map(self, base_path):
        """Load the isochrone map in the qgis

        :param base_path: Output path where layers are
        :type base_path:str
        """

        if not os.path.exists(base_path):
            message = self.tr("Error, failed to load the isochrone map")
            raise FileMissingError(message)
        else:
            for layer in os.listdir(base_path):
                layer_name = QFileInfo(layer).baseName

                if file.endswith(".asc"):
                    self.iface.addRasterLayer(file, layer_name)
                    continue
                elif file.endswith(".shp"):
                    self.iface.addVectorLayer(file, layer_name, 'ogr')
                    continue
                else:
                    continue
        canvas_srid = self.canvas.mapRenderer().destinationCrs().srsid()
        on_the_fly_projection = self.canvas.hasCrsTransformEnabled()
        if canvas_srid != 4326 and not on_the_fly_projection:
            if QGis.QGIS_VERSION_INT >= 20400:
                self.canvas.setCrsTransformEnabled(True)
            else:
                display_warning_message_box(
                    self.iface,
                    self.tr('Enable \'on the fly\''),
                    self.tr(
                        'Your current projection is different than EPSG:4326.'
                        'You should enable \'on the fly\' to display '
                        'correctly the isochrone map')
                    ) 
开发者ID:Samweli,项目名称:isochrones,代码行数:38,代码来源:isochrone_dialog.py

示例3: qgis_version

# 需要导入模块: from qgis.core import QGis [as 别名]
# 或者: from qgis.core.QGis import QGIS_VERSION_INT [as 别名]
def qgis_version():
    """Get the version of QGIS.

    :returns: QGIS Version where 10700 represents QGIS 1.7 etc.
    :rtype: int
    """
    version = unicode(QGis.QGIS_VERSION_INT)
    version = int(version)
    return version 
开发者ID:akbargumbira,项目名称:qgis_resources_sharing,代码行数:11,代码来源:utilities.py

示例4: __init__

# 需要导入模块: from qgis.core import QGis [as 别名]
# 或者: from qgis.core.QGis import QGIS_VERSION_INT [as 别名]
def __init__(self, iface):
        self.iface = iface
        self.canvas = self.iface.mapCanvas()

        self.qgsVersion = unicode(QGis.QGIS_VERSION_INT)

        pluginPath = os.path.abspath(os.path.dirname(__file__))

        overrideLocale = QSettings().value('locale/overrideFlag', False, bool)
        if not overrideLocale:
            locale = QLocale.system().name()[:2]
        else:
            locale = QSettings().value('locale/userLocale', '')

        translationPath = '{}/i18n/landmark_{}.qm'.format(pluginPath, locale)

        if QFileInfo(translationPath).exists():
            self.translator = QTranslator()
            self.translator.load(translationPath)
            QCoreApplication.installTranslator(self.translator) 
开发者ID:matsu-reki,项目名称:GkukanMusiumdb,代码行数:22,代码来源:landmark_plugin.py

示例5: commitClicked

# 需要导入模块: from qgis.core import QGis [as 别名]
# 或者: from qgis.core.QGis import QGIS_VERSION_INT [as 别名]
def commitClicked(self):
        feature = self.listWidget.currentItem().feature
        geom = None
        self.attributesTable.setRowCount(len(feature))
        for idx, attrname in enumerate(feature):
            value = feature[attrname]
            font = QFont()
            font.setBold(True)
            font.setWeight(75)
            item = QTableWidgetItem(attrname)
            item.setFont(font)
            self.attributesTable.setItem(idx, 0, item);
            self.attributesTable.setItem(idx, 1, QTableWidgetItem(str(value)));
            if geom is None:
                try:
                    geom = QgsGeometry.fromWkt(value)
                except:
                    pass

        self.attributesTable.resizeRowsToContents()
        self.attributesTable.horizontalHeader().setMinimumSectionSize(150)
        self.attributesTable.horizontalHeader().setStretchLastSection(True)

        settings = QSettings()
        prjSetting = settings.value('/Projections/defaultBehaviour')
        settings.setValue('/Projections/defaultBehaviour', '')
        types = ["Point", "LineString", "Polygon"]
        layers = []
        if geom is not None:
            geomtype = types[int(geom.type())]
            layer = loadLayerNoCrsDialog(geomtype + "?crs=EPSG:4326", "temp", "memory")
            pr = layer.dataProvider()
            feat = QgsFeature()
            feat.setGeometry(geom)
            pr.addFeatures([feat])
            layer.updateExtents()
            layer.selectAll()
            layer.setExtent(layer.boundingBoxOfSelected())
            layer.invertSelection()
            symbol = QgsSymbolV2.defaultSymbol(layer.geometryType())
            symbol.setColor(Qt.green)
            symbol.setAlpha(0.5)
            if QGis.QGIS_VERSION_INT < 29900:
                layer.setRendererV2(QgsSingleSymbolRendererV2(symbol))
            else:
                layer.setRenderer(QgsSingleSymbolRenderer(symbol))
            self.mapCanvas.setRenderFlag(False)
            self.mapCanvas.setLayerSet([QgsMapCanvasLayer(layer)])
            QgsMapLayerRegistry.instance().addMapLayer(layer, False)
            self.mapCanvas.setExtent(layer.extent())
            self.mapCanvas.setRenderFlag(True)
            layers.append(layer)
        else:
            self.mapCanvas.setLayerSet([])
        settings.setValue('/Projections/defaultBehaviour', prjSetting) 
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:57,代码来源:versionsviewer.py


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