本文整理匯總了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