mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
adds spin box to choose the number of nodes to approximate a circle for the buffer tool
git-svn-id: http://svn.osgeo.org/qgis/trunk@13729 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
d367fbab1c
commit
76d2a8fd4e
@ -79,14 +79,14 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
||||
if self.attrib.isEnabled():
|
||||
self.geoprocessing( self.inShapeA.currentText(), self.inShapeB.currentText(),
|
||||
unicode( self.attrib.currentText() ), self.mergeOutput.checkState(), self.useSelectedA.checkState(),
|
||||
self.useSelectedB.checkState() )
|
||||
self.useSelectedB.checkState(), self.spnSegments.value() )
|
||||
else:
|
||||
if self.param.isEnabled() and self.param.isVisible():
|
||||
parameter = float( self.param.text() )
|
||||
else:
|
||||
parameter = None
|
||||
self.geoprocessing( self.inShapeA.currentText(), self.inShapeB.currentText(),
|
||||
parameter, self.mergeOutput.checkState(), self.useSelectedA.checkState(), self.useSelectedB.checkState() )
|
||||
parameter, self.mergeOutput.checkState(), self.useSelectedA.checkState(), self.useSelectedB.checkState(), self.spnSegments.value() )
|
||||
|
||||
def outFile( self ):
|
||||
self.outShape.clear()
|
||||
@ -110,6 +110,8 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
||||
self.rdoField.setText( self.tr( "Create convex hulls based on input field" ) )
|
||||
self.label_4.hide()
|
||||
self.param.hide()
|
||||
self.lblSegments.hide()
|
||||
self.spnSegments.hide()
|
||||
self.setWindowTitle( self.tr( "Convex hull(s)" ) )
|
||||
self.mergeOutput.hide()
|
||||
elif self.myFunction == 4: # Dissolve
|
||||
@ -121,6 +123,8 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
||||
self.param.hide()
|
||||
self.rdoField.hide()
|
||||
self.mergeOutput.hide()
|
||||
self.lblSegments.hide()
|
||||
self.spnSegments.hide()
|
||||
self.setWindowTitle( self.tr( "Dissolve" ) )
|
||||
else:
|
||||
self.rdoBuffer.hide()
|
||||
@ -129,6 +133,8 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
||||
self.rdoField.hide()
|
||||
self.attrib.hide()
|
||||
self.mergeOutput.hide()
|
||||
self.lblSegments.hide()
|
||||
self.spnSegments.hide()
|
||||
if self.myFunction == 3: # Difference
|
||||
self.label_2.setText( self.tr( "Difference layer" ) )
|
||||
self.setWindowTitle( self.tr( "Difference" ) )
|
||||
@ -175,7 +181,7 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
||||
#7: Symetrical Difference
|
||||
#8: Clip
|
||||
|
||||
def geoprocessing( self, myLayerA, myLayerB, myParam, myMerge, mySelectionA, mySelectionB ):
|
||||
def geoprocessing( self, myLayerA, myLayerB, myParam, myMerge, mySelectionA, mySelectionB, mySegments ):
|
||||
check = QFile( self.shapefileName )
|
||||
if check.exists():
|
||||
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
||||
@ -183,7 +189,7 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
||||
return
|
||||
self.buttonOk.setEnabled( False )
|
||||
self.testThread = geoprocessingThread( self.iface.mainWindow(), self, self.myFunction, myLayerA,
|
||||
myLayerB, myParam, myMerge, mySelectionA, mySelectionB, self.shapefileName, self.encoding )
|
||||
myLayerB, myParam, myMerge, mySelectionA, mySelectionB, mySegments, self.shapefileName, self.encoding )
|
||||
QObject.connect( self.testThread, SIGNAL( "runFinished(PyQt_PyObject)" ), self.runFinishedFromThread )
|
||||
QObject.connect( self.testThread, SIGNAL( "runStatus(PyQt_PyObject)" ), self.runStatusFromThread )
|
||||
QObject.connect( self.testThread, SIGNAL( "runRange(PyQt_PyObject)" ), self.runRangeFromThread )
|
||||
@ -235,7 +241,7 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
||||
|
||||
class geoprocessingThread( QThread ):
|
||||
def __init__( self, parentThread, parentObject, function, myLayerA, myLayerB,
|
||||
myParam, myMerge, mySelectionA, mySelectionB, myName, myEncoding ):
|
||||
myParam, myMerge, mySelectionA, mySelectionB, mySegments, myName, myEncoding ):
|
||||
QThread.__init__( self, parentThread )
|
||||
self.parent = parentObject
|
||||
self.running = False
|
||||
@ -246,6 +252,7 @@ class geoprocessingThread( QThread ):
|
||||
self.myMerge = myMerge
|
||||
self.mySelectionA = mySelectionA
|
||||
self.mySelectionB = mySelectionB
|
||||
self.mySegments = int( mySegments )
|
||||
self.myName = myName
|
||||
self.myEncoding = myEncoding
|
||||
|
||||
@ -311,7 +318,7 @@ class geoprocessingThread( QThread ):
|
||||
value = self.myParam
|
||||
inGeom = QgsGeometry( inFeat.geometry() )
|
||||
try:
|
||||
outGeom = inGeom.buffer( float( value ), 5 )
|
||||
outGeom = inGeom.buffer( float( value ), self.mySegments )
|
||||
if first:
|
||||
tempGeom = QgsGeometry( outGeom )
|
||||
first = False
|
||||
@ -341,7 +348,7 @@ class geoprocessingThread( QThread ):
|
||||
value = self.myParam
|
||||
inGeom = QgsGeometry( inFeat.geometry() )
|
||||
try:
|
||||
outGeom = inGeom.buffer( float( value ), 5 )
|
||||
outGeom = inGeom.buffer( float( value ), self.mySegments )
|
||||
try:
|
||||
outFeat.setGeometry( outGeom )
|
||||
outFeat.setAttributeMap( atMap )
|
||||
@ -370,7 +377,7 @@ class geoprocessingThread( QThread ):
|
||||
value = self.myParam
|
||||
inGeom = QgsGeometry( inFeat.geometry() )
|
||||
try:
|
||||
outGeom = inGeom.buffer( float( value ), 5 )
|
||||
outGeom = inGeom.buffer( float( value ), self.mySegments )
|
||||
if first:
|
||||
tempGeom = QgsGeometry( outGeom )
|
||||
first = False
|
||||
@ -401,7 +408,7 @@ class geoprocessingThread( QThread ):
|
||||
value = self.myParam
|
||||
inGeom = QgsGeometry( inFeat.geometry() )
|
||||
try:
|
||||
outGeom = inGeom.buffer( float( value ), 5 )
|
||||
outGeom = inGeom.buffer( float( value ), self.mySegments )
|
||||
try:
|
||||
outFeat.setGeometry( outGeom )
|
||||
outFeat.setAttributeMap( atMap )
|
||||
@ -501,7 +508,7 @@ class geoprocessingThread( QThread ):
|
||||
first = True
|
||||
outID = 0
|
||||
vproviderA.select( allAttrsA )#, rect )
|
||||
vproviderA.rewind()
|
||||
#vproviderA.rewind()
|
||||
while vproviderA.nextFeature( inFeat ):
|
||||
atMap = inFeat.attributeMap()
|
||||
idVar = atMap[ self.myParam ]
|
||||
@ -531,7 +538,7 @@ class geoprocessingThread( QThread ):
|
||||
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
|
||||
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
|
||||
hull = []
|
||||
vproviderA.rewind()
|
||||
#vproviderA.rewind()
|
||||
vproviderA.select(allAttrsA)
|
||||
while vproviderA.nextFeature( inFeat ):
|
||||
inGeom = QgsGeometry( inFeat.geometry() )
|
||||
|
@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
@ -6,11 +7,11 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>422</width>
|
||||
<height>405</height>
|
||||
<height>448</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -31,7 +32,7 @@
|
||||
<item>
|
||||
<widget class="QComboBox" name="inShapeA">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -40,6 +41,17 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useSelectedA">
|
||||
<property name="text">
|
||||
<string>Use only selected features</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
@ -52,7 +64,7 @@
|
||||
<item>
|
||||
<widget class="QComboBox" name="inShapeB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -61,7 +73,18 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2" >
|
||||
<item row="4" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useSelectedB">
|
||||
<property name="text">
|
||||
<string>Use only selected features</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
@ -83,7 +106,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -101,7 +124,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2" >
|
||||
<item row="9" column="0" colspan="2">
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
@ -140,7 +163,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -149,7 +172,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0" >
|
||||
<item row="10" column="0">
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
@ -169,7 +192,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="0" >
|
||||
<item row="11" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -182,7 +205,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2" >
|
||||
<item row="12" column="0" colspan="2">
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
@ -211,7 +234,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="10" column="0" >
|
||||
<item row="13" column="0">
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
@ -224,30 +247,29 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" >
|
||||
<item row="13" column="1">
|
||||
<widget class="QDialogButtonBox" name="buttonBox_2">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item row="6" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useSelectedA" >
|
||||
<widget class="QLabel" name="lblSegments">
|
||||
<property name="text">
|
||||
<string>Use only selected features</string>
|
||||
<string>Segments to approximate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useSelectedB" >
|
||||
<property name="text" >
|
||||
<string>Use only selected features</string>
|
||||
<widget class="QSpinBox" name="spnSegments">
|
||||
<property name="minimum">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user