[QGIS Commit] r9582 - in trunk/qgis: python/core src/core src/providers/delimitedtext src/providers/gpx src/providers/grass src/providers/memory src/providers/ogr src/providers/postgres src/providers/wfs

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Nov 7 19:49:59 EST 2008


Author: timlinux
Date: 2008-11-07 19:49:59 -0500 (Fri, 07 Nov 2008)
New Revision: 9582

Added:
   trunk/qgis/src/providers/memory/qgsmemoryprovider.cpp
   trunk/qgis/src/providers/memory/qgsmemoryprovider.h
Removed:
   trunk/qgis/src/providers/memory/memoryprovider.cpp
   trunk/qgis/src/providers/memory/memoryprovider.h
Modified:
   trunk/qgis/python/core/qgsvectordataprovider.sip
   trunk/qgis/src/core/qgsvectordataprovider.h
   trunk/qgis/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
   trunk/qgis/src/providers/delimitedtext/qgsdelimitedtextprovider.h
   trunk/qgis/src/providers/gpx/qgsgpxprovider.cpp
   trunk/qgis/src/providers/gpx/qgsgpxprovider.h
   trunk/qgis/src/providers/grass/qgsgrassprovider.cpp
   trunk/qgis/src/providers/grass/qgsgrassprovider.h
   trunk/qgis/src/providers/memory/CMakeLists.txt
   trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
   trunk/qgis/src/providers/ogr/qgsogrprovider.h
   trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
   trunk/qgis/src/providers/postgres/qgspostgresprovider.h
   trunk/qgis/src/providers/wfs/qgswfsprovider.cpp
   trunk/qgis/src/providers/wfs/qgswfsprovider.h
Log:
Changed begin() to rewind() on provider interface

Modified: trunk/qgis/python/core/qgsvectordataprovider.sip
===================================================================
--- trunk/qgis/python/core/qgsvectordataprovider.sip	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/python/core/qgsvectordataprovider.sip	2008-11-08 00:49:59 UTC (rev 9582)
@@ -112,7 +112,7 @@
       virtual QString dataComment() const;
       
       /** Restart reading features from previous select operation */
-      virtual void begin() = 0;
+      virtual void rewind() = 0;
 
       /**
        * Returns the minimum value of an attributs

Modified: trunk/qgis/src/core/qgsvectordataprovider.h
===================================================================
--- trunk/qgis/src/core/qgsvectordataprovider.h	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/core/qgsvectordataprovider.h	2008-11-08 00:49:59 UTC (rev 9582)
@@ -155,7 +155,7 @@
     virtual QString dataComment() const;
 
     /** Restart reading features from previous select operation */
-    virtual void begin() = 0;
+    virtual void rewind() = 0;
 
     /**
      * Returns the minimum value of an attribute

Modified: trunk/qgis/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
===================================================================
--- trunk/qgis/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp	2008-11-08 00:49:59 UTC (rev 9582)
@@ -434,7 +434,7 @@
   {
     mSelectionRectangle = rect;
   }
-  begin();
+  rewind();
 }
 
 
@@ -476,7 +476,7 @@
   return attributeFields;
 }
 
-void QgsDelimitedTextProvider::begin()
+void QgsDelimitedTextProvider::rewind()
 {
   // Reset feature id to 0
   mFid = 0;

Modified: trunk/qgis/src/providers/delimitedtext/qgsdelimitedtextprovider.h
===================================================================
--- trunk/qgis/src/providers/delimitedtext/qgsdelimitedtextprovider.h	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/delimitedtext/qgsdelimitedtextprovider.h	2008-11-08 00:49:59 UTC (rev 9582)
@@ -103,7 +103,7 @@
     virtual const QgsFieldMap & fields() const;
 
     /** Restart reading features from previous select operation */
-    virtual void begin();
+    virtual void rewind();
 
     /** Returns a bitmask containing the supported capabilities
         Note, some capabilities may change depending on whether

Modified: trunk/qgis/src/providers/gpx/qgsgpxprovider.cpp
===================================================================
--- trunk/qgis/src/providers/gpx/qgsgpxprovider.cpp	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/gpx/qgsgpxprovider.cpp	2008-11-08 00:49:59 UTC (rev 9582)
@@ -425,7 +425,7 @@
   mAttributesToFetch = fetchAttributes;
   mFetchGeom = fetchGeometry;
 
-  begin();
+  rewind();
 }
 
 
@@ -482,7 +482,7 @@
 }
 
 
-void QgsGPXProvider::begin()
+void QgsGPXProvider::rewind()
 {
   if ( mFeatureType == WaypointType )
     mWptIter = data->waypointsBegin();

Modified: trunk/qgis/src/providers/gpx/qgsgpxprovider.h
===================================================================
--- trunk/qgis/src/providers/gpx/qgsgpxprovider.h	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/gpx/qgsgpxprovider.h	2008-11-08 00:49:59 UTC (rev 9582)
@@ -93,7 +93,7 @@
     virtual const QgsFieldMap & fields() const;
 
     /** Restart reading features from previous select operation */
-    virtual void begin();
+    virtual void rewind();
 
     /**
      * Adds a list of features

Modified: trunk/qgis/src/providers/grass/qgsgrassprovider.cpp
===================================================================
--- trunk/qgis/src/providers/grass/qgsgrassprovider.cpp	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/grass/qgsgrassprovider.cpp	2008-11-08 00:49:59 UTC (rev 9582)
@@ -557,7 +557,7 @@
   return mLayers[mLayerId].keyColumn;
 }
 
-void QgsGrassProvider::begin()
+void QgsGrassProvider::rewind()
 {
   if ( isEdited() || isFrozen() || !mValid )
     return;

Modified: trunk/qgis/src/providers/grass/qgsgrassprovider.h
===================================================================
--- trunk/qgis/src/providers/grass/qgsgrassprovider.h	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/grass/qgsgrassprovider.h	2008-11-08 00:49:59 UTC (rev 9582)
@@ -175,7 +175,7 @@
     int keyField();
 
     /** Restart reading features from previous select operation */
-    void begin();
+    void rewind();
 
     /** Returns the minimum value of an attributs
      *  @param index the index of the attribute */

