mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Optimise unordered set differencing
This commit is contained in:
parent
e46b00d40d
commit
9e03a7e1d3
@ -102,16 +102,6 @@ struct KDBushDataHashById
|
||||
}
|
||||
};
|
||||
|
||||
bool operator <( const QgsSpatialIndexKDBushData &data, const QgsFeatureId id )
|
||||
{
|
||||
return data.id < id;
|
||||
};
|
||||
|
||||
bool operator <( const QgsFeatureId id, const QgsSpatialIndexKDBushData &data )
|
||||
{
|
||||
return id < data.id;
|
||||
};
|
||||
|
||||
QVariantMap QgsDbscanClusteringAlgorithm::processAlgorithm( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
|
||||
{
|
||||
std::unique_ptr< QgsProcessingFeatureSource > source( parameterAsSource( parameters, QStringLiteral( "INPUT" ), context ) );
|
||||
@ -287,10 +277,13 @@ void QgsDbscanClusteringAlgorithm::dbscan( const std::size_t minSize,
|
||||
if ( within2.size() >= minSize )
|
||||
{
|
||||
// expand neighbourhood
|
||||
std::set_difference( within2.begin(),
|
||||
within2.end(),
|
||||
visited.begin(), visited.end(),
|
||||
std::inserter( within, within.end() ) );
|
||||
std::copy_if( within2.begin(),
|
||||
within2.end(),
|
||||
std::inserter( within, within.end() ),
|
||||
[&visited]( const QgsSpatialIndexKDBushData & needle )
|
||||
{
|
||||
return visited.find( needle.id ) == visited.end();
|
||||
} );
|
||||
}
|
||||
if ( !borderPointsAreNoise || within2.size() >= minSize )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user