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


Python ProcessingUtils.isMac方法代码示例

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


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

示例1: unload

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
 def unload(self):
     AlgorithmProvider.unload(self)
     if ProcessingUtils.isWindows() or ProcessingUtils.isMac():
         ProcessingConfig.removeSetting(GrassUtils.GRASS_FOLDER)
         ProcessingConfig.removeSetting(GrassUtils.GRASS_WIN_SHELL)
     ProcessingConfig.removeSetting(GrassUtils.GRASS_LOG_COMMANDS)
     ProcessingConfig.removeSetting(GrassUtils.GRASS_LOG_CONSOLE)
开发者ID:alextheleritis,项目名称:QGIS,代码行数:9,代码来源:GrassAlgorithmProvider.py

示例2: otbPath

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
 def otbPath():
     folder = ProcessingConfig.getSetting(OTBUtils.OTB_FOLDER)
     if folder == None:
         folder = ""
         #try to configure the path automatically
         if ProcessingUtils.isMac():
             testfolder = os.path.join(str(QgsApplication.prefixPath()), "bin")
             if os.path.exists(os.path.join(testfolder, "otbcli")):
                 folder = testfolder
             else:
                 testfolder = "/usr/local/bin"
                 if os.path.exists(os.path.join(testfolder, "otbcli")):
                     folder = testfolder
         elif ProcessingUtils.isWindows():
             testfolder = os.path.dirname(str(QgsApplication.prefixPath()))
             testfolder = os.path.dirname(testfolder)
             testfolder = os.path.join(testfolder,  "bin")
             path = os.path.join(testfolder, "otbcli.bat")
             if os.path.exists(path):
                 folder = testfolder
         else:
             testfolder = "/usr/bin"
             if os.path.exists(os.path.join(testfolder, "otbcli")):
                 folder = testfolder
     return folder
开发者ID:alextheleritis,项目名称:QGIS,代码行数:27,代码来源:OTBUtils.py

示例3: initializeSettings

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
 def initializeSettings(self):
     AlgorithmProvider.initializeSettings(self)
     if ProcessingUtils.isWindows() or ProcessingUtils.isMac():
         ProcessingConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_FOLDER, "GRASS folder", GrassUtils.grassPath()))
         ProcessingConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_WIN_SHELL, "Msys folder", GrassUtils.grassWinShell()))
     ProcessingConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_LOG_COMMANDS, "Log execution commands", False))
     ProcessingConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_LOG_CONSOLE, "Log console output", False))
开发者ID:alextheleritis,项目名称:QGIS,代码行数:9,代码来源:GrassAlgorithmProvider.py

示例4: exportRasterLayer

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
 def exportRasterLayer(self, layer):
     destFilename = ProcessingUtils.getTempFilenameInTempFolder(os.path.basename(layer)[0:5] + ".sgrd")
     self.exportedLayers[layer]= destFilename
     saga208 = ProcessingConfig.getSetting(SagaUtils.SAGA_208)
     if ProcessingUtils.isWindows() or ProcessingUtils.isMac() or not saga208:
         return "io_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + layer+"\""
     else:
         return "libio_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + layer + "\""
开发者ID:artfwo,项目名称:Quantum-GIS,代码行数:10,代码来源:SagaAlgorithm.py

示例5: mpiexecPath

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
    def mpiexecPath():
        folder = ProcessingConfig.getSetting(TauDEMUtils.MPIEXEC_FOLDER)
        if folder == None:
            folder = ""

        if ProcessingUtils.isMac():
            testfolder = os.path.join(QgsApplication.prefixPath(), "bin")
            if os.path.exists(os.path.join(testfolder, "mpiexec")):
                folder = testfolder
            else:
                testfolder = "/usr/local/bin"
                if os.path.exists(os.path.join(testfolder, "mpiexec")):
                    folder = testfolder
        return folder
开发者ID:alextheleritis,项目名称:QGIS,代码行数:16,代码来源:TauDEMUtils.py

示例6: taudemPath

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
    def taudemPath():
        folder = ProcessingConfig.getSetting(TauDEMUtils.TAUDEM_FOLDER)
        if folder == None:
            folder = ""

        if ProcessingUtils.isMac():
            testfolder = os.path.join(QgsApplication.prefixPath(), "bin")
            if os.path.exists(os.path.join(testfolder, "slopearea")):
                folder = testfolder
            else:
                testfolder = "/usr/local/bin"
                if os.path.exists(os.path.join(testfolder, "slopearea")):
                    folder = testfolder
        return folder
