コード例 #1
0
ファイル: ModelerUtils.py プロジェクト: alextheleritis/QGIS
    def modelsFolder():
        folder = ProcessingConfig.getSetting(ModelerUtils.MODELS_FOLDER)
        if folder == None:
            folder = unicode(os.path.join(ProcessingUtils.userFolder(), "models"))
        mkdir(folder)

        return os.path.abspath(folder)
コード例 #2
0
 def WpsDescriptionFolder():
     folder = ProcessingConfig.getSetting(
         WpsAlgorithmProvider.WPS_DESCRIPTIONS)
     if folder == None:
         folder = str(os.path.join(ProcessingUtils.userFolder(), "wps"))
     mkdir(folder)
     return os.path.abspath(folder)
コード例 #3
0
ファイル: RUtils.py プロジェクト: alextheleritis/QGIS
    def RScriptsFolder():
        folder = ProcessingConfig.getSetting(RUtils.RSCRIPTS_FOLDER)
        if folder == None:
            folder = unicode(os.path.join(ProcessingUtils.userFolder(), "rscripts"))
        mkdir(folder)

        return os.path.abspath(folder)
コード例 #4
0
ファイル: RUtils.py プロジェクト: xxsurvey/Quantum-GIS
    def RScriptsFolder():
        folder = ProcessingConfig.getSetting(RUtils.RSCRIPTS_FOLDER)
        if folder == None:
            folder = unicode(
                os.path.join(ProcessingUtils.userFolder(), "rscripts"))
        mkdir(folder)

        return os.path.abspath(folder)
コード例 #5
0
ファイル: ModelerUtils.py プロジェクト: xxsurvey/Quantum-GIS
    def modelsFolder():
        folder = ProcessingConfig.getSetting(ModelerUtils.MODELS_FOLDER)
        if folder == None:
            folder = unicode(
                os.path.join(ProcessingUtils.userFolder(), "models"))
        mkdir(folder)

        return os.path.abspath(folder)
コード例 #6
0
def createBaseHelpFile(alg, folder):
    folder = os.path.join(folder, alg.provider.getName().lower())
    mkdir(folder)
    cmdLineName = alg.commandLineName()[alg.commandLineName().find(":") + 1:].lower()
    validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    safeFilename = ''.join(c for c in cmdLineName if c in validChars)
    filepath = os.path.join(folder, safeFilename + ".rst")
    file = open(filepath, "w")
    file.write(alg.name.upper())
    file.write("\n")
    file.write("=" * len(alg.name))
    file.write("\n\n")
    file.write("Description\n")
    file.write("-----------\n\n")
    file.write("Parameters\n")
    file.write("----------\n\n")
    for param in alg.parameters:
        file.write("- ``" + param.description + "[" + param.parameterName()[9:] + "]``:\n")
    file.write("\nOutputs\n")
    file.write("-------\n\n")
    for out in alg.outputs:
        file.write("- ``" + out.description + "[" + out.outputTypeName()[6:] + "]``:\n")
    file.write("\nSee also\n")
    file.write("---------\n\n")
    file.write("\nConsole usage\n")
    file.write("-------------\n\n")
    file.write("\n::\n\n")
    s = "\tprocessing.runalg('" + alg.commandLineName() + "', "
    for param in alg.parameters:
        s+= str(param.name.lower().strip()) + ", "
    for out in alg.outputs:
        if not out.hidden:
            s+=str(out.name.lower().strip()) + ", "
    s = s[:-2] +")\n"
    file.write(s)

    s =""
    hasSelection = False
    for param in alg.parameters:
        if isinstance(param, ParameterSelection):
            hasSelection = True
            s+="\n\t" + param.name.lower() + "(" + param.description + ")\n"
            i=0
            for option in param.options:
                s+= "\t\t" + str(i) + " - " + str(option) + "\n"
                i+=1
    if hasSelection:
        file.write("\n\tAvailable options for selection parameters:\n")
        file.write(s)
    file.close()
