@@ -42,20 +42,21 @@ class GPXMapView: MKMapView {
42
42
var currentSegmentOverlay : MKPolyline
43
43
44
44
///
45
- var extent : GPXExtentCoordinates = GPXExtentCoordinates ( ) //extent of the GPX points and tracks
45
+ var extent : GPXExtentCoordinates = GPXExtentCoordinates ( ) // Extent of the GPX points and tracks
46
46
47
- ///position of the compass in the map
48
- ///Example:
47
+ /// Position of the compass in the map
48
+ /// Example:
49
49
/// map.compassRect = CGRect(x: map.frame.width/2 - 18, y: 70, width: 36, height: 36)
50
50
var compassRect : CGRect
51
51
52
52
/// Is the map using local image cache??
53
- var useCache : Bool = true { //use tile overlay cache (
53
+ var useCache : Bool = true { // Use tile overlay cache (
54
54
didSet {
55
55
if tileServerOverlay is CachedTileOverlay {
56
56
print ( " GPXMapView:: setting useCache \( useCache) " )
57
57
// swiftlint:disable force_cast
58
58
( tileServerOverlay as! CachedTileOverlay ) . useCache = useCache
59
+ // swiftlint:enable force_cast
59
60
}
60
61
}
61
62
}
@@ -72,13 +73,13 @@ class GPXMapView: MKMapView {
72
73
updateMapInformation ( newValue)
73
74
// remove current overlay
74
75
if tileServer != . apple {
75
- //to see apple maps we need to remove the overlay added by map cache.
76
+ // To see apple maps we need to remove the overlay added by map cache.
76
77
removeOverlay ( tileServerOverlay)
77
78
}
78
79
79
- //add new overlay to map if not using Apple Maps
80
+ // Add new overlay to map if not using Apple Maps
80
81
if newValue != . apple && newValue != . appleSatellite {
81
- //Update cacheConfig
82
+ // Update cacheConfig
82
83
var config = MapCacheConfig ( withUrlTemplate: newValue. templateUrl)
83
84
config. subdomains = newValue. subdomains
84
85
config. tileSize = CGSize ( width: newValue. tileSize, height: newValue. tileSize)
@@ -93,8 +94,7 @@ class GPXMapView: MKMapView {
93
94
// we need to keep a reference to remove it, in case we return back to Apple Maps.
94
95
//
95
96
tileServerOverlay = useCache ( cache, canReplaceMapContent: newValue. canReplaceMapContent)
96
- }
97
- else {
97
+ } else {
98
98
self . mapType = ( newValue == . apple) ? . standard : . satellite
99
99
}
100
100
}
@@ -130,7 +130,7 @@ class GPXMapView: MKMapView {
130
130
/// Initializes the map with an empty currentSegmentOverlay.
131
131
///
132
132
required init ? ( coder aDecoder: NSCoder ) {
133
- var tmpCoords : [ CLLocationCoordinate2D ] = [ ] //init with empty
133
+ var tmpCoords : [ CLLocationCoordinate2D ] = [ ] // Init with empty
134
134
currentSegmentOverlay = MKPolyline ( coordinates: & tmpCoords, count: 0 )
135
135
compassRect = CGRect . init ( x: 0 , y: 0 , width: 36 , height: 36 )
136
136
super. init ( coder: aDecoder)
@@ -257,8 +257,8 @@ class GPXMapView: MKMapView {
257
257
let pt = GPXTrackPoint ( location: location)
258
258
coreDataHelper. add ( toCoreData: pt, withTrackSegmentID: session. trackSegments. count)
259
259
session. addPointToCurrentTrackSegmentAtLocation ( location)
260
- //redrawCurrent track segment overlay
261
- //First remove last overlay, then re-add the overlay updated with the new point
260
+ // RedrawCurrent track segment overlay
261
+ // First remove last overlay, then re-add the overlay updated with the new point
262
262
removeOverlay ( currentSegmentOverlay)
263
263
currentSegmentOverlay = session. currentSegment. overlay
264
264
@@ -283,7 +283,7 @@ class GPXMapView: MKMapView {
283
283
/// Finishes current segment.
284
284
///
285
285
func finishCurrentSegment( ) {
286
- startNewTrackSegment ( ) //basically , we need to append the segment to the list of segments
286
+ startNewTrackSegment ( ) // Basically , we need to append the segment to the list of segments
287
287
}
288
288
289
289
///
@@ -295,8 +295,8 @@ class GPXMapView: MKMapView {
295
295
removeAnnotations ( annotations)
296
296
extent = GPXExtentCoordinates ( )
297
297
298
- //add tile server overlay
299
- //by removing all overlays, tile server overlay is also removed. We need to add it back
298
+ // Add tile server overlay
299
+ // by removing all overlays, tile server overlay is also removed. We need to add it back
300
300
if tileServer != . apple {
301
301
addOverlayOnBottom ( tileServerOverlay)
302
302
}
@@ -344,10 +344,9 @@ class GPXMapView: MKMapView {
344
344
session. totalTrackedDistance += oneTrack. length
345
345
for segment in oneTrack. segments {
346
346
let overlay = segment. overlay
347
- //addOverlay(overlay)
348
347
addOverlayOnTop ( overlay)
349
348
let segmentTrackpoints = segment. points
350
- //add point to map extent
349
+ // Add point to map extent
351
350
for waypoint in segmentTrackpoints {
352
351
extent. extendAreaToIncludeLocation ( waypoint. coordinate)
353
352
}
@@ -366,26 +365,24 @@ class GPXMapView: MKMapView {
366
365
session. totalTrackedDistance += oneTrack. length
367
366
for segment in oneTrack. segments {
368
367
let overlay = segment. overlay
369
- //addOverlay(overlay)
370
368
addOverlayOnTop ( overlay)
371
369
372
370
let segmentTrackpoints = segment. points
373
- //add point to map extent
371
+ // Add point to map extent
374
372
for waypoint in segmentTrackpoints {
375
373
extent. extendAreaToIncludeLocation ( waypoint. coordinate)
376
374
}
377
375
}
378
376
}
379
377
380
- // for last session track segment
378
+ // For last session track segment
381
379
for trackSegment in session. trackSegments {
382
380
383
381
let overlay = trackSegment. overlay
384
- //addOverlay(overlay)
385
382
addOverlayOnTop ( overlay)
386
383
387
384
let segmentTrackpoints = trackSegment. points
388
- //add point to map extent
385
+ // Add point to map extent
389
386
for waypoint in segmentTrackpoints {
390
387
extent. extendAreaToIncludeLocation ( waypoint. coordinate)
391
388
}
0 commit comments