Modified: trunk/qgis/src/providers/memory/CMakeLists.txt
===================================================================
--- trunk/qgis/src/providers/memory/CMakeLists.txt	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/memory/CMakeLists.txt	2008-11-08 00:49:59 UTC (rev 9582)
@@ -1,5 +1,5 @@
 
-SET (MEMORY_SRCS memoryprovider.cpp)
+SET (MEMORY_SRCS qgsmemoryprovider.cpp)
 
 INCLUDE_DIRECTORIES(
   .

Deleted: trunk/qgis/src/providers/memory/memoryprovider.cpp
===================================================================
--- trunk/qgis/src/providers/memory/memoryprovider.cpp	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/memory/memoryprovider.cpp	2008-11-08 00:49:59 UTC (rev 9582)
@@ -1,431 +0,0 @@
-/***************************************************************************
-    memoryprovider.cpp - provider with storage in memory
-    ------------------
-    begin                : June 2008
-    copyright            : (C) 2008 by Martin Dobias
-    email                : wonder.sk at gmail.com
- ***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include "memoryprovider.h"
-
-#include "qgsfeature.h"
-#include "qgsfield.h"
-#include "qgsgeometry.h"
-#include "qgslogger.h"
-#include "qgsspatialindex.h"
-#include "qgscoordinatereferencesystem.h"
-
-
-static const QString TEXT_PROVIDER_KEY = "memory";
-static const QString TEXT_PROVIDER_DESCRIPTION = "Memory provider";
-
-QgsMemoryProvider::QgsMemoryProvider( QString uri )
-    : QgsVectorDataProvider( uri ),
-    mSelectRectGeom( NULL ),
-    mSpatialIndex( NULL )
-{
-  if ( uri == "Point" )
-    mWkbType = QGis::WKBPoint;
-  else if ( uri == "LineString" )
-    mWkbType = QGis::WKBLineString;
-  else if ( uri == "Polygon" )
-    mWkbType = QGis::WKBPolygon;
-  else if ( uri == "MultiPoint" )
-    mWkbType = QGis::WKBMultiPoint;
-  else if ( uri == "MultiLineString" )
-    mWkbType = QGis::WKBMultiLineString;
-  else if ( uri == "MultiPolygon" )
-    mWkbType = QGis::WKBMultiPolygon;
-  else
-    mWkbType = QGis::WKBUnknown;
-
-  mNextFeatureId = 1;
-}
-
-QgsMemoryProvider::~QgsMemoryProvider()
-{
-  delete mSpatialIndex;
-  delete mSelectRectGeom;
-}
-
-QString QgsMemoryProvider::storageType() const
-{
-  return "Memory storage";
-}
-
-bool QgsMemoryProvider::nextFeature( QgsFeature& feature )
-{
-  bool hasFeature = FALSE;
-
-  // option 1: using spatial index
-  if ( mSelectUsingSpatialIndex )
-  {
-    while ( mSelectSI_Iterator != mSelectSI_Features.end() )
-    {
-      // do exact check in case we're doing intersection
-      if ( mSelectUseIntersect )
-      {
-        if ( mFeatures[*mSelectSI_Iterator].geometry()->intersects( mSelectRectGeom ) )
-          hasFeature = TRUE;
-      }
-      else
-        hasFeature = TRUE;
-
-      if ( hasFeature )
-        break;
-
-      mSelectSI_Iterator++;
-    }
-
-    // copy feature
-    if ( hasFeature )
-    {
-      feature = mFeatures[*mSelectSI_Iterator];
-      mSelectSI_Iterator++;
-    }
-    return hasFeature;
-  }
-
-  // option 2: not using spatial index
-  while ( mSelectIterator != mFeatures.end() )
-  {
-    if ( mSelectRect.isEmpty() )
-    {
-      // selection rect empty => using all features
-      hasFeature = TRUE;
-    }
-    else
-    {
-      if ( mSelectUseIntersect )
-      {
-        // using exact test when checking for intersection
-        if ( mSelectIterator->geometry()->intersects( mSelectRectGeom ) )
-          hasFeature = TRUE;
-      }
-      else
-      {
-        // check just bounding box against rect when not using intersection
-        if ( mSelectIterator->geometry()->boundingBox().intersects( mSelectRect ) )
-          hasFeature = TRUE;
-      }
-    }
-
-    if ( hasFeature )
-      break;
-
-    mSelectIterator++;
-  }
-
-  // copy feature
-  if ( hasFeature )
-  {
-    feature = mSelectIterator.value();
-    mSelectIterator++;
-  }
-
-  return hasFeature;
-}
-
-
-bool QgsMemoryProvider::featureAtId( int featureId,
-                                     QgsFeature& feature,
-                                     bool fetchGeometry,
-                                     QgsAttributeList fetchAttributes )
-{
-  QgsFeatureMap::iterator it = mFeatures.find( featureId );
-
-  if ( it == mFeatures.end() )
-    return FALSE;
-
-  feature = *it;
-  return TRUE;
-}
-
-
-void QgsMemoryProvider::select( QgsAttributeList fetchAttributes,
-                                QgsRect rect,
-                                bool fetchGeometry,
-                                bool useIntersect )
-{
-  mSelectAttrs = fetchAttributes;
-  mSelectRect = rect;
-  delete mSelectRectGeom;
-  mSelectRectGeom = QgsGeometry::fromRect( rect );
-  mSelectGeometry = fetchGeometry;
-  mSelectUseIntersect = useIntersect;
-
-  // if there's spatial index, use it!
-  // (but don't use it when selection rect is not specified)
-  if ( mSpatialIndex && !mSelectRect.isEmpty() )
-  {
-    mSelectUsingSpatialIndex = TRUE;
-    mSelectSI_Features = mSpatialIndex->intersects( rect );
-    QgsDebugMsg( "Features returned by spatial index: " + QString::number( mSelectSI_Features.count() ) );
-  }
-  else
-  {
-    mSelectUsingSpatialIndex = FALSE;
-    mSelectSI_Features.clear();
-  }
-
-  begin();
-}
-
-void QgsMemoryProvider::begin()
-{
-  if ( mSelectUsingSpatialIndex )
-    mSelectSI_Iterator = mSelectSI_Features.begin();
-  else
-    mSelectIterator = mFeatures.begin();
-}
-
-
-QgsRect QgsMemoryProvider::extent()
-{
-  return mExtent;
-}
-
-QGis::WkbType QgsMemoryProvider::geometryType() const
-{
-  return mWkbType;
-}
-
-long QgsMemoryProvider::featureCount() const
-{
-  return mFeatures.count();
-}
-
-uint QgsMemoryProvider::fieldCount() const
-{
-  return mFields.count();
-}
-
-
-const QgsFieldMap & QgsMemoryProvider::fields() const
-{
-  return mFields;
-}
-
-bool QgsMemoryProvider::isValid()
-{
-  return ( mWkbType != QGis::WKBUnknown );
-}
-
-QgsCoordinateReferenceSystem QgsMemoryProvider::crs()
-{
-  // TODO: make provider projection-aware
-  return QgsCoordinateReferenceSystem(); // return default CRS
-}
-
-
-bool QgsMemoryProvider::addFeatures( QgsFeatureList & flist )
-{
-  // TODO: sanity checks of fields and geometries
-  for ( QgsFeatureList::iterator it = flist.begin(); it != flist.end(); ++it )
-  {
-    mFeatures[mNextFeatureId] = *it;
-    QgsFeature& newfeat = mFeatures[mNextFeatureId];
-    newfeat.setFeatureId( mNextFeatureId );
-
-    // update spatial index
-    if ( mSpatialIndex )
-      mSpatialIndex->insertFeature( newfeat );
-
-    mNextFeatureId++;
-  }
-
-
-  updateExtent();
-
-  return TRUE;
-}
-
-bool QgsMemoryProvider::deleteFeatures( const QgsFeatureIds & id )
-{
-  for ( QgsFeatureIds::const_iterator it = id.begin(); it != id.end(); ++it )
-  {
-    QgsFeatureMap::iterator fit = mFeatures.find( *it );
-
-    // check whether such feature exists
-    if ( fit == mFeatures.end() )
-      continue;
-
-    // update spatial index
-    if ( mSpatialIndex )
-      mSpatialIndex->deleteFeature( *fit );
-
-    mFeatures.erase( fit );
-  }
-
-  updateExtent();
-
-  return TRUE;
-}
-
-bool QgsMemoryProvider::addAttributes( const QgsNewAttributesMap & attributes )
-{
-  for ( QgsNewAttributesMap::const_iterator it = attributes.begin(); it != attributes.end(); ++it )
-  {
-    QString name = it.key();
-    QString typeName = it.value();
-    QVariant::Type type;
-    if ( typeName == "int" )
-      type = QVariant::Int;
-    else if ( typeName == "double" )
-      type = QVariant::Double;
-    else if ( typeName == "string" )
-      type = QVariant::String;
-    else
-    {
-      QgsDebugMsg( "Field type not supported: " + typeName );
-      continue;
-    }
-
-    // add new field as a last one
-    int nextId = -1;
-    for ( QgsFieldMap::iterator it2 = mFields.begin(); it2 != mFields.end(); ++it2 )
-      if ( it2.key() > nextId ) nextId = it2.key();
-    mFields[nextId+1] = QgsField( name, type, typeName );
-  }
-  return TRUE;
-}
-
-bool QgsMemoryProvider::deleteAttributes( const QgsAttributeIds& attributes )
-{
-  for ( QgsAttributeIds::const_iterator it = attributes.begin(); it != attributes.end(); ++it )
-    mFields.remove( *it );
-  return TRUE;
-}
-
-bool QgsMemoryProvider::changeAttributeValues( const QgsChangedAttributesMap & attr_map )
-{
-  for ( QgsChangedAttributesMap::const_iterator it = attr_map.begin(); it != attr_map.end(); ++it )
-  {
-    QgsFeatureMap::iterator fit = mFeatures.find( it.key() );
-    if ( fit == mFeatures.end() )
-      continue;
-
-    const QgsAttributeMap& attrs = it.value();
-    for ( QgsAttributeMap::const_iterator it2 = attrs.begin(); it2 != attrs.end(); ++it2 )
-      fit->changeAttribute( it2.key(), it2.value() );
-  }
-  return TRUE;
-}
-
-bool QgsMemoryProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
-{
-  for ( QgsGeometryMap::const_iterator it = geometry_map.begin(); it != geometry_map.end(); ++it )
-  {
-    QgsFeatureMap::iterator fit = mFeatures.find( it.key() );
-    if ( fit == mFeatures.end() )
-      continue;
-
-    // update spatial index
-    if ( mSpatialIndex )
-      mSpatialIndex->deleteFeature( *fit );
-
-    fit->setGeometry( it.value() );
-
-    // update spatial index
-    if ( mSpatialIndex )
-      mSpatialIndex->insertFeature( *fit );
-  }
-
-  updateExtent();
-
-  return TRUE;
-}
-
-bool QgsMemoryProvider::createSpatialIndex()
-{
-  if ( !mSpatialIndex )
-  {
-    mSpatialIndex = new QgsSpatialIndex();
-
-    // add existing features to index
-    for ( QgsFeatureMap::iterator it = mFeatures.begin(); it != mFeatures.end(); ++it )
-    {
-      mSpatialIndex->insertFeature( *it );
-    }
-  }
-  return TRUE;
-}
-
-int QgsMemoryProvider::capabilities() const
-{
-  return AddFeatures | DeleteFeatures | ChangeGeometries |
-         ChangeAttributeValues | AddAttributes | DeleteAttributes | CreateSpatialIndex |
-         SelectAtId | SelectGeometryAtId | RandomSelectGeometryAtId | SequentialSelectGeometryAtId;
-}
-
-
-void QgsMemoryProvider::updateExtent()
-{
-  if ( mFeatures.count() == 0 )
-  {
-    mExtent = QgsRect();
-  }
-  else
-  {
-    mExtent = mFeatures.begin().value().geometry()->boundingBox();
-    for ( QgsFeatureMap::iterator it = mFeatures.begin(); it != mFeatures.end(); ++it )
-      mExtent.unionRect( it.value().geometry()->boundingBox() );
-  }
-}
-
-
-
-// --------------------------------
-
-QString  QgsMemoryProvider::name() const
-{
-  return TEXT_PROVIDER_KEY;
-}
-
-QString  QgsMemoryProvider::description() const
-{
-  return TEXT_PROVIDER_DESCRIPTION;
-}
-
-// --------------------------------
-
-
-/**
- * Class factory to return a pointer to a newly created
- * QgsMemoryProvider object
- */
-QGISEXTERN QgsMemoryProvider *classFactory( const QString *uri )
-{
-  return new QgsMemoryProvider( *uri );
-}
-
-/** Required key function (used to map the plugin to a data store type)
- */
-QGISEXTERN QString providerKey()
-{
-  return TEXT_PROVIDER_KEY;
-}
-
-/**
- * Required description function
- */
-QGISEXTERN QString description()
-{
-  return TEXT_PROVIDER_DESCRIPTION;
-}
-
-/**
- * Required isProvider function. Used to determine if this shared library
- * is a data provider plugin
- */
-QGISEXTERN bool isProvider()
-{
-  return true;
-}

Deleted: trunk/qgis/src/providers/memory/memoryprovider.h
===================================================================
--- trunk/qgis/src/providers/memory/memoryprovider.h	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/memory/memoryprovider.h	2008-11-08 00:49:59 UTC (rev 9582)
@@ -1,208 +0,0 @@
-/***************************************************************************
-    memoryprovider.h - provider with storage in memory
-    ------------------
-    begin                : June 2008
-    copyright            : (C) 2008 by Martin Dobias
-    email                : wonder.sk at gmail.com
- ***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include "qgsvectordataprovider.h"
-
-
-typedef QMap<int, QgsFeature> QgsFeatureMap;
-
-class QgsSpatialIndex;
-
-class QgsMemoryProvider : public QgsVectorDataProvider
-{
-  public:
-    QgsMemoryProvider( QString uri = QString() );
-
-    virtual ~QgsMemoryProvider();
-
-    /* Implementation of functions from QgsVectorDataProvider */
-
-    /**
-     * Returns the permanent storage type for this layer as a friendly name.
-     */
-    virtual QString storageType() const;
-
-    /** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
-     *  @param fetchAttributes list of attributes which should be fetched
-     *  @param rect spatial filter
-     *  @param fetchGeometry true if the feature geometry should be fetched
-     *  @param useIntersect true if an accurate intersection test should be used,
-     *                     false if a test based on bounding box is sufficient
-     */
-    virtual void select( QgsAttributeList fetchAttributes = QgsAttributeList(),
-                         QgsRect rect = QgsRect(),
-                         bool fetchGeometry = true,
-                         bool useIntersect = false );
-
-    /**
-     * Get the next feature resulting from a select operation.
-     * @param feature feature which will receive data from the provider
-     * @return true when there was a feature to fetch, false when end was hit
-     *
-     * mFile should be open with the file pointer at the record of the next
-     * feature, or EOF.  The feature found on the current line is parsed.
-     */
-    virtual bool nextFeature( QgsFeature& feature );
-
-    /**
-      * Gets the feature at the given feature ID.
-      * @param featureId id of the feature
-      * @param feature feature which will receive the data
-      * @param fetchGeoemtry if true, geometry will be fetched from the provider
-      * @param fetchAttributes a list containing the indexes of the attribute fields to copy
-      * @return True when feature was found, otherwise false
-      */
-    virtual bool featureAtId( int featureId,
-                              QgsFeature& feature,
-                              bool fetchGeometry = true,
-                              QgsAttributeList fetchAttributes = QgsAttributeList() );
-
-    /**
-     * Get feature type.
-     * @return int representing the feature type
-     */
-    virtual QGis::WkbType geometryType() const;
-
-    /**
-     * Number of features in the layer
-     * @return long containing number of features
-     */
-    virtual long featureCount() const;
-
-    /**
-     * Number of attribute fields for a feature in the layer
-     */
-    virtual uint fieldCount() const;
-
-    /**
-     * Return a map of indexes with field names for this layer
-     * @return map of fields
-     */
-    virtual const QgsFieldMap & fields() const;
-
-    /** Restart reading features from previous select operation */
-    virtual void begin();
-
-
-    /**
-      * Adds a list of features
-      * @return true in case of success and false in case of failure
-      */
-    virtual bool addFeatures( QgsFeatureList & flist );
-
-    /**
-      * Deletes a feature
-      * @param id list containing feature ids to delete
-      * @return true in case of success and false in case of failure
-      */
-    virtual bool deleteFeatures( const QgsFeatureIds & id );
-
-
-    /**
-     * Adds new attributes
-     * @param attributes map with attribute name as key and type as value
-     * @return true in case of success and false in case of failure
-     */
-    virtual bool addAttributes( const QgsNewAttributesMap & attributes );
-
-    /**
-     * Deletes existing attributes
-     * @param attributes a set containing names of attributes
-     * @return true in case of success and false in case of failure
-     */
-    virtual bool deleteAttributes( const QgsAttributeIds& attributes );
-
-    /**
-     * Changes attribute values of existing features.
-     * @param attr_map a map containing changed attributes
-     * @return true in case of success and false in case of failure
-     */
-    virtual bool changeAttributeValues( const QgsChangedAttributesMap & attr_map );
-
-    /**
-     * Changes geometries of existing features
-     * @param geometry_map   A std::map containing the feature IDs to change the geometries of.
-     *                       the second map parameter being the new geometries themselves
-     * @return               true in case of success and false in case of failure
-     */
-    virtual bool changeGeometryValues( QgsGeometryMap & geometry_map );
-
-    /**
-     * Creates a spatial index
-     * @return true in case of success
-     */
-    virtual bool createSpatialIndex();
-
-    /** Returns a bitmask containing the supported capabilities
-    Note, some capabilities may change depending on whether
-    a spatial filter is active on this provider, so it may
-    be prudent to check this value per intended operation.
-     */
-    virtual int capabilities() const;
-
-
-    /* Implementation of functions from QgsDataProvider */
-
-    /**
-     * return a provider name
-     */
-    QString name() const;
-
-    /**
-     * return description
-     */
-    QString description() const;
-
-    /**
-     * Return the extent for this data layer
-     */
-    virtual QgsRect extent();
-
-    /**
-     * Returns true if this is a valid provider
-     */
-    bool isValid();
-
-    virtual QgsCoordinateReferenceSystem crs();
-
-  protected:
-
-    // called when added / removed features or geometries has been changed
-    void updateExtent();
-
-  private:
-    // fields
-    QgsFieldMap mFields;
-    QGis::WkbType mWkbType;
-    QgsRect mExtent;
-
-    // features
-    QgsFeatureMap mFeatures;
-    int mNextFeatureId;
-
-    // selection
-    QgsAttributeList mSelectAttrs;
-    QgsRect mSelectRect;
-    QgsGeometry* mSelectRectGeom;
-    bool mSelectGeometry, mSelectUseIntersect;
-    QgsFeatureMap::iterator mSelectIterator;
-    bool mSelectUsingSpatialIndex;
-    QList<int> mSelectSI_Features;
-    QList<int>::iterator mSelectSI_Iterator;
-
-    // indexing
-    QgsSpatialIndex* mSpatialIndex;
-
-};

