Skip to content

Commit

Permalink
Merge branch 'master' of github.com:qgis/Quantum-GIS
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Dec 6, 2011
2 parents 5b6b293 + 0c39be6 commit 6ddf1f6
Show file tree
Hide file tree
Showing 31 changed files with 9,777 additions and 5,436 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -39,3 +39,4 @@ doc/CODING.tex
doc/INSTALL.tex
scripts/Debug
scripts/RelWithDebInfo
/CMakeLists.txt.user
8 changes: 6 additions & 2 deletions CMakeLists.txt
Expand Up @@ -117,7 +117,7 @@ ENDIF (NOT BISON_EXECUTABLE)
#############################################################
# search for dependencies

IF(NOT WIN32)
IF(NOT WIN32 AND NOT ANDROID)
INCLUDE(CheckFunctionExists)
CHECK_FUNCTION_EXISTS(openpty OPENPTY_IN_LIBC)
IF(NOT OPENPTY_IN_LIBC)
Expand All @@ -130,7 +130,7 @@ IF(NOT WIN32)
MESSAGE (SEND_ERROR "openpty not found!")
ENDIF(NEED_LIBUTIL)
ENDIF(NOT OPENPTY_IN_LIBC)
ENDIF(NOT WIN32)
ENDIF(NOT WIN32 AND NOT ANDROID)

# required
FIND_PACKAGE(Proj)
Expand Down Expand Up @@ -339,6 +339,10 @@ ELSE (WIN32)

ENDIF (WIN32)

IF (ANDROID)
SET (DEFAULT_PLUGIN_SUBDIR lib)
SET (DEFAULT_DATA_SUBDIR files/share)
ENDIF (ANDROID)

#assume we have escaped compiler directives
#eventually we want to change this to new
Expand Down
10 changes: 8 additions & 2 deletions cmake/FindPostgres.cmake
Expand Up @@ -14,7 +14,12 @@
# POSTGRES_INCLUDE_DIR
# POSTGRES_LIBRARY

IF(WIN32)
IF(ANDROID)
SET(POSTGRES_INCLUDE_DIR ${POSTGRES_INCLUDE_DIR} CACHE STRING INTERNAL)
SET(POSTGRES_LIBRARY ${PG_TMP}/libpq.so CACHE STRING INTERNAL)
ENDIF(ANDROID)