コード例 #7
0
ファイル: GrassUtils.py プロジェクト: alextheleritis/QGIS
    def createTempMapset():
        '''Creates a temporary location and mapset(s) for GRASS data processing. A minimal set of folders and files is created in the
         system's default temporary directory. The settings files are written with sane defaults, so GRASS can do its work. The mapset
         projection will be set later, based on the projection of the first input image or vector'''

        folder = GrassUtils.grassMapsetFolder()
        mkdir(os.path.join(folder, "PERMANENT"))
        mkdir(os.path.join(folder, "PERMANENT", ".tmp"))
        GrassUtils.writeGrassWindow(os.path.join(folder, "PERMANENT", "DEFAULT_WIND"));
        outfile = open(os.path.join(folder, "PERMANENT", "MYNAME"), "w")
        outfile.write("QGIS GRASS interface: temporary data processing location.\n");
        outfile.close();
        GrassUtils.writeGrassWindow(os.path.join(folder, "PERMANENT", "WIND"))
        mkdir(os.path.join(folder, "PERMANENT", "dbf"))
        outfile = open(os.path.join(folder, "PERMANENT", "VAR"), "w")
        outfile.write("DB_DRIVER: dbf\n")
        outfile.write("DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\n")
        outfile.close()
コード例 #8
0
    def createTempMapset():
        '''Creates a temporary location and mapset(s) for GRASS data processing. A minimal set of folders and files is created in the
         system's default temporary directory. The settings files are written with sane defaults, so GRASS can do its work. The mapset
         projection will be set later, based on the projection of the first input image or vector'''

        folder = GrassUtils.grassMapsetFolder()
        mkdir(os.path.join(folder, "PERMANENT"))
        mkdir(os.path.join(folder, "PERMANENT", ".tmp"))
        GrassUtils.writeGrassWindow(
            os.path.join(folder, "PERMANENT", "DEFAULT_WIND"))
        outfile = open(os.path.join(folder, "PERMANENT", "MYNAME"), "w")
        outfile.write(
            "QGIS GRASS interface: temporary data processing location.\n")
        outfile.close()
        GrassUtils.writeGrassWindow(os.path.join(folder, "PERMANENT", "WIND"))
        mkdir(os.path.join(folder, "PERMANENT", "dbf"))
        outfile = open(os.path.join(folder, "PERMANENT", "VAR"), "w")
        outfile.write("DB_DRIVER: dbf\n")
        outfile.write("DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\n")
        outfile.close()
コード例 #9
0
 def commandsFolder(self):
     folder = unicode(os.path.join(ProcessingUtils.userFolder(), "commander"))
     mkdir(folder)
     return os.path.abspath(folder)
コード例 #10
0
 def grassDataFolder():
     tempfolder = os.path.join(ProcessingUtils.tempFolder(), "grassdata")
     mkdir(tempfolder)
     return tempfolder
コード例 #11
0
 def grassMapsetFolder():
     folder = os.path.join(GrassUtils.grassDataFolder(), "temp_location")
     mkdir(folder)
     return folder
コード例 #12
0
 def WpsDescriptionFolder():
     folder = ProcessingConfig.getSetting(WpsAlgorithmProvider.WPS_DESCRIPTIONS)
     if folder == None:
         folder = unicode(os.path.join(ProcessingUtils.userFolder(), "wps"))
     mkdir(folder)
     return os.path.abspath(folder)
コード例 #13
0
ファイル: GrassUtils.py プロジェクト: alextheleritis/QGIS
 def grassDataFolder():
     tempfolder = os.path.join(ProcessingUtils.tempFolder(), "grassdata")
     mkdir(tempfolder)
     return tempfolder
コード例 #14
0
ファイル: GrassUtils.py プロジェクト: alextheleritis/QGIS
 def grassMapsetFolder():
     folder = os.path.join(GrassUtils.grassDataFolder(), "temp_location")
     mkdir(folder)
     return folder