Skip to content
Permalink
Browse files

[GdalTools] minor changes to ui and code (follow 32be475)

  • Loading branch information
brushtyler committed Oct 25, 2015
1 parent 55b068f commit 22aea3201b40b99537203838a83d02282610147d
Showing with 155 additions and 113 deletions.
  1. +8 −9 python/plugins/GdalTools/tools/doClipper.py
  2. +147 −104 python/plugins/GdalTools/tools/widgetClipper.ui
@@ -56,7 +56,6 @@ def __init__(self, iface):
(self.maskSelector, SIGNAL("filenameChanged()"), self.maskModeRadio, 1600),
(self.alphaBandCheck, SIGNAL("stateChanged(int)")),
(self.cropToCutlineCheck, SIGNAL("stateChanged(int)")),
([self.xRes, self.yRes], SIGNAL("valueChanged(double)"), self.keepResolutionRadio),
([self.xRes, self.yRes], SIGNAL("valueChanged(double)"), self.setResolutionRadio),
(self.extentSelector, [SIGNAL("selectionStarted()"), SIGNAL("newExtentDefined()")], self.extentModeRadio),
(self.modeStackedWidget, SIGNAL("currentIndexChanged(int)"))
@@ -92,9 +91,9 @@ def switchClippingMode(self):

def switchResolutionMode(self):
if self.keepResolutionRadio.isChecked():
self.resolutionStackedWidget.setCurrentIndex(0)
self.resolutionWidget.hide()
else:
self.resolutionStackedWidget.setCurrentIndex(1)
self.resolutionWidget.show()

def checkRun(self):
if self.extentModeRadio.isChecked():
@@ -162,11 +161,12 @@ def getArgsModeExtent(self):
arguments.append(unicode(rect.yMaximum()))
arguments.append(unicode(rect.xMaximum()))
arguments.append(unicode(rect.yMinimum()))
if not self.getOutputFileName() == '':
outputFn = self.getOutputFileName()
if not outputFn == '':
arguments.append("-of")
arguments.append(self.outputFormat)
arguments.append(inputFn)
arguments.append(self.getOutputFileName())
arguments.append(outputFn)
return arguments

def getArgsModeMask(self):
@@ -188,16 +188,15 @@ def getArgsModeMask(self):
if self.alphaBandCheck.isChecked():
arguments.append("-dstalpha")
if self.keepResolutionRadio.isChecked():
arguments.append("-tr")
resolution = Utils.getRasterResolution(self.getInputFileName())
resolution = Utils.getRasterResolution(inputFn)
if resolution is not None:
arguments.append("-tr")
arguments.append(resolution[0])
arguments.append(resolution[1])
if self.setResolutionRadio.isChecked():
else:
arguments.append("-tr")
arguments.append(unicode(self.xRes.value()))
arguments.append(unicode(self.yRes.value()))

outputFn = self.getOutputFileName()
if not outputFn == '':
arguments.append("-of")
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>485</width>
<height>341</height>
<width>531</width>
<height>330</height>
</rect>
</property>
<property name="sizePolicy">
@@ -20,6 +20,9 @@
<string>Clipper</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
@@ -73,6 +76,9 @@
<string>Clipping mode</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="0" colspan="2">
<widget class="QStackedWidget" name="modeStackedWidget">
<property name="currentIndex">
@@ -95,6 +101,19 @@
<item row="0" column="0">
<widget class="GdalToolsExtentSelector" name="extentSelector" native="true"/>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
@@ -111,126 +130,131 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<widget class="GdalToolsInOutSelector" name="maskSelector" native="true"/>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="cropToCutlineCheck">
<property name="text">
<string>Crop the extent of the target dataset to the extent of the cutline</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="alphaBandCheck">
<property name="text">
<string>Create an output alpha band</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="GdalToolsInOutSelector" name="maskSelector" native="true"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mask layer</string>
</property>
</widget>
</item>
<item row="3" column="0" rowspan="5" colspan="2">
<widget class="QGroupBox" name="gridGroupBox">
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="1" alignment="Qt::AlignHCenter">
<widget class="QGroupBox" name="resolutionGroup">
<layout class="QGridLayout" name="gridLayout_6">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="0" colspan="2">
<widget class="QWidget" name="resolutionWidget" native="true">
<layout class="QGridLayout" name="gridLayout_7">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>X Resolution</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="xRes">
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>999999.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>12.500000000000000</double>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Y Resolution</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QDoubleSpinBox" name="yRes">
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>999999.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>12.500000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="setResolutionRadio">
<property name="text">
<string>Set output file resolution</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QStackedWidget" name="resolutionStackedWidget">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page_3"/>
<widget class="QWidget" name="resolutionWidget">
<layout class="QGridLayout" name="gridLayout_5" columnstretch="0,0,0,0,0">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="0" column="4">
<widget class="QDoubleSpinBox" name="yRes">
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>999999.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>12.500000000000000</double>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QDoubleSpinBox" name="xRes">
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>999999.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>12.500000000000000</double>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Y Resolution</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_4">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>X Resolution</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="0" column="0" alignment="Qt::AlignHCenter">
<item row="0" column="0">
<widget class="QRadioButton" name="keepResolutionRadio">
<property name="text">
<string>Keep resolution of input raster</string>
@@ -256,6 +280,13 @@
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="cropToCutlineCheck">
<property name="text">
<string>Crop the extent of the target dataset to the extent of the cutline</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@@ -266,7 +297,19 @@
<string/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QRadioButton" name="extentModeRadio">
<property name="text">
<string>Extent</string>
@@ -276,7 +319,7 @@
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<item>
<widget class="QRadioButton" name="maskModeRadio">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>

0 comments on commit 22aea32

Please sign in to comment.
You can’t perform that action at this time.