Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' of github.com:qgis/Quantum-GIS
  • Loading branch information
brushtyler committed Nov 18, 2011
2 parents 8f33367 + d6ffb81 commit c40971d
Show file tree
Hide file tree
Showing 9 changed files with 339 additions and 119 deletions.
235 changes: 154 additions & 81 deletions CHANGELOG

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions doc/SPONSORS
Expand Up @@ -20,5 +20,6 @@ State of Vorarlberg, Austria (11.2011)|http://www.vorarlberg.at/
Kanton Solothurn, Switzerland (4.2011)|http://www.agi.so.ch/

BRONZE
City of Uster, Switzerland (11.2011)|http://gis.uster.ch/
Studio Associato Gfosservices|http://www.gfosservices.com
NEXTGIS|http://nextgis.org
74 changes: 61 additions & 13 deletions doc/changelog.t2t
Expand Up @@ -15,29 +15,77 @@ Change history for the QGIS Project
% These are comments and will not be generated in any output
% -------------------

% This document is in txt2tags format. You can generate html, plain text and
% moinmoin formatted documentation by running txt2tags on this document. See the
% txt2tags home page for more details. Please insert manual line breaks in this
% document as it makes diffing for changes much easier. To do this in vim
% automatically, select a section then issue (gq) command. Please don't
% apply vim formatting to the whole document as it screws up some formatting
% rather apply it selectively to paragraphs where needed.
%This document is in txt2tags format. You can generate html, plain text and
%moinmoin formatted documentation by running txt2tags on this document. See the
%txt2tags home page for more details. Please insert manual line breaks in this
%document as it makes diffing for changes much easier. To do this in vim
%automatically, select a section then issue (gq) command. Please don't
%apply vim formatting to the whole document as it screws up some formatting
%rather apply it selectively to paragraphs where needed.

% To generate the text version of this document:
% txt2tags -t txt -o CHANGELOG CHANGELOG.t2t
% txt2tags -t txt -o ../CHANGELOG changelog.t2t
% To generate the mediawiki version of this document:
% txt2tags -t wiki --no-enum-title -o CHANGELOG.wiki CHANGELOG.t2t
% txt2tags -t wiki --no-enum-title -o CHANGELOG.wiki changelog.t2t
% To generate the html version of this document:
% txt2tags -t html -o CHANGELOG.html CHANGELOG.t2t
% txt2tags -t html -o changelog.html changelog.t2t
% To generate the LaTeX version of this document:
% txt2tags -t tex -o CHANGELOG.tex CHANGELOG.t2t; pdflatex CHANGELOG.tex
% txt2tags -t tex -o CHANGELOG.tex CHANGELOG.t2t; pdflatex changelog.tex

% End of comments
% -------------------

Last Updated: %%date(%A %B %d, %Y)
Last Change : %%mtime(%A %B %d, %Y)

= Whats new in Version 1.7.2 'Wroclaw'? =

This is a bugfix release over version 1.7.1. The following changes
were made.

