Skip to content
Browse files
fixed #3449 making sure the clipping result has the layers order as i…
…n TOC

git-svn-id: c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
brushtyler committed Feb 3, 2011
1 parent 3f01957 commit fc6fb01fa7aa9a80d2fa3b5b3abeb0da189f823c
Showing with 16 additions and 2 deletions.
  1. +16 −2 python/plugins/GdalTools/tools/
@@ -53,8 +53,10 @@ def onClosing(self):
def fillInputFiles(self):
self.inputFiles = QStringList()

# for each active layer
for i in range(self.canvas.layerCount()):
# Reversed list to have the topmost layer as the last one in the list
# because "In areas of overlap, the last image will be copied over
# earlier ones" (see
for i in range(self.canvas.layerCount()-1, -1, -1):
layer = self.canvas.layer(i)
# only raster layers, but not WMS ones
if layer.type() == layer.RasterLayer and ( not layer.usesProvider() ):
@@ -70,6 +72,9 @@ def fillInputFiles(self):
if self.isVisible() and self.warningDialog.isHidden():
msg = QString("No active raster layers. You must add almost one raster layer to continue.") )

# refresh command when there are no active layers
@@ -114,6 +119,15 @@ def getArguments(self):
if not self.outputFileEdit.text().isEmpty():
arguments << "-o"
arguments << self.outputFileEdit.text()

if self.pctCheck.isChecked() and len(self.inputFiles) > 1:
# The topmost layer in the TOC is the last one in the list (see above),
# but I want to grab the pseudocolor table from the first image (the
# topmost layer in the TOC).
# Workaround: duplicate the last layer inserting it also as the first
# one to grab the pseudocolor table from it.
arguments << self.inputFiles[ len(self.inputFiles)-1 ]

arguments << self.inputFiles
return arguments

0 comments on commit fc6fb01

Please sign in to comment.