Copied: trunk/qgis/src/providers/memory/qgsmemoryprovider.cpp (from rev 9580, trunk/qgis/src/providers/memory/memoryprovider.cpp)
===================================================================
--- trunk/qgis/src/providers/memory/qgsmemoryprovider.cpp	                        (rev 0)
+++ trunk/qgis/src/providers/memory/qgsmemoryprovider.cpp	2008-11-08 00:49:59 UTC (rev 9582)
@@ -0,0 +1,431 @@
+/***************************************************************************
+    memoryprovider.cpp - provider with storage in memory
+    ------------------
+    begin                : June 2008
+    copyright            : (C) 2008 by Martin Dobias
+    email                : wonder.sk at gmail.com
+ ***************************************************************************
+ *                                                                         *
+ *   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.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "qgsmemoryprovider.h"
+
+#include "qgsfeature.h"
+#include "qgsfield.h"
+#include "qgsgeometry.h"
+#include "qgslogger.h"
+#include "qgsspatialindex.h"
+#include "qgscoordinatereferencesystem.h"
+
+
+static const QString TEXT_PROVIDER_KEY = "memory";
+static const QString TEXT_PROVIDER_DESCRIPTION = "Memory provider";
+
+QgsMemoryProvider::QgsMemoryProvider( QString uri )
+    : QgsVectorDataProvider( uri ),
+    mSelectRectGeom( NULL ),
+    mSpatialIndex( NULL )
+{
+  if ( uri == "Point" )
+    mWkbType = QGis::WKBPoint;
+  else if ( uri == "LineString" )
+    mWkbType = QGis::WKBLineString;
+  else if ( uri == "Polygon" )
+    mWkbType = QGis::WKBPolygon;
+  else if ( uri == "MultiPoint" )
+    mWkbType = QGis::WKBMultiPoint;
+  else if ( uri == "MultiLineString" )
+    mWkbType = QGis::WKBMultiLineString;
+  else if ( uri == "MultiPolygon" )
+    mWkbType = QGis::WKBMultiPolygon;
+  else
+    mWkbType = QGis::WKBUnknown;
+
+  mNextFeatureId = 1;
+}
+
+QgsMemoryProvider::~QgsMemoryProvider()
+{
+  delete mSpatialIndex;
+  delete mSelectRectGeom;
+}
+
+QString QgsMemoryProvider::storageType() const
+{
+  return "Memory storage";
+}
+
+bool QgsMemoryProvider::nextFeature( QgsFeature& feature )
+{
+  bool hasFeature = FALSE;
+
+  // option 1: using spatial index
+  if ( mSelectUsingSpatialIndex )
+  {
+    while ( mSelectSI_Iterator != mSelectSI_Features.end() )
+    {
+      // do exact check in case we're doing intersection
+      if ( mSelectUseIntersect )
+      {
+        if ( mFeatures[*mSelectSI_Iterator].geometry()->intersects( mSelectRectGeom ) )
+          hasFeature = TRUE;
+      }
+      else
+        hasFeature = TRUE;
+
+      if ( hasFeature )
+        break;
+
+      mSelectSI_Iterator++;
+    }
+
+    // copy feature
+    if ( hasFeature )
+    {
+      feature = mFeatures[*mSelectSI_Iterator];
+      mSelectSI_Iterator++;
+    }
+    return hasFeature;
+  }
+
+  // option 2: not using spatial index
+  while ( mSelectIterator != mFeatures.end() )
+  {
+    if ( mSelectRect.isEmpty() )
+    {
+      // selection rect empty => using all features
+      hasFeature = TRUE;
+    }
+    else
+    {
+      if ( mSelectUseIntersect )
+      {
+        // using exact test when checking for intersection
+        if ( mSelectIterator->geometry()->intersects( mSelectRectGeom ) )
+          hasFeature = TRUE;
+      }
+      else
+      {
+        // check just bounding box against rect when not using intersection
+        if ( mSelectIterator->geometry()->boundingBox().intersects( mSelectRect ) )
+          hasFeature = TRUE;
+      }
+    }
+
+    if ( hasFeature )
+      break;
+
+    mSelectIterator++;
+  }
+
+  // copy feature
+  if ( hasFeature )
+  {
+    feature = mSelectIterator.value();
+    mSelectIterator++;
+  }
+
+  return hasFeature;
+}
+
+
+bool QgsMemoryProvider::featureAtId( int featureId,
+                                     QgsFeature& feature,
+                                     bool fetchGeometry,
+                                     QgsAttributeList fetchAttributes )
+{
+  QgsFeatureMap::iterator it = mFeatures.find( featureId );
+
+  if ( it == mFeatures.end() )
+    return FALSE;
+
+  feature = *it;
+  return TRUE;
+}
+
+
+void QgsMemoryProvider::select( QgsAttributeList fetchAttributes,
+                                QgsRect rect,
+                                bool fetchGeometry,
+                                bool useIntersect )
+{
+  mSelectAttrs = fetchAttributes;
+  mSelectRect = rect;
+  delete mSelectRectGeom;
+  mSelectRectGeom = QgsGeometry::fromRect( rect );
+  mSelectGeometry = fetchGeometry;
+  mSelectUseIntersect = useIntersect;
+
+  // if there's spatial index, use it!
+  // (but don't use it when selection rect is not specified)
+  if ( mSpatialIndex && !mSelectRect.isEmpty() )
+  {
+    mSelectUsingSpatialIndex = TRUE;
+    mSelectSI_Features = mSpatialIndex->intersects( rect );
+    QgsDebugMsg( "Features returned by spatial index: " + QString::number( mSelectSI_Features.count() ) );
+  }
+  else
+  {
+    mSelectUsingSpatialIndex = FALSE;
+    mSelectSI_Features.clear();
+  }
+
+  rewind();
+}
+
+void QgsMemoryProvider::rewind()
+{
+  if ( mSelectUsingSpatialIndex )
+    mSelectSI_Iterator = mSelectSI_Features.begin();
+  else
+    mSelectIterator = mFeatures.begin();
+}
+
+
+QgsRect QgsMemoryProvider::extent()
+{
+  return mExtent;
+}
+
+QGis::WkbType QgsMemoryProvider::geometryType() const
+{
+  return mWkbType;
+}
+
+long QgsMemoryProvider::featureCount() const
+{
+  return mFeatures.count();
+}
+
+uint QgsMemoryProvider::fieldCount() const
+{
+  return mFields.count();
+}
+
+
+const QgsFieldMap & QgsMemoryProvider::fields() const
+{
+  return mFields;
+}
+
+bool QgsMemoryProvider::isValid()
+{
+  return ( mWkbType != QGis::WKBUnknown );
+}
+
+QgsCoordinateReferenceSystem QgsMemoryProvider::crs()
+{
+  // TODO: make provider projection-aware
+  return QgsCoordinateReferenceSystem(); // return default CRS
+}
+
+
+bool QgsMemoryProvider::addFeatures( QgsFeatureList & flist )
+{
+  // TODO: sanity checks of fields and geometries
+  for ( QgsFeatureList::iterator it = flist.begin(); it != flist.end(); ++it )
+  {
+    mFeatures[mNextFeatureId] = *it;
+    QgsFeature& newfeat = mFeatures[mNextFeatureId];
+    newfeat.setFeatureId( mNextFeatureId );
+
+    // update spatial index
+    if ( mSpatialIndex )
+      mSpatialIndex->insertFeature( newfeat );
+
+    mNextFeatureId++;
+  }
+
+
+  updateExtent();
+
+  return TRUE;
+}
+
+bool QgsMemoryProvider::deleteFeatures( const QgsFeatureIds & id )
+{
+  for ( QgsFeatureIds::const_iterator it = id.begin(); it != id.end(); ++it )
+  {
+    QgsFeatureMap::iterator fit = mFeatures.find( *it );
+
+    // check whether such feature exists
+    if ( fit == mFeatures.end() )
+      continue;
+
+    // update spatial index
+    if ( mSpatialIndex )
+      mSpatialIndex->deleteFeature( *fit );
+
+    mFeatures.erase( fit );
+  }
+
+  updateExtent();
+
+  return TRUE;
+}
+
+bool QgsMemoryProvider::addAttributes( const QgsNewAttributesMap & attributes )
+{
+  for ( QgsNewAttributesMap::const_iterator it = attributes.begin(); it != attributes.end(); ++it )
+  {
+    QString name = it.key();
+    QString typeName = it.value();
+    QVariant::Type type;
+    if ( typeName == "int" )
+      type = QVariant::Int;
+    else if ( typeName == "double" )
+      type = QVariant::Double;
+    else if ( typeName == "string" )
+      type = QVariant::String;
+    else
+    {
+      QgsDebugMsg( "Field type not supported: " + typeName );
+      continue;
+    }
+
+    // add new field as a last one
+    int nextId = -1;
+    for ( QgsFieldMap::iterator it2 = mFields.begin(); it2 != mFields.end(); ++it2 )
+      if ( it2.key() > nextId ) nextId = it2.key();
+    mFields[nextId+1] = QgsField( name, type, typeName );
+  }
+  return TRUE;
+}
+
+bool QgsMemoryProvider::deleteAttributes( const QgsAttributeIds& attributes )
+{
+  for ( QgsAttributeIds::const_iterator it = attributes.begin(); it != attributes.end(); ++it )
+    mFields.remove( *it );
+  return TRUE;
+}
+
+bool QgsMemoryProvider::changeAttributeValues( const QgsChangedAttributesMap & attr_map )
+{
+  for ( QgsChangedAttributesMap::const_iterator it = attr_map.begin(); it != attr_map.end(); ++it )
+  {
+    QgsFeatureMap::iterator fit = mFeatures.find( it.key() );
+    if ( fit == mFeatures.end() )
+      continue;
+
+    const QgsAttributeMap& attrs = it.value();
+    for ( QgsAttributeMap::const_iterator it2 = attrs.begin(); it2 != attrs.end(); ++it2 )
+      fit->changeAttribute( it2.key(), it2.value() );
+  }
+  return TRUE;
+}
+
+bool QgsMemoryProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
+{
+  for ( QgsGeometryMap::const_iterator it = geometry_map.begin(); it != geometry_map.end(); ++it )
+  {
+    QgsFeatureMap::iterator fit = mFeatures.find( it.key() );
+    if ( fit == mFeatures.end() )
+      continue;
+
+    // update spatial index
+    if ( mSpatialIndex )
+      mSpatialIndex->deleteFeature( *fit );
+
+    fit->setGeometry( it.value() );
+
+    // update spatial index
+    if ( mSpatialIndex )
+      mSpatialIndex->insertFeature( *fit );
+  }
+
+  updateExtent();
+
+  return TRUE;
+}
+
+bool QgsMemoryProvider::createSpatialIndex()
+{
+  if ( !mSpatialIndex )
+  {
+    mSpatialIndex = new QgsSpatialIndex();
+
+    // add existing features to index
+    for ( QgsFeatureMap::iterator it = mFeatures.begin(); it != mFeatures.end(); ++it )
+    {
+      mSpatialIndex->insertFeature( *it );
+    }
+  }
+  return TRUE;
+}
+
+int QgsMemoryProvider::capabilities() const
+{
+  return AddFeatures | DeleteFeatures | ChangeGeometries |
+         ChangeAttributeValues | AddAttributes | DeleteAttributes | CreateSpatialIndex |
+         SelectAtId | SelectGeometryAtId | RandomSelectGeometryAtId | SequentialSelectGeometryAtId;
+}
+
+
+void QgsMemoryProvider::updateExtent()
+{
+  if ( mFeatures.count() == 0 )
+  {
+    mExtent = QgsRect();
+  }
+  else
+  {
+    mExtent = mFeatures.begin().value().geometry()->boundingBox();
+    for ( QgsFeatureMap::iterator it = mFeatures.begin(); it != mFeatures.end(); ++it )
+      mExtent.unionRect( it.value().geometry()->boundingBox() );
+  }
+}
+
+
+
+// --------------------------------
+
+QString  QgsMemoryProvider::name() const
+{
+  return TEXT_PROVIDER_KEY;
+}
+
+QString  QgsMemoryProvider::description() const
+{
+  return TEXT_PROVIDER_DESCRIPTION;
+}
+
+// --------------------------------
+
+
+/**
+ * Class factory to return a pointer to a newly created
+ * QgsMemoryProvider object
+ */
+QGISEXTERN QgsMemoryProvider *classFactory( const QString *uri )
+{
+  return new QgsMemoryProvider( *uri );
+}
+
+/** Required key function (used to map the plugin to a data store type)
+ */
+QGISEXTERN QString providerKey()
+{
+  return TEXT_PROVIDER_KEY;
+}
+
+/**
+ * Required description function
+ */
+QGISEXTERN QString description()
+{
+  return TEXT_PROVIDER_DESCRIPTION;
+}
+
+/**
+ * Required isProvider function. Used to determine if this shared library
+ * is a data provider plugin
+ */
+QGISEXTERN bool isProvider()
+{
+  return true;
+}