IF(WIN32 AND NOT ANDROID)
IF (NOT POSTGRES_INCLUDE_DIR)
FIND_PATH(POSTGRES_INCLUDE_DIR libpq-fe.h
/usr/local/include
Expand Down Expand Up @@ -65,7 +70,8 @@ ELSE(WIN32)
ENDIF(POSTGRES_CONFIG)

ENDIF(UNIX)
ENDIF(WIN32)
ENDIF(WIN32 AND NOT ANDROID)


IF (POSTGRES_INCLUDE_DIR AND POSTGRES_LIBRARY)
SET(POSTGRES_FOUND TRUE)
Expand Down
14,123 changes: 8,985 additions & 5,138 deletions i18n/qgis_pt_PT.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions python/plugins/fTools/fTools.py
Expand Up @@ -379,6 +379,7 @@ def dointLines(self):

def dosplitVect(self):
d = doVectorSplit.Dialog(self.iface)
d.show()
d.exec_()

def docompGeo(self):
Expand Down
2 changes: 0 additions & 2 deletions python/plugins/fTools/tools/doMergeShapes.py
Expand Up @@ -130,7 +130,6 @@ def accept( self ):
if self.inEncoding == None:
self.inEncoding = "System"

QApplication.setOverrideCursor( QCursor( Qt.WaitCursor ) )
self.btnOk.setEnabled( False )

self.mergeThread = ShapeMergeThread( baseDir, self.inputFiles, self.inEncoding, self.outFileName, self.encoding )
Expand Down Expand Up @@ -192,7 +191,6 @@ def restoreGui( self ):
self.progressFeatures.setRange( 0, 100 )
self.progressFeatures.setValue( 0 )
self.progressFiles.setValue( 0 )
QApplication.restoreOverrideCursor()
QObject.connect( self.buttonBox, SIGNAL( "rejected()" ), self.reject )
self.btnClose.setText( self.tr( "Close" ) )
self.btnOk.setEnabled( True )
Expand Down
2 changes: 0 additions & 2 deletions python/plugins/fTools/tools/doSimplify.py
Expand Up @@ -90,7 +90,6 @@ def selectOutputFile( self ):
def accept( self ):
vLayer = ftools_utils.getVectorLayerByName( self.cmbInputLayer.currentText() )

QApplication.setOverrideCursor( Qt.WaitCursor )
self.btnOk.setEnabled( False )

if self.chkWriteShapefile.isChecked():
Expand Down Expand Up @@ -156,7 +155,6 @@ def stopProcessing( self ):

def restoreGui( self ):
self.progressBar.setValue( 0 )
QApplication.restoreOverrideCursor()
QObject.connect( self.buttonBox, SIGNAL( "rejected()" ), self.reject )
self.btnClose.setText( self.tr( "Close" ) )
self.btnOk.setEnabled( True )
Expand Down
2 changes: 0 additions & 2 deletions python/plugins/fTools/tools/doSpatialIndex.py
Expand Up @@ -108,7 +108,6 @@ def clearList( self ):
self.lstLayers.clear()

def accept( self ):
QApplication.setOverrideCursor( Qt.WaitCursor )
self.btnOk.setEnabled( False )

self.workThread = SpatialIdxThread( self.layers, self.chkExternalFiles.isChecked() )
Expand Down Expand Up @@ -147,7 +146,6 @@ def stopProcessing( self ):

def restoreGui( self ):
self.progressBar.setValue( 0 )
QApplication.restoreOverrideCursor()
QObject.connect( self.buttonBox, SIGNAL( "rejected()" ), self.reject )
self.btnClose.setText( self.tr( "Close" ) )
self.btnOk.setEnabled( True )
Expand Down
184 changes: 138 additions & 46 deletions python/plugins/fTools/tools/doVectorSplit.py
Expand Up @@ -31,22 +31,26 @@
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
#import os, sys, string, math
import ftools_utils
from ui_frmVectorSplit import Ui_Dialog

class Dialog(QDialog, Ui_Dialog):
def __init__(self, iface):
QDialog.__init__(self)
self.iface = iface
# Set up the user interface from Designer.

self.setupUi(self)
self.setWindowTitle(self.tr("Split vector layer"))

QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
self.setWindowTitle(self.tr("Split vector layer"))
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )

self.workThread = None

self.btnOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
self.btnClose = self.buttonBox_2.button( QDialogButtonBox.Close )

# populate layer list
self.progressBar.setValue(0)
mapCanvas = self.iface.mapCanvas()
layers = ftools_utils.getLayerNames([QGis.Point, QGis.Line, QGis.Polygon])
self.inShape.addItems(layers)
Expand All @@ -58,63 +62,151 @@ def update(self, inputLayer):
for i in changedField:
self.inField.addItem(unicode(changedField[i].name()))

def accept(self):
self.buttonOk.setEnabled( False )
if self.inShape.currentText() == "":
QMessageBox.information(self, self.tr("Vector Split"), self.tr("No input shapefile specified"))
elif self.outShape.text() == "":
QMessageBox.information(self, self.tr("Vector Split"), self.tr("Please specify output shapefile"))
else:
inField = self.inField.currentText()
inLayer = ftools_utils.getVectorLayerByName(unicode(self.inShape.currentText()))
self.progressBar.setValue(5)
outPath = QString(self.folderName)
self.progressBar.setValue(10)
if outPath.contains("\\"):
outPath.replace("\\", "/")
self.progressBar.setValue(15)
if not outPath.endsWith("/"): outPath = outPath + "/"
self.split(inLayer, unicode(outPath), unicode(inField), self.progressBar)
self.progressBar.setValue(100)
self.outShape.clear()
QMessageBox.information(self, self.tr("Vector Split"), self.tr("Created output shapefiles in folder:\n%1").arg( outPath))
self.progressBar.setValue(0)
self.buttonOk.setEnabled( True )

