Skip to content

Commit

Permalink
Remove some duplicated code
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15169 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Feb 13, 2011
1 parent 049d490 commit fd5f119
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
18 changes: 3 additions & 15 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -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 );
}

Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 );
Expand Down
4 changes: 0 additions & 4 deletions src/core/qgsvectorlayer.h
Expand Up @@ -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;

Expand Down

0 comments on commit fd5f119

Please sign in to comment.