开发者ID:alextheleritis,项目名称:QGIS,代码行数:16,代码来源:TauDEMUtils.py

示例7: createSagaBatchJobFileFromSagaCommands

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
    def createSagaBatchJobFileFromSagaCommands(commands):

        fout = open(SagaUtils.sagaBatchJobFilename(), "w")
        if ProcessingUtils.isWindows():
            fout.write("set SAGA=" + SagaUtils.sagaPath() + "\n")
            fout.write("set SAGA_MLB=" + SagaUtils.sagaPath() + os.sep + "modules" + "\n")
            fout.write("PATH=PATH;%SAGA%;%SAGA_MLB%\n")
        elif ProcessingUtils.isMac():
            fout.write("export SAGA_MLB=" + SagaUtils.sagaPath() + "/../lib/saga\n")
            fout.write("export PATH=" + SagaUtils.sagaPath() + ":$PATH\n")
        else:
            pass
        for command in commands:
            fout.write("saga_cmd " + command.encode("utf8") + "\n")

        fout.write("exit")
        fout.close()
开发者ID:artfwo,项目名称:Quantum-GIS,代码行数:19,代码来源:SagaUtils.py

示例8: exportRasterLayer

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
 def exportRasterLayer(self, source):
     layer = QGisLayers.getObjectFromUri(source, False)
     if layer:
         filename = str(layer.name())
     else:
         filename = source.rstrip(".sgrd")
     validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:"
     filename = ''.join(c for c in filename if c in validChars)
     if len(filename) == 0:
         filename = "layer"
     destFilename = ProcessingUtils.getTempFilenameInTempFolder(filename + ".sgrd")
     self.exportedLayers[source]= destFilename
     saga208 = ProcessingConfig.getSetting(SagaUtils.SAGA_208)
     if ProcessingUtils.isWindows() or ProcessingUtils.isMac() or not saga208:
         return "io_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + source+"\""
     else:
         return "libio_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + source + "\""
开发者ID:alextheleritis,项目名称:QGIS,代码行数:19,代码来源:SagaAlgorithm.py

示例9: prepareGrassExecution

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
    def prepareGrassExecution(commands):
        if ProcessingUtils.isWindows():
            GrassUtils.createGrassScript(commands)
            command = ["cmd.exe", "/C ", GrassUtils.grassScriptFilename()]
        else:
            gisrc =  ProcessingUtils.userFolder() + os.sep + "processing.gisrc"
            os.putenv("GISRC", gisrc)
            os.putenv("GRASS_MESSAGE_FORMAT", "gui")
            os.putenv("GRASS_BATCH_JOB", GrassUtils.grassBatchJobFilename())
            GrassUtils.createGrassBatchJobFileFromGrassCommands(commands)
            os.chmod(GrassUtils.grassBatchJobFilename(), stat.S_IEXEC | stat.S_IREAD | stat.S_IWRITE)
            if ProcessingUtils.isMac():
                command = GrassUtils.grassPath() + os.sep + "grass.sh " + GrassUtils.grassMapsetFolder() + "/PERMANENT"
            else:
                command = "grass64 " + GrassUtils.grassMapsetFolder() + "/PERMANENT"

        return command
开发者ID:alextheleritis,项目名称:QGIS,代码行数:19,代码来源:GrassUtils.py