- Fix Gdaltools error checking for ogr layers
- More Translations in OSM plugin
- Fix for ticket #4283 (composer forgets on/off status of layers)
- Fix to v.generalize for recent GRASS versions
- Fix typos in GRASS command list
- Restore override cursor when about box is shown
- Fix #4319 (Enhance maximum for point displacement tolerance)
- Added Python wrappers for QgsZonalStatistics
- Fix #4331 (Classification dialog issues)
- Fix #4282 (Wrong map zooming when using the "Attribute Table" zoom tool)
- Match proj4string in database
- Fix #4241 (Ensure that we have a valid line in line decoration)
- Fix label id for GetPrint in composer
- Fix #3041 (Make the gdaltools command editable)
- Fix shift in point displacement renderer
- Fix for a crash in projection selection
- Fix #4308 (Interpolation and Terrain core plugins)
- Insert date value in attribute editor
- Fix #4387 (Enable "add direction symbol" only for line layers)
- Fix #2491 (Handle raster layer's transparency band while rendering)
- Allow setting I/O encoding for OGR layers in vector layer properties.
- Fix #4414 (SVG indicators for arrows are not shown)
- Label direction symbol shouldn't depend on "map" vs. "line" orientation.
- Set prompt as default behaviour for unknown CRS
- For EPSG initialize GDAL CRS from authid instead of proj.4 string
- Fix #4439 (Crash when changing style in Layer Properties)
- Fix #4444 (Error when loading Python plugins)
- Fix #4440 (invalid reference to Trac)
- Fix stopRender call in graduated symbol renderer
- Fix #4479 - trigger "new color ramp" always when activated
- Hide query entry in legend context menu for layers with joins
- Fix #4496 (Refresh map list in composer table widget in showEvent)
- OS X build/install updates
- GRASS version support
- Intializing from WKT favourize EPSG instead of PROJ.4
- Add What's this to Help menu (implement #4179)
- fTools: update layers lists after adding new layer to TOC (fix #4318)
- Don't block QGIS main window when running Merge shapefiles tool. Partially addresses #4383
- Fix broken Assign projection functionality in GDALTools and improve handling output file extension
-



= Whats new in Version 1.7.1 'Wroclaw'? =

This is a bugfix release over version 1.7.0. The following changes
Expand Down Expand Up @@ -81,7 +129,7 @@ http://linfiniti.com/2011/08/improvements-to-raster-performance-in-qgis-master/]
- Reduce top and side margins for attribute table dialog
- Remove the (hopefully) last SVN reference
- More svn version removal
- Added missing color accessor/mutator/member from composerlegenditem header
- Added missing colour accessor/mutator/member from composerlegenditem header
- Get rid of svn version stuff from release branch.
- Other workaround for Qt#5114 (fixes #3250, #3028, #2598)
- Try to make the histogram smoother
Expand Down Expand Up @@ -216,7 +264,7 @@ changed so we will just provide a bullet list of key new features here.

- Support for icons of plugins in the plugin manager dialog.
- Removed quickprint plugin - use easyprint plugin rather from plugin repo.
- Removed ogr converter plugin - use 'save as' context menu rather.
- Removed ogr convertor plugin - use 'save as' context menu rather.
-

==Printing==
Expand Down
4 changes: 1 addition & 3 deletions src/core/symbology-ng/qgsrulebasedrendererv2.cpp
Expand Up @@ -118,10 +118,8 @@ QgsRuleBasedRendererV2::Rule& QgsRuleBasedRendererV2::Rule::operator=( const Qgs
/////////////////////

QgsRuleBasedRendererV2::QgsRuleBasedRendererV2( QgsSymbolV2* defaultSymbol )
: QgsFeatureRendererV2( "RuleRenderer" )
: QgsFeatureRendererV2( "RuleRenderer" ), mDefaultSymbol( defaultSymbol ), mCurrentSymbol( 0 )
{
mDefaultSymbol = defaultSymbol;

// add the default rule
mRules << Rule( defaultSymbol->clone() );
}
Expand Down
37 changes: 37 additions & 0 deletions src/providers/spatialite/qgsspatialitedataitems.cpp
Expand Up @@ -12,6 +12,43 @@
#include <QMessageBox>
#include <QSettings>

QGISEXTERN bool deleteLayer( const QString& dbPath, const QString& tableName, QString& errCause );

QgsSLLayerItem::QgsSLLayerItem( QgsDataItem* parent, QString name, QString path, QString uri, LayerType layerType )
: QgsLayerItem( parent, name, path, uri, layerType, "spatialite" )
{
mPopulated = true; // no children are expected
}

QList<QAction*> QgsSLLayerItem::actions()
{
QList<QAction*> lst;

QAction* actionDeleteLayer = new QAction( tr( "Delete layer" ), this );
connect( actionDeleteLayer, SIGNAL( triggered() ), this, SLOT( deleteLayer() ) );
lst.append( actionDeleteLayer );

return lst;
}

void QgsSLLayerItem::deleteLayer()
{
QgsDataSourceURI uri( mUri );
QString errCause;
bool res = ::deleteLayer( uri.database(), uri.table(), errCause );
if ( !res )
{
QMessageBox::warning( 0, tr( "Delete layer" ), errCause );
}
else
{
QMessageBox::information( 0, tr( "Delete layer" ), tr( "Layer deleted successfully." ) );
mParent->refresh();
}
}

// ------

QgsSLConnectionItem::QgsSLConnectionItem( QgsDataItem* parent, QString name, QString path )
: QgsDataCollectionItem( parent, name, path )
{
Expand Down
12 changes: 7 additions & 5 deletions src/providers/spatialite/qgsspatialitedataitems.h
Expand Up @@ -5,12 +5,14 @@

class QgsSLLayerItem : public QgsLayerItem
{
Q_OBJECT
public:
QgsSLLayerItem( QgsDataItem* parent, QString name, QString path, QString uri, LayerType layerType )
: QgsLayerItem( parent, name, path, uri, layerType, "spatialite" )
{
mPopulated = true; // no children are expected
}
QgsSLLayerItem( QgsDataItem* parent, QString name, QString path, QString uri, LayerType layerType );

QList<QAction*> actions();

public slots:
void deleteLayer();
};

class QgsSLConnectionItem : public QgsDataCollectionItem
Expand Down
59 changes: 57 additions & 2 deletions src/providers/spatialite/qgsspatialiteprovider.cpp
Expand Up @@ -795,8 +795,7 @@ bool QgsSpatiaLiteProvider::getFeature( sqlite3_stmt *stmt, bool fetchGeometry,
}
if ( fetchGeometry )
{
QString geoCol = QString( "AsBinary(%1)" ).arg( quotedIdentifier( mGeometryColumn ) );
if ( strcasecmp( geoCol.toUtf8().constData(), sqlite3_column_name( stmt, ic ) ) == 0 )
if ( ic == mGeomColIdx )
{
if ( sqlite3_column_type( stmt, ic ) == SQLITE_BLOB )
{
Expand Down Expand Up @@ -3247,6 +3246,7 @@ bool QgsSpatiaLiteProvider::prepareStatement(
QString primaryKey = !isQuery ? "ROWID" : quotedIdentifier( mPrimaryKey );

QString sql = QString( "SELECT %1" ).arg( primaryKey );
int colIdx = 1; // column 0 is primary key
for ( QgsAttributeList::const_iterator it = fetchAttributes.constBegin(); it != fetchAttributes.constEnd(); ++it )
{
const QgsField & fld = field( *it );
Expand All @@ -3258,10 +3258,12 @@ bool QgsSpatiaLiteProvider::prepareStatement(
fieldname = QString( "AsText(%1)" ).arg( fieldname );
}
sql += "," + fieldname;
colIdx++;
}
if ( fetchGeometry )
{
sql += QString( ", AsBinary(%1)" ).arg( quotedIdentifier( mGeometryColumn ) );
mGeomColIdx = colIdx;
}
sql += QString( " FROM %1" ).arg( mQuery );

Expand Down Expand Up @@ -4986,3 +4988,56 @@ QGISEXTERN bool createDb( const QString& dbPath, QString& errCause )

return init_res;
}

// -------------

QGISEXTERN bool deleteLayer( const QString& dbPath, const QString& tableName, QString& errCause )
{
QgsDebugMsg( "deleting layer " + tableName );

spatialite_init( 0 );
QgsSpatiaLiteProvider::SqliteHandles* hndl = QgsSpatiaLiteProvider::SqliteHandles::openDb( dbPath );
if ( !hndl )
{
errCause = QObject::tr( "Connection to database failed" );
return false;
}
sqlite3* sqlite_handle = hndl->handle();

// drop the table

QString sql = QString( "DROP TABLE " ) + QgsSpatiaLiteProvider::quotedIdentifier( tableName );
QgsDebugMsg( sql );
char *errMsg = NULL;
int ret = sqlite3_exec( sqlite_handle, sql.toUtf8().constData(), NULL, NULL, &errMsg );
if ( ret != SQLITE_OK )
{
errCause = QObject::tr( "Unable to delete table %1:\n" ).arg( tableName );
errCause += QString::fromUtf8( errMsg );
sqlite3_free( errMsg );
QgsSpatiaLiteProvider::SqliteHandles::closeDb( hndl );
return false;
}

// remove table from geometry columns
sql = QString( "DELETE FROM geometry_columns WHERE f_table_name = %1" )
.arg( QgsSpatiaLiteProvider::quotedValue( tableName ) );
ret = sqlite3_exec( sqlite_handle, sql.toUtf8().constData(), NULL, NULL, NULL );
if ( ret != SQLITE_OK )
{
QgsDebugMsg( "sqlite error: " + QString::fromUtf8( sqlite3_errmsg( sqlite_handle ) ) );
}

// TODO: remove spatial indexes?

// run VACUUM to free unused space and compact the database
ret = sqlite3_exec( sqlite_handle, "VACUUM", NULL, NULL, &errMsg );
if ( ret != SQLITE_OK )
{
QgsDebugMsg( "Failed to run VACUUM after deleting table on database " + dbPath );
}

QgsSpatiaLiteProvider::SqliteHandles::closeDb( hndl );

return true;
}
8 changes: 6 additions & 2 deletions src/providers/spatialite/qgsspatialiteprovider.h
Expand Up @@ -382,13 +382,14 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider

const QgsField & field( int index ) const;

/** geometry column index used when fetching geometry */
int mGeomColIdx;

/**
* internal utility functions used to handle common SQLite tasks
*/
//void sqliteOpen();
void closeDb();
static QString quotedIdentifier( QString id );
static QString quotedValue( QString value );
bool checkLayerType();
bool getGeometryDetails();
bool getTableGeometryDetails();
Expand Down Expand Up @@ -442,6 +443,9 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider
};

public:
static QString quotedIdentifier( QString id );
static QString quotedValue( QString value );

class SqliteHandles
{
//
Expand Down

0 comments on commit c40971d

Please sign in to comment.