Skip to content

Commit

Permalink
Merge pull request #114 from etiennesky/providers_browser2
Browse files Browse the repository at this point in the history
[FEATURE] gdal/ogr providers: optimizations and .zip / .gz file support - fixed
  • Loading branch information
timlinux committed Apr 17, 2012
2 parents 213a1bc + e5775e7 commit fc373b3
Show file tree
Hide file tree
Showing 40 changed files with 8,079 additions and 93 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Expand Up @@ -264,6 +264,20 @@ FIND_PROGRAM(QT_LRELEASE_EXECUTABLE
NO_DEFAULT_PATH
)


#############################################################
# search for zlib optional, used by quazip
# this uses script provided by cmake
# if WIN32 should use zlib from QT
FIND_PACKAGE(ZLIB)
IF (ZLIB_FOUND)
MESSAGE(STATUS "Found zlib: ${ZLIB_LIBRARIES}")
SET(HAVE_ZLIB TRUE)
ELSE (ZLIB_FOUND)
MESSAGE(STATUS "Could not find zlib (optional)")
ENDIF(ZLIB_FOUND)


#############################################################
# enable warnings

Expand Down
2 changes: 2 additions & 0 deletions cmake_templates/qgsconfig.h.in
Expand Up @@ -31,6 +31,8 @@

#cmakedefine HAVE_SPATIALITE

#cmakedefine HAVE_ZLIB

#cmakedefine HAVE_MSSQL

#cmakedefine HAVE_PYTHON
Expand Down
1 change: 1 addition & 0 deletions images/images.qrc
Expand Up @@ -193,6 +193,7 @@
<file>themes/default/mIconWms.png</file>
<file>themes/default/mIconWmsLayer.png</file>
<file>themes/default/mIconWarn.png</file>
<file>themes/default/mIconZip.png</file>
<file>themes/default/mMapserverExport.png</file>
<file>themes/default/plugin.png</file>
<file>themes/default/propertyicons/action.png</file>
Expand Down
Binary file added images/themes/default/mIconZip.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -2325,8 +2325,10 @@ void QgisApp::askUserForGDALSublayers( QgsRasterLayer *layer )
return;

QStringList sublayers = layer->subLayers();
QgsDebugMsg( QString( "raster has %1 sublayers" ).arg( layer->subLayers().size() ) );

QgsDebugMsg( "sublayers:\n " + sublayers.join( " \n" ) + "\n" );
if ( sublayers.size() < 1 )
return;

// if promptLayers=Load all, load all sublayers without prompting
QSettings settings;
Expand Down Expand Up @@ -2401,6 +2403,7 @@ void QgisApp::loadGDALSublayers( QString uri, QStringList list )
else
delete subLayer;
}

}
}

Expand Down Expand Up @@ -6776,6 +6779,7 @@ QgsRasterLayer* QgisApp::addRasterLayer(
// draw the map
mMapCanvas->freeze( false );
mMapCanvas->refresh();

return layer;
} // QgisApp::addRasterLayer

