-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1550 from Framstag/vyskocil-fix-and-modernize-app…
…le-sample Fix and modernize Apple sample code
- Loading branch information
Showing
152 changed files
with
205 additions
and
12,319 deletions.
There are no files selected for viewing
100 changes: 44 additions & 56 deletions
100
Apple/OSMScoutOSX/OSMScoutOSX.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file modified
BIN
+35.1 KB
(120%)
...deproj/project.xcworkspace/xcuserdata/vyskocil.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// AppDelegate.swift | ||
// OSMScoutOSX | ||
// | ||
// Created by Vladimir Vyskocil on 30/12/2023. | ||
// Copyright © 2023 libosmscout. All rights reserved. | ||
// | ||
|
||
import AppKit | ||
|
||
@main | ||
class AppDelegate: NSResponder, NSApplicationDelegate { | ||
var window : NSWindow? = nil | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
Apple/OSMScoutOSX/OSMScoutOSX/OSMScoutOSX-Bridging-Header.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// OSMScoutOSX-Bridging-Header.h | ||
// OSMScoutOSX | ||
// | ||
// Created by Vladimir Vyskocil on 30/12/2023. | ||
// Copyright © 2023 libosmscout. All rights reserved. | ||
// | ||
|
||
#ifndef OSMScoutOSX_Bridging_Header_h | ||
#define OSMScoutOSX_Bridging_Header_h | ||
|
||
#import "OSMScoutMKTileOverlay.h" | ||
|
||
#endif /* OSMScoutOSX_Bridging_Header_h */ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// | ||
// OSMScoutView.swift | ||
// OSMScoutOSX | ||
// | ||
// Created by Vladimir Vyskocil on 31/12/2023. | ||
// Copyright © 2023 libosmscout. All rights reserved. | ||
// | ||
|
||
import MapKit | ||
import CoreLocation | ||
|
||
// The OpenStreetMap compiled data with the Import tools should be put in map.osmscout | ||
// folder in the Resources of the project, a example of OSM source data is | ||
// the Greater London from GeoFabrik | ||
// (https://download.geofabrik.de/europe/great-britain/england/greater-london.html) | ||
|
||
class OSMScoutView: MKMapView, MKMapViewDelegate { | ||
// The center of the displayed map | ||
let LATITUDE = 51.5102 | ||
let LONGITUDE = -0.1024 | ||
// The zoom level | ||
let ZOOM = 16.0 | ||
|
||
var tileOverlay : MKTileOverlay! = nil | ||
|
||
func defaults() { | ||
showsTraffic = false | ||
showsBuildings = false | ||
pointOfInterestFilter = .excludingAll | ||
|
||
let centerCoordinate = CLLocationCoordinate2D(latitude:LATITUDE, longitude:LONGITUDE) | ||
let longitudeDelta = 360.0 / pow(2, ZOOM) * Double(frame.size.width/256) | ||
let span = MKCoordinateSpan(latitudeDelta: 0, longitudeDelta: longitudeDelta) | ||
|
||
setRegion(MKCoordinateRegion(center: centerCoordinate, span: span), animated:false) | ||
delegate = self | ||
let overlay = OSMScoutMKTileOverlay(urlTemplate: nil) | ||
let path = (Bundle.main.resourcePath ?? "") + "/map.osmscout" | ||
OSMScoutMKTileOverlay.path = path | ||
tileOverlay = overlay; | ||
insertOverlay(tileOverlay, at:0, level:.aboveLabels) | ||
} | ||
|
||
override func awakeFromNib() { | ||
super.awakeFromNib() | ||
defaults() | ||
} | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
defaults() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
super.init(coder: coder) | ||
defaults() | ||
} | ||
|
||
// MARK: - MKMapViewDelegate | ||
|
||
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer { | ||
if let overlay = overlay as? MKTileOverlay { | ||
return MKTileOverlayRenderer(tileOverlay: overlay) | ||
} else { | ||
return MKOverlayRenderer() | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.