Skip to content

Commit

Permalink
Merge remote branch 'pb/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
stopa85milk committed May 12, 2011
2 parents 5b1a9f9 + 76751f6 commit dfeb19b
Show file tree
Hide file tree
Showing 23 changed files with 356 additions and 48 deletions.
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Build-Depends:
python-dev,
python-qt4-dev (>=4.1.0),
python-sip-dev (>= 4.5.0) | python-sip4-dev (>= 4.5.0) | sip4 (>= 4.5),
git,
git-core | git,
txt2tags,
doxygen
Build-Conflicts: libqgis-dev, qgis-dev
Expand Down
2 changes: 1 addition & 1 deletion debian/control.hardy
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Build-Depends: debhelper (>= 5.0.51~), libgdal1-dev, libpq-dev,
python-sip4 (>= 4.5.0), python-central (>=0.5), python, sip4 (>= 4.5),
libqt4-core (>=4.2.0), libqt4-dev (>=4.2.0), libqt4-gui (>=4.2.0),
libqt4-sql (>=4.2.0), python-qt4 (>=4.1.0), python-qt4-dev (>=4.1.0),
python-sip4-dev (>= 4.5.0), pyqt4-dev-tools, fcgi-dev, git
python-sip4-dev (>= 4.5.0), pyqt4-dev-tools, fcgi-dev, git-core
Build-Conflicts: libqgis-dev, qgis-dev
Standards-Version: 3.8.0
XS-Python-Version: current
Expand Down
2 changes: 1 addition & 1 deletion debian/control.intrepid
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Build-Depends: debhelper (>= 5.0.51~), libgdal1-dev, libpq-dev,
libqt4-core (>=4.2.0), libqt4-dev (>=4.2.0), libqt4-gui (>=4.2.0),
libqt4-sql (>=4.2.0), python-qt4 (>=4.1.0), python-qt4-dev (>=4.1.0),
python-sip4-dev (>= 4.5.0), pyqt4-dev-tools, libqwt5-qt4-dev, libfcgi-dev,
git, doxygen, graphviz, txt2tags
git-core, doxygen, graphviz, txt2tags
Build-Conflicts: libqgis-dev, qgis-dev
Standards-Version: 3.8.0
XS-Python-Version: current
Expand Down
2 changes: 1 addition & 1 deletion debian/control.jaunty
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Build-Depends: debhelper (>= 5.0.51~), libgdal1-dev, libpq-dev,
libqt4-core (>=4.2.0), libqt4-dev (>=4.2.0), libqt4-gui (>=4.2.0),
libqt4-sql (>=4.2.0), python-qt4 (>=4.1.0), python-qt4-dev (>=4.1.0),
python-sip4-dev (>= 4.5.0), pyqt4-dev-tools, libqwt5-qt4-dev, libfcgi-dev,
git, doxygen, graphviz, txt2tags
git-core, doxygen, graphviz, txt2tags
Build-Conflicts: libqgis-dev, qgis-dev
Standards-Version: 3.8.0
XS-Python-Version: current
Expand Down
2 changes: 1 addition & 1 deletion debian/control.karmic
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Build-Depends: debhelper (>= 5.0.51~), libgdal1-dev, libpq-dev,
libqt4-core (>=4.2.0), libqt4-dev (>=4.2.0), libqt4-gui (>=4.2.0),
libqt4-sql (>=4.2.0), python-qt4 (>=4.1.0), python-qt4-dev (>=4.1.0),
python-sip4-dev (>= 4.5.0), pyqt4-dev-tools, libqwt5-qt4-dev, libfcgi-dev,
git, doxygen, graphviz, txt2tags
git-core, doxygen, graphviz, txt2tags
Build-Conflicts: libqgis-dev, qgis-dev
Standards-Version: 3.8.0
XS-Python-Version: current
Expand Down
2 changes: 1 addition & 1 deletion debian/control.lenny
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Build-Depends:
python-qt4-dev (>=4.1.0),
python-sip4-dev (>= 4.5.0),
sip4 (>= 4.5),
git,
git-core,
doxygen,
graphviz,
txt2tags
Expand Down
2 changes: 1 addition & 1 deletion debian/control.lucid
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Build-Depends:
python-qt4-dev (>=4.1.0),
python-sip (>= 4.5.0),
python-sip-dev (>= 4.5.0),
git,
git-core,
doxygen,
graphviz,
txt2tags
Expand Down
43 changes: 35 additions & 8 deletions python/plugins/fTools/tools/doMergeShapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ def __init__( self, iface ):
self.mergeThread = None
self.inputFiles = None
self.outFileName = None
self.inEncoding = None

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

