Skip to content

Commit 3374f38

Browse files
author
mhugent
committed
Remove some duplicated code
git-svn-id: http://svn.osgeo.org/qgis/trunk@15169 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 132088f commit 3374f38

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

src/core/qgsvectorlayer.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ void QgsVectorLayer::updateFeatureAttributes( QgsFeature &f, bool all )
15061506
if ( mDataProvider && ( all || ( mFetchAttributes.size() > 0 && mJoinBuffer->containsFetchJoins() ) ) )
15071507
{
15081508
int index = 0;
1509-
maxIndex( mDataProvider->fields(), index );
1509+
QgsVectorLayerJoinBuffer::maximumIndex( mDataProvider->fields(), index );
15101510
mJoinBuffer->updateFeatureAttributes( f, index, all );
15111511
}
15121512

@@ -1636,7 +1636,7 @@ void QgsVectorLayer::select( QgsAttributeList attributes, QgsRectangle rect, boo
16361636
int maxProviderIndex = 0;
16371637
if ( mDataProvider )
16381638
{
1639-
maxIndex( mDataProvider->fields(), maxProviderIndex );
1639+
QgsVectorLayerJoinBuffer::maximumIndex( mDataProvider->fields(), maxProviderIndex );
16401640
}
16411641

16421642
mJoinBuffer->select( mFetchAttributes, joinFields, maxProviderIndex );
@@ -4879,7 +4879,7 @@ void QgsVectorLayer::updateFieldMap()
48794879
}
48804880

48814881
int currentMaxIndex = 0; //maximum index of current layer
4882-
if ( !maxIndex( mUpdatedFields, currentMaxIndex ) )
4882+
if ( !QgsVectorLayerJoinBuffer::maximumIndex( mUpdatedFields, currentMaxIndex ) )
48834883
{
48844884
return;
48854885
}
@@ -4943,18 +4943,6 @@ void QgsVectorLayer::stopRendererV2( QgsRenderContext& rendererContext, QgsSingl
49434943
}
49444944
}
49454945

4946-
bool QgsVectorLayer::maxIndex( const QgsFieldMap& fMap, int& index ) const
4947-
{
4948-
if ( fMap.size() < 1 )
4949-
{
4950-
return false;
4951-
}
4952-
QgsFieldMap::const_iterator endIt = fMap.constEnd();
4953-
--endIt;
4954-
index = endIt.key();
4955-
return true;
4956-
}
4957-
49584946
void QgsVectorLayer::updateAttributeMapIndex( QgsAttributeMap& map, int oldIndex, int newIndex ) const
49594947
{
49604948
QgsAttributeMap::const_iterator it = map.find( oldIndex );

src/core/qgsvectorlayer.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -776,10 +776,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
776776
/** Stop version 2 renderer and selected renderer (if required) */
777777
void stopRendererV2( QgsRenderContext& rendererContext, QgsSingleSymbolRendererV2* selRenderer );
778778

779-
/** Helper function to find out the maximum index of a field map
780-
@return true in case of success, otherwise false (e.g. empty map)*/
781-
bool maxIndex( const QgsFieldMap& fMap, int& index ) const;
782-
783779
/**Updates an index in an attribute map to a new value (usually necessary because of a join operation)*/
784780
void updateAttributeMapIndex( QgsAttributeMap& map, int oldIndex, int newIndex ) const;
785781

0 commit comments

Comments
 (0)