[QGIS Commit] r15169 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Feb 13 17:43:53 EST 2011


Author: mhugent
Date: 2011-02-13 14:43:53 -0800 (Sun, 13 Feb 2011)
New Revision: 15169

Modified:
   trunk/qgis/src/core/qgsvectorlayer.cpp
   trunk/qgis/src/core/qgsvectorlayer.h
Log:
Remove some duplicated code

Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp	2011-02-13 20:24:55 UTC (rev 15168)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp	2011-02-13 22:43:53 UTC (rev 15169)
@@ -1506,7 +1506,7 @@
   if ( mDataProvider && ( all || ( mFetchAttributes.size() > 0 && mJoinBuffer->containsFetchJoins() ) ) )
   {
     int index = 0;
-    maxIndex( mDataProvider->fields(), index );
+    QgsVectorLayerJoinBuffer::maximumIndex( mDataProvider->fields(), index );
     mJoinBuffer->updateFeatureAttributes( f, index, all );
   }
 
@@ -1636,7 +1636,7 @@
       int maxProviderIndex = 0;
       if ( mDataProvider )
       {
-        maxIndex( mDataProvider->fields(), maxProviderIndex );
+        QgsVectorLayerJoinBuffer::maximumIndex( mDataProvider->fields(), maxProviderIndex );
       }
 
       mJoinBuffer->select( mFetchAttributes, joinFields, maxProviderIndex );
@@ -4879,7 +4879,7 @@
   }
 
   int currentMaxIndex = 0; //maximum index of current layer
-  if ( !maxIndex( mUpdatedFields, currentMaxIndex ) )
+  if ( !QgsVectorLayerJoinBuffer::maximumIndex( mUpdatedFields, currentMaxIndex ) )
   {
     return;
   }
@@ -4943,18 +4943,6 @@
   }
 }
 
-bool QgsVectorLayer::maxIndex( const QgsFieldMap& fMap, int& index ) const
-{
-  if ( fMap.size() < 1 )
-  {
-    return false;
-  }
-  QgsFieldMap::const_iterator endIt = fMap.constEnd();
-  --endIt;
-  index = endIt.key();
-  return true;
-}
-
 void QgsVectorLayer::updateAttributeMapIndex( QgsAttributeMap& map, int oldIndex, int newIndex ) const
 {
   QgsAttributeMap::const_iterator it = map.find( oldIndex );

Modified: trunk/qgis/src/core/qgsvectorlayer.h
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.h	2011-02-13 20:24:55 UTC (rev 15168)
+++ trunk/qgis/src/core/qgsvectorlayer.h	2011-02-13 22:43:53 UTC (rev 15169)
@@ -776,10 +776,6 @@
     /** Stop version 2 renderer and selected renderer (if required) */
     void stopRendererV2( QgsRenderContext& rendererContext, QgsSingleSymbolRendererV2* selRenderer );
 
-    /** Helper function to find out the maximum index of a field map
-        @return true in case of success, otherwise false (e.g. empty map)*/
-    bool maxIndex( const QgsFieldMap& fMap, int& index ) const;
-
     /**Updates an index in an attribute map to a new value (usually necessary because of a join operation)*/
     void updateAttributeMapIndex( QgsAttributeMap& map, int oldIndex, int newIndex ) const;
 



More information about the QGIS-commit mailing list