1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-11-28 08:58:49 +02:00

Cleaned up

Removed unnecessary comments; replaced `break wpoints_loop` with `continue wpoints_loop` which caused infinite loops, let's see if it still happens and if I can fix it...
This commit is contained in:
zigmhount 2022-03-11 22:49:56 +01:00 committed by GitHub
parent f1a5c6c0ee
commit 92f346b1ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -386,6 +386,7 @@ export class GalleryMapLightboxComponent implements OnChanges {
// tslint:disable-next-line:prefer-for-of
for (let i = 0; i < this.gpxFiles.length; i++) {
const file = this.gpxFiles[i];
// get <trkpt> items into path[] and <wpt> items into wpoints[]
const [path,wpoints] = await this.mapService.getMapCoordinates(file);
if (file !== this.gpxFiles[i]) { // check race condition
return;
@ -393,22 +394,14 @@ export class GalleryMapLightboxComponent implements OnChanges {
if (path.length !== 0) {
this.mapLayersControlOption.overlays.Paths.addLayer(marker(path[0] as LatLng));
this.mapLayersControlOption.overlays.Paths.addLayer(polyline(path as LatLng[]));
// console.log('Trk path is not empty, in file ' + i + ', path[0]=' + JSON.stringify(path[0]));
} else {
// console.log('No trk path in file ' + i);
}
if (wpoints.length !== 0) {
// console.log('Wpt exist in file ' + i + ', wpoints[0]=' + JSON.stringify(wpoints[0]) +', wpoints.length=' + wpoints.length);
wpoints_loop: for (let wpt_i = 0; i < wpoints.length; wpt_i++) {
// console.log('item number ' + wpt_i + ' out of ' + wpoints.length + ', coord=' + JSON.stringify(wpoints[wpt_i]));
if (wpoints[wpt_i] === undefined) {
break wpoints_loop;
}
continue wpoints_loop;
}
this.mapLayersControlOption.overlays.Paths.addLayer(marker(wpoints[wpt_i] as LatLng));
}
// console.log('Wpoints plotted.');
} else {
// console.log('No wpt points in file ' + i);
}
}
}