Property changes on: trunk/qgis/src/providers/memory/qgsmemoryprovider.cpp
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/qgis/src/providers/memory/qgsmemoryprovider.h (from rev 9580, trunk/qgis/src/providers/memory/memoryprovider.h)
===================================================================
--- trunk/qgis/src/providers/memory/qgsmemoryprovider.h	                        (rev 0)
+++ trunk/qgis/src/providers/memory/qgsmemoryprovider.h	2008-11-08 00:49:59 UTC (rev 9582)
@@ -0,0 +1,208 @@
+/***************************************************************************
+    memoryprovider.h - provider with storage in memory
+    ------------------
+    begin                : June 2008
+    copyright            : (C) 2008 by Martin Dobias
+    email                : wonder.sk at gmail.com
+ ***************************************************************************
+ *                                                                         *
+ *   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.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "qgsvectordataprovider.h"
+
+
+typedef QMap<int, QgsFeature> QgsFeatureMap;
+
+class QgsSpatialIndex;
+
+class QgsMemoryProvider : public QgsVectorDataProvider
+{
+  public:
+    QgsMemoryProvider( QString uri = QString() );
+
+    virtual ~QgsMemoryProvider();
+
+    /* Implementation of functions from QgsVectorDataProvider */
+
+    /**
+     * Returns the permanent storage type for this layer as a friendly name.
+     */
+    virtual QString storageType() const;
+
+    /** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
+     *  @param fetchAttributes list of attributes which should be fetched
+     *  @param rect spatial filter
+     *  @param fetchGeometry true if the feature geometry should be fetched
+     *  @param useIntersect true if an accurate intersection test should be used,
+     *                     false if a test based on bounding box is sufficient
+     */
+    virtual void select( QgsAttributeList fetchAttributes = QgsAttributeList(),
+                         QgsRect rect = QgsRect(),
+                         bool fetchGeometry = true,
+                         bool useIntersect = false );
+
+    /**
+     * Get the next feature resulting from a select operation.
+     * @param feature feature which will receive data from the provider
+     * @return true when there was a feature to fetch, false when end was hit
+     *
+     * mFile should be open with the file pointer at the record of the next
+     * feature, or EOF.  The feature found on the current line is parsed.
+     */
+    virtual bool nextFeature( QgsFeature& feature );
+
+    /**
+      * Gets the feature at the given feature ID.
+      * @param featureId id of the feature
+      * @param feature feature which will receive the data
+      * @param fetchGeoemtry if true, geometry will be fetched from the provider
+      * @param fetchAttributes a list containing the indexes of the attribute fields to copy
+      * @return True when feature was found, otherwise false
+      */
+    virtual bool featureAtId( int featureId,
+                              QgsFeature& feature,
+                              bool fetchGeometry = true,
+                              QgsAttributeList fetchAttributes = QgsAttributeList() );
+
+    /**
+     * Get feature type.
+     * @return int representing the feature type
+     */
+    virtual QGis::WkbType geometryType() const;
+
+    /**
+     * Number of features in the layer
+     * @return long containing number of features
+     */
+    virtual long featureCount() const;
+
+    /**
+     * Number of attribute fields for a feature in the layer
+     */
+    virtual uint fieldCount() const;
+
+    /**
+     * Return a map of indexes with field names for this layer
+     * @return map of fields
+     */
+    virtual const QgsFieldMap & fields() const;
+
+    /** Restart reading features from previous select operation */
+    virtual void rewind();
+
+
+    /**
+      * Adds a list of features
+      * @return true in case of success and false in case of failure
+      */
+    virtual bool addFeatures( QgsFeatureList & flist );
+
+    /**
+      * Deletes a feature
+      * @param id list containing feature ids to delete
+      * @return true in case of success and false in case of failure
+      */
+    virtual bool deleteFeatures( const QgsFeatureIds & id );
+
+
+    /**
+     * Adds new attributes
+     * @param attributes map with attribute name as key and type as value
+     * @return true in case of success and false in case of failure
+     */
+    virtual bool addAttributes( const QgsNewAttributesMap & attributes );
+
+    /**
+     * Deletes existing attributes
+     * @param attributes a set containing names of attributes
+     * @return true in case of success and false in case of failure
+     */
+    virtual bool deleteAttributes( const QgsAttributeIds& attributes );
+
+    /**
+     * Changes attribute values of existing features.
+     * @param attr_map a map containing changed attributes
+     * @return true in case of success and false in case of failure
+     */
+    virtual bool changeAttributeValues( const QgsChangedAttributesMap & attr_map );
+
+    /**
+     * Changes geometries of existing features
+     * @param geometry_map   A std::map containing the feature IDs to change the geometries of.
+     *                       the second map parameter being the new geometries themselves
+     * @return               true in case of success and false in case of failure
+     */
+    virtual bool changeGeometryValues( QgsGeometryMap & geometry_map );
+
+    /**
+     * Creates a spatial index
+     * @return true in case of success
+     */
+    virtual bool createSpatialIndex();
+
+    /** Returns a bitmask containing the supported capabilities
+    Note, some capabilities may change depending on whether
+    a spatial filter is active on this provider, so it may
+    be prudent to check this value per intended operation.
+     */
+    virtual int capabilities() const;
+
+
+    /* Implementation of functions from QgsDataProvider */
+
+    /**
+     * return a provider name
+     */
+    QString name() const;
+
+    /**
+     * return description
+     */
+    QString description() const;
+
+    /**
+     * Return the extent for this data layer
+     */
+    virtual QgsRect extent();
+
+    /**
+     * Returns true if this is a valid provider
+     */
+    bool isValid();
+
+    virtual QgsCoordinateReferenceSystem crs();
+
+  protected:
+
+    // called when added / removed features or geometries has been changed
+    void updateExtent();
+
+  private:
+    // fields
+    QgsFieldMap mFields;
+    QGis::WkbType mWkbType;
+    QgsRect mExtent;
+
+    // features
+    QgsFeatureMap mFeatures;
+    int mNextFeatureId;
+
+    // selection
+    QgsAttributeList mSelectAttrs;
+    QgsRect mSelectRect;
+    QgsGeometry* mSelectRectGeom;
+    bool mSelectGeometry, mSelectUseIntersect;
+    QgsFeatureMap::iterator mSelectIterator;
+    bool mSelectUsingSpatialIndex;
+    QList<int> mSelectSI_Features;
+    QList<int>::iterator mSelectSI_Iterator;
+
+    // indexing
+    QgsSpatialIndex* mSpatialIndex;
+
+};