Expand Down Expand Up @@ -6817,7 +6821,8 @@ bool QgisApp::addRasterLayers( QStringList const &theFileNameQStringList, bool g
QFileInfo myFileInfo( *myIterator );
// get the directory the .adf file was in
QString myDirNameQString = myFileInfo.path();
QString myBaseNameQString = myFileInfo.completeBaseName();
//extract basename with extension
QString myBaseNameQString = myFileInfo.completeBaseName() + "." + myFileInfo.suffix();
//only allow one copy of a ai grid file to be loaded at a
//time to prevent the user selecting all adfs in 1 dir which
//actually represent 1 coverage,
Expand Down
26 changes: 26 additions & 0 deletions src/app/qgsoptions.cpp
Expand Up @@ -46,6 +46,8 @@
#include <gdal.h>
#include <geos_c.h>

#include "qgsconfig.h"

/**
* \class QgsOptions - Set user options and preferences
* Constructor
Expand Down Expand Up @@ -198,6 +200,28 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
cmbPromptRasterSublayers->addItem( tr( "Load all" ) );
cmbPromptRasterSublayers->setCurrentIndex( settings.value( "/qgis/promptForRasterSublayers", 0 ).toInt() );

// Scan for valid items in the browser dock
cmbScanItemsInBrowser->clear();
cmbScanItemsInBrowser->addItem( tr( "Check file contents" ) ); // 0
cmbScanItemsInBrowser->addItem( tr( "Check extension" ) ); // 1
cmbScanItemsInBrowser->setCurrentIndex( settings.value( "/qgis/scanItemsInBrowser", 1 ).toInt() );

// Scan for contents of compressed files (.zip) in browser dock
cmbScanZipInBrowser->clear();
cmbScanZipInBrowser->addItem( tr( "No" ) ); // 0
cmbScanZipInBrowser->addItem( tr( "Passthru" ) ); // 1
// only add these options if zlib is available
#ifdef HAVE_ZLIB
cmbScanZipInBrowser->addItem( tr( "Basic scan" ) ); // 2
cmbScanZipInBrowser->addItem( tr( "Full scan" ) ); // 3
cmbScanZipInBrowser->setCurrentIndex( settings.value( "/qgis/scanZipInBrowser", 1 ).toInt() );
#else
if ( settings.value( "/qgis/scanZipInBrowser", 1 ) == 0 )
cmbScanZipInBrowser->setCurrentIndex( 0 );
else
cmbScanZipInBrowser->setCurrentIndex( 1 );
#endif

// set the display update threshold
spinBoxUpdateThreshold->setValue( settings.value( "/Map/updateThreshold" ).toInt() );
//set the default projection behaviour radio buttongs
Expand Down Expand Up @@ -684,6 +708,8 @@ void QgsOptions::saveOptions()
settings.setValue( "/qgis/attributeTableBehaviour", cmbAttrTableBehaviour->currentIndex() );
settings.setValue( "/qgis/attributeTableRowCache", spinBoxAttrTableRowCache->value() );
settings.setValue( "/qgis/promptForRasterSublayers", cmbPromptRasterSublayers->currentIndex() );
settings.setValue( "/qgis/scanItemsInBrowser", cmbScanItemsInBrowser->currentIndex() );
settings.setValue( "/qgis/scanZipInBrowser", cmbScanZipInBrowser->currentIndex() );
settings.setValue( "/qgis/dockIdentifyResults", cbxIdentifyResultsDocked->isChecked() );
settings.setValue( "/qgis/dockSnapping", cbxSnappingOptionsDocked->isChecked() );
settings.setValue( "/qgis/addPostgisDC", cbxAddPostgisDC->isChecked() );
Expand Down
27 changes: 27 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -177,6 +177,21 @@ SET(QGIS_CORE_SRCS
qgsspatialindex.cpp
)

IF(HAVE_ZLIB)
SET(QGIS_CORE_SRCS
${QGIS_CORE_SRCS}
quazip/unzip.c
quazip/zip.c
quazip/JlCompress.cpp
quazip/qioapi.cpp
quazip/quaadler32.cpp
quazip/quacrc32.cpp
quazip/quazip.cpp
quazip/quazipfile.cpp
quazip/quazipnewinfo.cpp
)
ENDIF(HAVE_ZLIB)

IF(WIN32)
SET(QGIS_CORE_SRCS
${QGIS_CORE_SRCS}
Expand Down Expand Up @@ -281,6 +296,14 @@ SET(QGIS_CORE_MOC_HDRS
gps/qextserialport/qextserialenumerator.h
)

IF (HAVE_ZLIB)
SET(QGIS_CORE_MOC_HDRS
${QGIS_CORE_MOC_HDRS}
quazip/quazipfile.h
)
ENDIF(HAVE_ZLIB)


IF (QT_MOBILITY_LOCATION_FOUND)
SET(QGIS_CORE_MOC_HDRS
${QGIS_CORE_MOC_HDRS}
Expand Down Expand Up @@ -550,6 +573,10 @@ IF (NOT WITH_INTERNAL_SPATIALINDEX)
TARGET_LINK_LIBRARIES(qgis_core ${SPATIALINDEX_LIBRARY})
ENDIF (NOT WITH_INTERNAL_SPATIALINDEX)

IF (HAVE_ZLIB)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(qgis_core ${ZLIB_LIBRARIES})
ENDIF (HAVE_ZLIB)

IF (APPLE)
SET_TARGET_PROPERTIES(qgis_core PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE )
Expand Down

0 comments on commit fc373b3

Please sign in to comment.