Esempio n. 1
0
    def batchRun(self):
        self.base.enableRun(False)
        self.base.setCursor(Qt.WaitCursor)

        inDir = self.getInputFileName()

        filter = Utils.getRasterExtensions()
        workDir = QDir(inDir)
        workDir.setFilter(QDir.Files | QDir.NoSymLinks | QDir.NoDotAndDotDot)
        workDir.setNameFilters(filter)
        workFiles = workDir.entryList()

        self.inFiles = Utils.getRasterFiles(inDir,
                                            self.isRecursiveScanEnabled())
        self.outFiles = []

        for f in self.inFiles:
            self.outFiles.append(self.getBatchOutputFileName(f))

        self.errors = QStringList()
        self.batchIndex = 0
        self.batchTotal = len(self.inFiles)
        self.setProgressRange(self.batchTotal)

        self.runItem(self.batchIndex, self.batchTotal)
Esempio n. 2
0
    def accept(self):
        self.inFiles = None
        if self.batchCheck.isChecked():
            self.inFiles = Utils.getRasterFiles(self.inSelector.filename(),
                                                self.recurseCheck.isChecked())
        else:
            self.inFiles = [self.inSelector.filename()]

        self.progressBar.setRange(0, len(self.inFiles))

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        self.okButton.setEnabled(False)

        self.extractor = ExtractThread(self.inFiles, self.prjCheck.isChecked())
        QObject.connect(self.extractor, SIGNAL("fileProcessed()"),
                        self.updateProgress)
        QObject.connect(self.extractor, SIGNAL("processFinished()"),
                        self.processingFinished)
        QObject.connect(self.extractor, SIGNAL("processInterrupted()"),
                        self.processingInterrupted)

        QObject.disconnect(self.buttonBox, SIGNAL("rejected()"), self.reject)
        QObject.connect(self.buttonBox, SIGNAL("rejected()"),
                        self.stopProcessing)

        self.extractor.start()
Esempio n. 3
0
 def getArguments(self):
     arguments = []
     if self.resolutionCheck.isChecked() and self.resolutionComboBox.currentIndex() >= 0:
         arguments.append("-resolution")
         arguments.append(self.resolutions[self.resolutionComboBox.currentIndex()])
     if self.separateCheck.isChecked():
         arguments.append("-separate")
     if self.srcNoDataCheck.isChecked():
         nodata = self.noDataEdit.text().strip()
         if nodata:
             arguments.append("-srcnodata")
             arguments.append(nodata)
     if self.targetSRSCheck.isChecked() and self.targetSRSEdit.text():
         arguments.append("-a_srs")
         arguments.append(self.targetSRSEdit.text())
     if self.allowProjDiffCheck.isChecked():
         arguments.append("-allow_projection_difference")
     arguments.append(self.getOutputFileName())
     if self.inputSelLayersCheck.isChecked():
         arguments.extend(self.visibleRasterLayers)
     elif self.inputDirCheck.isChecked():
         arguments.extend(Utils.getRasterFiles(self.getInputFileName(), self.recurseCheck.isChecked()))
     else:
         arguments.extend(self.getInputFileName())
     return arguments
Esempio n. 4
0
 def getArguments(self):
     arguments = []
     if self.resolutionCheck.isChecked(
     ) and self.resolutionComboBox.currentIndex() >= 0:
         arguments.append("-resolution")
         arguments.append(
             self.resolutions[self.resolutionComboBox.currentIndex()])
     if self.separateCheck.isChecked():
         arguments.append("-separate")
     if self.srcNoDataCheck.isChecked():
         nodata = self.noDataEdit.text().strip()
         if nodata:
             arguments.append("-srcnodata")
             arguments.append(nodata)
     if self.targetSRSCheck.isChecked() and self.targetSRSEdit.text():
         arguments.append("-a_srs")
         arguments.append(self.targetSRSEdit.text())
     if self.allowProjDiffCheck.isChecked():
         arguments.append("-allow_projection_difference")
     arguments.append(self.getOutputFileName())
     if self.inputSelLayersCheck.isChecked():
         arguments.extend(self.visibleRasterLayers)
     elif self.inputDirCheck.isChecked():
         arguments.extend(
             Utils.getRasterFiles(self.getInputFileName(),
                                  self.recurseCheck.isChecked()))
     else:
         arguments.extend(self.getInputFileName())
     return arguments