Property changes on: trunk/qgis/src/providers/memory/qgsmemoryprovider.h
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
===================================================================
--- trunk/qgis/src/providers/ogr/qgsogrprovider.cpp	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/ogr/qgsogrprovider.cpp	2008-11-08 00:49:59 UTC (rev 9582)
@@ -458,7 +458,7 @@
   return mAttributeFields;
 }
 
-void QgsOgrProvider::begin()
+void QgsOgrProvider::rewind()
 {
   OGR_L_ResetReading( ogrLayer );
 }

Modified: trunk/qgis/src/providers/ogr/qgsogrprovider.h
===================================================================
--- trunk/qgis/src/providers/ogr/qgsogrprovider.h	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/ogr/qgsogrprovider.h	2008-11-08 00:49:59 UTC (rev 9582)
@@ -120,7 +120,7 @@
     virtual QgsRect extent();
 
     /** Restart reading features from previous select operation */
-    virtual void begin();
+    virtual void rewind();
 
     /**Writes a list of features to the file*/
     virtual bool addFeatures( QgsFeatureList & flist );

Modified: trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2008-11-08 00:49:59 UTC (rev 9582)
@@ -720,7 +720,7 @@
   return mDataComment;
 }
 
-void QgsPostgresProvider::begin()
+void QgsPostgresProvider::rewind()
 {
   if ( mFetching )
   {
@@ -1876,7 +1876,7 @@
     returnvalue = false;
   }
 
-  begin();
+  rewind();
   return returnvalue;
 }
 
