本文整理汇总了Python中pluginmanager.PluginManager.findDEMProvider方法的典型用法代码示例。如果您正苦于以下问题:Python PluginManager.findDEMProvider方法的具体用法?Python PluginManager.findDEMProvider怎么用?Python PluginManager.findDEMProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pluginmanager.PluginManager
的用法示例。
在下文中一共展示了PluginManager.findDEMProvider方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pluginmanager import PluginManager [as 别名]
# 或者: from pluginmanager.PluginManager import findDEMProvider [as 别名]
#.........这里部分代码省略.........
import json
with open(filepath) as f:
settings = json.load(f)
self.loadSettings(settings)
def setTemplatePath(self, filepath):
"""filepath: relative path from html_templates directory or absolute path to a template html file"""
self.templatePath = filepath
self._templateConfig = None
def setOutputFilename(self, filepath=None):
if not filepath:
filepath = tools.temporaryOutputDir() + "/%s.html" % self.timestamp # temporary file
self.htmlfilename = filepath
self.path_root = os.path.splitext(filepath)[0]
self.htmlfiletitle = os.path.basename(self.path_root)
self.title = self.htmlfiletitle
def setMapCanvas(self, canvas):
self.setMapSettings(canvas.mapSettings() if QGis.QGIS_VERSION_INT >= 20300 else canvas.mapRenderer())
self.canvas = canvas
def setMapSettings(self, settings):
"""settings: QgsMapSettings (QGIS >= 2.3) or QgsMapRenderer"""
self.canvas = None
self.mapSettings = settings
self.baseExtent = RotatedRect.fromMapSettings(settings)
self.crs = settings.destinationCrs()
def demProvider(self):
layerId = self.data.get(ObjectTreeItem.ITEM_DEM, {}).get("comboBox_DEMLayer", 0)
return self.demProviderByLayerId(layerId)
def mapTo3d(self):
if self._mapTo3d:
return self._mapTo3d
if self.mapSettings is None:
return None
world = self.data.get(ObjectTreeItem.ITEM_WORLD, {})
baseSize = world.get("lineEdit_BaseSize", def_vals.baseSize)
verticalExaggeration = world.get("lineEdit_zFactor", def_vals.zExaggeration)
verticalShift = world.get("lineEdit_zShift", def_vals.zShift)
self._mapTo3d = MapTo3D(self.mapSettings, float(baseSize), float(verticalExaggeration), float(verticalShift))
return self._mapTo3d
def quadtree(self):
if self._quadtree:
self._quadtree
if self.baseExtent is None:
return
properties = self.data.get(ObjectTreeItem.ITEM_DEM, {})
self._quadtree = createQuadTree(self.baseExtent, properties)
return self._quadtree
def templateConfig(self):
if self._templateConfig:
return self._templateConfig
if not self.templatePath:
self.setTemplatePath(def_vals.template)
self._templateConfig = tools.getTemplateConfig(self.templatePath)
return self._templateConfig
def wgs84Center(self):
if self.crs and self.baseExtent:
wgs84 = QgsCoordinateReferenceSystem(4326)
transform = QgsCoordinateTransform(self.crs, wgs84)
return transform.transform(self.baseExtent.center())
return None
def get(self, key, default=None):
return self.data.get(key, default)
def checkValidity(self):
"""check validity of export settings. return error message as unicode. return None if valid."""
if self.exportMode == ExportSettings.PLAIN_MULTI_RES and self.quadtree() is None:
return u"Focus point/area is not selected."
return None
def demProviderByLayerId(self, id):
if not id:
return FlatDEMProvider()
if id.startswith("plugin:"):
provider = self.pluginManager.findDEMProvider(id[7:])
if provider:
return provider(str(self.crs.toWkt()))
logMessage('Plugin "{0}" not found'.format(id))
return FlatDEMProvider()
else:
layer = QgsMapLayerRegistry.instance().mapLayer(id)
return GDALDEMProvider(layer.source(), str(self.crs.toWkt()), source_wkt=str(layer.crs().toWkt())) # use CRS set to the layer in QGIS