Skip to content

Commit 1650e86

Browse files
author
brushtyler
committedDec 27, 2010
define extent for grid analisys, to fix #3332
git-svn-id: http://svn.osgeo.org/qgis/trunk@14976 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 517c002 commit 1650e86

File tree

7 files changed

+676
-442
lines changed

7 files changed

+676
-442
lines changed
 

‎python/plugins/GdalTools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def name():
2222
def description():
2323
return "Integrate gdal tools into qgis"
2424
def version():
25-
return "Version 1.2.19"
25+
return "Version 1.2.20"
2626
def qgisMinimumVersion():
2727
return "1.0"
2828
def icon():

‎python/plugins/GdalTools/tools/doClipper.py

Lines changed: 13 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ def __init__(self, iface):
1515
self.iface = iface
1616
self.canvas = self.iface.mapCanvas()
1717

18-
self.clipper = ClipperSelector(self.canvas)
19-
2018
self.setupUi(self)
2119
BasePluginWidget.__init__(self, self.iface, "gdal_merge.py", None, self.iface.mainWindow())
2220

21+
self.extentSelector.setCanvas(self.canvas)
2322
self.outputFormat = Utils.fillRasterOutputFormat()
2423

2524
self.inputFiles = QStringList()
@@ -29,50 +28,28 @@ def __init__(self, iface):
2928
[
3029
(self.outputFileEdit, SIGNAL("textChanged(const QString &)")),
3130
(self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck),
32-
(self.pctCheck, SIGNAL("stateChanged(int)"))
31+
(self.pctCheck, SIGNAL("stateChanged(int)")),
32+
( self.extentSelector, [SIGNAL("selectionStarted()"), SIGNAL("newExtentDefined()")] )
3333
]
3434
)
3535

3636
self.connect(self.selectOutputFileButton, SIGNAL("clicked()"), self.fillOutputFileEdit)
37-
self.connect(self.clipper, SIGNAL("clippingRectangleCreated()"), self.fillCoords)
38-
self.connect(self.x1CoordEdit, SIGNAL("textChanged(const QString &)"), self.coordsChanged)
39-
self.connect(self.x2CoordEdit, SIGNAL("textChanged(const QString &)"), self.coordsChanged)
40-
self.connect(self.y1CoordEdit, SIGNAL("textChanged(const QString &)"), self.coordsChanged)
41-
self.connect(self.y2CoordEdit, SIGNAL("textChanged(const QString &)"), self.coordsChanged)
42-
self.connect(self.clipper, SIGNAL("deactivated()"), self.pauseClipping)
43-
self.connect(self.btnEnableClip, SIGNAL("clicked()"), self.startClipping)
37+
self.connect(self.extentSelector, SIGNAL("newExtentDefined()"), self.checkRun)
38+
self.connect(self.extentSelector, SIGNAL("selectionStarted()"), self.checkRun)
4439

4540
def show_(self):
4641
self.connect(self.canvas, SIGNAL("layersChanged()"), self.fillInputFiles)
47-
self.btnEnableClip.setVisible(False)
42+
self.extentSelector.start()
4843
BasePluginWidget.show_(self)
4944

5045
self.fillInputFiles()
51-
self.fillCoords()
46+
self.checkRun()
5247

5348
def onClosing(self):
5449
self.disconnect(self.canvas, SIGNAL("layersChanged()"), self.fillInputFiles)
55-
self.stopClipping()
50+
self.extentSelector.stop()
5651
BasePluginWidget.onClosing(self)
5752

58-
def stopClipping(self):
59-
self.isClippingStarted = False
60-
self.canvas.unsetMapTool(self.clipper)
61-
self.clipper.reset()
62-
self.btnEnableClip.setVisible(False)
63-
64-
def startClipping(self):
65-
self.canvas.setMapTool(self.clipper)
66-
self.isClippingStarted = True
67-
self.btnEnableClip.setVisible(False)
68-
self.coordsChanged()
69-
70-
def pauseClipping(self):
71-
if not self.isClippingStarted:
72-
return
73-
74-
self.btnEnableClip.setVisible(True)
75-
7653
def fillInputFiles(self):
7754
self.inputFiles = QStringList()
7855

