[QGIS Commit] r13557 - trunk/qgis/src/providers/postgres
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon May 24 07:02:38 EDT 2010
Author: jef
Date: 2010-05-24 07:02:37 -0400 (Mon, 24 May 2010)
New Revision: 13557
Removed:
trunk/qgis/src/providers/postgres/qgspostgisbox2d.cpp
trunk/qgis/src/providers/postgres/qgspostgisbox2d.h
trunk/qgis/src/providers/postgres/qgspostgisbox3d.cpp
trunk/qgis/src/providers/postgres/qgspostgisbox3d.h
trunk/qgis/src/providers/postgres/qgspostgrescountthread.cpp
trunk/qgis/src/providers/postgres/qgspostgrescountthread.h
trunk/qgis/src/providers/postgres/qgspostgresextentthread.cpp
trunk/qgis/src/providers/postgres/qgspostgresextentthread.h
Modified:
trunk/qgis/src/providers/postgres/CMakeLists.txt
trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
trunk/qgis/src/providers/postgres/qgspostgresprovider.h
Log:
postgres provider: remove unused threading code
Modified: trunk/qgis/src/providers/postgres/CMakeLists.txt
===================================================================
--- trunk/qgis/src/providers/postgres/CMakeLists.txt 2010-05-24 10:59:49 UTC (rev 13556)
+++ trunk/qgis/src/providers/postgres/CMakeLists.txt 2010-05-24 11:02:37 UTC (rev 13557)
@@ -2,14 +2,7 @@
########################################################
# Files
-SET(PG_SRCS
-qgspostgresprovider.cpp
-qgspostgisbox2d.cpp
-qgspostgisbox3d.cpp
-qgspostgrescountthread.cpp
-qgspostgresextentthread.cpp
-)
-
+SET(PG_SRCS qgspostgresprovider.cpp)
SET(PG_MOC_HDRS qgspostgresprovider.h)
Deleted: trunk/qgis/src/providers/postgres/qgspostgisbox2d.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgisbox2d.cpp 2010-05-24 10:59:49 UTC (rev 13556)
+++ trunk/qgis/src/providers/postgres/qgspostgisbox2d.cpp 2010-05-24 11:02:37 UTC (rev 13557)
@@ -1,84 +0,0 @@
-/***************************************************************************
- qgspostgisbox3d.cpp - PostgreSQL/PostGIS "box2d" representation and
- transformation
- -------------------
- begin : Feb 1, 2005
- copyright : (C) 2005 by Brendan Morley
- email : morb at ozemail dot com dot au
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-/* $Id$ */
-
-#include <fstream>
-#include <cstdlib>
-
-#include <QString>
-
-#include "qgsrectangle.h"
-
-#include "qgspostgisbox2d.h"
-#include "qgslogger.h"
-
-
-QgsPostGisBox2d::QgsPostGisBox2d( std::string box2d )
-{
-
- // If given a nil box2d, give back a nominal QgsPostGisBox2d
- if ( "" == box2d )
- {
- xmin = xmax = ymin = ymax = 0;
- return;
- }
-
- std::string s;
-
- box2d = box2d.substr( box2d.find_first_of( "(" ) + 1 );
- box2d = box2d.substr( box2d.find_first_not_of( " " ) );
- s = box2d.substr( 0, box2d.find_first_of( " " ) );
- xmin = strtod( s.c_str(), NULL );
-
- box2d = box2d.substr( box2d.find_first_of( " " ) + 1 );
- s = box2d.substr( 0, box2d.find_first_of( " " ) );
- ymin = strtod( s.c_str(), NULL );
-
- box2d = box2d.substr( box2d.find_first_of( "," ) + 1 );
- box2d = box2d.substr( box2d.find_first_not_of( " " ) );
- s = box2d.substr( 0, box2d.find_first_of( " " ) );
- xmax = strtod( s.c_str(), NULL );
-
- box2d = box2d.substr( box2d.find_first_of( " " ) + 1 );
- s = box2d.substr( 0, box2d.find_first_of( " " ) );
- ymax = strtod( s.c_str(), NULL );
-}
-
-
-QgsPostGisBox2d::~QgsPostGisBox2d()
-{
- // NO-OP
-}
-
-
-QString QgsPostGisBox2d::toStringAsBox2d()
-{
-
- QString s;
-
- s = QString( "BOX2D(%f %f,%f %f)" )
- .arg( xmin )
- .arg( ymin )
- .arg( xmax )
- .arg( ymax );
-
- QgsDebugMsg( QString( "QgsPostGisBox2d: toStringAsBox2d is returning '%1'" ).arg( s ) );
-
- return s;
-}
-
Deleted: trunk/qgis/src/providers/postgres/qgspostgisbox2d.h
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgisbox2d.h 2010-05-24 10:59:49 UTC (rev 13556)
+++ trunk/qgis/src/providers/postgres/qgspostgisbox2d.h 2010-05-24 11:02:37 UTC (rev 13557)
@@ -1,72 +0,0 @@
-/***************************************************************************
- qgspostgisbox3d.h - PostgreSQL/PostGIS "box2d" representation and
- transformation
- -------------------
- begin : Feb 1, 2005
- copyright : (C) 2005 by Brendan Morley
- email : morb at ozemail dot com dot au
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-/* $Id$ */
-
-#ifndef QGSPOSTGISBOX2D_H
-#define QGSPOSTGISBOX2D_H
-
-#include <string>
-
-#include "qgsrectangle.h"
-
-/*!
- * \brief PostgreSQL/PostGIS "box3d" representation and transformation
- \author Brendan Morley
- \date March 2005
-
-
- This object is designed to represent and transform the PostGIS "box2d"
- data type.
-
- \note This class only has meaning with PostGIS 1.0 installations.
- pre-1.0 only understands the box3d version
-
- TODO Enforce the PostGIS 1.0 prerequisite
-
- */
-
-class QgsPostGisBox2d : public QgsRectangle
-{
-
- public:
-
- /*! Constructor from a string
- \param box2d The box2d formed as a PostGIS SQL string,
- formed by functions such as PQgetvalue
- */
-
- QgsPostGisBox2d( std::string box2d );
-
-
- ~QgsPostGisBox2d();
-
-
- /*! Returns this object as a PostGIS SQL-compatible QString
- */
-
-
- QString toStringAsBox2d();
-
-
- private:
-
-
-};
-
-
-#endif
Deleted: trunk/qgis/src/providers/postgres/qgspostgisbox3d.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgisbox3d.cpp 2010-05-24 10:59:49 UTC (rev 13556)
+++ trunk/qgis/src/providers/postgres/qgspostgisbox3d.cpp 2010-05-24 11:02:37 UTC (rev 13557)
@@ -1,85 +0,0 @@
-/***************************************************************************
- qgspostgisbox3d.cpp - PostgreSQL/PostGIS "box3d" representation and
- transformation
- -------------------
- begin : Feb 1, 2005
- copyright : (C) 2005 by Brendan Morley
- email : morb at ozemail dot com dot au
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-/* $Id$ */
-
-#include <fstream>
-#include <cstdlib>
-
-#include <QString>
-
-#include "qgsrectangle.h"
-
-#include "qgspostgisbox3d.h"
-#include "qgslogger.h"
-
-
-QgsPostGisBox3d::QgsPostGisBox3d( std::string box3d )
-{
-
- // If given a nil box3d, give back a nominal QgsPostGisBox3d
- if ( "" == box3d )
- {
- xmin = xmax = ymin = ymax = 0;
- return;
- }
-
- std::string s;
-
- box3d = box3d.substr( box3d.find_first_of( "(" ) + 1 );
- box3d = box3d.substr( box3d.find_first_not_of( " " ) );
- s = box3d.substr( 0, box3d.find_first_of( " " ) );
- xmin = strtod( s.c_str(), NULL );
-
- box3d = box3d.substr( box3d.find_first_of( " " ) + 1 );
- s = box3d.substr( 0, box3d.find_first_of( " " ) );
- ymin = strtod( s.c_str(), NULL );
-
- box3d = box3d.substr( box3d.find_first_of( "," ) + 1 );
- box3d = box3d.substr( box3d.find_first_not_of( " " ) );
- s = box3d.substr( 0, box3d.find_first_of( " " ) );
- xmax = strtod( s.c_str(), NULL );
-
- box3d = box3d.substr( box3d.find_first_of( " " ) + 1 );
- s = box3d.substr( 0, box3d.find_first_of( " " ) );
- ymax = strtod( s.c_str(), NULL );
-
-}
-
-
-QgsPostGisBox3d::~QgsPostGisBox3d()
-{
- // NO-OP
-}
-
-
-QString QgsPostGisBox3d::toStringAsBox3d()
-{
-
- QString s;
-
- s = QString( "BOX3D(%f %f,%f %f)" )
- .arg( xmin )
- .arg( ymin )
- .arg( xmax )
- .arg( ymax );
-
- QgsDebugMsg( QString( "QgsPostGisBox3d: toStringAsBox3d is returning '%1'" ).arg( s ) );
-
- return s;
-}
-
Deleted: trunk/qgis/src/providers/postgres/qgspostgisbox3d.h
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgisbox3d.h 2010-05-24 10:59:49 UTC (rev 13556)
+++ trunk/qgis/src/providers/postgres/qgspostgisbox3d.h 2010-05-24 11:02:37 UTC (rev 13557)
@@ -1,71 +0,0 @@
-/***************************************************************************
- qgspostgisbox3d.h - PostgreSQL/PostGIS "box3d" representation and
- transformation
- -------------------
- begin : Feb 1, 2005
- copyright : (C) 2005 by Brendan Morley
- email : morb at ozemail dot com dot au
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-/* $Id$ */
-
-#ifndef QGSPOSTGISBOX3D_H
-#define QGSPOSTGISBOX3D_H
-
-#include <string>
-
-#include "qgsrectangle.h"
-
-/*!
- * \brief PostgreSQL/PostGIS "box3d" representation and transformation
- \author Brendan Morley
- \date March 2005
-
-
- This object is designed to represent and transform the PostGIS "box3d"
- data type.
-
- \note Only 2 dimensions are handled at this time.
-
- */
-
-class QgsPostGisBox3d : public QgsRectangle
-{
-
- public:
-
- /*! Constructor from a string
- \param box3d The box3d formed as a PostGIS SQL string,
- formed by functions such as PQgetvalue
- */
-
- QgsPostGisBox3d( std::string box3d );
-
-
- ~QgsPostGisBox3d();
-
-
- /*! Returns this object as a PostGIS SQL-compatible QString
- */
-
-
- QString toStringAsBox3d();
-
-
- protected:
-
- double zmin;
- double zmax;
-
-};
-
-
-#endif
Deleted: trunk/qgis/src/providers/postgres/qgspostgrescountthread.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgrescountthread.cpp 2010-05-24 10:59:49 UTC (rev 13556)
+++ trunk/qgis/src/providers/postgres/qgspostgrescountthread.cpp 2010-05-24 11:02:37 UTC (rev 13557)
@@ -1,131 +0,0 @@
-/***************************************************************************
- qgspostgrescountthread.cpp - Multithreaded PostgreSQL layer count
- retrieval
- -------------------
- begin : Feb 1, 2005
- copyright : (C) 2005 by Brendan Morley
- email : morb at ozemail dot com dot au
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-/* $Id$ */
-
-#include <fstream>
-#include <QEvent>
-#include <QApplication>
-
-#include "qgis.h"
-#include "qgsrectangle.h"
-
-#include "qgsprovidercountcalcevent.h"
-
-#include "qgspostgrescountthread.h"
-#include "qgslogger.h"
-
-
-/*
-QgsPostgresCountThread::QgsPostgresCountThread()
- : QgsPostgresProvider(), QThread()
-{
-
-
-
-}
-
-
-QgsPostgresCountThread::~QgsPostgresCountThread()
-{
-}
-*/
-
-void QgsPostgresCountThread::setConnInfo( QString s )
-{
- connectionInfo = s;
-}
-
-void QgsPostgresCountThread::setTableName( QString s )
-{
- tableName = s;
-}
-
-void QgsPostgresCountThread::setSqlWhereClause( QString s )
-{
- sqlWhereClause = s;
-}
-
-void QgsPostgresCountThread::setGeometryColumn( QString s )
-{
- geometryColumn = s;
-}
-
-//void QgsPostgresCountThread::setCallback( QgsPostgresProvider* o )
-//{
-// callbackObject = o;
-//}
-
-
-void QgsPostgresCountThread::run()
-{
-// // placeholders for now.
-// QString connectionInfo;
-
- QgsDebugMsg( "QgsPostgresCountThread: Started running." );
-
- // Open another connection to the database
- PGconn *connection = PQconnectdb( connectionInfo.toUtf8() );
-
- // get the extents
-
- QString sql = "select count(*) from " + tableName;
- if ( sqlWhereClause.length() > 0 )
- {
- sql += " where " + sqlWhereClause;
- }
-
-
- QgsDebugMsg( "QgsPostgresCountThread: About to issue query." );
-
- PGresult *result = PQexec( connection, sql.toUtf8() );
-
- QgsDebugMsg( "QgsPostgresCountThread: Query completed." );
-
-
- featuresCounted = QString( PQgetvalue( result, 0, 0 ) ).toLong();
- PQclear( result );
-
- QgsDebugMsg( QString( "QgsPostgresCountThread: Exact Number of features: %1" ).arg( featuresCounted ) );
-
-
- // Send some events (instead of a signal) as it is thread-safe
-
- // First we tell the object that invoked us that we have some new extents for her
- // Second we tell the application that the extents have changed, so that it
- // can go on and do any visual housekeeping (e.g. update the overview window)
-
- QgsDebugMsg( QString( "About to create and dispatch event %1 to callback" ).arg( QGis::ProviderCountCalcEvent ) );
-
- QgsProviderCountCalcEvent* e1 = new QgsProviderCountCalcEvent( featuresCounted );
- QApplication::postEvent(( QObject * )callbackObject, e1 );
-
-// QApplication::postEvent(qApp->mainWidget(), e1);
-
- QgsDebugMsg( QString( "Posted event %1 to callback" ).arg( QGis::ProviderCountCalcEvent ) );
-
-
- QgsDebugMsg( "About to finish connection." );
-
- // ending the thread, clean up
- PQfinish( connection );
-
- QgsDebugMsg( "About to complete running." );
-
-
-}
-
Deleted: trunk/qgis/src/providers/postgres/qgspostgrescountthread.h
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgrescountthread.h 2010-05-24 10:59:49 UTC (rev 13556)
+++ trunk/qgis/src/providers/postgres/qgspostgrescountthread.h 2010-05-24 11:02:37 UTC (rev 13557)
@@ -1,127 +0,0 @@
-/***************************************************************************
- qgspostgrescountthread.h - Multithreaded PostgreSQL layer count
- retrieval
- -------------------
- begin : Feb 1, 2005
- copyright : (C) 2005 by Brendan Morley
- email : morb at ozemail dot com dot au
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-/* $Id$ */
-
-#ifndef QGSPOSTGRESCOUNTTHREAD_H
-#define QGSPOSTGRESCOUNTTHREAD_H
-
-extern "C"
-{
-#include <libpq-fe.h>
-}
-
-#include <QThread>
-
-/*!
- * \brief A thread to retrieve the exact number of items in a PostgreSQL/PostGIS table.
- \author Brendan Morley
- \date March 2005
-
-
- This QThread is designed to take the parsed PostgreSQL connection parameters from
- a parent QgsPostgresProvider, and select the full PostgreSQL count(*) of the specified table.
-
- Upon completion, this thread expects to be able to post an event back to the parent
- QgsPostgresProvider. This parent should take this event as a notification that the
- exact count is now available for the parent to copy into whereever it keeps its
- layer count.
-
- The parent is also responsible for notifying any GUI items that use the count.
-
- Events are used instead of Qt signals/slots as events can be received asynchronously,
- which makes for better mutlithreading behaviour and less opportunity for programmer mishap.
-
- */
-
-class QgsPostgresCountThread : public QThread
-{
-
- public:
-
- /*
- * BM
- * The idea behind this one is to retrieve the extents asynchronously
- *
- */
- virtual void run();
-
- void setConnInfo( QString s );
-
- void setTableName( QString s );
-
- void setSqlWhereClause( QString s );
-
- void setGeometryColumn( QString s );
-
- // Feed this the object (e.g. Map Layer) for which you want to update the extents.
- //void setCallback( QgsPostgresProvider& o )
- void setCallback( QObject* o )
- {
- callbackObject = o;
- }
-
-// signals:
-
- // Presumably this reimplements the equivalent in QgsPostgresProvider > QgsVectorLayer
- /** This is used to send a request that any mapcanvas using this layer update its extents */
-// void recalculateExtents();
-
-
- private:
-
- /**
- * Connection pointer
- */
- PGconn *connection;
-
- /**
- *
- */
- QString connectionInfo;
-
- /**
- * Name of the table with no schema
- */
- QString tableName;
-
- /**
- * SQL statement used to limit the features retrieved
- */
- QString sqlWhereClause;
-
- /**
- * Name of the geometry column in the table
- */
- QString geometryColumn;
-
- /**
- * Pointer to the object to call back when the extents have been calculated.
- * It is a void pointer to avoid a circular reference back to QgsPostgresProvider
- */
-
-
- QObject* callbackObject;
-
- /**
- * Integer that contains the row count (including non-geometry rows) of the layer
- */
- long featuresCounted;
-
-};
-
-#endif
Deleted: trunk/qgis/src/providers/postgres/qgspostgresextentthread.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresextentthread.cpp 2010-05-24 10:59:49 UTC (rev 13556)
+++ trunk/qgis/src/providers/postgres/qgspostgresextentthread.cpp 2010-05-24 11:02:37 UTC (rev 13557)
@@ -1,173 +0,0 @@
-/***************************************************************************
- qgspostgresextentthread.cpp - Multithreaded PostgreSQL layer extents
- retrieval
- -------------------
- begin : Feb 1, 2005
- copyright : (C) 2005 by Brendan Morley
- email : morb at ozemail dot com dot au
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-/* $Id$ */
-
-#include <fstream>
-#include <cstdlib>
-
-#include <QEvent>
-#include <QApplication>
-#include <QEvent>
-
-#include "qgis.h"
-#include "qgsrectangle.h"
-
-
-#include "qgspostgresextentthread.h"
-#include "qgsproviderextentcalcevent.h"
-#include "qgslogger.h"
-
-
-/*
-QgsPostgresExtentThread::QgsPostgresExtentThread()
- : QgsPostgresProvider(), QThread()
-{
-
-
-
-}
-
-
-QgsPostgresExtentThread::~QgsPostgresExtentThread()
-{
-}
-*/
-
-void QgsPostgresExtentThread::setConnInfo( QString s )
-{
- connectionInfo = s;
-}
-
-void QgsPostgresExtentThread::setTableName( QString s )
-{
- tableName = s;
-}
-
-void QgsPostgresExtentThread::setSqlWhereClause( QString s )
-{
- sqlWhereClause = s;
-}
-
-void QgsPostgresExtentThread::setGeometryColumn( QString s )
-{
- geometryColumn = s;
-}
-
-//void QgsPostgresExtentThread::setCallback( QgsPostgresProvider* o )
-//{
-// callbackObject = o;
-//}
-
-
-void QgsPostgresExtentThread::run()
-{
-// // placeholders for now.
-// QString connectionInfo;
-
- QgsDebugMsg( "Started running." );
-
- // Open another connection to the database
- PGconn *connection = PQconnectdb( connectionInfo.toUtf8() );
-
- // get the extents
-
- QString sql = "select extent(" + geometryColumn + ") from " + tableName;
- if ( sqlWhereClause.length() > 0 )
- {
- sql += " where " + sqlWhereClause;
- }
-
-#if WASTE_TIME
- sql = "select xmax(extent(" + geometryColumn + ")) as xmax,"
- "xmin(extent(" + geometryColumn + ")) as xmin,"
- "ymax(extent(" + geometryColumn + ")) as ymax," "ymin(extent(" + geometryColumn + ")) as ymin" " from " + tableName;
-#endif
-
- QgsDebugMsg( QString( "Getting extents using schema.table: %1" ).arg( sql ) );
-
- QgsDebugMsg( "About to issue query." );
-
- PGresult *result = PQexec( connection, sql.toUtf8() );
-
- QgsDebugMsg( "Query completed." );
-
-
-
- std::string box3d = PQgetvalue( result, 0, 0 );
- std::string s;
-
- box3d = box3d.substr( box3d.find_first_of( "(" ) + 1 );
- box3d = box3d.substr( box3d.find_first_not_of( " " ) );
- s = box3d.substr( 0, box3d.find_first_of( " " ) );
- double minx = strtod( s.c_str(), NULL );
-
- box3d = box3d.substr( box3d.find_first_of( " " ) + 1 );
- s = box3d.substr( 0, box3d.find_first_of( " " ) );
- double miny = strtod( s.c_str(), NULL );
-
- box3d = box3d.substr( box3d.find_first_of( "," ) + 1 );
- box3d = box3d.substr( box3d.find_first_not_of( " " ) );
- s = box3d.substr( 0, box3d.find_first_of( " " ) );
- double maxx = strtod( s.c_str(), NULL );
-
- box3d = box3d.substr( box3d.find_first_of( " " ) + 1 );
- s = box3d.substr( 0, box3d.find_first_of( " " ) );
- double maxy = strtod( s.c_str(), NULL );
-
- layerExtent = new QgsRectangle( minx, miny, maxx, maxy );
-
- /*
- layerExtent.setXMaximum(maxx);
- layerExtent.setXMinimum(minx);
- layerExtent.setYMaximum(maxy);
- layerExtent.setYMinimum(miny);
- */
-
-
- QgsDebugMsg( QString( "Set extents to: %1, %2 %3, %4" ).arg( layerExtent->xMinimum() ).arg( layerExtent->yMinimum() ).arg( layerExtent->xMaximum() ).arg( layerExtent->yMaximum() ) );
-
- // clear query result
- PQclear( result );
-
-
- // Send some events (instead of a signal) as it is thread-safe
-
- // First we tell the object that invoked us that we have some new extents for her
- // Second we tell the application that the extents have changed, so that it
- // can go on and do any visual housekeeping (e.g. update the overview window)
-
- QgsDebugMsg( QString( "About to create and dispatch event %1 to callback" ).arg( QGis::ProviderExtentCalcEvent ) );
-
- QgsProviderExtentCalcEvent * e1 = new QgsProviderExtentCalcEvent( layerExtent );
- QApplication::postEvent(( QObject * )callbackObject, e1 );
-
-// QApplication::postEvent(qApp->mainWidget(), e1);
-
- QgsDebugMsg( QString( "Posted event %1 to callback" ).arg( QGis::ProviderExtentCalcEvent ) );
-
-
- QgsDebugMsg( "About to finish connection." );
-
- // ending the thread, clean up
- PQfinish( connection );
-
- QgsDebugMsg( "About to complete running." );
-
-
-}
-
Deleted: trunk/qgis/src/providers/postgres/qgspostgresextentthread.h
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresextentthread.h 2010-05-24 10:59:49 UTC (rev 13556)
+++ trunk/qgis/src/providers/postgres/qgspostgresextentthread.h 2010-05-24 11:02:37 UTC (rev 13557)
@@ -1,153 +0,0 @@
-/***************************************************************************
- qgspostgresextentthread.h - Multithreaded PostgreSQL layer extents
- retrieval
- -------------------
- begin : Feb 1, 2005
- copyright : (C) 2005 by Brendan Morley
- email : morb at ozemail dot com dot au
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-/* $Id$ */
-
-#ifndef QGSPOSTGRESEXTENTTHREAD_H
-#define QGSPOSTGRESEXTENTTHREAD_H
-
-extern "C"
-{
-#include <libpq-fe.h>
-}
-
-#include <QThread>
-
-/*!
- * \brief A thread to retrieve the exact extent in a PostgreSQL/PostGIS table in its native coordinates
- \author Brendan Morley
- \date March 2005
-
-
- This QThread is designed to take the parsed PostgreSQL connection parameters from
- a parent QgsPostgresProvider, and select the full PostGIS extent() of the specified table.
-
- Upon completion, this thread expects to be able to post an event back to the parent
- QgsPostgresProvider. This parent should take this event as a notification that the
- exact exten is now available for the parent to copy into whereever it keeps its
- layer extent.
-
- The parent is also responsible for notifying any GUI items that use the extent.
-
- Events are used instead of Qt signals/slots as events can be received asynchronously,
- which makes for better mutlithreading behaviour and less opportunity for programmer mishap.
-
- The intended return path is:
- 1. Post a QGis::ProviderExtentCalcEvent to the calling QgsPostgresProvider with new extent.
- 2. QgsPostgresProvider emits a fullExtentCalculated() signal.
- 3. QgsVectorLayer receives this signal.
- 4. The updateExtents slot in QgsVectorLayer is called.
- 5. The QgsVectorLayer extents are refreshed from the QgsPostgresProvider.
- 6. QgsVectorLayer emits a recalculateExtents() signal.
- 7. QgsMapCanvas receives this signal.
- 8. The recalculateExtents() slot in QgsMapCanvas is called.
-
- (The overview canvas is only refreshed with this new extent when the user
- resizes the extent of the main canvas)
-
- Optionally also from 2:
- 2. QgsPostgresProvider emits a repaintRequested() signal.
- 3. QgsVectorLayer receives this signal.
- 4. The triggerRepaint slot in QgsVectorLayer is called.
- 6. QgsVectorLayer emits a repaintRequested() signal.
- 7. QgsMapCanvas receives this signal.
- 8. The refresh() slot in QgsMapCanvas is called.
-
- TODO: Subclass overview canvas from mapcanvas so that only it needs to be refreshed
-
- */
-
-class QgsPostgresExtentThread : public QThread
-{
-
- public:
-
- // TODO: Combine everything into a constructor.
-
- virtual void run();
-
- void setConnInfo( QString s );
-
- void setTableName( QString s );
-
- void setSqlWhereClause( QString s );
-
- void setGeometryColumn( QString s );
-
- //! Inform this thread of where to lodge an event upon successful completion.
- /*!
-
- \param o The QObject that this thread should post an event to when the full extents
- have been calculated
-
- */
- void setCallback( QObject* o )
- {
- callbackObject = o;
- }
-
-
- private:
-
- /**
- * Connection pointer
- */
- PGconn *connection;
-
- /**
- *
- */
- QString connectionInfo;
-
- /**
- * Name of the table with no schema
- */
- QString tableName;
-
- /**
- * SQL statement used to limit the features retrieved
- */
- QString sqlWhereClause;
-
- /**
- * Name of the geometry column in the table
- */
- QString geometryColumn;
-
- /**
- * Pointer to the object to call back when the extents have been calculated.
- * It is a void pointer to avoid a circular reference back to QgsPostgresProvider
- */
-
-
- QObject* callbackObject;
- //QgsPostgresProvider* callbackObject;
-
-// typedef void (QgsPostgresProvider::*tFunction)(QgsRectangle* rect);
-
-// QgsPostgresProvider *cInst;
-// tFunction pFunction;
-// QgsRectangleCallbackTemplate<QgsPostgresExtentThread> callbackFunction;
-
- /**
- * Rectangle that contains the extent (bounding box) of the layer
- */
- QgsRectangle* layerExtent;
-
-};
-
-#endif
Modified: trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp 2010-05-24 10:59:49 UTC (rev 13556)
+++ trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp 2010-05-24 11:02:37 UTC (rev 13557)
@@ -38,10 +38,6 @@
#include "qgspostgresprovider.h"
-#include "qgspostgrescountthread.h"
-#include "qgspostgresextentthread.h"
-
-#include "qgspostgisbox3d.h"
#include "qgslogger.h"
#include "qgscredentials.h"
Modified: trunk/qgis/src/providers/postgres/qgspostgresprovider.h
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresprovider.h 2010-05-24 10:59:49 UTC (rev 13556)
+++ trunk/qgis/src/providers/postgres/qgspostgresprovider.h 2010-05-24 11:02:37 UTC (rev 13557)
@@ -36,9 +36,6 @@
#include "qgsdatasourceuri.h"
-#include "qgspostgrescountthread.h"
-#include "qgspostgresextentthread.h"
-
/**
\class QgsPostgresProvider
\brief Data provider for PostgreSQL/PostGIS layers.
@@ -375,12 +372,6 @@
//! Data source URI struct for this layer
QgsDataSourceURI mUri;
- //! Child thread for calculating extents.
- QgsPostgresExtentThread mExtentThread;
-
- //! Child thread for calculating count.
- QgsPostgresCountThread mCountThread;
-
/**
* Flag indicating if the layer data source is a valid PostgreSQL layer
*/
More information about the QGIS-commit
mailing list