示例10: resampleRasterLayer

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
 def resampleRasterLayer(self,layer):
     '''this is supposed to be run after having exported all raster layers'''
     if layer in self.exportedLayers.keys():
         inputFilename = self.exportedLayers[layer]
     else:
         inputFilename = layer
     destFilename = ProcessingUtils.getTempFilename("sgrd")
     self.exportedLayers[layer]= destFilename
     saga208 = ProcessingConfig.getSetting(SagaUtils.SAGA_208)
     if ProcessingUtils.isWindows() or ProcessingUtils.isMac() or not saga208:
         s = "grid_tools \"Resampling\" -INPUT \"" + inputFilename + "\" -TARGET 0 -SCALE_UP_METHOD 4 -SCALE_DOWN_METHOD 4 -USER_XMIN " +\
             str(self.xmin) + " -USER_XMAX " + str(self.xmax) + " -USER_YMIN " + str(self.ymin) + " -USER_YMAX "  + str(self.ymax) +\
             " -USER_SIZE " + str(self.cellsize) + " -USER_GRID \"" + destFilename + "\""
     else:
         s = "libgrid_tools \"Resampling\" -INPUT \"" + inputFilename + "\" -TARGET 0 -SCALE_UP_METHOD 4 -SCALE_DOWN_METHOD 4 -USER_XMIN " +\
             str(self.xmin) + " -USER_XMAX " + str(self.xmax) + " -USER_YMIN " + str(self.ymin) + " -USER_YMAX "  + str(self.ymax) +\
             " -USER_SIZE " + str(self.cellsize) + " -USER_GRID \"" + destFilename + "\""
     return s
开发者ID:alextheleritis,项目名称:QGIS,代码行数:20,代码来源:SagaAlgorithm.py

示例11: sagaPath

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
 def sagaPath():
     folder = ProcessingConfig.getSetting(SagaUtils.SAGA_FOLDER)
     if folder == None:
         folder = ""
         # try to auto-configure the folder
         if ProcessingUtils.isMac():
             testfolder = os.path.join(str(QgsApplication.prefixPath()), "bin")
             if os.path.exists(os.path.join(testfolder, "saga_cmd")):
                 folder = testfolder
             else:
                 testfolder = "/usr/local/bin"
                 if os.path.exists(os.path.join(testfolder, "saga_cmd")):
                     folder = testfolder
         elif ProcessingUtils.isWindows():
             testfolder = os.path.dirname(str(QgsApplication.prefixPath()))
             testfolder = os.path.join(testfolder, "saga")
             if os.path.exists(os.path.join(testfolder, "saga_cmd.exe")):
                 folder = testfolder
     return folder
开发者ID:artfwo,项目名称:Quantum-GIS,代码行数:21,代码来源:SagaUtils.py

示例12: grassPath

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
    def grassPath():
        if not ProcessingUtils.isWindows() and not ProcessingUtils.isMac():
            return ""

        folder = ProcessingConfig.getSetting(GrassUtils.GRASS_FOLDER)
        if folder == None:
            if ProcessingUtils.isWindows():
                testfolder = os.path.dirname(str(QgsApplication.prefixPath()))
                testfolder = os.path.join(testfolder,  "grass")
                if os.path.isdir(testfolder):
                    for subfolder in os.listdir(testfolder):
                        if subfolder.startswith("grass"):
                            folder = os.path.join(testfolder, subfolder)
                            break
            else:
                folder = os.path.join(str(QgsApplication.prefixPath()), "grass")
                if not os.path.isdir(folder):
                    folder = "/Applications/GRASS-6.4.app/Contents/MacOS"

        return folder
开发者ID:alextheleritis,项目名称:QGIS,代码行数:22,代码来源:GrassUtils.py

示例13: otbLibPath

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
 def otbLibPath():
     folder = ProcessingConfig.getSetting(OTBUtils.OTB_LIB_FOLDER)
     if folder == None:
         folder =""
         #try to configure the path automatically
         if ProcessingUtils.isMac():
             testfolder = os.path.join(str(QgsApplication.prefixPath()), "lib/otb/applications")
             if os.path.exists(testfolder):
                 folder = testfolder
             else:
                 testfolder = "/usr/local/lib/otb/applications"
                 if os.path.exists(testfolder):
                     folder = testfolder
         elif ProcessingUtils.isWindows():
             testfolder = os.path.dirname(str(QgsApplication.prefixPath()))
             testfolder = os.path.join(testfolder,  "orfeotoolbox")
             testfolder = os.path.join(testfolder,  "applications")
             if os.path.exists(testfolder):
                 folder = testfolder
         else:
             testfolder = "/usr/lib/otb/applications"
             if os.path.exists(testfolder):
                 folder = testfolder
     return folder
开发者ID:alextheleritis,项目名称:QGIS,代码行数:26,代码来源:OTBUtils.py