@@ -88,59 +65,19 @@ def fillInputFiles(self):
8865
self.inputFiles << layer.source()
8966

9067
if self.inputFiles.isEmpty():
91-
self.stopClipping()
68+
self.extentSelector.stop()
9269

9370
if self.isVisible() and self.warningDialog.isHidden():
9471
msg = QString( self.tr("No active raster layers. You must add almost one raster layer to continue.") )
9572
self.warningDialog.showMessage(msg)
9673
else:
9774
self.warningDialog.hide()
98-
self.startClipping()
99-
100-
self.checkRun()
101-
102-
def isCoordsValid(self):
103-
return not ( self.x1CoordEdit.text().isEmpty() or \
104-
self.x2CoordEdit.text().isEmpty() or \
105-
self.y1CoordEdit.text().isEmpty() or \
106-
self.y2CoordEdit.text().isEmpty() )
107-
108-
def coordsChanged(self):
109-
if not self.isCoordsValid():
110-
self.clipper.setClippingRectangle(None)
111-
else:
112-
point1 = QgsPoint( float(self.x1CoordEdit.text()), float(self.y1CoordEdit.text()) )
113-
point2 = QgsPoint( float(self.x2CoordEdit.text()), float(self.y2CoordEdit.text()) )
114-
rect = QgsRectangle(point1, point2)
115-
116-
self.clipper.setClippingRectangle(rect)
117-
118-
self.checkRun()
119-
120-
def fillCoords(self):
121-
rect = self.clipper.clippingRectangle()
122-
if rect != None:
123-
self.x1CoordEdit.setText( str(rect.xMinimum()) )
124-
self.x2CoordEdit.setText( str(rect.xMaximum()) )
125-
self.y1CoordEdit.setText( str(rect.yMaximum()) )
126-
self.y2CoordEdit.setText( str(rect.yMinimum()) )
127-
else:
128-
self.x1CoordEdit.clear()
129-
self.x2CoordEdit.clear()
130-
self.y1CoordEdit.clear()
131-
self.y2CoordEdit.clear()
75+
self.extentSelector.start()
13276

13377
self.checkRun()
13478

13579
def checkRun(self):
136-
self.someValueChanged()
137-
138-
self.x1CoordEdit.setEnabled( not self.inputFiles.isEmpty() )
139-
self.x2CoordEdit.setEnabled( not self.inputFiles.isEmpty() )
140-
self.y1CoordEdit.setEnabled( not self.inputFiles.isEmpty() )
141-
self.y2CoordEdit.setEnabled( not self.inputFiles.isEmpty() )
142-
143-
self.base.enableRun( not self.inputFiles.isEmpty() and self.isCoordsValid() )
80+
self.base.enableRun( not self.inputFiles.isEmpty() and self.extentSelector.getExtent() != None )
14481

14582
def fillOutputFileEdit(self):
14683
lastUsedFilter = Utils.FileFilter.lastUsedRasterFilter()
@@ -163,8 +100,8 @@ def getArguments(self):
163100
arguments << str(self.noDataSpin.value())
164101
if self.pctCheck.isChecked():
165102
arguments << "-pct"
166-
if self.isCoordsValid():
167-
rect = self.clipper.clippingRectangle()
103+
if self.extentSelector.isCoordsValid():
104+
rect = self.extentSelector.getExtent()
168105
if rect != None:
169106
arguments << "-ul_lr"
170107
arguments << str(rect.xMinimum())
@@ -186,77 +123,3 @@ def getOutputFileName(self):
186123
def addLayerIntoCanvas(self, fileInfo):
187124
self.iface.addRasterLayer(fileInfo.filePath())
188125