Esempio n. 5
0
 def getArguments(self):
     arguments = []
     if self.indexFieldCheck.isChecked() and self.indexFieldEdit.text():
         arguments.append("-tileindex")
         arguments.append(self.indexFieldEdit.text())
     if self.skipDifferentProjCheck.isChecked():
         arguments.append("-skip_different_projection")
     arguments.append(self.getOutputFileName())
     arguments.extend(Utils.getRasterFiles(self.getInputFileName(), self.recurseCheck.isChecked()))
     return arguments
Esempio n. 6
0
 def getArguments( self ):
     arguments = QStringList()
     if self.indexFieldCheck.isChecked() and not self.indexFieldEdit.text().isEmpty():
       arguments << "-tileindex"
       arguments << self.indexFieldEdit.text()
     if self.absolutePathCheck.isChecked():
       arguments << "-write_absolute_path"
     if self.skipDifferentProjCheck.isChecked():
       arguments << "-skip_different_projection"
     arguments << self.getOutputFileName()
     arguments << Utils.getRasterFiles( self.getInputFileName(), self.recurseCheck.isChecked() )
     return arguments
Esempio n. 7
0
 def getArguments( self ):
     arguments = []
     if self.indexFieldCheck.isChecked() and self.indexFieldEdit.text():
       arguments.append("-tileindex")
       arguments.append(self.indexFieldEdit.text())
     if self.absolutePathCheck.isChecked():
       arguments.append("-write_absolute_path")
     if self.skipDifferentProjCheck.isChecked():
       arguments.append("-skip_different_projection")
     arguments.append(self.getOutputFileName())
     arguments.extend(Utils.getRasterFiles( self.getInputFileName(), self.recurseCheck.isChecked() ))
     return arguments
Esempio n. 8
0
 def getArguments(self):
     arguments = QStringList()
     if self.resolutionCheck.isChecked() and self.resolutionComboBox.currentIndex() >= 0:
       arguments << "-resolution"
       arguments << self.resolutions[self.resolutionComboBox.currentIndex()]
     if self.separateCheck.isChecked():
       arguments << "-separate"
     if self.srcNoDataCheck.isChecked():
       arguments << "-srcnodata"
       arguments << str(self.srcNoDataSpin.value())
     arguments << self.outputFileEdit.text()
     if self.inputDirCheck.isChecked():
       arguments << Utils.getRasterFiles( self.inputFilesEdit.text(), self.recurseCheck.isChecked() )
     else:
       arguments << self.inputFilesEdit.text().split(",")
     return arguments
Esempio n. 9
0
 def getArguments(self):
     arguments = QStringList()
     if self.resolutionCheck.isChecked() and self.resolutionComboBox.currentIndex() >= 0:
       arguments << "-resolution"
       arguments << self.resolutions[self.resolutionComboBox.currentIndex()]
     if self.separateCheck.isChecked():
       arguments << "-separate"
     if self.srcNoDataCheck.isChecked():
       arguments << "-srcnodata"
       arguments << str(self.srcNoDataSpin.value())
     if self.allowProjDiffCheck.isChecked():
       arguments << "-allow_projection_difference"
     arguments << self.getOutputFileName()
     if self.inputDirCheck.isChecked():
       arguments << Utils.getRasterFiles( self.getInputFileName(), self.recurseCheck.isChecked() )
     else:
       arguments << self.getInputFileName()
     return arguments
Esempio n. 10
0
  def batchRun(self):
      self.base.enableRun( False )
      self.base.setCursor( Qt.WaitCursor )

      inDir = self.getInputFileName()

      self.inFiles = Utils.getRasterFiles( inDir, self.isRecursiveScanEnabled() )
      self.outFiles = []

      for f in self.inFiles:
        self.outFiles.append( self.getBatchOutputFileName( f ) )

      self.errors = QStringList()
      self.batchIndex = 0
      self.batchTotal = len( self.inFiles )
      self.setProgressRange( self.batchTotal )

      self.runItem( self.batchIndex, self.batchTotal )