示例14: processAlgorithm

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isMac [as 别名]
    def processAlgorithm(self, progress):
        if ProcessingUtils.isWindows():
            path = SagaUtils.sagaPath()
            if path == "":
                raise GeoAlgorithmExecutionException("SAGA folder is not configured.\nPlease configure it before running SAGA algorithms.")
        commands = list()
        self.exportedLayers = {}

        self.preProcessInputs()

        #1: Export rasters to sgrd and vectors to shp
        #   Tables must be in dbf format. We check that.
        if self.resample:
            self.calculateResamplingExtent()
        for param in self.parameters:
            if isinstance(param, ParameterRaster):
                if param.value == None:
                    continue
                value = param.value
                if not value.endswith("sgrd"):
                    commands.append(self.exportRasterLayer(value))
                if self.resample:
                    commands.append(self.resampleRasterLayer(value));
            if isinstance(param, ParameterVector):
                if param.value == None:
                    continue
                layer = QGisLayers.getObjectFromUri(param.value, False)
                if layer:
                    filename = LayerExporter.exportVectorLayer(layer)
                    self.exportedLayers[param.value]=filename
                elif not param.value.endswith("shp"):
                    raise GeoAlgorithmExecutionException("Unsupported file format")
            if isinstance(param, ParameterTable):
                if param.value == None:
                    continue
                table = QGisLayers.getObjectFromUri(param.value, False)
                if table:
                    filename = LayerExporter.exportTable(table)
                    self.exportedLayers[param.value]=filename
                elif not param.value.endswith("shp"):
                        raise GeoAlgorithmExecutionException("Unsupported file format")
            if isinstance(param, ParameterMultipleInput):
                if param.value == None:
                    continue
                layers = param.value.split(";")
                if layers == None or len(layers) == 0:
                    continue
                if param.datatype == ParameterMultipleInput.TYPE_RASTER:
                    for layerfile in layers:
                        if not layerfile.endswith("sgrd"):
                            commands.append(self.exportRasterLayer(layerfile))
                        if self.resample:
                            commands.append(self.resampleRasterLayer(layerfile));
                elif param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY:
                    for layerfile in layers:
                        layer = QGisLayers.getObjectFromUri(layerfile, False)
                        if layer:
                            filename = LayerExporter.exportVectorLayer(layer)
                            self.exportedLayers[layerfile]=filename
                        elif (not layerfile.endswith("shp")):
                            raise GeoAlgorithmExecutionException("Unsupported file format")

        #2: set parameters and outputs
        saga208 = ProcessingConfig.getSetting(SagaUtils.SAGA_208)
        if ProcessingUtils.isWindows() or ProcessingUtils.isMac() or not saga208:
            command = self.undecoratedGroup  + " \"" + self.cmdname + "\""
        else:
            command = "lib" + self.undecoratedGroup  + " \"" + self.cmdname + "\""

        if self.hardcodedStrings:
            for s in self.hardcodedStrings:
                command += " " + s

        for param in self.parameters:
            if param.value is None:
                continue
            if isinstance(param, (ParameterRaster, ParameterVector, ParameterTable)):
                value = param.value
                if value in self.exportedLayers.keys():
                    command += (" -" + param.name + " \"" + self.exportedLayers[value] + "\"")
                else:
                    command += (" -" + param.name + " \"" + value + "\"")
            elif isinstance(param, ParameterMultipleInput):
                s = param.value
                for layer in self.exportedLayers.keys():
                    s = s.replace(layer, self.exportedLayers[layer])
                command += (" -" + param.name + " \"" + s + "\"");
            elif isinstance(param, ParameterBoolean):
                if param.value:
                    command+=(" -" + param.name);
            elif isinstance(param, ParameterFixedTable):
                tempTableFile  = ProcessingUtils.getTempFilename("txt")
                f = open(tempTableFile, "w")
                f.write('\t'.join([col for col in param.cols]) + "\n")
                values = param.value.split(",")
                for i in range(0, len(values), 3):
                    s = values[i] + "\t" + values[i+1] + "\t" + values[i+2] + "\n"
                    f.write(s)
                f.close()
                command+=( " -" + param.name + " \"" + tempTableFile + "\"")
#.........这里部分代码省略.........
开发者ID:alextheleritis,项目名称:QGIS,代码行数:103,代码来源:SagaAlgorithm.py


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