189-
190-
class ClipperSelector(QgsMapToolEmitPoint):
191-
def __init__(self, canvas):
192-
self.canvas = canvas
193-
QgsMapToolEmitPoint.__init__(self, self.canvas)
194-
195-
self.rubberBand = QgsRubberBand( self.canvas, True ) # true, its a polygon
196-
self.rubberBand.setColor( Qt.red )
197-
self.rubberBand.setWidth( 1 )
198-
199-
self.isEmittingPoint = False
200-
201-
self.startPoint = self.endPoint = None
202-
203-
def reset(self):
204-
self.isEmittingPoint = False
205-
self.rubberBand.reset( True ) # true, its a polygon
206-
207-
def canvasPressEvent(self, e):
208-
self.startPoint = self.toMapCoordinates( e.pos() )
209-
self.endPoint = self.startPoint
210-
self.isEmittingPoint = True
211-
212-
self.showRect(self.startPoint, self.endPoint)
213-
214-
def canvasReleaseEvent(self, e):
215-
self.isEmittingPoint = False
216-
self.emit( SIGNAL("clippingRectangleCreated()") )
217-
218-
def canvasMoveEvent(self, e):
219-
if not self.isEmittingPoint:
220-
return
221-
222-
self.endPoint = self.toMapCoordinates( e.pos() )
223-
self.showRect(self.startPoint, self.endPoint)
224-
225-
def showRect(self, startPoint, endPoint):
226-
self.rubberBand.reset( True ) # true, it's a polygon
227-
228-
if startPoint.x() == endPoint.x() or startPoint.y() == endPoint.y():
229-
return
230-
231-
point1 = QgsPoint(startPoint.x(), startPoint.y())
232-
point2 = QgsPoint(startPoint.x(), endPoint.y())
233-
point3 = QgsPoint(endPoint.x(), endPoint.y())
234-
point4 = QgsPoint(endPoint.x(), startPoint.y())
235-
236-
self.rubberBand.addPoint( point1, False )
237-
self.rubberBand.addPoint( point2, False )
238-
self.rubberBand.addPoint( point3, False )
239-
self.rubberBand.addPoint( point4, True ) # true to update canvas
240-
self.rubberBand.show()
241-
242-
def clippingRectangle(self):
243-
if self.startPoint == None or self.endPoint == None:
244-
return None
245-
elif self.startPoint.x() == self.endPoint.x() or self.startPoint.y() == self.endPoint.y():
246-
return None
247-
248-
return QgsRectangle(self.startPoint, self.endPoint)
249-
250-
def setClippingRectangle(self, rect):
251-
if rect == None:
252-
self.reset()
253-
return
254-
255-
self.startPoint = QgsPoint(rect.xMaximum(), rect.yMaximum())
256-
self.endPoint = QgsPoint(rect.xMinimum(), rect.yMinimum())
257-
self.showRect(self.startPoint, self.endPoint)
258-
259-
def deactivate(self):
260-
QgsMapTool.deactivate(self)
261-
self.emit(SIGNAL("deactivated()"))
262-

‎python/plugins/GdalTools/tools/doGrid.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from PyQt4.QtGui import *
44
from qgis.core import *
55
from qgis.gui import *
6-
from osgeo import ogr
76

87
from ui_widgetGrid import Ui_GdalToolsWidget as Ui_Widget
98
from widgetPluginBase import GdalToolsBasePluginWidget as BasePluginWidget
@@ -14,12 +13,16 @@ class GdalToolsDialog(QWidget, Ui_Widget, BasePluginWidget):
1413
def __init__(self, iface):
1514
QWidget.__init__(self)
1615
self.iface = iface
16+
self.canvas = self.iface.mapCanvas()
1717
self.algorithm = ('invdist', 'average', 'nearest', 'datametrics')
1818
self.datametrics = ('minimum', 'maximum', 'range')
1919

2020
self.setupUi(self)
2121
BasePluginWidget.__init__(self, self.iface, "gdal_grid")
2222

23+
self.extentSelector.setCanvas(self.canvas)
24+
#self.extentSelector.stop()
25+
2326
# set the default QSpinBoxes value
2427
self.invdistPowerSpin.setValue(2.0)
2528

