@@ -182,7 +182,7 @@ QVariantMap QgsKMeansClusteringAlgorithm::processAlgorithm( const QVariantMap &p
182
182
183
183
void QgsKMeansClusteringAlgorithm::initClusters ( std::vector<Feature> &points, std::vector<QgsPointXY> ¢ers, const int k, QgsProcessingFeedback *feedback )
184
184
{
185
- ulong n = points.size ();
185
+ std:: size_t n = points.size ();
186
186
if ( n == 0 )
187
187
return ;
188
188
@@ -195,12 +195,12 @@ void QgsKMeansClusteringAlgorithm::initClusters( std::vector<Feature> &points, s
195
195
196
196
long duplicateCount = 1 ;
197
197
// initially scan for two most distance points from each other, p1 and p2
198
- ulong p1 = 0 ;
199
- ulong p2 = 0 ;
198
+ std:: size_t p1 = 0 ;
199
+ std:: size_t p2 = 0 ;
200
200
double distanceP1 = 0 ;
201
201
double distanceP2 = 0 ;
202
202
double maxDistance = -1 ;
203
- for ( ulong i = 1 ; i < n; i++ )
203
+ for ( std:: size_t i = 1 ; i < n; i++ )
204
204
{
205
205
distanceP1 = points[i].point .sqrDist ( points[p1].point );
206
206
distanceP2 = points[i].point .sqrDist ( points[p2].point );
@@ -238,7 +238,7 @@ void QgsKMeansClusteringAlgorithm::initClusters( std::vector<Feature> &points, s
238
238
std::vector< double > distances ( n );
239
239
240
240
// initialize array with distance to first object
241
- for ( ulong j = 0 ; j < n; j++ )
241
+ for ( std:: size_t j = 0 ; j < n; j++ )
242
242
{
243
243
distances[j] = points[j].point .sqrDist ( centers[0 ] );
244
244
}
@@ -248,11 +248,11 @@ void QgsKMeansClusteringAlgorithm::initClusters( std::vector<Feature> &points, s
248
248
// loop i on clusters, skip 0 and 1 as found already
249
249
for ( int i = 2 ; i < k; i++ )
250
250
{
251
- ulong candidateCenter = 0 ;
251
+ std:: size_t candidateCenter = 0 ;
252
252
double maxDistance = std::numeric_limits<double >::lowest ();
253
253
254
254
// loop j on points
255
- for ( ulong j = 0 ; j < n; j++ )
255
+ for ( std:: size_t j = 0 ; j < n; j++ )
256
256
{
257
257
// accepted clusters are already marked with distance = -1
258
258
if ( distances[j] < 0 )
@@ -312,8 +312,8 @@ void QgsKMeansClusteringAlgorithm::calculateKMeans( std::vector<QgsKMeansCluster
312
312
void QgsKMeansClusteringAlgorithm::findNearest ( std::vector<QgsKMeansClusteringAlgorithm::Feature> &points, const std::vector<QgsPointXY> ¢ers, const int k, bool &changed )
313
313
{
314
314
changed = false ;
315
- ulong n = points.size ();
316
- for ( ulong i = 0 ; i < n; i++ )
315
+ std:: size_t n = points.size ();
316
+ for ( std:: size_t i = 0 ; i < n; i++ )
317
317
{
318
318
Feature &point = points[i];
319
319
0 commit comments