本文整理匯總了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))
示例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')
)
示例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
示例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)
示例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)