@@ -40,17 +43,26 @@ def __init__(self, iface):
4043
([self.nearestRadius1Spin, self.nearestRadius2Spin, self.nearestAngleSpin, self.nearestNoDataSpin], SIGNAL("valueChanged(double)")),
4144
(self.datametricsCombo, SIGNAL("currentIndexChanged(int)")),
4245
([self.datametricsRadius1Spin, self.datametricsRadius2Spin, self.datametricsAngleSpin, self.datametricsNoDataSpin], SIGNAL("valueChanged(double)")),
43-
(self.datametricsMinPointsSpin, SIGNAL("valueChanged(int)"))
46+
(self.datametricsMinPointsSpin, SIGNAL("valueChanged(int)")),
47+
(self.extentSelector, [SIGNAL("selectionStarted()"), SIGNAL("newExtentDefined()")], self.extentGroup)
4448
]
4549
)
4650

4751
self.connect(self.selectInputFileButton, SIGNAL("clicked()"), self.fillInputFileEdit)
4852
self.connect(self.selectOutputFileButton, SIGNAL("clicked()"), self.fillOutputFileEdit)
4953
self.connect(self.inputLayerCombo, SIGNAL("currentIndexChanged(int)"), self.fillFieldsCombo)
54+
self.connect(self.extentGroup, SIGNAL("toggled(bool)"), self.onExtentCheckedChenged)
5055

5156
# fill layers combo
5257
self.fillInputLayerCombo()
5358

59+
def onClosing(self):
60+
self.extentSelector.stop()
61+
BasePluginWidget.onClosing(self)
62+
63+
def onExtentCheckedChenged(self, enabled):
64+
self.extentSelector.start() if enabled else self.extentSelector.stop()
65+
5466
def fillInputLayerCombo(self):
5567
self.inputLayerCombo.clear()
5668
( self.layers, names ) = Utils.getVectorLayers()
@@ -98,6 +110,15 @@ def getArguments(self):
98110
elif not self.inputLayerCombo.currentText().isEmpty():
99111
arguments << "-l"
100112
arguments << QFileInfo(self.inputLayerCombo.currentText()).baseName()
113+
if self.extentGroup.isChecked():
114+
rect = self.extentSelector.getExtent()
115+
if rect != None:
116+
arguments << "-txe"
117+
arguments << str(rect.xMinimum())
118+
arguments << str(rect.xMaximum())
119+
arguments << "-tye"
120+
arguments << str(rect.yMaximum())
121+
arguments << str(rect.yMinimum())
101122
if self.algorithmCheck.isChecked() and self.algorithmCombo.currentIndex() >= 0:
102123
arguments << "-a"
103124
arguments << self.algorithmArguments(self.algorithmCombo.currentIndex())
@@ -109,8 +130,8 @@ def getArguments(self):
109130
return arguments
110131

111132
def getInputFileName(self):
112-
if self.inputLayerCombo.currentIndex() >= 0:
113-
return self.layers[self.inputLayerCombo.currentIndex()].source()
133+
#if self.inputLayerCombo.currentIndex() >= 0:
134+
# return self.layers[self.inputLayerCombo.currentIndex()].source()
114135
return self.inputLayerCombo.currentText()
115136

