NCViewerImageDetailView.swift 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // NCViewerImageDetailView.swift
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 31/10/2020.
  6. // Copyright © 2020 Marino Faggiana. All rights reserved.
  7. //
  8. import Foundation
  9. import MapKit
  10. class NCViewerImageDetailView: UIView {
  11. @IBOutlet weak var mapView: MKMapView!
  12. var annotation = MKPointAnnotation()
  13. override func awakeFromNib() {
  14. super.awakeFromNib()
  15. mapView.layer.cornerRadius = 6
  16. }
  17. func updateExifLocal(metadata: tableMetadata) {
  18. if metadata.typeFile == k_metadataTypeFile_image {
  19. CCExifGeo.sharedInstance()?.setExif(metadata)
  20. }
  21. if let localFile = NCManageDatabase.sharedInstance.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) {
  22. let latitude = Double(localFile.exifLatitude) ?? 0
  23. let longitude = Double(localFile.exifLongitude) ?? 0
  24. annotation.coordinate = CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
  25. mapView.addAnnotation(annotation)
  26. }
  27. }
  28. }