@@ -1914,7 +1914,7 @@
     connectionRW->PQexecNR( "ROLLBACK" );
     returnvalue = false;
   }
-  begin();
+  rewind();
   return returnvalue;
 }
 
@@ -1953,7 +1953,7 @@
     returnvalue = false;
   }
 
-  begin();
+  rewind();
   return returnvalue;
 }
 
@@ -1998,7 +1998,7 @@
     returnvalue = false;
   }
 
-  begin();
+  rewind();
   return returnvalue;
 }
 
@@ -2068,7 +2068,7 @@
     returnvalue = false;
   }
 
-  begin();
+  rewind();
 
   return returnvalue;
 }
@@ -2148,7 +2148,7 @@
     returnvalue = false;
   }
 
-  begin();
+  rewind();
 
   QgsDebugMsg( "exiting." );
 

Modified: trunk/qgis/src/providers/postgres/qgspostgresprovider.h
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresprovider.h	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/postgres/qgspostgresprovider.h	2008-11-08 00:49:59 UTC (rev 9582)
@@ -176,7 +176,7 @@
     /** Reset the layer - for a PostgreSQL layer, this means clearing the PQresult
      * pointer, setting it to 0 and reloading the field list
      */
-    void begin();
+    void rewind();
 
     /** Returns the minimum value of an attribute
      *  @param index the index of the attribute */