Esempio n. 11
0
 def getArguments(self):
     arguments = QStringList()
     if self.resolutionCheck.isChecked(
     ) and self.resolutionComboBox.currentIndex() >= 0:
         arguments << "-resolution"
         arguments << self.resolutions[
             self.resolutionComboBox.currentIndex()]
     if self.separateCheck.isChecked():
         arguments << "-separate"
     if self.srcNoDataCheck.isChecked():
         arguments << "-srcnodata"
         arguments << str(self.srcNoDataSpin.value())
     arguments << self.getOutputFileName()
     if self.inputDirCheck.isChecked():
         arguments << Utils.getRasterFiles(self.getInputFileName(),
                                           self.recurseCheck.isChecked())
     else:
         arguments << self.getInputFileName()
     return arguments
Esempio n. 12
0
  def batchRun(self):
      self.inFiles = Utils.getRasterFiles( self.getInputFileName(), self.isRecursiveScanEnabled() )
      if len(self.inFiles) == 0: 
        QMessageBox.warning( self, self.tr( "Warning" ), self.tr( "No input files to process." ) )
        return

      self.outFiles = []
      for f in self.inFiles:
        self.outFiles.append( self.getBatchOutputFileName( f ) )

      self.base.enableRun( False )
      self.base.setCursor( Qt.WaitCursor )

      self.errors = []
      self.batchIndex = 0
      self.batchTotal = len( self.inFiles )
      self.setProgressRange( self.batchTotal )

      self.runItem( self.batchIndex, self.batchTotal )
Esempio n. 13
0
  def batchRun(self):
      self.inFiles = Utils.getRasterFiles( self.getInputFileName(), self.isRecursiveScanEnabled() )
      if len(self.inFiles) == 0:
        QMessageBox.warning( self, self.tr( "Warning" ), self.tr( "No input files to process." ) )
        return

      self.outFiles = []
      for f in self.inFiles:
        self.outFiles.append( self.getBatchOutputFileName( f ) )

      self.base.enableRun( False )
      self.base.setCursor( Qt.WaitCursor )

      self.errors = []
      self.batchIndex = 0
      self.batchTotal = len( self.inFiles )
      self.setProgressRange( self.batchTotal )

      self.runItem( self.batchIndex, self.batchTotal )
Esempio n. 14
0
 def getArguments(self):
     arguments = []
     if self.resolutionCheck.isChecked() and self.resolutionComboBox.currentIndex() >= 0:
         arguments.append("-resolution")
         arguments.append(self.resolutions[self.resolutionComboBox.currentIndex()])
     if self.separateCheck.isChecked():
         arguments.append("-separate")
     if self.srcNoDataCheck.isChecked():
         arguments.append("-srcnodata")
         arguments.append(unicode(self.srcNoDataSpin.value()))
     if self.allowProjDiffCheck.isChecked():
         arguments.append("-allow_projection_difference")
     arguments.append(self.getOutputFileName())
     if self.inputSelLayersCheck.isChecked():
         arguments.extend(self.visibleRasterLayers)
     elif self.inputDirCheck.isChecked():
         arguments.extend(Utils.getRasterFiles(self.getInputFileName(), self.recurseCheck.isChecked()))
     else:
         arguments.extend(self.getInputFileName())
     return arguments
