Skip to content

Instantly share code, notes, and snippets.

@craiggrummitt

craiggrummitt/Mapper.swift Secret

Created Feb 27, 2019
Embed
What would you like to do?
GMSMutablePaths for Continents
class Mapper {
static func getPath(lat:[CLLocationDegrees],long:[CLLocationDegrees])->GMSMutablePath {
let path = GMSMutablePath()
for i in 0..<lat.count {
path.add(CLLocationCoordinate2D(latitude: lat[i], longitude: long[i]))
}
return path
}
}
enum Continent:String,CaseIterable {
case australia
case northAmerica
case southAmerica
case africa
case europe
case asia
case antarctica
static var australiaPath:GMSMutablePath = Mapper.getPath(lat: [-11.88, -10.27, -10, -30, -52.5, -31.88],long: [110, 140, 145, 161.25, 142.5, 110])
static var africaPath:GMSMutablePath = Mapper.getPath(lat: [15, 28.25, 35.42, 38, 33, 31.74, 29.54, 27.78, 11.3, 12.5, -60, -60],long: [-30, -13, -10, 10, 27.5, 34.58, 34.92, 34.46, 44.3, 52, 75, -30])
static var europePath:GMSMutablePath = Mapper.getPath(lat: [90, 90, 42.5, 42.5, 40.79, 41, 40.55, 40.40, 40.05, 39.17, 35.46, 33, 38, 35.42, 28.25, 15, 57.5, 78.13],long: [-10, 77.5, 48.8, 30, 28.81, 29, 27.31, 26.75, 26.36, 25.19, 27.91, 27.5, 10, -10, -13, -30, -37.5, -10])
static var asiaPath:GMSMutablePath = Mapper.getPath(lat: [90, 42.5, 42.5, 40.79, 41, 40.55, 40.4, 40.05, 39.17, 35.46, 33, 31.74, 29.54, 27.78, 11.3, 12.5, -60, -60, -31.88, -11.88, -10.27, 33.13, 51, 60, 90],long: [77.5, 48.8, 30, 28.81, 29, 27.31, 26.75, 26.36, 25.19, 27.91, 27.5, 34.58, 34.92, 34.46, 44.3, 52, 75, 110, 110, 110, 140, 140, 166.6, 180, 180])
static var asia2Path:GMSMutablePath = Mapper.getPath(lat: [90, 90, 60, 60],long: [-180, -168.75, -168.75, -180])
static var northAmericaPath:GMSMutablePath = Mapper.getPath(lat: [90, 90, 78.13, 57.5, 15, 15, 1.25, 1.25, 51, 60, 60],long: [-168.75, -10, -10, -37.5, -30, -75, -82.5, -105, -180, -180, -168.75])
static var northAmerica2Path:GMSMutablePath = Mapper.getPath(lat: [51, 51, 60],long: [166.6, 180, 180])
static var southAmericaPath:GMSMutablePath = Mapper.getPath(lat: [1.25, 1.25, 15, 15, -60, -60],long: [-105, -82.5, -75, -30, -30, -105])
static var antarcticaPath:GMSMutablePath = Mapper.getPath(lat: [-60, -60, -90, -90],long: [-180, 180, 180, -180])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.