Skip to content
Permalink
Browse files

Remove some duplicated code

git-svn-id: http://svn.osgeo.org/qgis/trunk@15169 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Feb 13, 2011
1 parent 132088f commit 3374f38265c995993800332fd49082c9d3755797
Showing with 3 additions and 19 deletions.
  1. +3 −15 src/core/qgsvectorlayer.cpp
  2. +0 −4 src/core/qgsvectorlayer.h
@@ -1506,7 +1506,7 @@ void QgsVectorLayer::updateFeatureAttributes( QgsFeature &f, bool all )
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 @@ void QgsVectorLayer::select( QgsAttributeList attributes, QgsRectangle rect, boo
int maxProviderIndex = 0;
if ( mDataProvider )
{
maxIndex( mDataProvider->fields(), maxProviderIndex );
QgsVectorLayerJoinBuffer::maximumIndex( mDataProvider->fields(), maxProviderIndex );
}

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

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

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 );
@@ -776,10 +776,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
/** 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;

0 comments on commit 3374f38

Please sign in to comment.
You can’t perform that action at this time.