116137
def getOutputFileName(self):
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# -*- coding: utf-8 -*-
2+
from PyQt4.QtCore import *
3+
from PyQt4.QtGui import *
4+
from qgis.core import *
5+
from qgis.gui import *
6+
7+
from ui_extentSelector import Ui_GdalToolsExtentSelector as Ui_ExtentSelector
8+
import GdalTools_utils as Utils
9+
10+
class GdalToolsExtentSelector(QWidget, Ui_ExtentSelector):
11+
12+
def __init__(self, parent=None):
13+
QWidget.__init__(self, parent)
14+
self.canvas = None
15+
self.tool = None
16+
self.previousMapTool = None
17+
self.isStarted = False
18+
19+
self.setupUi(self)
20+
21+
self.connect(self.x1CoordEdit, SIGNAL("textChanged(const QString &)"), self.coordsChanged)
22+
self.connect(self.x2CoordEdit, SIGNAL("textChanged(const QString &)"), self.coordsChanged)
23+
self.connect(self.y1CoordEdit, SIGNAL("textChanged(const QString &)"), self.coordsChanged)
24+
self.connect(self.y2CoordEdit, SIGNAL("textChanged(const QString &)"), self.coordsChanged)
25+
self.connect(self.btnEnable, SIGNAL("clicked()"), self.start)
26+
27+
def setCanvas(self, canvas):
28+
self.canvas = canvas
29+
self.tool = RectangleMapTool(self.canvas)
30+
self.previousMapTool = self.canvas.mapTool()
31+
self.connect(self.tool, SIGNAL("rectangleCreated()"), self.fillCoords)
32+
self.connect(self.tool, SIGNAL("deactivated()"), self.pause)
33+
34+
def stop(self):
35+
self.isStarted = False
36+
self.btnEnable.setVisible(False)
37+
self.tool.reset()
38+
self.canvas.unsetMapTool(self.tool)
39+
self.canvas.setMapTool(self.previousMapTool)
40+
#self.coordsChanged()
41+
self.emit( SIGNAL( "selectionStopped()" ) )
42+
43+
def start(self):
44+
self.previousMapTool = self.canvas.mapTool()
45+
self.canvas.setMapTool(self.tool)
46+
self.isStarted = True
47+
self.btnEnable.setVisible(False)
48+
self.coordsChanged()
49+
self.emit( SIGNAL( "selectionStarted()" ) )
50+
51+
def pause(self):
52+
if not self.isStarted:
53+
return
54+
55+
self.btnEnable.setVisible(True)
56+
self.emit( SIGNAL( "selectionPaused()" ) )
57+
58+
def setExtent(self, rect):
59+
if self.tool.setRectangle(rect):
60+
self.emit( SIGNAL( "newExtentDefined()" ) )
61+
62+
def getExtent(self):
63+
return self.tool.rectangle()
64+
65+
def isCoordsValid(self):
66+
try:
67+
point1 = QgsPoint( float(self.x1CoordEdit.text()), float(self.y1CoordEdit.text()) )
68+
point2 = QgsPoint( float(self.x2CoordEdit.text()), float(self.y2CoordEdit.text()) )
69+
except ValueError:
70+
return False
71+
72+
return True
73+
74+
def coordsChanged(self):
75+
rect = None
76+
if self.isCoordsValid():
77+
point1 = QgsPoint( float(self.x1CoordEdit.text()), float(self.y1CoordEdit.text()) )
78+
point2 = QgsPoint( float(self.x2CoordEdit.text()), float(self.y2CoordEdit.text()) )
79+
rect = QgsRectangle(point1, point2)
80+
81+
self.setExtent(rect)
82+
83+
def fillCoords(self):
84+
rect = self.getExtent()
85+
86+
self.blockSignals(True)
87+
if rect != None:
88+
self.x1CoordEdit.setText( str(rect.xMinimum()) )
89+
self.x2CoordEdit.setText( str(rect.xMaximum()) )
90+
self.y1CoordEdit.setText( str(rect.yMaximum()) )
91+
self.y2CoordEdit.setText( str(rect.yMinimum()) )
92+
else:
93+
self.x1CoordEdit.clear()
94+
self.x2CoordEdit.clear()
95+
self.y1CoordEdit.clear()
96+
self.y2CoordEdit.clear()
97+
self.blockSignals(False)
98+
99+
self.coordsChanged()
100+
101+
class RectangleMapTool(QgsMapToolEmitPoint):
102+
def __init__(self, canvas):
103+
self.canvas = canvas
104+
QgsMapToolEmitPoint.__init__(self, self.canvas)
105+
106+
self.rubberBand = QgsRubberBand( self.canvas, True ) # true, its a polygon
107+
self.rubberBand.setColor( Qt.red )
108+
self.rubberBand.setWidth( 1 )
109+
110+
self.reset()
111+
112+
def reset(self):
113+
self.startPoint = self.endPoint = None
114+
self.isEmittingPoint = False
115+
self.rubberBand.reset( True ) # true, its a polygon
116+
117+
def canvasPressEvent(self, e):
118+
self.startPoint = self.toMapCoordinates( e.pos() )
119+
self.endPoint = self.startPoint
120+
self.isEmittingPoint = True
121+
122+
self.showRect(self.startPoint, self.endPoint)
123+
124+
def canvasReleaseEvent(self, e):
125+
self.isEmittingPoint = False
126+
if self.rectangle() != None:
127+
self.emit( SIGNAL("rectangleCreated()") )
128+
129+
def canvasMoveEvent(self, e):
130+
if not self.isEmittingPoint:
131+
return
132+
133+
self.endPoint = self.toMapCoordinates( e.pos() )
134+
self.showRect(self.startPoint, self.endPoint)
135+
136+
def showRect(self, startPoint, endPoint):
137+
self.rubberBand.reset( True ) # true, it's a polygon
138+
if startPoint.x() == endPoint.x() or startPoint.y() == endPoint.y():
139+
return
140+
141+
point1 = QgsPoint(startPoint.x(), startPoint.y())
142+
point2 = QgsPoint(startPoint.x(), endPoint.y())
143+
point3 = QgsPoint(endPoint.x(), endPoint.y())
144+
point4 = QgsPoint(endPoint.x(), startPoint.y())
145+
146+
self.rubberBand.addPoint( point1, False )
147+
self.rubberBand.addPoint( point2, False )
148+
self.rubberBand.addPoint( point3, False )
149+
self.rubberBand.addPoint( point4, True ) # true to update canvas
150+
self.rubberBand.show()
151+
152+
def rectangle(self):
153+
if self.startPoint == None or self.endPoint == None:
154+
return None
155+
elif self.startPoint.x() == self.endPoint.x() or self.startPoint.y() == self.endPoint.y():
156+
return None
157+
158+
return QgsRectangle(self.startPoint, self.endPoint)
159+
160+
def setRectangle(self, rect):
161+
if rect == self.rectangle():
162+
return False
163+
164+
if rect == None:
165+
self.reset()
166+
else:
167+
self.startPoint = QgsPoint(rect.xMaximum(), rect.yMaximum())
168+
self.endPoint = QgsPoint(rect.xMinimum(), rect.yMinimum())
169+
self.showRect(self.startPoint, self.endPoint)
170+
return True
171+
172+
def deactivate(self):
173+
QgsMapTool.deactivate(self)
174+
self.emit(SIGNAL("deactivated()"))
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>GdalToolsExtentSelector</class>
4+
<widget class="QWidget" name="GdalToolsExtentSelector">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>343</width>
10+
<height>134</height>
11+
</rect>
12+
</property>
13+
<layout class="QGridLayout" name="gridLayout">
14+
<property name="margin">
15+
<number>0</number>
16+
</property>
17+
<item row="1" column="0">
18+
<widget class="QLabel" name="label">
19+
<property name="text">
20+
<string>Select the extent by drag on canvas</string>
21+
</property>
22+
</widget>
23+
</item>
24+
<item row="3" column="0" colspan="2">
25+
<widget class="QLabel" name="label_7">
26+
<property name="text">
27+
<string>or change the extent coordinates</string>
28+
</property>
29+
</widget>
30+
</item>
31+
<item row="4" column="0" colspan="2">
32+
<widget class="QWidget" name="widget" native="true">
33+
<layout class="QGridLayout" name="gridLayout_3">
34+
<item row="0" column="2">
35+
<widget class="QLabel" name="label_11">
36+
<property name="text">
37+
<string>x</string>
38+
</property>
39+
</widget>
40+
</item>
41+
<item row="0" column="3">
42+
<widget class="QLineEdit" name="x1CoordEdit"/>
43+
</item>
44+
<item row="0" column="7">
45+
<widget class="QLabel" name="label_13">
46+
<property name="text">
47+
<string>x</string>
48+
</property>
49+
</widget>
50+
</item>
51+
<item row="0" column="8">
52+
<widget class="QLineEdit" name="x2CoordEdit"/>
53+
</item>
54+
<item row="1" column="3">
55+
<widget class="QLineEdit" name="y1CoordEdit"/>
56+
</item>
57+
<item row="1" column="8">
58+
<widget class="QLineEdit" name="y2CoordEdit"/>
59+
</item>
60+
<item row="1" column="7">
61+
<widget class="QLabel" name="label_15">
62+
<property name="text">
63+
<string>y</string>
64+
</property>
65+
</widget>
66+
</item>
67+
<item row="1" column="2">
68+
<widget class="QLabel" name="label_14">
69+
<property name="text">
70+
<string>y</string>
71+
</property>
72+
</widget>
73+
</item>
74+
<item row="0" column="6" rowspan="2">
75+
<widget class="QLabel" name="label_12">
76+
<property name="text">
77+
<string>2</string>
78+
</property>
79+
<property name="indent">
80+
<number>20</number>
81+
</property>
82+
</widget>
83+
</item>
84+
<item row="0" column="1" rowspan="2">
85+
<widget class="QLabel" name="label_10">
86+
<property name="text">
87+
<string>1</string>
88+
</property>
89+
</widget>
90+
</item>
91+
</layout>
92+
</widget>
93+
</item>
94+
<item row="1" column="1">
95+
<widget class="QPushButton" name="btnEnable">
96+
<property name="text">
97+
<string>Re-Enable</string>
98+
</property>
99+
</widget>
100+
</item>
101+
</layout>
102+
</widget>
103+
<resources/>
104+
<connections/>
105+
</ui>

