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


Python Sextante.getInterface方法代码示例

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


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

示例1: processAlgorithm

# 需要导入模块: from sextante.core.Sextante import Sextante [as 别名]
# 或者: from sextante.core.Sextante.Sextante import getInterface [as 别名]
	def processAlgorithm(self, progress):
		# Include must be done here to avoid cyclic import
		from sextante.core.Sextante import Sextante
		qgis = Sextante.getInterface()

		layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
		layername = layer.name()

		node_filename = self.getOutputValue(self.NODEFILENAME)
		attribute_filename = self.getOutputValue(self.ATTRIBUTEFILENAME)
		print "Layer: " + str(layername)
		print "Nodes: " + str(node_filename)
		print "Attributes: " + str(attribute_filename)

		if self.getParameterValue(self.FIELDDELIMITER) == 1:
			field_delimiter = "|"
		elif self.getParameterValue(self.FIELDDELIMITER) == 2:
			field_delimiter = " "
		else:
			field_delimiter = ","

		if self.getParameterValue(self.LINETERMINATOR) == 1:
			line_terminator = "\n"
		else:
			line_terminator = "\r\n"

		message = mmqgisx_geometry_export_to_csv(qgis, layername, node_filename, attribute_filename,
			field_delimiter, line_terminator)

		if message:
			raise GeoAlgorithmExecutionException(message)
开发者ID:pka,项目名称:qgisenterprise-sextante-plugin,代码行数:33,代码来源:MMQGISXAlgorithms.py

示例2: processAlgorithm

# 需要导入模块: from sextante.core.Sextante import Sextante [as 别名]
# 或者: from sextante.core.Sextante.Sextante import getInterface [as 别名]
	def processAlgorithm(self, progress):
		# Include must be done here to avoid cyclic import
		from sextante.core.Sextante import Sextante
		qgis = Sextante.getInterface()

		layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.LAYERNAME))
		layername = layer.name()
		savename = self.getOutputValue(self.SAVENAME)

		index = self.getParameterValue(self.NEWTYPE)

		splitnodes = 0
		if index == 0:
			newtype = QGis.WKBPoint
		elif index == 1:
			newtype = QGis.WKBPoint
			splitnodes = 1
		elif index == 2:
			newtype = QGis.WKBLineString
		elif index == 3:
			newtype = QGis.WKBMultiLineString
		elif index == 4:
			newtype = QGis.WKBPolygon
		else:
			newtype = QGis.WKBPoint

		message = mmqgisx_geometry_convert(qgis, layername, newtype, splitnodes, savename, False)

		if message:
			raise GeoAlgorithmExecutionException(message)
开发者ID:carsonfarmer,项目名称:Quantum-GIS,代码行数:32,代码来源:MMQGISXAlgorithmProvider.py

示例3: processAlgorithm

# 需要导入模块: from sextante.core.Sextante import Sextante [as 别名]
# 或者: from sextante.core.Sextante.Sextante import getInterface [as 别名]
    def processAlgorithm(self, progress):
        # Include must be done here to avoid cyclic import
        from sextante.core.Sextante import Sextante

        qgis = Sextante.getInterface()

        table = QGisLayers.getObjectFromUri(self.getParameterValue(self.CSVNAME))
        csvname = table.name()

        params = [
            self.getParameterValue(self.ADDRESS),
            self.getParameterValue(self.CITY),
            self.getParameterValue(self.STATE),
            self.getParameterValue(self.COUNTRY),
        ]

        keys = []
        for param in params:
            if not (param in keys):
                keys.append(param)

        shapefilename = self.getOutputValue(self.SHAPEFILENAME)
        notfoundfile = self.getOutputValue(self.NOTFOUNDFILE)

        message = mmqgisx_geocode_google(qgis, csvname, shapefilename, notfoundfile, keys, False)

        if message:
            raise GeoAlgorithmExecutionException(message)
开发者ID:psibi,项目名称:Quantum-GIS,代码行数:30,代码来源:MMQGISXAlgorithms.py

示例4: setSessionProjectionFromProject

# 需要导入模块: from sextante.core.Sextante import Sextante [as 别名]
# 或者: from sextante.core.Sextante.Sextante import getInterface [as 别名]
 def setSessionProjectionFromProject(self, commands):
     if not GrassUtils.projectionSet:
         from sextante.core.Sextante import Sextante
         qgis = Sextante.getInterface()
         proj4 = qgis.mapCanvas().mapRenderer().destinationCrs().toProj4()
         command = "g.proj"
         command +=" -c"
         command +=" proj4=\""+proj4+"\""
         commands.append(command)
         GrassUtils.projectionSet = True
开发者ID:tomyun,项目名称:Quantum-GIS,代码行数:12,代码来源:GrassAlgorithm.py

示例5: processAlgorithm

# 需要导入模块: from sextante.core.Sextante import Sextante [as 别名]
# 或者: from sextante.core.Sextante.Sextante import getInterface [as 别名]
	def processAlgorithm(self, progress):
		# Include must be done here to avoid cyclic import
		from sextante.core.Sextante import Sextante
		qgis = Sextante.getInterface()

		hublayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.HUBNAME))		
		spokelayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.SPOKENAME))
		
		hubattribute = self.getParameterValue(self.HUBATTRIBUTE)
		spokeattribute = self.getParameterValue(self.SPOKEATTRIBUTE)

		savename = self.getOutputValue(self.SAVENAME)

		message = mmqgisx_hub_lines(qgis, hublayer, hubattribute, spokelayer, spokeattribute, savename, False)

		if message:
			raise GeoAlgorithmExecutionException(message)
开发者ID:hCivil,项目名称:Quantum-GIS,代码行数:19,代码来源:MMQGISXAlgorithmProvider.py

示例6: fillCombo

# 需要导入模块: from sextante.core.Sextante import Sextante [as 别名]
# 或者: from sextante.core.Sextante.Sextante import getInterface [as 别名]
 def fillCombo(self):
     self.combo.clear()
     #add algorithms
     for providerName in Sextante.algs.keys():
         provider = Sextante.algs[providerName]            
         algs = provider.values()            
         for alg in algs:
             self.combo.addItem("SEXTANTE algorithm: " + alg.name)        
     #add functions
     for command in dir(self.commands):
         if isinstance(self.commands.__dict__.get(command), types.FunctionType):
             self.combo.addItem("Command: " + command);    
     #add menu entries
     menuActions = []
     actions = Sextante.getInterface().mainWindow().menuBar().actions()
     for action in actions:
         menuActions.extend(self.getActions(action))
     for action in menuActions:
         self.combo.addItem("Menu action: " + unicode(action.text()))
开发者ID:geodenilson,项目名称:Quantum-GIS,代码行数:21,代码来源:CommanderWindow.py


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