Esempio n. 15
0
  def accept( self ):
    self.inFiles = None
    if self.batchCheck.isChecked():
      self.inFiles = Utils.getRasterFiles( self.inSelector.filename(), self.recurseCheck.isChecked() )
    else:
      self.inFiles = [ self.inSelector.filename() ]

    self.progressBar.setRange( 0, len( self.inFiles ) )

    QApplication.setOverrideCursor( QCursor( Qt.WaitCursor ) )
    self.okButton.setEnabled( False )

    self.extractor = ExtractThread( self.inFiles, self.prjCheck.isChecked() )
    QObject.connect( self.extractor, SIGNAL( "fileProcessed()" ), self.updateProgress )
    QObject.connect( self.extractor, SIGNAL( "processFinished()" ), self.processingFinished )
    QObject.connect( self.extractor, SIGNAL( "processInterrupted()" ), self.processingInterrupted )

    QObject.disconnect( self.buttonBox, SIGNAL( "rejected()" ), self.reject )
    QObject.connect( self.buttonBox, SIGNAL( "rejected()" ), self.stopProcessing )

    self.extractor.start()
Esempio n. 16
0
 def getArguments(self):
     arguments = QStringList()
     if self.resolutionCheck.isChecked(
     ) and self.resolutionComboBox.currentIndex() >= 0:
         arguments << "-resolution"
         arguments << self.resolutions[
             self.resolutionComboBox.currentIndex()]
     if self.separateCheck.isChecked():
         arguments << "-separate"
     if self.srcNoDataCheck.isChecked():
         arguments << "-srcnodata"
         arguments << str(self.srcNoDataSpin.value())
     if self.allowProjDiffCheck.isChecked():
         arguments << "-allow_projection_difference"
     arguments << self.getOutputFileName()
     if self.inputSelLayersCheck.isChecked():
         arguments << self.visibleRasterLayers
     elif self.inputDirCheck.isChecked():
         arguments << Utils.getRasterFiles(self.getInputFileName(),
                                           self.recurseCheck.isChecked())
     else:
         arguments << self.getInputFileName()
     return arguments
Esempio n. 17
0
 def getArguments(self):
     arguments = []
     if self.resolutionCheck.isChecked(
     ) and self.resolutionComboBox.currentIndex() >= 0:
         arguments.append("-resolution")
         arguments.append(
             self.resolutions[self.resolutionComboBox.currentIndex()])
     if self.separateCheck.isChecked():
         arguments.append("-separate")
     if self.srcNoDataCheck.isChecked():
         arguments.append("-srcnodata")
         arguments.append(unicode(self.srcNoDataSpin.value()))
     if self.allowProjDiffCheck.isChecked():
         arguments.append("-allow_projection_difference")
     arguments.append(self.getOutputFileName())
     if self.inputSelLayersCheck.isChecked():
         arguments.extend(self.visibleRasterLayers)
     elif self.inputDirCheck.isChecked():
         arguments.extend(
             Utils.getRasterFiles(self.getInputFileName(),
                                  self.recurseCheck.isChecked()))
     else:
         arguments.extend(self.getInputFileName())
     return arguments
  def batchRun(self):
      self.base.enableRun( False )
      self.base.setCursor( Qt.WaitCursor )

      inDir = self.getInputFileName()

      filter = Utils.getRasterExtensions()
      workDir = QDir( inDir )
      workDir.setFilter( QDir.Files | QDir.NoSymLinks | QDir.NoDotAndDotDot )
      workDir.setNameFilters( filter )
      workFiles = workDir.entryList()

      self.inFiles = Utils.getRasterFiles( inDir, self.isRecursiveScanEnabled() )
      self.outFiles = []

      for f in self.inFiles:
        self.outFiles.append( self.getBatchOutputFileName( f ) )

      self.errors = QStringList()
      self.batchIndex = 0
      self.batchTotal = len( self.inFiles )
      self.setProgressRange( self.batchTotal )

      self.runItem( self.batchIndex, self.batchTotal )
Esempio n. 19
0
 def getInputFileNames(self):
     if self.inputDirCheck.isChecked():
       return Utils.getRasterFiles( self.inSelector.filename(), self.recurseCheck.isChecked() )
     return self.inSelector.filename().split(",", QString.SkipEmptyParts)
Esempio n. 20
0
 def getInputFileNames(self):
     if self.inputDirCheck.isChecked():
         return Utils.getRasterFiles(self.inSelector.filename(),
                                     self.recurseCheck.isChecked())
     return self.inSelector.filename().split(",")