Modified: trunk/qgis/src/providers/wfs/qgswfsprovider.cpp
===================================================================
--- trunk/qgis/src/providers/wfs/qgswfsprovider.cpp	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/wfs/qgswfsprovider.cpp	2008-11-08 00:49:59 UTC (rev 9582)
@@ -128,7 +128,7 @@
   return mFields;
 }
 
-void QgsWFSProvider::begin()
+void QgsWFSProvider::rewind()
 {
   mFeatureIterator = mSelectedFeatures.begin();
 }

Modified: trunk/qgis/src/providers/wfs/qgswfsprovider.h
===================================================================
--- trunk/qgis/src/providers/wfs/qgswfsprovider.h	2008-11-08 00:47:44 UTC (rev 9581)
+++ trunk/qgis/src/providers/wfs/qgswfsprovider.h	2008-11-08 00:49:59 UTC (rev 9582)
@@ -69,7 +69,7 @@
     long featureCount() const;
     uint fieldCount() const;
     const QgsFieldMap & fields() const;
-    void begin();
+    void rewind();
 
     virtual QgsCoordinateReferenceSystem crs();
 
@@ -114,7 +114,7 @@
     QgsSpatialIndex *mSpatialIndex;
     /**Vector where the ids of the selected features are inserted*/
     QList<int> mSelectedFeatures;
-    /**Iterator on the feature vector for use in begin(), nextFeature(), etc...*/
+    /**Iterator on the feature vector for use in rewind(), nextFeature(), etc...*/
     QList<int>::iterator mFeatureIterator;
     /**Vector where the features are inserted*/
     QList<QgsFeature*> mFeatures;



More information about the QGIS-commit mailing list