MerginMaps / MerginMaps/mobile
Exit early from loop when feature has been found in VR model
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 388
- Forks
- 87
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 20
Description
ValueRelationFeaturesModel::convertFromQgisType converts QGIS VR type {1, 2, 3} to normal list. It supports VR with multiple values.
That function includes a loop that goes over the entire referenced layer and tries to find the features.
We should stop the loop when number of found features equals the number of features from QGIS value.
See ValueRelationFeaturesModel::150 ⬇️
for ( int ix = 0; ix < FeaturesModel::rowCount(); ++ix )
{
QgsFeature f = FeaturesModel::data( index( ix, 0 ), Feature ).value<QgsFeature>();
if ( keyMap.contains( f.attribute( mKeyField ).toString() ) )
{
if ( toRole == FeatureId )
roleList.append( f.id() );
else
{
QVariant attr = FeaturesModel::convertRoleValue( FeatureId, f.id(), toRole );
if ( !attr.isNull() )
roleList.append( attr );
}
// <----- TODO: stop the search if the roleList has enough features
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ValueRelationFeaturesModel::convertFromQgisType at the loop around line 150 and inspect how the QGIS value count and roleList are established. Update the search so it stops once the required features have been found, then verify conversion for VR types with multiple values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- mobile-dev
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100