‎python/plugins/GdalTools/tools/widgetClipper.ui

Lines changed: 19 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>342</width>
10-
<height>271</height>
9+
<width>338</width>
10+
<height>165</height>
1111
</rect>
1212
</property>
1313
<property name="sizePolicy">
@@ -19,7 +19,7 @@
1919
<property name="windowTitle">
2020
<string>Clipper</string>
2121
</property>
22-
<layout class="QVBoxLayout" name="verticalLayout_4">
22+
<layout class="QVBoxLayout" name="verticalLayout">
2323
<item>
2424
<layout class="QGridLayout" name="gridLayout">
2525
<item row="0" column="0">
@@ -70,148 +70,17 @@
7070
</layout>
7171
</item>
7272
<item>
73-
<widget class="QPushButton" name="btnEnableClip">
74-
<property name="text">
75-
<string>Re-Enable Clipping</string>
73+
<widget class="QGroupBox" name="extentGroup">
74+
<property name="title">
75+
<string>Extent</string>
7676
</property>
77+
<layout class="QGridLayout" name="gridLayout_2">
78+
<item row="0" column="0">
79+
<widget class="GdalToolsExtentSelector" name="extentSelector" native="true"/>
80+
</item>
81+
</layout>
7782
</widget>
7883
</item>
79-
<item>
80-
<layout class="QVBoxLayout" name="verticalLayout_3">
81-
<item>
82-
<widget class="QLabel" name="label">
83-
<property name="text">
84-
<string>Select the extent by drag &amp; drop on canvas</string>
85-
</property>
86-
</widget>
87-
</item>
88-
<item>
89-
<widget class="QLabel" name="label_7">
90-
<property name="text">
91-
<string>or change the extent coordinates</string>
92-
</property>
93-
</widget>
94-
</item>
95-
<item>
96-
<layout class="QHBoxLayout" name="horizontalLayout_8">
97-
<item>
98-
<layout class="QHBoxLayout" name="horizontalLayout_4">
99-
<item>
100-
<widget class="QLabel" name="label_8">
101-
<property name="text">
102-
<string>1</string>
103-
</property>
104-
</widget>
105-
</item>
106-
<item>
107-
<layout class="QVBoxLayout" name="verticalLayout">
108-
<item>
109-
<layout class="QHBoxLayout" name="horizontalLayout">
110-
<item>
111-
<widget class="QLabel" name="label_3">
112-
<property name="text">
113-
<string>x</string>
114-
</property>
115-
<property name="buddy">
116-
<cstring>selectOutputFileButton</cstring>
117-
</property>
118-
</widget>
119-
</item>
120-
<item>
121-
<widget class="QLineEdit" name="x1CoordEdit"/>
122-
</item>
123-
</layout>
124-
</item>
125-
<item>
126-
<layout class="QHBoxLayout" name="horizontalLayout_3">
127-
<item>
128-
<widget class="QLabel" name="label_5">
129-
<property name="text">
130-
<string>y</string>
131-
</property>
132-
<property name="buddy">
133-
<cstring>selectOutputFileButton</cstring>
134-
</property>
135-
</widget>
136-
</item>
137-
<item>
138-
<widget class="QLineEdit" name="y1CoordEdit"/>
139-
</item>
140-
</layout>
141-
</item>
142-
</layout>
143-
</item>
144-
</layout>
145-
</item>
146-
<item>
147-
<spacer name="horizontalSpacer">
148-
<property name="orientation">
149-
<enum>Qt::Horizontal</enum>
150-
</property>
151-
<property name="sizeType">
152-
<enum>QSizePolicy::Fixed</enum>
153-
</property>
154-
<property name="sizeHint" stdset="0">
155-
<size>
156-
<width>13</width>
157-
<height>20</height>
158-
</size>
159-
</property>
160-
</spacer>
161-
</item>
162-
<item>
163-
<layout class="QHBoxLayout" name="horizontalLayout_7">
164-
<item>
165-
<widget class="QLabel" name="label_9">
166-
<property name="text">
167-
<string>2</string>
168-
</property>
169-
</widget>
170-
</item>
171-
<item>
172-
<layout class="QVBoxLayout" name="verticalLayout_2">
173-
<item>
174-
<layout class="QHBoxLayout" name="horizontalLayout_5">
175-
<item>
176-
<widget class="QLabel" name="label_4">
177-
<property name="text">
178-
<string>x</string>
179-
</property>
180-
<property name="buddy">
181-
<cstring>selectOutputFileButton</cstring>
182-
</property>
183-
</widget>
184-
</item>
185-
<item>
186-
<widget class="QLineEdit" name="x2CoordEdit"/>
187-
</item>
188-
</layout>
189-
</item>
190-
<item>
191-
<layout class="QHBoxLayout" name="horizontalLayout_6">
192-
<item>
193-
<widget class="QLabel" name="label_6">
194-
<property name="text">
195-
<string>y</string>
196-
</property>
197-
<property name="buddy">
198-
<cstring>selectOutputFileButton</cstring>
199-
</property>
200-
</widget>
201-
</item>
202-
<item>
203-
<widget class="QLineEdit" name="y2CoordEdit"/>
204-
</item>
205-
</layout>
206-
</item>
207-
</layout>
208-
</item>
209-
</layout>
210-
</item>
211-
</layout>
212-
</item>
213-
</layout>
214-
</item>
21584
<item>
21685
<widget class="QCheckBox" name="pctCheck">
21786
<property name="text">
@@ -221,6 +90,14 @@
22190
</item>
22291
</layout>
22392
</widget>
93+
<customwidgets>
94+
<customwidget>
95+
<class>GdalToolsExtentSelector</class>
96+
<extends>QWidget</extends>
97+
<header>extentSelector</header>
98+
<container>1</container>
99+
</customwidget>
100+
</customwidgets>
224101
<resources/>
225102
<connections/>
226103
</ui>

‎python/plugins/GdalTools/tools/widgetGrid.ui

Lines changed: 339 additions & 145 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.