QObject.connect( self.btnSelectDir, SIGNAL( "clicked()" ), self.inputDir )
QObject.connect( self.btnSelectFile, SIGNAL( "clicked()" ), self.outFile )
QObject.connect( self.chkListMode, SIGNAL( "stateChanged( int )" ), self.changeMode )
QObject.connect( self.leOutShape, SIGNAL( "editingFinished()" ), self.updateOutFile )

def inputDir( self ):
inDir = QFileDialog.getExistingDirectory( self,
Expand Down Expand Up @@ -83,6 +85,11 @@ def changeMode( self ):
self.lblGeometry.setEnabled( True )
self.cmbGeometry.setEnabled( True )

def updateOutFile( self ):
self.outFileName = self.leOutShape.text()
settings = QSettings()
self.outEncoding = settings.value( "/UI/encoding" ).toString()

def reject( self ):
QDialog.reject( self )

Expand Down Expand Up @@ -110,22 +117,27 @@ def accept( self ):
else:
baseDir = self.leInputDir.text()

# look for shapes with specified geometry type
self.inputFiles = ftools_utils.getShapesByGeometryType( baseDir, self.inputFiles, self.cmbGeometry.currentIndex() )

self.progressFiles.setRange( 0, self.inputFiles.count() )

outFile = QFile( self.outFileName )
if outFile.exists():
if not QgsVectorFileWriter.deleteShapeFile( self.outFileName ):
QMessageBox.warning( self, self.tr( "Delete error" ), self.tr( "Can't delete file %1" ).arg( outFileName ) )
return

# look for shapes with specified geometry type
self.inputFiles = ftools_utils.getShapesByGeometryType( baseDir, self.inputFiles, self.cmbGeometry.currentIndex() )
self.progressFiles.setRange( 0, self.inputFiles.count() )

if self.inEncoding == None:
self.inEncoding = "System"

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

self.mergeThread = ShapeMergeThread( baseDir, self.inputFiles, self.outFileName, self.encoding )
self.mergeThread = ShapeMergeThread( baseDir, self.inputFiles, self.inEncoding, self.outFileName, self.encoding )
QObject.connect( self.mergeThread, SIGNAL( "rangeChanged( PyQt_PyObject )" ), self.setProgressRange )
QObject.connect( self.mergeThread, SIGNAL( "checkStarted()" ), self.setFeatureProgressFormat )
QObject.connect( self.mergeThread, SIGNAL( "checkFinished()" ), self.resetFeatureProgressFormat )
QObject.connect( self.mergeThread, SIGNAL( "fileNameChanged( PyQt_PyObject )" ), self.setShapeProgressFormat )
QObject.connect( self.mergeThread, SIGNAL( "featureProcessed()" ), self.featureProcessed )
QObject.connect( self.mergeThread, SIGNAL( "shapeProcessed()" ), self.shapeProcessed )
QObject.connect( self.mergeThread, SIGNAL( "processingFinished()" ), self.processingFinished )
Expand All @@ -141,9 +153,18 @@ def setProgressRange( self, max ):
self.progressFeatures.setRange( 0, max )
self.progressFeatures.setValue( 0 )

def setFeatureProgressFormat( self ):
self.progressFeatures.setFormat( "Checking files: %p% ")

def resetFeatureProgressFormat( self ):
self.progressFeatures.setFormat( "%p% ")

def featureProcessed( self ):
self.progressFeatures.setValue( self.progressFeatures.value() + 1 )

def setShapeProgressFormat( self, fileName ):
self.progressFiles.setFormat( "%p% " + fileName )

def shapeProcessed( self ):
self.progressFiles.setValue( self.progressFiles.value() + 1 )

Expand All @@ -152,7 +173,9 @@ def processingFinished( self ):

if self.chkAddToCanvas.isChecked():
if not ftools_utils.addShapeToCanvas( unicode( self.outFileName ) ):
QMessageBox.warning( self, self.tr( "Merging" ), self.tr( "Error loading output shapefile:\n%1" ).arg( unicode( self.outFileName ) ) )
QMessageBox.warning( self, self.tr( "Merging" ),
self.tr( "Error loading output shapefile:\n%1" )
.arg( unicode( self.outFileName ) ) )

self.restoreGui()

Expand All @@ -165,6 +188,7 @@ def stopProcessing( self ):
self.mergeThread = None

def restoreGui( self ):
self.progressFiles.setFormat( "%p%" )
self.progressFeatures.setRange( 0, 100 )
self.progressFeatures.setValue( 0 )
self.progressFiles.setValue( 0 )
Expand All @@ -174,10 +198,11 @@ def restoreGui( self ):
self.btnOk.setEnabled( True )

class ShapeMergeThread( QThread ):
def __init__( self, dir, shapes, outputFileName, outputEncoding ):
def __init__( self, dir, shapes, inputEncoding, outputFileName, outputEncoding ):
QThread.__init__( self, QThread.currentThread() )
self.baseDir = dir
self.shapes = shapes
self.inputEncoding = inputEncoding
self.outputFileName = outputFileName
self.outputEncoding = outputEncoding

Expand Down Expand Up @@ -208,10 +233,12 @@ def run( self ):
if not newLayer.isValid():
continue
vprovider = newLayer.dataProvider()
vprovider.setEncoding( self.inputEncoding )
allAttrs = vprovider.attributeIndexes()
vprovider.select( allAttrs )
nFeat = vprovider.featureCount()
self.emit( SIGNAL( "rangeChanged( PyQt_PyObject )" ), nFeat )
self.emit( SIGNAL( "fileNameChanged( PyQt_PyObject )" ), fileName )
inFeat = QgsFeature()
outFeat = QgsFeature()
inGeom = QgsGeometry()
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorfilewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(

if ( !found )
{
vectorFileName += "." + exts[0];
vectorFileName += "." + allExts[0];
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/gui/qgsmapcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name )
, mCanvasProperties( new CanvasProperties )
, mNewSize( QSize() )
, mPainting( false )
, mAntiAliasing( false )
{
//disable the update that leads to the resize crash
if( viewport() )
if ( viewport() )
{
viewport()->setAttribute( Qt::WA_PaintOnScreen, true );
}
Expand Down Expand Up @@ -163,6 +164,7 @@ QgsMapCanvas::~QgsMapCanvas()

void QgsMapCanvas::enableAntiAliasing( bool theFlag )
{
mAntiAliasing = theFlag;
mMap->enableAntiAliasing( theFlag );
if ( mMapOverview )
mMapOverview->enableAntiAliasing( theFlag );
Expand Down
5 changes: 5 additions & 0 deletions src/gui/qgsmapcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! used to determine if anti-aliasing is enabled or not
void enableAntiAliasing( bool theFlag );

//! true if antialising is enabled
bool antiAliasingEnabled() const { return mAntiAliasing; }

//! Select which Qt class to render with
void useImageToRender( bool theFlag );

Expand Down Expand Up @@ -463,6 +466,8 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! currently in paint event
bool mPainting;

//! indicates whether antialiasing will be used for rendering
bool mAntiAliasing;
}; // class QgsMapCanvas


Expand Down
4 changes: 4 additions & 0 deletions src/gui/qgsmapcanvasitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ void QgsMapCanvasItem::paint( QPainter * painter,
const QStyleOptionGraphicsItem * option,
QWidget * widget )
{
if ( mMapCanvas->antiAliasingEnabled() )
{
painter->setRenderHint( QPainter::Antialiasing );
}
paint( painter ); // call the derived item's drawing routines
}

Expand Down
8 changes: 4 additions & 4 deletions src/mac/Contents/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

SET(COMPLETE_VERSION_WITH_RELEASE_NAME \"${COMPLETE_VERSION}-${RELEASE_NAME}\")

IF (NOT EXISTS SVN_MARKER)
SET (SVN_MARKER ${CMAKE_SOURCE_DIR}/CMakeLists.txt) # Dummy file
ENDIF (NOT EXISTS SVN_MARKER)
IF (NOT EXISTS GIT_MARKER)
SET (GIT_MARKER ${CMAKE_SOURCE_DIR}/CMakeLists.txt) # Dummy file
ENDIF (NOT EXISTS GIT_MARKER)

ADD_CUSTOM_TARGET(Info.plist ALL
DEPENDS ${SVN_MARKER}
DEPENDS ${GIT_MARKER}
COMMAND ${CMAKE_COMMAND}
-D CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-D SOURCE_DIR=${CMAKE_SOURCE_DIR}
Expand Down
12 changes: 6 additions & 6 deletions src/mac/Contents/Info.plist.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
SET(CMAKE_BACKWARDS_COMPATIBILITY "2.4")

# See if we have svn installed
FIND_PROGRAM(SVNVERSION svnversion)
# See if we have git installed
FIND_PROGRAM (GIT git)

# Read the revision if installed, else set to "unknown"
IF (SVNVERSION)
EXEC_PROGRAM (${SVNVERSION} ARGS ${SOURCE_DIR} OUTPUT_VARIABLE REVISION)
ELSE (SVNVERSION)
IF (GIT)
EXEC_PROGRAM (${GIT} ${SOURCE_DIR} ARGS "log -n1 --pretty=%h" OUTPUT_VARIABLE REVISION)
ELSE (GIT)
SET (REVISION unknown)
ENDIF (SVNVERSION)
ENDIF (GIT)

# Create Info.plist
CONFIGURE_FILE (${CURRENT_SOURCE_DIR}/Info.plist.in
Expand Down
2 changes: 1 addition & 1 deletion src/mac/Contents/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundleSignature</key>
<string>QGIS</string>
<key>CFBundleGetInfoString</key>
<string>QGIS @VERSION@ (@REVISION@), © 2002-2010 QGIS Development Team</string>
<string>QGIS @VERSION@ (@REVISION@), © 2002-2011 QGIS Development Team</string>
<key>CFBundleShortVersionString</key>
<string>@VERSION_NUM@</string>
<key>CFBundleVersion</key>
Expand Down
1 change: 1 addition & 0 deletions src/mapserver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ENDIF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo

SET ( qgis_mapserv_SRCS
qgis_map_serv.cpp
qgscapabilitiescache.cpp
qgsconfigcache.cpp
qgsconfigparser.cpp
qgsepsgcache.cpp
Expand Down
38 changes: 28 additions & 10 deletions src/mapserver/qgis_map_serv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ map service syntax for SOAP/HTTP POST
***************************************************************************/

#include "qgsapplication.h"
#include "qgscapabilitiescache.h"
#include "qgsconfigcache.h"
#include "qgsgetrequesthandler.h"
#include "qgssoaprequesthandler.h"
Expand Down Expand Up @@ -191,6 +192,9 @@ int main( int argc, char * argv[] )
}
}

//create cache for capabilities XML
QgsCapabilitiesCache capabilitiesCache;

//creating QgsMapRenderer is expensive (access to srs.db), so we do it here before the fcgi loop
QgsMapRenderer* theMapRenderer = new QgsMapRenderer();

Expand Down Expand Up @@ -291,20 +295,34 @@ int main( int argc, char * argv[] )

if ( requestIt->second == "GetCapabilities" )
{
QDomDocument capabilitiesDocument;
try
const QDomDocument* capabilitiesDocument = capabilitiesCache.searchCapabilitiesDocument( configFilePath );
if( !capabilitiesDocument ) //capabilities xml not in cache. Create a new one
{
QgsMSDebugMsg( "Capabilities document not found in cache" );
QDomDocument doc;
try
{
doc = theServer->getCapabilities();
}
catch ( QgsMapServiceException& ex )
{
theRequestHandler->sendServiceException( ex );
delete theRequestHandler;
delete theServer;
continue;
}
capabilitiesCache.insertCapabilitiesDocument( configFilePath, &doc );
capabilitiesDocument = capabilitiesCache.searchCapabilitiesDocument( configFilePath );
}
else
{
capabilitiesDocument = theServer->getCapabilities();
QgsMSDebugMsg( "Found capabilities document in cache" );
}
catch ( QgsMapServiceException& ex )

if( capabilitiesDocument )
{
theRequestHandler->sendServiceException( ex );
delete theRequestHandler;
delete theServer;
continue;
theRequestHandler->sendGetCapabilitiesResponse( *capabilitiesDocument );
}
QgsMSDebugMsg( "sending GetCapabilities response" );
theRequestHandler->sendGetCapabilitiesResponse( capabilitiesDocument );
delete theRequestHandler;
delete theServer;
continue;
Expand Down
Loading

0 comments on commit dfeb19b

Please sign in to comment.