def outFile(self):
self.outShape.clear()
( self.folderName, self.encoding ) = ftools_utils.dirDialog( self )
if self.folderName is None or self.encoding is None:
return
self.outShape.setText( QString( self.folderName ) )

def split(self, vlayer, outPath, inField, progressBar):
provider = vlayer.dataProvider()
#unique = []
index = provider.fieldNameIndex(inField)
#provider.uniqueValues(index, unique)
unique = ftools_utils.getUniqueValues(vlayer.dataProvider(), int(index))
baseName = unicode( outPath + vlayer.name() + "_" + inField + "_" )
def accept(self):
inShape = self.inShape.currentText()
outDir = self.outShape.text()
if inShape == "":
QMessageBox.information(self, self.tr("Vector Split"),
self.tr("No input shapefile specified"))
return
elif outDir == "":
QMessageBox.information(self, self.tr("Vector Split"),
self.tr("Please specify output shapefile"))
return

self.btnOk.setEnabled( False )

vLayer = ftools_utils.getVectorLayerByName(unicode(self.inShape.currentText()))
self.workThread = SplitThread(vLayer, self.inField.currentText(), self.encoding, outDir)

QObject.connect(self.workThread, SIGNAL("rangeCalculated(PyQt_PyObject)"), self.setProgressRange)
QObject.connect(self.workThread, SIGNAL("valueProcessed()"), self.valueProcessed)
QObject.connect(self.workThread, SIGNAL("processFinished(PyQt_PyObject)"), self.processFinished)
QObject.connect(self.workThread, SIGNAL("processInterrupted()"), self.processInterrupted)

self.btnClose.setText(self.tr("Cancel"))
QObject.disconnect(self.buttonBox_2, SIGNAL("rejected()"), self.reject)
QObject.connect(self.btnClose, SIGNAL("clicked()"), self.stopProcessing)

self.workThread.start()

def setProgressRange(self, maximum):
self.progressBar.setRange(0, maximum)

def valueProcessed(self):
self.progressBar.setValue(self.progressBar.value() + 1)

def restoreGui(self):
self.progressBar.setValue(0)
self.outShape.clear()
QObject.connect(self.buttonBox_2, SIGNAL("rejected()"), self.reject)
self.btnClose.setText(self.tr("Close"))
self.btnOk.setEnabled(True)

def stopProcessing(self):
if self.workThread != None:
self.workThread.stop()
self.workThread = None

def processInterrupted( self ):
self.restoreGui()

def processFinished(self, errors):
self.stopProcessing()
outPath = self.outShape.text()
self.restoreGui()

if not errors.isEmpty():
msg = QString( "Processing of the following layers/files ended with error:<br><br>" ).append( errors.join( "<br>" ) )
QErrorMessage( self ).showMessage( msg )

QMessageBox.information(self, self.tr("Vector Split"),
self.tr("Created output shapefiles in folder:\n%1").arg(outPath))

class SplitThread(QThread):
def __init__(self, layer, splitField, encoding, outDir):
QThread.__init__(self, QThread.currentThread())
self.layer = layer
self.field = splitField
self.encoding = encoding
self.outDir = outDir

self.mutex = QMutex()
self.stopMe = 0

self.errors = QStringList()

def run(self):
self.mutex.lock()
self.stopMe = 0
self.mutex.unlock()

interrupted = False

outPath = QString(self.outDir)

if outPath.contains("\\"):
outPath.replace("\\", "/")

if not outPath.endsWith("/"):
outPath = outPath + "/"

provider = self.layer.dataProvider()
index = provider.fieldNameIndex(self.field)
unique = ftools_utils.getUniqueValues(provider, int(index))
baseName = unicode( outPath + self.layer.name() + "_" + self.field + "_" )
allAttrs = provider.attributeIndexes()
provider.select(allAttrs)
fieldList = ftools_utils.getFieldList(vlayer)
fieldList = ftools_utils.getFieldList(self.layer)
sRs = provider.crs()
geom = self.layer.wkbType()
inFeat = QgsFeature()
progressBar.setValue(20)
start = 20.00
add = 80.00 / len(unique)

