-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@68 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
- Loading branch information
volayaf
committed
Apr 10, 2012
1 parent
f499c85
commit 69bc4a0
Showing
12 changed files
with
290 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from PyQt4 import QtGui | ||
from sextante.core.GeoAlgorithm import GeoAlgorithm | ||
from sextante.outputs.OutputRaster import OutputRaster | ||
import os | ||
from sextante.gdal.GdalUtils import GdalUtils | ||
from sextante.core.SextanteUtils import SextanteUtils | ||
from sextante.parameters.ParameterBoolean import ParameterBoolean | ||
from sextante.parameters.ParameterMultipleInput import ParameterMultipleInput | ||
|
||
class merge(GeoAlgorithm): | ||
|
||
INPUT = "INPUT" | ||
OUTPUT = "OUTPUT" | ||
PCT = "PCT" | ||
SEPARATE = "SEPARATE" | ||
|
||
def getIcon(self): | ||
filepath = os.path.dirname(__file__) + "/icons/merge.png" | ||
return QtGui.QIcon(filepath) | ||
|
||
def defineCharacteristics(self): | ||
self.name = "rgb2pct" | ||
self.group = "Conversion" | ||
self.addParameter(ParameterMultipleInput(merge.INPUT, "Input layers", ParameterMultipleInput.TYPE_RASTER)) | ||
self.addParameter(ParameterBoolean(merge.PCT, "Grab pseudocolor table from first layer", False)) | ||
self.addParameter(ParameterBoolean(merge.SEPARATE, "Layer stack", False)) | ||
self.addOutput(OutputRaster(merge.OUTPUT, "Output layer")) | ||
|
||
def processAlgorithm(self, progress): | ||
if SextanteUtils.isWindows(): | ||
commands = ["cmd.exe", "/C ", "merge.bat"] | ||
else: | ||
commands = ["merge.py"] | ||
if self.getParameterValue(merge.SEPARATE): | ||
commands.append("-separate") | ||
if self.getParameterValue(merge.PCT): | ||
commands.append("-pct") | ||
commands.append("-of") | ||
out = self.getOutputValue(merge.OUTPUT) | ||
commands.append(GdalUtils.getFormatShortNameFromFilename(out)) | ||
commands.append(self.getParameterValue(merge.INPUT).replace(";", " ")) | ||
commands.append(out) | ||
|
||
GdalUtils.runGdal(commands, progress) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from PyQt4 import QtGui | ||
from sextante.core.GeoAlgorithm import GeoAlgorithm | ||
from sextante.parameters.ParameterRaster import ParameterRaster | ||
from sextante.outputs.OutputRaster import OutputRaster | ||
import os | ||
from sextante.gdal.GdalUtils import GdalUtils | ||
from sextante.parameters.ParameterSelection import ParameterSelection | ||
from sextante.core.SextanteUtils import SextanteUtils | ||
|
||
class pct2rgb(GeoAlgorithm): | ||
|
||
INPUT = "INPUT" | ||
OUTPUT = "OUTPUT" | ||
NBAND = "NBAND" | ||
|
||
def getIcon(self): | ||
filepath = os.path.dirname(__file__) + "/icons/8-to-24-bits.png" | ||
return QtGui.QIcon(filepath) | ||
|
||
def defineCharacteristics(self): | ||
self.name = "pct2rgb" | ||
self.group = "Conversion" | ||
self.addParameter(ParameterRaster(pct2rgb.INPUT, "Input layer", False)) | ||
self.addParameter(ParameterSelection(pct2rgb.NBAND, "Band to convert", range(25))) | ||
self.addOutput(OutputRaster(pct2rgb.OUTPUT, "Output layer")) | ||
|
||
def processAlgorithm(self, progress): | ||
if SextanteUtils.isWindows(): | ||
commands = ["cmd.exe", "/C ", "pct2rgb.bat"] | ||
else: | ||
commands = ["pct2rgb.py"] | ||
commands.append("-b") | ||
commands.append(str(self.getParameterValue(pct2rgb.NBAND) + 1)) | ||
commands.append("-of") | ||
out = self.getOutputValue(pct2rgb.OUTPUT) | ||
commands.append(GdalUtils.getFormatShortNameFromFilename(out)) | ||
commands.append(self.getParameterValue(pct2rgb.INPUT)) | ||
commands.append(out) | ||
|
||
GdalUtils.runGdal(commands, progress) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from PyQt4 import QtGui | ||
from sextante.core.GeoAlgorithm import GeoAlgorithm | ||
from sextante.parameters.ParameterRaster import ParameterRaster | ||
from sextante.outputs.OutputRaster import OutputRaster | ||
import os | ||
from sextante.gdal.GdalUtils import GdalUtils | ||
from sextante.parameters.ParameterNumber import ParameterNumber | ||
from sextante.core.SextanteUtils import SextanteUtils | ||
|
||
class rgb2pct(GeoAlgorithm): | ||
|
||
INPUT = "INPUT" | ||
OUTPUT = "OUTPUT" | ||
NCOLORS = "NCOLORS" | ||
|
||
def getIcon(self): | ||
filepath = os.path.dirname(__file__) + "/icons/24-to-8-bits.png" | ||
return QtGui.QIcon(filepath) | ||
|
||
def defineCharacteristics(self): | ||
self.name = "rgb2pct" | ||
self.group = "Conversion" | ||
self.addParameter(ParameterRaster(rgb2pct.INPUT, "Input layer", False)) | ||
self.addParameter(ParameterNumber(rgb2pct.NCOLORS, "Number of colors", 1, None, 2)) | ||
self.addOutput(OutputRaster(rgb2pct.OUTPUT, "Output layer")) | ||
|
||
def processAlgorithm(self, progress): | ||
if SextanteUtils.isWindows(): | ||
commands = ["cmd.exe", "/C ", "rgb2pct.bat"] | ||
else: | ||
commands = ["rgb2pct.py"] | ||
commands.append("-n") | ||
commands.append(str(self.getParameterValue(rgb2pct.NCOLORS))) | ||
commands.append("-of") | ||
out = self.getOutputValue(rgb2pct.OUTPUT) | ||
commands.append(GdalUtils.getFormatShortNameFromFilename(out)) | ||
commands.append(self.getParameterValue(rgb2pct.INPUT)) | ||
commands.append(out) | ||
|
||
GdalUtils.runGdal(commands, progress) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from PyQt4 import QtGui | ||
from sextante.core.GeoAlgorithm import GeoAlgorithm | ||
from sextante.parameters.ParameterRaster import ParameterRaster | ||
from sextante.outputs.OutputRaster import OutputRaster | ||
import os | ||
from sextante.gdal.GdalUtils import GdalUtils | ||
|
||
class translate(GeoAlgorithm): | ||
|
||
INPUT = "INPUT" | ||
OUTPUT = "OUTPUT" | ||
|
||
def getIcon(self): | ||
filepath = os.path.dirname(__file__) + "/icons/translate.png" | ||
return QtGui.QIcon(filepath) | ||
|
||
def defineCharacteristics(self): | ||
self.name = "translate" | ||
self.group = "Conversion" | ||
self.addParameter(ParameterRaster(translate.INPUT, "Input layer", False)) | ||
self.addOutput(OutputRaster(translate.OUTPUT, "Output layer")) | ||
|
||
def processAlgorithm(self, progress): | ||
commands = ["gdal_translate"] | ||
commands.append("-of") | ||
out = self.getOutputValue(translate.OUTPUT) | ||
commands.append(GdalUtils.getFormatShortNameFromFilename(out)) | ||
commands.append(self.getParameterValue(translate.INPUT)) | ||
commands.append(out) | ||
|
||
GdalUtils.runGdal(commands, progress) |
Oops, something went wrong.