[QGIS Commit] r10610 - in trunk/qgis/python/plugins/fTools: . tools
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Tue Apr 21 10:29:25 EDT 2009
Author: cfarmer
Date: 2009-04-21 10:29:25 -0400 (Tue, 21 Apr 2009)
New Revision: 10610
Modified:
trunk/qgis/python/plugins/fTools/__init__.py
trunk/qgis/python/plugins/fTools/doAbout.py
trunk/qgis/python/plugins/fTools/fTools.py
trunk/qgis/python/plugins/fTools/tools/doVisual.py
trunk/qgis/python/plugins/fTools/tools/frmVisual.py
trunk/qgis/python/plugins/fTools/tools/frmVisual.ui
Log:
adds ability to copy unique values to clipboard to pasting into other
software (i.e. excel); updates version number as well
Modified: trunk/qgis/python/plugins/fTools/__init__.py
===================================================================
--- trunk/qgis/python/plugins/fTools/__init__.py 2009-04-21 08:39:25 UTC (rev 10609)
+++ trunk/qgis/python/plugins/fTools/__init__.py 2009-04-21 14:29:25 UTC (rev 10610)
@@ -21,7 +21,7 @@
return "Tools for vector data analysis and management"
def version():
- return "0.5.9"
+ return "0.5.10"
def qgisMinimumVersion():
return "1.0"
Modified: trunk/qgis/python/plugins/fTools/doAbout.py
===================================================================
--- trunk/qgis/python/plugins/fTools/doAbout.py 2009-04-21 08:39:25 UTC (rev 10609)
+++ trunk/qgis/python/plugins/fTools/doAbout.py 2009-04-21 14:29:25 UTC (rev 10610)
@@ -32,7 +32,7 @@
QObject.connect(self.btnWeb, SIGNAL("clicked()"), self.openWeb)
QObject.connect(self.btnHelp, SIGNAL("clicked()"), self.openHelp)
self.fToolsLogo.setPixmap(QPixmap(":/icons/default/ftools_logo.png"))
- self.label_3.setText("fTools 0.5.8")
+ self.label_3.setText("fTools 0.5.10")
self.textEdit.setText(self.getText())
def getText(self):
Modified: trunk/qgis/python/plugins/fTools/fTools.py
===================================================================
--- trunk/qgis/python/plugins/fTools/fTools.py 2009-04-21 08:39:25 UTC (rev 10609)
+++ trunk/qgis/python/plugins/fTools/fTools.py 2009-04-21 14:29:25 UTC (rev 10610)
@@ -48,350 +48,350 @@
import doReProject, doSpatialJoin, doSubsetSelect, doSumLines, doVectorGrid, doAbout
class fToolsPlugin:
- def __init__( self,iface ):
- self.iface = iface
- try:
- self.QgisVersion = unicode( QGis.QGIS_VERSION_INT )
- except:
- self.QgisVersion = unicode( QGis.qgisVersion )[ 0 ]
-
- def getThemeIcon( self, icon ):
- settings = QSettings()
- pluginPath = QString( os.path.dirname( __file__ ) )
- themePath = QString( "icons" ) + QDir.separator() + QString( settings.value( "/Themes" ).toString() ) + QDir.separator() + QString( icon)
- defaultPath = QString( "icons" ) + QDir.separator() + QString( "default" ) + QDir.separator() + QString( icon )
- if QFile.exists( pluginPath + QDir.separator() + themePath ):
- return QIcon( ":" + themePath )
- elif QFile.exists( pluginPath + QDir.separator() + defaultPath ):
- return QIcon( ":" + defaultPath )
- else:
- return QIcon()
-
- def updateThemeIcons( self, theme ):
- self.analysisMenu.setIcon( QIcon( self.getThemeIcon( "analysis.png" ) ) )
- self.distMatrix.setIcon( QIcon( self.getThemeIcon( "matrix.png" ) ) )
- self.sumLines.setIcon( QIcon( self.getThemeIcon( "sum_lines.png" ) ) )
- self.pointsPoly.setIcon( QIcon( self.getThemeIcon( "sum_points.png" ) ) )
- self.compStats.setIcon( QIcon( self.getThemeIcon( "basic_statistics.png" ) ) )
- self.listUnique.setIcon( QIcon( self.getThemeIcon( "unique.png" ) ) )
- self.nearestNeigh.setIcon( QIcon( self.getThemeIcon( "neighbour.png" ) ) )
- self.meanCoords.setIcon( QIcon( self.getThemeIcon( "mean.png" ) ) )
- self.intLines.setIcon( QIcon( self.getThemeIcon( "intersections.png" ) ) )
+ def __init__( self,iface ):
+ self.iface = iface
+ try:
+ self.QgisVersion = unicode( QGis.QGIS_VERSION_INT )
+ except:
+ self.QgisVersion = unicode( QGis.qgisVersion )[ 0 ]
+
+ def getThemeIcon( self, icon ):
+ settings = QSettings()
+ pluginPath = QString( os.path.dirname( __file__ ) )
+ themePath = QString( "icons" ) + QDir.separator() + QString( settings.value( "/Themes" ).toString() ) + QDir.separator() + QString( icon)
+ defaultPath = QString( "icons" ) + QDir.separator() + QString( "default" ) + QDir.separator() + QString( icon )
+ if QFile.exists( pluginPath + QDir.separator() + themePath ):
+ return QIcon( ":" + themePath )
+ elif QFile.exists( pluginPath + QDir.separator() + defaultPath ):
+ return QIcon( ":" + defaultPath )
+ else:
+ return QIcon()
+
+ def updateThemeIcons( self, theme ):
+ self.analysisMenu.setIcon( QIcon( self.getThemeIcon( "analysis.png" ) ) )
+ self.distMatrix.setIcon( QIcon( self.getThemeIcon( "matrix.png" ) ) )
+ self.sumLines.setIcon( QIcon( self.getThemeIcon( "sum_lines.png" ) ) )
+ self.pointsPoly.setIcon( QIcon( self.getThemeIcon( "sum_points.png" ) ) )
+ self.compStats.setIcon( QIcon( self.getThemeIcon( "basic_statistics.png" ) ) )
+ self.listUnique.setIcon( QIcon( self.getThemeIcon( "unique.png" ) ) )
+ self.nearestNeigh.setIcon( QIcon( self.getThemeIcon( "neighbour.png" ) ) )
+ self.meanCoords.setIcon( QIcon( self.getThemeIcon( "mean.png" ) ) )
+ self.intLines.setIcon( QIcon( self.getThemeIcon( "intersections.png" ) ) )
- self.researchMenu.setIcon( QIcon( self.getThemeIcon( "sampling.png" ) ) )
- self.randSel.setIcon( QIcon( self.getThemeIcon( "random_selection.png" ) ) )
- self.randSub.setIcon( QIcon( self.getThemeIcon( "sub_selection.png" ) ) )
- self.randPoints.setIcon( QIcon( self.getThemeIcon( "random_points.png" ) ) )
- self.regPoints.setIcon( QIcon( self.getThemeIcon( "regular_points.png" ) ) )
- self.vectGrid.setIcon( QIcon( self.getThemeIcon( "vector_grid.png" ) ) )
- self.selectLocation.setIcon( QIcon( self.getThemeIcon( "select_location.png" ) ) )
- self.layerExtent.setIcon( QIcon( self.getThemeIcon( "layer_extent.png" ) ) )
+ self.researchMenu.setIcon( QIcon( self.getThemeIcon( "sampling.png" ) ) )
+ self.randSel.setIcon( QIcon( self.getThemeIcon( "random_selection.png" ) ) )
+ self.randSub.setIcon( QIcon( self.getThemeIcon( "sub_selection.png" ) ) )
+ self.randPoints.setIcon( QIcon( self.getThemeIcon( "random_points.png" ) ) )
+ self.regPoints.setIcon( QIcon( self.getThemeIcon( "regular_points.png" ) ) )
+ self.vectGrid.setIcon( QIcon( self.getThemeIcon( "vector_grid.png" ) ) )
+ self.selectLocation.setIcon( QIcon( self.getThemeIcon( "select_location.png" ) ) )
+ self.layerExtent.setIcon( QIcon( self.getThemeIcon( "layer_extent.png" ) ) )
- self.geoMenu.setIcon( QIcon( self.getThemeIcon( "geoprocessing.png" ) ) )
- self.minConvex.setIcon( QIcon( self.getThemeIcon( "convex_hull.png" ) ) )
- self.dynaBuffer.setIcon( QIcon( self.getThemeIcon( "buffer.png" ) ) )
- self.intersect.setIcon( QIcon( self.getThemeIcon( "intersect.png" ) ) )
- self.union.setIcon( QIcon( self.getThemeIcon( "union.png" ) ) )
- self.symDifference.setIcon( QIcon( self.getThemeIcon( "sym_difference.png" ) ) )
- self.clip.setIcon( QIcon( self.getThemeIcon( "clip.png" ) ) )
- self.dissolve.setIcon( QIcon( self.getThemeIcon( "dissolve.png" ) ) )
- self.erase.setIcon( QIcon( self.getThemeIcon( "difference.png" ) ) )
+ self.geoMenu.setIcon( QIcon( self.getThemeIcon( "geoprocessing.png" ) ) )
+ self.minConvex.setIcon( QIcon( self.getThemeIcon( "convex_hull.png" ) ) )
+ self.dynaBuffer.setIcon( QIcon( self.getThemeIcon( "buffer.png" ) ) )
+ self.intersect.setIcon( QIcon( self.getThemeIcon( "intersect.png" ) ) )
+ self.union.setIcon( QIcon( self.getThemeIcon( "union.png" ) ) )
+ self.symDifference.setIcon( QIcon( self.getThemeIcon( "sym_difference.png" ) ) )
+ self.clip.setIcon( QIcon( self.getThemeIcon( "clip.png" ) ) )
+ self.dissolve.setIcon( QIcon( self.getThemeIcon( "dissolve.png" ) ) )
+ self.erase.setIcon( QIcon( self.getThemeIcon( "difference.png" ) ) )
- self.conversionMenu.setIcon( QIcon( self.getThemeIcon( "geometry.png" ) ) )
- self.compGeo.setIcon( QIcon( self.getThemeIcon( "export_geometry.png") ) )
- self.checkGeom.setIcon( QIcon( self.getThemeIcon( "check_geometry.png") ) )
- self.centroids.setIcon( QIcon( self.getThemeIcon( "centroids.png") ) )
- self.delaunay.setIcon( QIcon( self.getThemeIcon( "delaunay.png") ) )
- self.extNodes.setIcon( QIcon( self.getThemeIcon( "extract_nodes.png") ) )
- self.simplify.setIcon( QIcon( self.getThemeIcon( "simplify.png") ) )
- self.multiToSingle.setIcon( QIcon( self.getThemeIcon( "multi_to_single.png") ) )
- self.singleToMulti.setIcon( QIcon( self.getThemeIcon( "single_to_multi.png") ) )
- self.polysToLines.setIcon( QIcon( self.getThemeIcon( "to_lines.png") ) )
-
- self.dataManageMenu.setIcon( QIcon( self.getThemeIcon( "management.png") ) )
- self.project.setIcon( QIcon( self.getThemeIcon( "export_projection.png") ) )
- self.define.setIcon( QIcon( self.getThemeIcon( "define_projection.png" ) ) )
- self.joinAttr.setIcon( QIcon( self.getThemeIcon( "join_attributes.png" ) ) )
- self.spatJoin.setIcon( QIcon( self.getThemeIcon( "join_location.png" ) ) )
- self.splitVect.setIcon( QIcon( self.getThemeIcon( "split_layer.png" ) ) )
- self.ftools_aboot.setIcon( QIcon( self.getThemeIcon( "ftools_logo.png" ) ) )
+ self.conversionMenu.setIcon( QIcon( self.getThemeIcon( "geometry.png" ) ) )
+ self.compGeo.setIcon( QIcon( self.getThemeIcon( "export_geometry.png") ) )
+ self.checkGeom.setIcon( QIcon( self.getThemeIcon( "check_geometry.png") ) )
+ self.centroids.setIcon( QIcon( self.getThemeIcon( "centroids.png") ) )
+ self.delaunay.setIcon( QIcon( self.getThemeIcon( "delaunay.png") ) )
+ self.extNodes.setIcon( QIcon( self.getThemeIcon( "extract_nodes.png") ) )
+ self.simplify.setIcon( QIcon( self.getThemeIcon( "simplify.png") ) )
+ self.multiToSingle.setIcon( QIcon( self.getThemeIcon( "multi_to_single.png") ) )
+ self.singleToMulti.setIcon( QIcon( self.getThemeIcon( "single_to_multi.png") ) )
+ self.polysToLines.setIcon( QIcon( self.getThemeIcon( "to_lines.png") ) )
+
+ self.dataManageMenu.setIcon( QIcon( self.getThemeIcon( "management.png") ) )
+ self.project.setIcon( QIcon( self.getThemeIcon( "export_projection.png") ) )
+ self.define.setIcon( QIcon( self.getThemeIcon( "define_projection.png" ) ) )
+ self.joinAttr.setIcon( QIcon( self.getThemeIcon( "join_attributes.png" ) ) )
+ self.spatJoin.setIcon( QIcon( self.getThemeIcon( "join_location.png" ) ) )
+ self.splitVect.setIcon( QIcon( self.getThemeIcon( "split_layer.png" ) ) )
+ self.ftools_aboot.setIcon( QIcon( self.getThemeIcon( "ftools_logo.png" ) ) )
- def initGui( self ):
- if int( self.QgisVersion ) < 1:
- QMessageBox.warning( self.iface.getMainWindow(), "fTools",
- QCoreApplication.translate( "fTools", "Quantum GIS version detected: " ) +unicode( self.QgisVersion )+".xx\n"
- + QCoreApplication.translate( "fTools", "This version of fTools requires at least QGIS version 1.0.0\nPlugin will not be enabled." ) )
- return None
- QObject.connect( self.iface, SIGNAL( "currentThemeChanged ( QString )" ), self.updateThemeIcons )
- self.menu = QMenu()
- self.menu.setTitle( QCoreApplication.translate( "fTools", "&Tools" ) )
-
- self.analysisMenu = QMenu( QCoreApplication.translate( "fTools", "&Analysis Tools" ) )
- self.distMatrix = QAction( QCoreApplication.translate( "fTools", "Distance matrix" ),self.iface.mainWindow( ) )
- self.sumLines = QAction( QCoreApplication.translate( "fTools", "Sum line lengths" ), self.iface.mainWindow() )
- self.pointsPoly = QAction( QCoreApplication.translate( "fTools", "Points in polygon" ),self.iface.mainWindow() )
- self.compStats = QAction( QCoreApplication.translate( "fTools", "Basic statistics" ),self.iface.mainWindow() )
- self.listUnique = QAction( QCoreApplication.translate( "fTools", "List unique values" ),self.iface.mainWindow() )
- self.nearestNeigh = QAction( QCoreApplication.translate( "fTools", "Nearest neighbour analysis" ), self.iface.mainWindow() )
- self.meanCoords = QAction( QCoreApplication.translate( "fTools", "Mean coordinate(s)" ),self.iface.mainWindow() )
- self.intLines = QAction( QCoreApplication.translate( "fTools", "Line intersections" ) ,self.iface.mainWindow() )
- self.analysisMenu.addActions( [ self.distMatrix, self.sumLines, self.pointsPoly,
- self.listUnique, self.compStats, self.nearestNeigh, self.meanCoords, self.intLines ] )
+ def initGui( self ):
+ if int( self.QgisVersion ) < 1:
+ QMessageBox.warning( self.iface.getMainWindow(), "fTools",
+ QCoreApplication.translate( "fTools", "Quantum GIS version detected: " ) +unicode( self.QgisVersion )+".xx\n"
+ + QCoreApplication.translate( "fTools", "This version of fTools requires at least QGIS version 1.0.0\nPlugin will not be enabled." ) )
+ return None
+ QObject.connect( self.iface, SIGNAL( "currentThemeChanged ( QString )" ), self.updateThemeIcons )
+ self.menu = QMenu()
+ self.menu.setTitle( QCoreApplication.translate( "fTools", "&Tools" ) )
+
+ self.analysisMenu = QMenu( QCoreApplication.translate( "fTools", "&Analysis Tools" ) )
+ self.distMatrix = QAction( QCoreApplication.translate( "fTools", "Distance matrix" ),self.iface.mainWindow( ) )
+ self.sumLines = QAction( QCoreApplication.translate( "fTools", "Sum line lengths" ), self.iface.mainWindow() )
+ self.pointsPoly = QAction( QCoreApplication.translate( "fTools", "Points in polygon" ),self.iface.mainWindow() )
+ self.compStats = QAction( QCoreApplication.translate( "fTools", "Basic statistics" ),self.iface.mainWindow() )
+ self.listUnique = QAction( QCoreApplication.translate( "fTools", "List unique values" ),self.iface.mainWindow() )
+ self.nearestNeigh = QAction( QCoreApplication.translate( "fTools", "Nearest neighbour analysis" ), self.iface.mainWindow() )
+ self.meanCoords = QAction( QCoreApplication.translate( "fTools", "Mean coordinate(s)" ),self.iface.mainWindow() )
+ self.intLines = QAction( QCoreApplication.translate( "fTools", "Line intersections" ) ,self.iface.mainWindow() )
+ self.analysisMenu.addActions( [ self.distMatrix, self.sumLines, self.pointsPoly,
+ self.listUnique, self.compStats, self.nearestNeigh, self.meanCoords, self.intLines ] )
- self.researchMenu = QMenu( QCoreApplication.translate( "fTools", "&Research Tools" ) )
- self.randSel = QAction( QCoreApplication.translate( "fTools", "Random selection" ),self.iface.mainWindow() )
- self.randSub = QAction( QCoreApplication.translate( "fTools", "Random selection within subsets" ),self.iface.mainWindow() )
- self.randPoints = QAction( QCoreApplication.translate( "fTools", "Random points" ),self.iface.mainWindow() )
- self.regPoints = QAction( QCoreApplication.translate( "fTools", "Regular points" ), self.iface.mainWindow() )
- self.vectGrid = QAction( QCoreApplication.translate( "fTools", "Vector grid" ), self.iface.mainWindow() )
- self.selectLocation = QAction( QCoreApplication.translate( "fTools", "Select by location" ), self.iface.mainWindow() )
- self.layerExtent = QAction( QCoreApplication.translate( "fTools", "Polygon from layer extent" ), self.iface.mainWindow() )
- self.researchMenu.addActions( [ self.randSel, self.randSub, self.randPoints,
- self.regPoints, self.vectGrid, self.selectLocation, self.layerExtent ] )
+ self.researchMenu = QMenu( QCoreApplication.translate( "fTools", "&Research Tools" ) )
+ self.randSel = QAction( QCoreApplication.translate( "fTools", "Random selection" ),self.iface.mainWindow() )
+ self.randSub = QAction( QCoreApplication.translate( "fTools", "Random selection within subsets" ),self.iface.mainWindow() )
+ self.randPoints = QAction( QCoreApplication.translate( "fTools", "Random points" ),self.iface.mainWindow() )
+ self.regPoints = QAction( QCoreApplication.translate( "fTools", "Regular points" ), self.iface.mainWindow() )
+ self.vectGrid = QAction( QCoreApplication.translate( "fTools", "Vector grid" ), self.iface.mainWindow() )
+ self.selectLocation = QAction( QCoreApplication.translate( "fTools", "Select by location" ), self.iface.mainWindow() )
+ self.layerExtent = QAction( QCoreApplication.translate( "fTools", "Polygon from layer extent" ), self.iface.mainWindow() )
+ self.researchMenu.addActions( [ self.randSel, self.randSub, self.randPoints,
+ self.regPoints, self.vectGrid, self.selectLocation, self.layerExtent ] )
- self.geoMenu = QMenu( QCoreApplication.translate( "fTools", "&Geoprocessing Tools" ) )
- self.minConvex = QAction( QCoreApplication.translate( "fTools", "Convex hull(s)" ),self.iface.mainWindow() )
- self.dynaBuffer = QAction( QCoreApplication.translate( "fTools", "Buffer(s)" ),self.iface.mainWindow() )
- self.intersect = QAction( QCoreApplication.translate( "fTools", "Intersect" ),self.iface.mainWindow() )
- self.union = QAction( QCoreApplication.translate( "fTools", "Union" ),self.iface.mainWindow() )
- self.symDifference = QAction( QCoreApplication.translate( "fTools", "Symetrical difference" ),self.iface.mainWindow() )
- self.clip = QAction( QCoreApplication.translate( "fTools", "Clip" ),self.iface.mainWindow() )
- self.dissolve = QAction( QCoreApplication.translate( "fTools", "Dissolve" ),self.iface.mainWindow() )
- self.erase = QAction( QCoreApplication.translate( "fTools", "Difference" ),self.iface.mainWindow() )
- self.geoMenu.addActions( [ self.minConvex, self.dynaBuffer, self.intersect,
- self.union, self.symDifference, self.clip, self.erase, self.dissolve ] )
+ self.geoMenu = QMenu( QCoreApplication.translate( "fTools", "&Geoprocessing Tools" ) )
+ self.minConvex = QAction( QCoreApplication.translate( "fTools", "Convex hull(s)" ),self.iface.mainWindow() )
+ self.dynaBuffer = QAction( QCoreApplication.translate( "fTools", "Buffer(s)" ),self.iface.mainWindow() )
+ self.intersect = QAction( QCoreApplication.translate( "fTools", "Intersect" ),self.iface.mainWindow() )
+ self.union = QAction( QCoreApplication.translate( "fTools", "Union" ),self.iface.mainWindow() )
+ self.symDifference = QAction( QCoreApplication.translate( "fTools", "Symetrical difference" ),self.iface.mainWindow() )
+ self.clip = QAction( QCoreApplication.translate( "fTools", "Clip" ),self.iface.mainWindow() )
+ self.dissolve = QAction( QCoreApplication.translate( "fTools", "Dissolve" ),self.iface.mainWindow() )
+ self.erase = QAction( QCoreApplication.translate( "fTools", "Difference" ),self.iface.mainWindow() )
+ self.geoMenu.addActions( [ self.minConvex, self.dynaBuffer, self.intersect,
+ self.union, self.symDifference, self.clip, self.erase, self.dissolve ] )
- self.conversionMenu = QMenu( QCoreApplication.translate( "fTools", "G&eometry Tools" ) )
- self.compGeo = QAction( QCoreApplication.translate( "fTools", "Export/Add geometry columns" ),self.iface.mainWindow() )
- self.checkGeom = QAction( QCoreApplication.translate( "fTools", "Check geometry validity" ),self.iface.mainWindow() )
- self.centroids = QAction( QCoreApplication.translate( "fTools", "Polygon centroids" ),self.iface.mainWindow() )
- self.delaunay = QAction( QCoreApplication.translate( "fTools", "Delaunay triangulation" ),self.iface.mainWindow() )
- self.extNodes = QAction( QCoreApplication.translate( "fTools", "Extract nodes" ),self.iface.mainWindow() )
- self.simplify = QAction( QCoreApplication.translate( "fTools", "Simplify geometries" ),self.iface.mainWindow() )
- self.multiToSingle = QAction( QCoreApplication.translate( "fTools", "Multipart to singleparts" ),self.iface.mainWindow() )
- self.singleToMulti = QAction( QCoreApplication.translate( "fTools", "Singleparts to multipart" ),self.iface.mainWindow() )
- self.polysToLines = QAction( QCoreApplication.translate( "fTools", "Polygons to lines" ),self.iface.mainWindow() )
- self.conversionMenu.addActions( [ self.checkGeom, self.compGeo, self.centroids, self.delaunay,
- self.simplify, self.multiToSingle, self.singleToMulti, self.polysToLines, self.extNodes] )
+ self.conversionMenu = QMenu( QCoreApplication.translate( "fTools", "G&eometry Tools" ) )
+ self.compGeo = QAction( QCoreApplication.translate( "fTools", "Export/Add geometry columns" ),self.iface.mainWindow() )
+ self.checkGeom = QAction( QCoreApplication.translate( "fTools", "Check geometry validity" ),self.iface.mainWindow() )
+ self.centroids = QAction( QCoreApplication.translate( "fTools", "Polygon centroids" ),self.iface.mainWindow() )
+ self.delaunay = QAction( QCoreApplication.translate( "fTools", "Delaunay triangulation" ),self.iface.mainWindow() )
+ self.extNodes = QAction( QCoreApplication.translate( "fTools", "Extract nodes" ),self.iface.mainWindow() )
+ self.simplify = QAction( QCoreApplication.translate( "fTools", "Simplify geometries" ),self.iface.mainWindow() )
+ self.multiToSingle = QAction( QCoreApplication.translate( "fTools", "Multipart to singleparts" ),self.iface.mainWindow() )
+ self.singleToMulti = QAction( QCoreApplication.translate( "fTools", "Singleparts to multipart" ),self.iface.mainWindow() )
+ self.polysToLines = QAction( QCoreApplication.translate( "fTools", "Polygons to lines" ),self.iface.mainWindow() )
+ self.conversionMenu.addActions( [ self.checkGeom, self.compGeo, self.centroids, self.delaunay,
+ self.simplify, self.multiToSingle, self.singleToMulti, self.polysToLines, self.extNodes] )
- self.dataManageMenu = QMenu( QCoreApplication.translate( "fTools", "&Data Management Tools") )
- self.project = QAction( QCoreApplication.translate( "fTools", "Export to new projection" ), self.iface.mainWindow() )
- self.define = QAction( QCoreApplication.translate( "fTools", "Define current projection" ), self.iface.mainWindow() )
- self.joinAttr = QAction( QCoreApplication.translate( "fTools", "Join attributes" ), self.iface.mainWindow() )
- self.spatJoin = QAction( QCoreApplication.translate( "fTools", "Join attributes by location" ), self.iface.mainWindow() )
- self.splitVect = QAction( QCoreApplication.translate( "fTools", "Split vector layer" ), self.iface.mainWindow() )
- self.dataManageMenu.addActions( [ self.project, self.define, self.joinAttr, self.spatJoin, self.splitVect ] )
- self.ftools_aboot = QAction( QCoreApplication.translate( "fTools", "fTools Information" ), self.iface.mainWindow() )
- self.updateThemeIcons( "theme" )
-
- self.menu.addMenu( self.analysisMenu )
- self.menu.addMenu( self.researchMenu )
- self.menu.addMenu( self.geoMenu )
- self.menu.addMenu( self.conversionMenu )
- self.menu.addMenu( self.dataManageMenu )
- self.menu.addSeparator()
- self.menu.addAction( self.ftools_aboot )
+ self.dataManageMenu = QMenu( QCoreApplication.translate( "fTools", "&Data Management Tools") )
+ self.project = QAction( QCoreApplication.translate( "fTools", "Export to new projection" ), self.iface.mainWindow() )
+ self.define = QAction( QCoreApplication.translate( "fTools", "Define current projection" ), self.iface.mainWindow() )
+ self.joinAttr = QAction( QCoreApplication.translate( "fTools", "Join attributes" ), self.iface.mainWindow() )
+ self.spatJoin = QAction( QCoreApplication.translate( "fTools", "Join attributes by location" ), self.iface.mainWindow() )
+ self.splitVect = QAction( QCoreApplication.translate( "fTools", "Split vector layer" ), self.iface.mainWindow() )
+ self.dataManageMenu.addActions( [ self.project, self.define, self.joinAttr, self.spatJoin, self.splitVect ] )
+ self.ftools_aboot = QAction( QCoreApplication.translate( "fTools", "fTools Information" ), self.iface.mainWindow() )
+ self.updateThemeIcons( "theme" )
+
+ self.menu.addMenu( self.analysisMenu )
+ self.menu.addMenu( self.researchMenu )
+ self.menu.addMenu( self.geoMenu )
+ self.menu.addMenu( self.conversionMenu )
+ self.menu.addMenu( self.dataManageMenu )
+ self.menu.addSeparator()
+ self.menu.addAction( self.ftools_aboot )
- menuBar = self.iface.mainWindow().menuBar()
- actions = menuBar.actions()
- lastAction = actions[ len( actions ) - 1 ]
- menuBar.insertMenu( lastAction, self.menu )
+ menu_bar = self.iface.mainWindow().menuBar()
+ actions = menu_bar.actions()
+ lastAction = actions[ len( actions ) - 1 ]
+ menu_bar.insertMenu( lastAction, self.menu )
- QObject.connect( self.distMatrix, SIGNAL("triggered()"), self.dodistMatrix )
- QObject.connect( self.sumLines, SIGNAL("triggered()"), self.dosumLines )
- QObject.connect( self.pointsPoly, SIGNAL("triggered()"), self.dopointsPoly )
- QObject.connect( self.compStats, SIGNAL("triggered()"), self.docompStats )
- QObject.connect( self.listUnique, SIGNAL("triggered()"), self.dolistUnique )
- QObject.connect( self.nearestNeigh, SIGNAL("triggered()"), self.donearestNeigh )
- QObject.connect( self.meanCoords, SIGNAL("triggered()"), self.domeanCoords )
- QObject.connect( self.intLines, SIGNAL("triggered()"), self.dointLines )
+ QObject.connect( self.distMatrix, SIGNAL("triggered()"), self.dodistMatrix )
+ QObject.connect( self.sumLines, SIGNAL("triggered()"), self.dosumLines )
+ QObject.connect( self.pointsPoly, SIGNAL("triggered()"), self.dopointsPoly )
+ QObject.connect( self.compStats, SIGNAL("triggered()"), self.docompStats )
+ QObject.connect( self.listUnique, SIGNAL("triggered()"), self.dolistUnique )
+ QObject.connect( self.nearestNeigh, SIGNAL("triggered()"), self.donearestNeigh )
+ QObject.connect( self.meanCoords, SIGNAL("triggered()"), self.domeanCoords )
+ QObject.connect( self.intLines, SIGNAL("triggered()"), self.dointLines )
- QObject.connect( self.randSel, SIGNAL("triggered()"), self.dorandSel )
- QObject.connect( self.randSub, SIGNAL("triggered()"), self.dorandSub )
- QObject.connect( self.randPoints, SIGNAL("triggered()"), self.dorandPoints )
- QObject.connect( self.regPoints, SIGNAL("triggered()"), self.doregPoints )
- QObject.connect( self.vectGrid, SIGNAL("triggered()"), self.dovectGrid )
- QObject.connect( self.selectLocation, SIGNAL("triggered()"), self.doselectLocation )
- QObject.connect( self.layerExtent, SIGNAL("triggered()"), self.doextent )
+ QObject.connect( self.randSel, SIGNAL("triggered()"), self.dorandSel )
+ QObject.connect( self.randSub, SIGNAL("triggered()"), self.dorandSub )
+ QObject.connect( self.randPoints, SIGNAL("triggered()"), self.dorandPoints )
+ QObject.connect( self.regPoints, SIGNAL("triggered()"), self.doregPoints )
+ QObject.connect( self.vectGrid, SIGNAL("triggered()"), self.dovectGrid )
+ QObject.connect( self.selectLocation, SIGNAL("triggered()"), self.doselectLocation )
+ QObject.connect( self.layerExtent, SIGNAL("triggered()"), self.doextent )
- QObject.connect( self.minConvex, SIGNAL("triggered()"), self.dominConvex )
- QObject.connect( self.intersect, SIGNAL("triggered()"), self.dointersect )
- QObject.connect( self.dissolve, SIGNAL("triggered()"), self.dodissolve )
- QObject.connect( self.symDifference, SIGNAL("triggered()"), self.dosymdifference )
- QObject.connect( self.erase, SIGNAL("triggered()"), self.doerase )
- QObject.connect( self.union, SIGNAL("triggered()"), self.dounion )
- QObject.connect( self.clip, SIGNAL("triggered()"), self.doclip )
- QObject.connect( self.dynaBuffer, SIGNAL("triggered()"), self.dodynaBuffer )
+ QObject.connect( self.minConvex, SIGNAL("triggered()"), self.dominConvex )
+ QObject.connect( self.intersect, SIGNAL("triggered()"), self.dointersect )
+ QObject.connect( self.dissolve, SIGNAL("triggered()"), self.dodissolve )
+ QObject.connect( self.symDifference, SIGNAL("triggered()"), self.dosymdifference )
+ QObject.connect( self.erase, SIGNAL("triggered()"), self.doerase )
+ QObject.connect( self.union, SIGNAL("triggered()"), self.dounion )
+ QObject.connect( self.clip, SIGNAL("triggered()"), self.doclip )
+ QObject.connect( self.dynaBuffer, SIGNAL("triggered()"), self.dodynaBuffer )
- QObject.connect( self.multiToSingle, SIGNAL("triggered()"), self.domultiToSingle )
- QObject.connect( self.singleToMulti, SIGNAL("triggered()"), self.dosingleToMulti )
- QObject.connect( self.checkGeom, SIGNAL("triggered()"), self.docheckGeom )
- QObject.connect( self.simplify, SIGNAL("triggered()"), self.dosimplify )
- QObject.connect( self.centroids, SIGNAL("triggered()"), self.docentroids )
- QObject.connect( self.delaunay, SIGNAL("triggered()"), self.dodelaunay )
- QObject.connect( self.polysToLines, SIGNAL("triggered()"), self.dopolysToLines )
- QObject.connect( self.compGeo, SIGNAL("triggered()"), self.docompGeo )
- QObject.connect( self.extNodes, SIGNAL("triggered()"), self.doextNodes )
+ QObject.connect( self.multiToSingle, SIGNAL("triggered()"), self.domultiToSingle )
+ QObject.connect( self.singleToMulti, SIGNAL("triggered()"), self.dosingleToMulti )
+ QObject.connect( self.checkGeom, SIGNAL("triggered()"), self.docheckGeom )
+ QObject.connect( self.simplify, SIGNAL("triggered()"), self.dosimplify )
+ QObject.connect( self.centroids, SIGNAL("triggered()"), self.docentroids )
+ QObject.connect( self.delaunay, SIGNAL("triggered()"), self.dodelaunay )
+ QObject.connect( self.polysToLines, SIGNAL("triggered()"), self.dopolysToLines )
+ QObject.connect( self.compGeo, SIGNAL("triggered()"), self.docompGeo )
+ QObject.connect( self.extNodes, SIGNAL("triggered()"), self.doextNodes )
- QObject.connect( self.project, SIGNAL("triggered()"), self.doproject )
- QObject.connect( self.define, SIGNAL("triggered()"), self.dodefine )
- QObject.connect( self.joinAttr, SIGNAL("triggered()"), self.dojoinAttr )
- QObject.connect( self.spatJoin, SIGNAL("triggered()"), self.dospatJoin )
- QObject.connect( self.splitVect, SIGNAL("triggered()"), self.dosplitVect )
+ QObject.connect( self.project, SIGNAL("triggered()"), self.doproject )
+ QObject.connect( self.define, SIGNAL("triggered()"), self.dodefine )
+ QObject.connect( self.joinAttr, SIGNAL("triggered()"), self.dojoinAttr )
+ QObject.connect( self.spatJoin, SIGNAL("triggered()"), self.dospatJoin )
+ QObject.connect( self.splitVect, SIGNAL("triggered()"), self.dosplitVect )
- QObject.connect( self.ftools_aboot, SIGNAL("triggered()"), self.doaboot )
+ QObject.connect( self.ftools_aboot, SIGNAL("triggered()"), self.doaboot )
- def unload( self ):
- pass
+ def unload( self ):
+ pass
- def dosimplify( self ):
- d = doGeometry.GeometryDialog( self.iface, 6 )
- d.exec_()
+ def dosimplify( self ):
+ d = doGeometry.GeometryDialog( self.iface, 6 )
+ d.exec_()
- def dopolysToLines( self ):
- d = doGeometry.GeometryDialog( self.iface, 4 )
- d.exec_()
+ def dopolysToLines( self ):
+ d = doGeometry.GeometryDialog( self.iface, 4 )
+ d.exec_()
- def docheckGeom( self ):
- d = doVisual.VisualDialog( self.iface, 1 )
- d.exec_()
+ def docheckGeom( self ):
+ d = doVisual.VisualDialog( self.iface, 1 )
+ d.exec_()
- def domultiToSingle( self ):
- d = doGeometry.GeometryDialog( self.iface, 2 )
- d.exec_()
+ def domultiToSingle( self ):
+ d = doGeometry.GeometryDialog( self.iface, 2 )
+ d.exec_()
- def dosingleToMulti( self ):
- d = doGeometry.GeometryDialog( self.iface, 1 )
- d.exec_()
+ def dosingleToMulti( self ):
+ d = doGeometry.GeometryDialog( self.iface, 1 )
+ d.exec_()
- def doselectLocation( self ):
- d = doSelectByLocation.Dialog( self.iface )
- d.exec_()
+ def doselectLocation( self ):
+ d = doSelectByLocation.Dialog( self.iface )
+ d.exec_()
- def domeanCoords( self ):
- d = doMeanCoords.Dialog( self.iface, 1 )
- d.exec_()
+ def domeanCoords( self ):
+ d = doMeanCoords.Dialog( self.iface, 1 )
+ d.exec_()
- def dominConvex( self):
- d = doGeoprocessing.GeoprocessingDialog( self.iface, 2 )
- d.exec_()
+ def dominConvex( self):
+ d = doGeoprocessing.GeoprocessingDialog( self.iface, 2 )
+ d.exec_()
- def dodynaBuffer( self):
- d = doGeoprocessing.GeoprocessingDialog( self.iface, 1 )
- d.exec_()
+ def dodynaBuffer( self):
+ d = doGeoprocessing.GeoprocessingDialog( self.iface, 1 )
+ d.exec_()
- def dointersect( self):
- d = doGeoprocessing.GeoprocessingDialog( self.iface, 5 )
- d.exec_()
+ def dointersect( self):
+ d = doGeoprocessing.GeoprocessingDialog( self.iface, 5 )
+ d.exec_()
- def dodissolve( self):
- d = doGeoprocessing.GeoprocessingDialog( self.iface, 4 )
- d.exec_()
+ def dodissolve( self):
+ d = doGeoprocessing.GeoprocessingDialog( self.iface, 4 )
+ d.exec_()
- def doerase( self):
- d = doGeoprocessing.GeoprocessingDialog( self.iface, 3 )
- d.exec_()
+ def doerase( self):
+ d = doGeoprocessing.GeoprocessingDialog( self.iface, 3 )
+ d.exec_()
- def dosymdifference( self):
- d = doGeoprocessing.GeoprocessingDialog( self.iface, 7 )
- d.exec_()
+ def dosymdifference( self):
+ d = doGeoprocessing.GeoprocessingDialog( self.iface, 7 )
+ d.exec_()
- def dounion( self):
- d = doGeoprocessing.GeoprocessingDialog( self.iface, 6 )
- d.exec_()
+ def dounion( self):
+ d = doGeoprocessing.GeoprocessingDialog( self.iface, 6 )
+ d.exec_()
- def doclip( self):
- d = doGeoprocessing.GeoprocessingDialog( self.iface, 8 )
- d.exec_()
+ def doclip( self):
+ d = doGeoprocessing.GeoprocessingDialog( self.iface, 8 )
+ d.exec_()
- def donearestNeigh( self ):
- d = doVisual.VisualDialog( self.iface, 4 )
- d.exec_()
+ def donearestNeigh( self ):
+ d = doVisual.VisualDialog( self.iface, 4 )
+ d.exec_()
- def dodistMatrix( self ):
- d = doPointDistance.Dialog( self.iface )
- d.exec_()
+ def dodistMatrix( self ):
+ d = doPointDistance.Dialog( self.iface )
+ d.exec_()
- def docentroids( self ):
- d = doGeometry.GeometryDialog( self.iface, 7 )
- d.exec_()
-
- def dodelaunay( self ):
- d = doGeometry.GeometryDialog( self.iface, 8 )
- d.exec_()
-
- def doextent( self ):
- d = doGeometry.GeometryDialog( self.iface, 9 )
- d.exec_()
+ def docentroids( self ):
+ d = doGeometry.GeometryDialog( self.iface, 7 )
+ d.exec_()
+
+ def dodelaunay( self ):
+ d = doGeometry.GeometryDialog( self.iface, 8 )
+ d.exec_()
+
+ def doextent( self ):
+ d = doGeometry.GeometryDialog( self.iface, 9 )
+ d.exec_()
- def dosumLines(self):
- d = doSumLines.Dialog(self.iface)
- d.exec_()
+ def dosumLines(self):
+ d = doSumLines.Dialog(self.iface)
+ d.exec_()
- def dopointsPoly( self ):
- d = doPointsInPolygon.Dialog( self.iface )
- d.exec_()
+ def dopointsPoly( self ):
+ d = doPointsInPolygon.Dialog( self.iface )
+ d.exec_()
- def dorandSel( self ):
- d = doRandom.Dialog( self.iface )
- d.exec_()
+ def dorandSel( self ):
+ d = doRandom.Dialog( self.iface )
+ d.exec_()
- def dorandSub( self ):
- d = doSubsetSelect.Dialog( self.iface )
- d.exec_()
+ def dorandSub( self ):
+ d = doSubsetSelect.Dialog( self.iface )
+ d.exec_()
- def dorandPoints( self ):
- d = doRandPoints.Dialog( self.iface )
- d.exec_()
+ def dorandPoints( self ):
+ d = doRandPoints.Dialog( self.iface )
+ d.exec_()
- def doregPoints( self ):
- d = doRegPoints.Dialog( self.iface )
- d.exec_()
+ def doregPoints( self ):
+ d = doRegPoints.Dialog( self.iface )
+ d.exec_()
- def dovectGrid( self ):
- d = doVectorGrid.Dialog( self.iface )
- d.exec_()
+ def dovectGrid( self ):
+ d = doVectorGrid.Dialog( self.iface )
+ d.exec_()
- def doextNodes( self ):
- d = doGeometry.GeometryDialog( self.iface, 3 )
- d.exec_()
+ def doextNodes( self ):
+ d = doGeometry.GeometryDialog( self.iface, 3 )
+ d.exec_()
- def dointLines( self ):
- d = doIntersectLines.Dialog( self.iface )
- d.exec_()
+ def dointLines( self ):
+ d = doIntersectLines.Dialog( self.iface )
+ d.exec_()
- def dosplitVect( self ):
- d = doVectorSplit.Dialog( self.iface )
- d.exec_()
+ def dosplitVect( self ):
+ d = doVectorSplit.Dialog( self.iface )
+ d.exec_()
- def docompGeo( self ):
- d = doGeometry.GeometryDialog( self.iface, 5 )
- d.exec_()
+ def docompGeo( self ):
+ d = doGeometry.GeometryDialog( self.iface, 5 )
+ d.exec_()
- def dolistUnique( self ):
- d = doVisual.VisualDialog( self.iface, 2 )
- d.exec_()
+ def dolistUnique( self ):
+ d = doVisual.VisualDialog( self.iface, 2 )
+ d.exec_()
- def docompStats( self ):
- d = doVisual.VisualDialog( self.iface, 3 )
- d.exec_()
+ def docompStats( self ):
+ d = doVisual.VisualDialog( self.iface, 3 )
+ d.exec_()
- def doproject( self ):
- d = doReProject.Dialog( self.iface )
- d.exec_()
+ def doproject( self ):
+ d = doReProject.Dialog( self.iface )
+ d.exec_()
- def dodefine( self ):
- d = doDefineProj.Dialog( self.iface )
- d.exec_()
+ def dodefine( self ):
+ d = doDefineProj.Dialog( self.iface )
+ d.exec_()
- def dojoinAttr( self ):
- d = doJoinAttributes.Dialog( self.iface )
- d.exec_()
+ def dojoinAttr( self ):
+ d = doJoinAttributes.Dialog( self.iface )
+ d.exec_()
- def dospatJoin( self ):
- d = doSpatialJoin.Dialog( self.iface )
- d.exec_()
+ def dospatJoin( self ):
+ d = doSpatialJoin.Dialog( self.iface )
+ d.exec_()
- def doaboot( self ):
- d = doAbout.Dialog( self.iface )
- d.exec_()
+ def doaboot( self ):
+ d = doAbout.Dialog( self.iface )
+ d.exec_()
Modified: trunk/qgis/python/plugins/fTools/tools/doVisual.py
===================================================================
--- trunk/qgis/python/plugins/fTools/tools/doVisual.py 2009-04-21 08:39:25 UTC (rev 10609)
+++ trunk/qgis/python/plugins/fTools/tools/doVisual.py 2009-04-21 14:29:25 UTC (rev 10610)
@@ -6,346 +6,361 @@
import math
class VisualDialog( QDialog, Ui_Dialog ):
- def __init__( self, iface, function ):
- QDialog.__init__( self )
- self.iface = iface
- self.setupUi( self )
- self.myFunction = function
- if self.myFunction == 2 or self.myFunction == 3:
- QObject.connect( self.inShape, SIGNAL( "currentIndexChanged(QString)" ), self.update )
- self.manageGui()
- self.cancel_close = self.buttonBox_2.button( QDialogButtonBox.Close )
- self.progressBar.setValue( 0 )
+ def __init__( self, iface, function ):
+ QDialog.__init__( self )
+ self.iface = iface
+ self.setupUi( self )
+ self.myFunction = function
+ if self.myFunction == 2 or self.myFunction == 3:
+ QObject.connect( self.inShape, SIGNAL( "currentIndexChanged(QString)" ), self.update )
+ self.manageGui()
+ self.cancel_close = self.buttonBox_2.button( QDialogButtonBox.Close )
+ self.progressBar.setValue( 0 )
+
+ def keyPressEvent( self, e ):
+ '''
+ Reimplemented key press event:
+ '''
+ if ( e.modifiers() == Qt.ControlModifier or e.modifiers() == Qt.MetaModifier ) and e.key() == Qt.Key_C:
+ selection = self.lstUnique.selectedItems()
+ items = QString()
+ for item in selection:
+ items.append( item.text() + "\n" )
+ if not items.isEmpty():
+ clip_board = QApplication.clipboard()
+ clip_board.setText( items )
+ else:
+ QDialog.keyPressEvent( self, e )
- def update( self ):
- self.cmbField.clear()
- inputLayer = unicode( self.inShape.currentText() )
- if inputLayer != "":
- changedLayer = ftools_utils.getVectorLayerByName( inputLayer )
- changedField = changedLayer.dataProvider().fields()
- for i in changedField:
- if self.myFunction == 3:
- if changedField[i].type() == QVariant.Int or changedField[i].type() == QVariant.Double:
- self.cmbField.addItem( unicode( changedField[i].name() ) )
- else:
- self.cmbField.addItem( unicode( changedField[i].name() ) )
- def accept( self ):
- if self.inShape.currentText() == "":
- QMessageBox.information( self, "Error!", self.tr( "Please specify input vector layer" ) )
- elif self.cmbField.isVisible() and self.cmbField.currentText() == "":
- QMessageBox.information( self, "Error!", self.tr( "Please specify input field" ) )
- else:
- self.visual( self.inShape.currentText(), self.cmbField.currentText() )
+ def update( self ):
+ self.cmbField.clear()
+ inputLayer = unicode( self.inShape.currentText() )
+ if inputLayer != "":
+ changedLayer = ftools_utils.getVectorLayerByName( inputLayer )
+ changedField = changedLayer.dataProvider().fields()
+ for i in changedField:
+ if self.myFunction == 3:
+ if changedField[i].type() == QVariant.Int or changedField[i].type() == QVariant.Double:
+ self.cmbField.addItem( unicode( changedField[i].name() ) )
+ else:
+ self.cmbField.addItem( unicode( changedField[i].name() ) )
+ def accept( self ):
+ if self.inShape.currentText() == "":
+ QMessageBox.information( self, "Error!", self.tr( "Please specify input vector layer" ) )
+ elif self.cmbField.isVisible() and self.cmbField.currentText() == "":
+ QMessageBox.information( self, "Error!", self.tr( "Please specify input field" ) )
+ else:
+ self.visual( self.inShape.currentText(), self.cmbField.currentText() )
- def manageGui( self ):
- if self.myFunction == 1: # Check geometry validity
- self.setWindowTitle( self.tr( "Check geometry validity" ) )
- self.cmbField.setVisible( False )
- self.label.setVisible( False )
- self.label_2.setText( self.tr( "Geometry errors" ) )
- self.label_4.setText( self.tr( "Total encountered errors" ) )
- elif self.myFunction == 2: # List unique values
- self.setWindowTitle( self.tr( "List unique values" ) )
- self.label_2.setText( self.tr( "Unique values" ) )
- self.label_4.setText(self.tr( "Total unique values" ) )
- elif self.myFunction == 3: # Basic statistics
- self.setWindowTitle( self.tr( "Basics statistics" ) )
- self.label_2.setText( self.tr( "Statistics output" ) )
- self.label_4.setVisible( False )
- self.lstCount.setVisible( False )
- self.resize( 381, 400 )
- elif self.myFunction == 4: # Nearest neighbour analysis
- self.setWindowTitle( self.tr( "Nearest neighbour analysis" ) )
- self.cmbField.setVisible( False )
- self.label.setVisible( False )
- self.label_2.setText( self.tr( "Nearest neighbour statistics" ) )
- self.label_4.setVisible( False )
- self.lstCount.setVisible( False )
- self.resize( 381, 200 )
- self.inShape.clear()
- if self.myFunction == 1:
- myList = ftools_utils.getLayerNames( [ QGis.Polygon ] )
- elif self.myFunction == 4:
- myList = ftools_utils.getLayerNames( [ QGis.Point ] )
- else:
- myList = ftools_utils.getLayerNames( [ QGis.Point, QGis.Line, QGis.Polygon ] )
- self.inShape.addItems( myList )
- return
+ def manageGui( self ):
+ if self.myFunction == 1: # Check geometry validity
+ self.setWindowTitle( self.tr( "Check geometry validity" ) )
+ self.cmbField.setVisible( False )
+ self.label.setVisible( False )
+ self.label_2.setText( self.tr( "Geometry errors" ) )
+ self.label_4.setText( self.tr( "Total encountered errors" ) )
+ elif self.myFunction == 2: # List unique values
+ self.setWindowTitle( self.tr( "List unique values" ) )
+ self.label_2.setText( self.tr( "Unique values" ) )
+ self.label_4.setText(self.tr( "Total unique values" ) )
+ elif self.myFunction == 3: # Basic statistics
+ self.setWindowTitle( self.tr( "Basics statistics" ) )
+ self.label_2.setText( self.tr( "Statistics output" ) )
+ self.label_4.setVisible( False )
+ self.lstCount.setVisible( False )
+ self.resize( 381, 400 )
+ elif self.myFunction == 4: # Nearest neighbour analysis
+ self.setWindowTitle( self.tr( "Nearest neighbour analysis" ) )
+ self.cmbField.setVisible( False )
+ self.label.setVisible( False )
+ self.label_2.setText( self.tr( "Nearest neighbour statistics" ) )
+ self.label_4.setVisible( False )
+ self.lstCount.setVisible( False )
+ self.resize( 381, 200 )
+ self.inShape.clear()
+ if self.myFunction == 1:
+ myList = ftools_utils.getLayerNames( [ QGis.Polygon ] )
+ elif self.myFunction == 4:
+ myList = ftools_utils.getLayerNames( [ QGis.Point ] )
+ else:
+ myList = ftools_utils.getLayerNames( [ QGis.Point, QGis.Line, QGis.Polygon ] )
+ self.inShape.addItems( myList )
+ return
-#1: Check geometry
-#2: List unique values
-#3: Basic statistics
-#4: Nearest neighbour analysis
- def visual( self, myLayer, myField ):
- vlayer = ftools_utils.getVectorLayerByName( myLayer )
- self.lstUnique.clear()
- self.lstCount.clear()
- self.testThread = visualThread( self.iface.mainWindow(), self, self.myFunction, vlayer, myField )
- 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 )
- self.cancel_close.setText( "Cancel" )
- QObject.connect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
- self.testThread.start()
- return True
+#1: Check geometry
+#2: List unique values
+#3: Basic statistics
+#4: Nearest neighbour analysis
+ def visual( self, myLayer, myField ):
+ vlayer = ftools_utils.getVectorLayerByName( myLayer )
+ self.lstUnique.clear()
+ self.lstCount.clear()
+ self.testThread = visualThread( self.iface.mainWindow(), self, self.myFunction, vlayer, myField )
+ 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 )
+ self.cancel_close.setText( "Cancel" )
+ QObject.connect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
+ self.testThread.start()
+ return True
- def cancelThread( self ):
- self.testThread.stop()
-
- def runFinishedFromThread( self, output ):
- self.testThread.stop()
- self.lstUnique.addItems( output[ 0 ] )
- self.lstCount.insert( unicode( output[ 1 ] ) )
- self.cancel_close.setText( "Close" )
- QObject.disconnect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
- return True
-
- def runStatusFromThread( self, status ):
- self.progressBar.setValue( status )
+ def cancelThread( self ):
+ self.testThread.stop()
+
+ def runFinishedFromThread( self, output ):
+ self.testThread.stop()
+ self.lstUnique.addItems( output[ 0 ] )
+ self.lstCount.insert( unicode( output[ 1 ] ) )
+ self.cancel_close.setText( "Close" )
+ QObject.disconnect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
+ return True
+
+ def runStatusFromThread( self, status ):
+ self.progressBar.setValue( status )
- def runRangeFromThread( self, range_vals ):
- self.progressBar.setRange( range_vals[ 0 ], range_vals[ 1 ] )
-
+ def runRangeFromThread( self, range_vals ):
+ self.progressBar.setRange( range_vals[ 0 ], range_vals[ 1 ] )
+
class visualThread( QThread ):
- def __init__( self, parentThread, parentObject, function, vlayer, myField ):
- QThread.__init__( self, parentThread )
- self.parent = parentObject
- self.running = False
- self.myFunction = function
- self.vlayer = vlayer
- self.myField = myField
+ def __init__( self, parentThread, parentObject, function, vlayer, myField ):
+ QThread.__init__( self, parentThread )
+ self.parent = parentObject
+ self.running = False
+ self.myFunction = function
+ self.vlayer = vlayer
+ self.myField = myField
# self.total = 0
# self.currentCount = 0
- def run( self ):
- self.running = True
- if self.myFunction == 1: # Check geometry
- ( lst, cnt ) = self.check_geometry( self.vlayer )
- elif self.myFunction == 2: # List unique values
- ( lst, cnt ) = self.list_unique_values( self.vlayer, self.myField )
- elif self.myFunction == 3: # Basic statistics
- ( lst, cnt ) = self.basic_statistics( self.vlayer, self.myField )
- elif self.myFunction == 4: # Nearest neighbour analysis
- ( lst, cnt ) = self.nearest_neighbour_analysis( self.vlayer )
- self.emit( SIGNAL( "runFinished(PyQt_PyObject)" ), ( lst, cnt ) )
- self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
+ def run( self ):
+ self.running = True
+ if self.myFunction == 1: # Check geometry
+ ( lst, cnt ) = self.check_geometry( self.vlayer )
+ elif self.myFunction == 2: # List unique values
+ ( lst, cnt ) = self.list_unique_values( self.vlayer, self.myField )
+ elif self.myFunction == 3: # Basic statistics
+ ( lst, cnt ) = self.basic_statistics( self.vlayer, self.myField )
+ elif self.myFunction == 4: # Nearest neighbour analysis
+ ( lst, cnt ) = self.nearest_neighbour_analysis( self.vlayer )
+ self.emit( SIGNAL( "runFinished(PyQt_PyObject)" ), ( lst, cnt ) )
+ self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
- def stop(self):
- self.running = False
+ def stop(self):
+ self.running = False
- def list_unique_values( self, vlayer, myField ):
- vprovider = vlayer.dataProvider()
- allAttrs = vprovider.attributeIndexes()
- vprovider.select( allAttrs )
- fields = vprovider.fields()
- index = vprovider.fieldNameIndex( myField )
- unique = ftools_utils.getUniqueValues( vprovider, int( index ) )
- lstUnique = []
- nFeat = len( unique )
- nElement = 0
- self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
- self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
- for item in unique:
- nElement += 1
- self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
- lstUnique.append(item.toString().trimmed())
- lstCount = len( unique )
- return ( lstUnique, lstCount )
+ def list_unique_values( self, vlayer, myField ):
+ vprovider = vlayer.dataProvider()
+ allAttrs = vprovider.attributeIndexes()
+ vprovider.select( allAttrs )
+ fields = vprovider.fields()
+ index = vprovider.fieldNameIndex( myField )
+ unique = ftools_utils.getUniqueValues( vprovider, int( index ) )
+ lstUnique = []
+ nFeat = len( unique )
+ nElement = 0
+ self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
+ self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
+ for item in unique:
+ nElement += 1
+ self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
+ lstUnique.append(item.toString().trimmed())
+ lstCount = len( unique )
+ return ( lstUnique, lstCount )
- def basic_statistics( self, vlayer, myField ):
- vprovider = vlayer.dataProvider()
- allAttrs = vprovider.attributeIndexes()
- vprovider.select( allAttrs )
- fields = vprovider.fields()
- index = vprovider.fieldNameIndex( myField )
- feat = QgsFeature()
- sumVal = 0
- meanVal = 0
- stdVal = 0
- cvVal = 0
- nVal = 0
- values = []
- first = True
- nFeat = vprovider.featureCount()
- nElement = 0
- self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
- self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
- while vprovider.nextFeature( feat ):
- atMap = feat.attributeMap()
- value = float( atMap[ index ].toDouble()[ 0 ] )
- if first:
- minVal = value
- maxVal = value
- first = False
- else:
- if value < minVal: minVal = value
- if value > maxVal: maxVal = value
- values.append( value )
- sumVal = sumVal + value
- nElement += 1
- self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
- nVal= float( len( values ) )
- print "to here"
- if not nVal > 0.00:
- print "then here"
- meanVal = float( sumVal ) / nVal
- if not meanVal == 0.00:
- for val in values:
- stdVal += ( ( val - meanVal ) * ( val - meanVal ) )
- print "finally here"
- stdVal = math.sqrt( stdVal / nVal )
- cvVal = stdVal / meanVal
- lstStats = []
- lstStats.append( "Mean : " + unicode( meanVal ) )
- lstStats.append( "StdDev : " + unicode( stdVal ) )
- lstStats.append( "Sum : " + unicode( sumVal) )
- lstStats.append( "Min : " + unicode( minVal ) )
- lstStats.append( "Max : " + unicode( maxVal ) )
- lstStats.append( "N : " + unicode( nVal ) )
- lstStats.append( "CV : " + unicode( cvVal ) )
- return ( lstStats, [] )
+ def basic_statistics( self, vlayer, myField ):
+ vprovider = vlayer.dataProvider()
+ allAttrs = vprovider.attributeIndexes()
+ vprovider.select( allAttrs )
+ fields = vprovider.fields()
+ index = vprovider.fieldNameIndex( myField )
+ feat = QgsFeature()
+ sumVal = 0
+ meanVal = 0
+ stdVal = 0
+ cvVal = 0
+ nVal = 0
+ values = []
+ first = True
+ nFeat = vprovider.featureCount()
+ nElement = 0
+ self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
+ self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
+ while vprovider.nextFeature( feat ):
+ atMap = feat.attributeMap()
+ value = float( atMap[ index ].toDouble()[ 0 ] )
+ if first:
+ minVal = value
+ maxVal = value
+ first = False
+ else:
+ if value < minVal: minVal = value
+ if value > maxVal: maxVal = value
+ values.append( value )
+ sumVal = sumVal + value
+ nElement += 1
+ self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
+ nVal= float( len( values ) )
+ print "to here"
+ if not nVal > 0.00:
+ print "then here"
+ meanVal = float( sumVal ) / nVal
+ if not meanVal == 0.00:
+ for val in values:
+ stdVal += ( ( val - meanVal ) * ( val - meanVal ) )
+ print "finally here"
+ stdVal = math.sqrt( stdVal / nVal )
+ cvVal = stdVal / meanVal
+ lstStats = []
+ lstStats.append( "Mean : " + unicode( meanVal ) )
+ lstStats.append( "StdDev : " + unicode( stdVal ) )
+ lstStats.append( "Sum : " + unicode( sumVal) )
+ lstStats.append( "Min : " + unicode( minVal ) )
+ lstStats.append( "Max : " + unicode( maxVal ) )
+ lstStats.append( "N : " + unicode( nVal ) )
+ lstStats.append( "CV : " + unicode( cvVal ) )
+ return ( lstStats, [] )
- def nearest_neighbour_analysis( self, vlayer ):
- vprovider = vlayer.dataProvider()
- allAttrs = vprovider.attributeIndexes()
- vprovider.select( allAttrs )
- feat = QgsFeature()
- neighbour = QgsFeature()
- sumDist = 0.00
- distance = QgsDistanceArea()
- A = vlayer.extent()
- A = float( A.width() * A.height() )
- index = ftools_utils.createIndex( vprovider )
- vprovider.rewind()
- nFeat = vprovider.featureCount()
- nElement = 0
- self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
- self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
- while vprovider.nextFeature( feat ):
- neighbourID = index.nearestNeighbor( feat.geometry().asPoint(), 2 )[ 1 ]
- vprovider.featureAtId( neighbourID, neighbour, True, [] )
- nearDist = distance.measureLine( neighbour.geometry().asPoint(), feat.geometry().asPoint() )
- sumDist += nearDist
- nElement += 1
- self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
- nVal = vprovider.featureCount()
- do = float( sumDist) / nVal
- de = float( 0.5 / math.sqrt( nVal / A ) )
- d = float( do / de )
- SE = float( 0.26136 / math.sqrt( ( nVal * nVal ) / A ) )
- zscore = float( ( do - de ) / SE )
- lstStats = []
- lstStats.append( self.tr( "Observed mean distance : " ) + " " + unicode( do ) )
- lstStats.append( self.tr( "Expected mean distance : " ) + " " + unicode( de ) )
- lstStats.append( self.tr( "Nearest neighbour index : " ) + " " + unicode( d ) )
- lstStats.append( "N : " + unicode( nVal ) )
- lstStats.append( "Z-Score : " + unicode( zscore ) )
- return ( lstStats, [] )
+ def nearest_neighbour_analysis( self, vlayer ):
+ vprovider = vlayer.dataProvider()
+ allAttrs = vprovider.attributeIndexes()
+ vprovider.select( allAttrs )
+ feat = QgsFeature()
+ neighbour = QgsFeature()
+ sumDist = 0.00
+ distance = QgsDistanceArea()
+ A = vlayer.extent()
+ A = float( A.width() * A.height() )
+ index = ftools_utils.createIndex( vprovider )
+ vprovider.rewind()
+ nFeat = vprovider.featureCount()
+ nElement = 0
+ self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
+ self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
+ while vprovider.nextFeature( feat ):
+ neighbourID = index.nearestNeighbor( feat.geometry().asPoint(), 2 )[ 1 ]
+ vprovider.featureAtId( neighbourID, neighbour, True, [] )
+ nearDist = distance.measureLine( neighbour.geometry().asPoint(), feat.geometry().asPoint() )
+ sumDist += nearDist
+ nElement += 1
+ self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
+ nVal = vprovider.featureCount()
+ do = float( sumDist) / nVal
+ de = float( 0.5 / math.sqrt( nVal / A ) )
+ d = float( do / de )
+ SE = float( 0.26136 / math.sqrt( ( nVal * nVal ) / A ) )
+ zscore = float( ( do - de ) / SE )
+ lstStats = []
+ lstStats.append( self.tr( "Observed mean distance : " ) + " " + unicode( do ) )
+ lstStats.append( self.tr( "Expected mean distance : " ) + " " + unicode( de ) )
+ lstStats.append( self.tr( "Nearest neighbour index : " ) + " " + unicode( d ) )
+ lstStats.append( "N : " + unicode( nVal ) )
+ lstStats.append( "Z-Score : " + unicode( zscore ) )
+ return ( lstStats, [] )
- def check_geometry( self, vlayer ):
- vprovider = vlayer.dataProvider()
- allAttrs = vprovider.attributeIndexes()
- vprovider.select( allAttrs )
- feat = QgsFeature()
- geom = QgsGeometry()
- count = 0
- lstErrors = []
- nFeat = vprovider.featureCount()
- nElement = 0
- self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
- self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
- while vprovider.nextFeature( feat ):
- geom = QgsGeometry( feat.geometry() )
- nElement += 1
- self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
- if geom.isMultipart():
- polygons = geom.asMultiPolygon()
- for polygon in polygons:
- if not self.isHoleNested( polygon ):
- lstErrors.append( self.tr( "Feature %1 contains an unnested hole" ).arg( unicode( feat.id() ) ) )
- count += 1
- if not self.isPolygonClosed( polygon ):
- lstErrors.append( self.tr( "Feature %1 is not closed" ).arg( unicode( feat.id() ) ) )
- count += 1
- if self.isSelfIntersecting( polygon ):
- lstErrors.append( self.tr( "Feature %1 is self intersecting" ).arg( unicode( feat.id() ) ) )
- count += 1
- if not self.isCorrectOrientation( polygon ):
- lstErrors.append( self.tr( "Feature %1 has incorrect node ordering" ).arg( unicode( feat.id() ) ) )
- count += 1
-
- else:
- geom = geom.asPolygon()
- if not self.isHoleNested( geom ):
- lstErrors.append( self.tr( "Feature %1 contains an unnested hole" ).arg( unicode( feat.id() ) ) )
- count += 1
- if not self.isPolygonClosed( geom ):
- lstErrors.append( self.tr( "Feature %1 is not closed" ).arg( unicode( feat.id() ) ) )
- count += 1
- if self.isSelfIntersecting( geom ):
- lstErrors.append( self.tr( "Feature %1 is self intersecting" ).arg( unicode( feat.id() ) ) )
- count += 1
- if not self.isCorrectOrientation( geom ):
- lstErrors.append( self.tr( "Feature %1 has incorrect node ordering" ).arg( unicode( feat.id() ) ) )
- count += 1
- return ( lstErrors, count )
+ def check_geometry( self, vlayer ):
+ vprovider = vlayer.dataProvider()
+ allAttrs = vprovider.attributeIndexes()
+ vprovider.select( allAttrs )
+ feat = QgsFeature()
+ geom = QgsGeometry()
+ count = 0
+ lstErrors = []
+ nFeat = vprovider.featureCount()
+ nElement = 0
+ self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0 )
+ self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
+ while vprovider.nextFeature( feat ):
+ geom = QgsGeometry( feat.geometry() )
+ nElement += 1
+ self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
+ if geom.isMultipart():
+ polygons = geom.asMultiPolygon()
+ for polygon in polygons:
+ if not self.isHoleNested( polygon ):
+ lstErrors.append( self.tr( "Feature %1 contains an unnested hole" ).arg( unicode( feat.id() ) ) )
+ count += 1
+ if not self.isPolygonClosed( polygon ):
+ lstErrors.append( self.tr( "Feature %1 is not closed" ).arg( unicode( feat.id() ) ) )
+ count += 1
+ if self.isSelfIntersecting( polygon ):
+ lstErrors.append( self.tr( "Feature %1 is self intersecting" ).arg( unicode( feat.id() ) ) )
+ count += 1
+ if not self.isCorrectOrientation( polygon ):
+ lstErrors.append( self.tr( "Feature %1 has incorrect node ordering" ).arg( unicode( feat.id() ) ) )
+ count += 1
+
+ else:
+ geom = geom.asPolygon()
+ if not self.isHoleNested( geom ):
+ lstErrors.append( self.tr( "Feature %1 contains an unnested hole" ).arg( unicode( feat.id() ) ) )
+ count += 1
+ if not self.isPolygonClosed( geom ):
+ lstErrors.append( self.tr( "Feature %1 is not closed" ).arg( unicode( feat.id() ) ) )
+ count += 1
+ if self.isSelfIntersecting( geom ):
+ lstErrors.append( self.tr( "Feature %1 is self intersecting" ).arg( unicode( feat.id() ) ) )
+ count += 1
+ if not self.isCorrectOrientation( geom ):
+ lstErrors.append( self.tr( "Feature %1 has incorrect node ordering" ).arg( unicode( feat.id() ) ) )
+ count += 1
+ return ( lstErrors, count )
- def isHoleNested( self, polygon ):
- if len( polygon ) <= 1:
- return True
- else:
- outer = polygon[ 0 ]
- for i in polygon[ 1: len( polygon ) ]:
- if not self.arePointsInside( i, outer ):
- return False
- return True
+ def isHoleNested( self, polygon ):
+ if len( polygon ) <= 1:
+ return True
+ else:
+ outer = polygon[ 0 ]
+ for i in polygon[ 1: len( polygon ) ]:
+ if not self.arePointsInside( i, outer ):
+ return False
+ return True
- def arePointsInside( self, inner, outer ):
- outer = QgsGeometry().fromPolygon( [ outer ] )
- for j in inner:
- if not outer.contains(j):
- return False
- return True
+ def arePointsInside( self, inner, outer ):
+ outer = QgsGeometry().fromPolygon( [ outer ] )
+ for j in inner:
+ if not outer.contains(j):
+ return False
+ return True
- def isPolygonClosed( self, polygon ):
- for i in polygon:
- first = i[ 0 ]
- last = i[ len( i )-1 ]
- if not first == last:
- return False
- return True
+ def isPolygonClosed( self, polygon ):
+ for i in polygon:
+ first = i[ 0 ]
+ last = i[ len( i )-1 ]
+ if not first == last:
+ return False
+ return True
- def isSelfIntersecting( self, polygon ):
- for h in polygon:
- count = 0
- size = range( 0, len (h )- 1 )
- for i in size:
- count = 0
- for j in size:
- if QgsGeometry().fromPolyline( [ h[ i ], h[ i + 1 ] ] ).intersects( QgsGeometry().fromPolyline( [ h[ j ], h[ j + 1 ] ] ) ):
- count += 1
- if count > 3:
- return True
- return False
+ def isSelfIntersecting( self, polygon ):
+ for h in polygon:
+ count = 0
+ size = range( 0, len (h )- 1 )
+ for i in size:
+ count = 0
+ for j in size:
+ if QgsGeometry().fromPolyline( [ h[ i ], h[ i + 1 ] ] ).intersects( QgsGeometry().fromPolyline( [ h[ j ], h[ j + 1 ] ] ) ):
+ count += 1
+ if count > 3:
+ return True
+ return False
- def isCorrectOrientation( self, polygon ):
- outer = True
- for h in polygon:
- if outer:
- outer = False
- if not self.isClockwise( h ):
- return False
- else:
- if self.isClockwise(h):
- return False
- return True
+ def isCorrectOrientation( self, polygon ):
+ outer = True
+ for h in polygon:
+ if outer:
+ outer = False
+ if not self.isClockwise( h ):
+ return False
+ else:
+ if self.isClockwise(h):
+ return False
+ return True
- def isClockwise( self, temp ):
- area = 0
- for pt in range( 0, len( temp ) -1 ):
- area += ( temp[ pt ].x() * temp[ pt + 1 ].y() - temp[ pt + 1 ].x() * temp[ pt ].y() )
- area = area / 2
- if area <= 0:
- return True
- else:
- return False
+ def isClockwise( self, temp ):
+ area = 0
+ for pt in range( 0, len( temp ) -1 ):
+ area += ( temp[ pt ].x() * temp[ pt + 1 ].y() - temp[ pt + 1 ].x() * temp[ pt ].y() )
+ area = area / 2
+ if area <= 0:
+ return True
+ else:
+ return False
Modified: trunk/qgis/python/plugins/fTools/tools/frmVisual.py
===================================================================
--- trunk/qgis/python/plugins/fTools/tools/frmVisual.py 2009-04-21 08:39:25 UTC (rev 10609)
+++ trunk/qgis/python/plugins/fTools/tools/frmVisual.py 2009-04-21 14:29:25 UTC (rev 10610)
@@ -2,8 +2,8 @@
# Form implementation generated from reading ui file 'frmVisual.ui'
#
-# Created: Mon Nov 10 00:01:18 2008
-# by: PyQt4 UI code generator 4.3.3
+# Created: Tue Apr 21 15:10:47 2009
+# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
@@ -13,81 +13,67 @@
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.setWindowModality(QtCore.Qt.NonModal)
- Dialog.resize(QtCore.QSize(QtCore.QRect(0,0,374,485).size()).expandedTo(Dialog.minimumSizeHint()))
+ Dialog.resize(374, 485)
Dialog.setSizeGripEnabled(True)
-
- self.gridlayout = QtGui.QGridLayout(Dialog)
- self.gridlayout.setObjectName("gridlayout")
-
+ self.gridLayout = QtGui.QGridLayout(Dialog)
+ self.gridLayout.setObjectName("gridLayout")
self.vboxlayout = QtGui.QVBoxLayout()
self.vboxlayout.setObjectName("vboxlayout")
-
self.label_3 = QtGui.QLabel(Dialog)
self.label_3.setObjectName("label_3")
self.vboxlayout.addWidget(self.label_3)
-
self.inShape = QtGui.QComboBox(Dialog)
self.inShape.setObjectName("inShape")
self.vboxlayout.addWidget(self.inShape)
- self.gridlayout.addLayout(self.vboxlayout,0,0,1,2)
-
+ self.gridLayout.addLayout(self.vboxlayout, 0, 0, 1, 2)
self.vboxlayout1 = QtGui.QVBoxLayout()
self.vboxlayout1.setObjectName("vboxlayout1")
-
self.label = QtGui.QLabel(Dialog)
self.label.setObjectName("label")
self.vboxlayout1.addWidget(self.label)
-
self.cmbField = QtGui.QComboBox(Dialog)
self.cmbField.setObjectName("cmbField")
self.vboxlayout1.addWidget(self.cmbField)
- self.gridlayout.addLayout(self.vboxlayout1,1,0,1,2)
-
+ self.gridLayout.addLayout(self.vboxlayout1, 1, 0, 1, 2)
self.vboxlayout2 = QtGui.QVBoxLayout()
self.vboxlayout2.setObjectName("vboxlayout2")
-
self.label_2 = QtGui.QLabel(Dialog)
self.label_2.setObjectName("label_2")
self.vboxlayout2.addWidget(self.label_2)
-
self.lstUnique = QtGui.QListWidget(Dialog)
self.lstUnique.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
+ self.lstUnique.setProperty("showDropIndicator", QtCore.QVariant(False))
self.lstUnique.setAlternatingRowColors(True)
self.lstUnique.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.lstUnique.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
self.lstUnique.setSelectionRectVisible(True)
self.lstUnique.setObjectName("lstUnique")
self.vboxlayout2.addWidget(self.lstUnique)
- self.gridlayout.addLayout(self.vboxlayout2,2,0,1,2)
-
+ self.gridLayout.addLayout(self.vboxlayout2, 2, 0, 1, 2)
self.hboxlayout = QtGui.QHBoxLayout()
self.hboxlayout.setObjectName("hboxlayout")
-
self.label_4 = QtGui.QLabel(Dialog)
self.label_4.setObjectName("label_4")
self.hboxlayout.addWidget(self.label_4)
-
self.lstCount = QtGui.QLineEdit(Dialog)
self.lstCount.setReadOnly(True)
self.lstCount.setObjectName("lstCount")
self.hboxlayout.addWidget(self.lstCount)
- self.gridlayout.addLayout(self.hboxlayout,3,0,1,2)
-
+ self.gridLayout.addLayout(self.hboxlayout, 3, 0, 1, 2)
self.progressBar = QtGui.QProgressBar(Dialog)
- self.progressBar.setProperty("value",QtCore.QVariant(24))
+ self.progressBar.setProperty("value", QtCore.QVariant(24))
self.progressBar.setAlignment(QtCore.Qt.AlignCenter)
self.progressBar.setObjectName("progressBar")
- self.gridlayout.addWidget(self.progressBar,4,0,1,1)
-
+ self.gridLayout.addWidget(self.progressBar, 4, 0, 1, 1)
self.buttonBox_2 = QtGui.QDialogButtonBox(Dialog)
self.buttonBox_2.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox_2.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.Ok)
self.buttonBox_2.setObjectName("buttonBox_2")
- self.gridlayout.addWidget(self.buttonBox_2,4,1,1,1)
+ self.gridLayout.addWidget(self.buttonBox_2, 4, 1, 1, 1)
self.retranslateUi(Dialog)
- QtCore.QObject.connect(self.buttonBox_2,QtCore.SIGNAL("accepted()"),Dialog.accept)
- QtCore.QObject.connect(self.buttonBox_2,QtCore.SIGNAL("rejected()"),Dialog.close)
+ QtCore.QObject.connect(self.buttonBox_2, QtCore.SIGNAL("accepted()"), Dialog.accept)
+ QtCore.QObject.connect(self.buttonBox_2, QtCore.SIGNAL("rejected()"), Dialog.close)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
@@ -95,5 +81,6 @@
self.label_3.setText(QtGui.QApplication.translate("Dialog", "Input Vector Layer", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("Dialog", "Target field", None, QtGui.QApplication.UnicodeUTF8))
self.label_2.setText(QtGui.QApplication.translate("Dialog", "Unique values list", None, QtGui.QApplication.UnicodeUTF8))
+ self.lstUnique.setSortingEnabled(True)
self.label_4.setText(QtGui.QApplication.translate("Dialog", "Unique value count", None, QtGui.QApplication.UnicodeUTF8))
Modified: trunk/qgis/python/plugins/fTools/tools/frmVisual.ui
===================================================================
--- trunk/qgis/python/plugins/fTools/tools/frmVisual.ui 2009-04-21 08:39:25 UTC (rev 10609)
+++ trunk/qgis/python/plugins/fTools/tools/frmVisual.ui 2009-04-21 14:29:25 UTC (rev 10610)
@@ -61,6 +61,9 @@
<property name="editTriggers" >
<set>QAbstractItemView::NoEditTriggers</set>
</property>
+ <property name="showDropIndicator" stdset="0" >
+ <bool>false</bool>
+ </property>
<property name="alternatingRowColors" >
<bool>true</bool>
</property>
@@ -73,6 +76,9 @@
<property name="selectionRectVisible" >
<bool>true</bool>
</property>
+ <property name="sortingEnabled" >
+ <bool>true</bool>
+ </property>
</widget>
</item>
</layout>
More information about the QGIS-commit
mailing list