self.emit(SIGNAL("rangeCalculated(PyQt_PyObject)"), len(unique))

for i in unique:
check = QFile(baseName + "_" + unicode(i) + ".shp")
print "I", i
print "INDEX", index
check = QFile(baseName + "_" + unicode(i.toString().trimmed()) + ".shp")
fName = check.fileName()
if check.exists():
if not QgsVectorFileWriter.deleteShapeFile(baseName + "_" + unicode(i.toString().trimmed()) + ".shp"):
return
writer = QgsVectorFileWriter(baseName + "_" + unicode(i.toString().trimmed()) + ".shp", self.encoding, fieldList, vlayer.dataProvider().geometryType(), sRs)
if not QgsVectorFileWriter.deleteShapeFile(fName):
self.errors.append( fName )
continue

writer = QgsVectorFileWriter(fName, self.encoding, fieldList, geom, sRs)
provider.rewind()
while provider.nextFeature(inFeat):
atMap = inFeat.attributeMap()
#changed from QVariant(i) to below:
#print "AtMAP", atMAP
if atMap[index] == i:
writer.addFeature(inFeat)
del writer
start = start + add
progressBar.setValue(start)

self.emit(SIGNAL("valueProcessed()"))

self.mutex.lock()
s = self.stopMe
self.mutex.unlock()
if s == 1:
interrupted = True
break

if not interrupted:
self.emit(SIGNAL("processFinished( PyQt_PyObject )"), self.errors)
else:
self.emit(SIGNAL("processInterrupted()"))

def stop(self):
self.mutex.lock()
self.stopMe = 1
self.mutex.unlock()

QThread.wait(self)
10 changes: 8 additions & 2 deletions src/analysis/CMakeLists.txt
Expand Up @@ -93,8 +93,6 @@ ENDIF (WIN32)
ADD_LIBRARY(qgis_analysis SHARED ${QGIS_ANALYSIS_SRCS} ${QGIS_ANALYSIS_MOC_SRCS} ${QGIS_ANALYSIS_HDRS})

SET_TARGET_PROPERTIES(qgis_analysis PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
# no moc headers, messes up PROPERTIES syntax
PUBLIC_HEADER "${QGIS_ANALYSIS_HDRS}"
CLEAN_DIRECT_OUTPUT 1
Expand All @@ -104,6 +102,14 @@ SET_TARGET_PROPERTIES(qgis_analysis PROPERTIES
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_analysis)

#generate unversioned libs for android
IF (NOT ANDROID)
SET_TARGET_PROPERTIES(qgis_analysis PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
)
ENDIF (NOT ANDROID)

ADD_DEPENDENCIES(qgis_analysis qgis_core)

TARGET_LINK_LIBRARIES(qgis_analysis
Expand Down
10 changes: 8 additions & 2 deletions src/analysis/network/CMakeLists.txt
Expand Up @@ -45,8 +45,6 @@ INCLUDE_DIRECTORIES(
ADD_LIBRARY(qgis_networkanalysis SHARED ${QGIS_NETWORK_ANALYSIS_SRCS} ${QGIS_NETWORK_ANALYSIS_MOC_SRCS} ${QGIS_NETWORK_ANALYSIS_HDRS})

SET_TARGET_PROPERTIES(qgis_networkanalysis PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
PUBLIC_HEADER "${QGIS_NETWORK_ANALYSIS_HDRS};${QGIS_NETWORK_ANALYSIS_MOC_HDRS}"
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
Expand All @@ -55,6 +53,14 @@ SET_TARGET_PROPERTIES(qgis_networkanalysis PROPERTIES
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_networkanalysis)

#generate unversioned libs for android
IF (NOT ANDROID)
SET_TARGET_PROPERTIES(qgis_networkanalysis PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
)
ENDIF (NOT ANDROID)

ADD_DEPENDENCIES(qgis_networkanalysis qgis_core)

TARGET_LINK_LIBRARIES(qgis_networkanalysis
Expand Down

0 comments on commit 6ddf1f6

Please sign in to comment.