feat: Show callout for shakemap annotations
This commit is contained in:
@@ -15,7 +15,7 @@ class EQNMapAnnotationShakemap: NSObject, MKAnnotation {
|
||||
var intensityColor: UIColor?
|
||||
var intensityTextColor: UIColor?
|
||||
|
||||
let title: String? = nil
|
||||
let title: String?
|
||||
let subtitle: String? = nil
|
||||
|
||||
|
||||
@@ -25,5 +25,24 @@ class EQNMapAnnotationShakemap: NSObject, MKAnnotation {
|
||||
) {
|
||||
self.coordinate = coordinate
|
||||
self.shakemap = shakemap
|
||||
self.title = Self.title(for: shakemap.intensity)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private static func title(for intensity: Float) -> String {
|
||||
return switch intensity {
|
||||
case 0..<2.5: NSLocalizedString("mercalli_II", comment: "")
|
||||
case 2.5..<3.5: NSLocalizedString("mercalli_III", comment: "")
|
||||
case 3.5..<4.5: NSLocalizedString("mercalli_IV", comment: "")
|
||||
case 4.5..<5.5: NSLocalizedString("mercalli_V", comment: "")
|
||||
case 5.5..<6.5: NSLocalizedString("mercalli_VI", comment: "")
|
||||
case 6.5..<7.5: NSLocalizedString("mercalli_VII", comment: "")
|
||||
case 7.5..<8.5: NSLocalizedString("mercalli_VIII", comment: "")
|
||||
case 8.5..<9.5: NSLocalizedString("mercalli_IX", comment: "")
|
||||
case 9.5..<10.5: NSLocalizedString("mercalli_X", comment: "")
|
||||
case 10.5..<11.5: NSLocalizedString("mercalli_XI", comment: "")
|
||||
default: NSLocalizedString("mercalli_XII", comment: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user