refactor: Rewrite seismic map in Swift and rename its annotation model
This commit is contained in:
@@ -7,13 +7,13 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
65DBFB4B25E29DD60041CBA6 /* SeismicNetworksMapDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65DBFB4A25E29DD60041CBA6 /* SeismicNetworksMapDetailViewController.swift */; };
|
||||
8C10B0B92281FE7F00125C9F /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8C10B0BD2281FE7F00125C9F /* Localizable.strings */; };
|
||||
8C10B0BA2281FE7F00125C9F /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8C10B0BD2281FE7F00125C9F /* Localizable.strings */; };
|
||||
8C10B0BB2281FE7F00125C9F /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8C10B0BD2281FE7F00125C9F /* Localizable.strings */; };
|
||||
8C14113121ED3E5B00A59729 /* SettingsRealTimeAlertsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C14113021ED3E5B00A59729 /* SettingsRealTimeAlertsViewController.m */; };
|
||||
8C14113721EE502800A59729 /* EQNAllertaSismica.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C14113621EE502800A59729 /* EQNAllertaSismica.m */; };
|
||||
8C2B251121938BFD00E0E25E /* SegnalazioniUtenteDettagliMappa.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2B251021938BFD00E0E25E /* SegnalazioniUtenteDettagliMappa.m */; };
|
||||
8C2B25142193927E00E0E25E /* ReteSismiDettagliMappa.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2B25132193927E00E0E25E /* ReteSismiDettagliMappa.m */; };
|
||||
8C465D9A21F653AB00F04673 /* Assets.xcassets in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CBD3DD12149B9AD0070C963 /* Assets.xcassets */; };
|
||||
8C465D9B21F653CA00F04673 /* Assets.xcassets in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CBD3DD12149B9AD0070C963 /* Assets.xcassets */; };
|
||||
8C465D9C21F7BBE700F04673 /* PastquakesAnnotation.m in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C602249218EDBE200C799C2 /* PastquakesAnnotation.m */; };
|
||||
@@ -41,7 +41,7 @@
|
||||
8C7CD64921F7D11700835812 /* ReteSismicaAnnotation.m in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CD08637218B3BEE0000CB5E /* ReteSismicaAnnotation.m */; };
|
||||
8C7CD64A21F7D11700835812 /* ReteSismicaAnnotation.h in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CD08636218B3BEE0000CB5E /* ReteSismicaAnnotation.h */; };
|
||||
8C8EBBA721540039002784BA /* EQNUser.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C8EBBA621540039002784BA /* EQNUser.m */; };
|
||||
8CA46BA12194532E00C63C16 /* SismaAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CA46BA02194532E00C63C16 /* SismaAnnotation.m */; };
|
||||
8CA46BA12194532E00C63C16 /* EQNMapAnnotationSeismic.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CA46BA02194532E00C63C16 /* EQNMapAnnotationSeismic.m */; };
|
||||
8CADAA9421B2627D0044E256 /* LogViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CADAA9321B2627D0044E256 /* LogViewController.m */; };
|
||||
8CAFD7C521825E4A00F8BD29 /* EQNSisma.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CAFD7C421825E4A00F8BD29 /* EQNSisma.m */; };
|
||||
8CBD3DC72149B9AD0070C963 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CBD3DC62149B9AD0070C963 /* AppDelegate.m */; };
|
||||
@@ -272,6 +272,7 @@
|
||||
/* Begin PBXFileReference section */
|
||||
25A8BFFE29D46740E8A8A7A3 /* Pods_Earthquake_Network.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Earthquake_Network.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
40CD2E5581CF2FA3D52F392D /* Pods-Earthquake Network.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Earthquake Network.release.xcconfig"; path = "Pods/Target Support Files/Pods-Earthquake Network/Pods-Earthquake Network.release.xcconfig"; sourceTree = "<group>"; };
|
||||
65DBFB4A25E29DD60041CBA6 /* SeismicNetworksMapDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeismicNetworksMapDetailViewController.swift; sourceTree = "<group>"; };
|
||||
8C10B0AF2281FBE800125C9F /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Main.strings; sourceTree = "<group>"; };
|
||||
8C10B0B02281FBE800125C9F /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
|
||||
8C10B0B12281FBE800125C9F /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/MainInterface.strings; sourceTree = "<group>"; };
|
||||
@@ -288,8 +289,6 @@
|
||||
8C14113621EE502800A59729 /* EQNAllertaSismica.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EQNAllertaSismica.m; sourceTree = "<group>"; };
|
||||
8C2B250F21938BFD00E0E25E /* SegnalazioniUtenteDettagliMappa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SegnalazioniUtenteDettagliMappa.h; sourceTree = "<group>"; };
|
||||
8C2B251021938BFD00E0E25E /* SegnalazioniUtenteDettagliMappa.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SegnalazioniUtenteDettagliMappa.m; sourceTree = "<group>"; };
|
||||
8C2B25122193927E00E0E25E /* ReteSismiDettagliMappa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReteSismiDettagliMappa.h; sourceTree = "<group>"; };
|
||||
8C2B25132193927E00E0E25E /* ReteSismiDettagliMappa.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReteSismiDettagliMappa.m; sourceTree = "<group>"; };
|
||||
8C465D9721F6539700F04673 /* Earthquake Network.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "Earthquake Network.xcodeproj"; sourceTree = "<group>"; };
|
||||
8C483CAD21FDA53B00259FD2 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
|
||||
8C483CB021FDA8C700259FD2 /* Earthquake Network-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Earthquake Network-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
@@ -326,8 +325,8 @@
|
||||
8C7A3B65225A5EA40045B266 /* NSDictionary+EQNExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+EQNExtensions.h"; sourceTree = "<group>"; };
|
||||
8C8EBBA521540039002784BA /* EQNUser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EQNUser.h; sourceTree = "<group>"; };
|
||||
8C8EBBA621540039002784BA /* EQNUser.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EQNUser.m; sourceTree = "<group>"; };
|
||||
8CA46B9F2194532E00C63C16 /* SismaAnnotation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SismaAnnotation.h; sourceTree = "<group>"; };
|
||||
8CA46BA02194532E00C63C16 /* SismaAnnotation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SismaAnnotation.m; sourceTree = "<group>"; };
|
||||
8CA46B9F2194532E00C63C16 /* EQNMapAnnotationSeismic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EQNMapAnnotationSeismic.h; sourceTree = "<group>"; };
|
||||
8CA46BA02194532E00C63C16 /* EQNMapAnnotationSeismic.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EQNMapAnnotationSeismic.m; sourceTree = "<group>"; };
|
||||
8CADAA9221B2627D0044E256 /* LogViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LogViewController.h; sourceTree = "<group>"; };
|
||||
8CADAA9321B2627D0044E256 /* LogViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LogViewController.m; sourceTree = "<group>"; };
|
||||
8CAFD7C321825E4A00F8BD29 /* EQNSisma.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EQNSisma.h; sourceTree = "<group>"; };
|
||||
@@ -584,6 +583,15 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
65DBFB5225E2A2580041CBA6 /* Map annotation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8CA46B9F2194532E00C63C16 /* EQNMapAnnotationSeismic.h */,
|
||||
8CA46BA02194532E00C63C16 /* EQNMapAnnotationSeismic.m */,
|
||||
);
|
||||
path = "Map annotation";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8C465D9821F6539700F04673 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -634,8 +642,6 @@
|
||||
8CD08637218B3BEE0000CB5E /* ReteSismicaAnnotation.m */,
|
||||
8C602248218EDBE200C799C2 /* PastquakesAnnotation.h */,
|
||||
8C602249218EDBE200C799C2 /* PastquakesAnnotation.m */,
|
||||
8CA46B9F2194532E00C63C16 /* SismaAnnotation.h */,
|
||||
8CA46BA02194532E00C63C16 /* SismaAnnotation.m */,
|
||||
);
|
||||
path = annotation;
|
||||
sourceTree = "<group>";
|
||||
@@ -761,8 +767,7 @@
|
||||
DC65B390250F243E00251693 /* SeismicSettingsNetworksViewController.swift */,
|
||||
DC2814372519C56100C1AFF7 /* SeismicNetworksViewController.swift */,
|
||||
DCC76BD7251F56050005C4DC /* SeismicCardSettingsViewController.swift */,
|
||||
8C2B25122193927E00E0E25E /* ReteSismiDettagliMappa.h */,
|
||||
8C2B25132193927E00E0E25E /* ReteSismiDettagliMappa.m */,
|
||||
65DBFB4A25E29DD60041CBA6 /* SeismicNetworksMapDetailViewController.swift */,
|
||||
);
|
||||
path = "Seismic Networks";
|
||||
sourceTree = "<group>";
|
||||
@@ -1030,6 +1035,7 @@
|
||||
DCF9E15024F6EA0B002B6B1D /* Networks */,
|
||||
DC99A50124E66DFB0071BC9F /* Commands */,
|
||||
DCEFF21824F587CC009D3FE1 /* Settings */,
|
||||
65DBFB5225E2A2580041CBA6 /* Map annotation */,
|
||||
8C483CBB21FDACE500259FD2 /* VersioneProProducts.swift */,
|
||||
8C483CB721FDACD300259FD2 /* IAPHelper.swift */,
|
||||
DCF10DC524D2B8C7009F34C3 /* EQNPurchaseUtility.swift */,
|
||||
@@ -1556,7 +1562,6 @@
|
||||
8CF6604F214C0E58009F4314 /* EQNCalibrazione.m in Sources */,
|
||||
DCBB84F0252CFC4600F12633 /* AlertsNoLocationTableViewCell.swift in Sources */,
|
||||
DCD3E3C024D15576007C78D4 /* PurchaseProVersionViewController.swift in Sources */,
|
||||
8C2B25142193927E00E0E25E /* ReteSismiDettagliMappa.m in Sources */,
|
||||
8CF05B51218C41FB0055012B /* PickerViewController.m in Sources */,
|
||||
DC99A50324E66E270071BC9F /* EQNCommandProtocol.swift in Sources */,
|
||||
DCB45BC8250E86E100DB2D0C /* SeismicSettingsViewController.swift in Sources */,
|
||||
@@ -1568,6 +1573,7 @@
|
||||
8C14113121ED3E5B00A59729 /* SettingsRealTimeAlertsViewController.m in Sources */,
|
||||
DCBB267A24D1E7F500F04559 /* SubscriptionsHeaderTableViewCell.swift in Sources */,
|
||||
DC65B391250F243E00251693 /* SeismicSettingsNetworksViewController.swift in Sources */,
|
||||
65DBFB4B25E29DD60041CBA6 /* SeismicNetworksMapDetailViewController.swift in Sources */,
|
||||
DC08804124F5B41400186D97 /* SettingSliderTableViewCell.swift in Sources */,
|
||||
8CBD3DD82149B9AD0070C963 /* main.m in Sources */,
|
||||
8CF05B57218C93BA0055012B /* EQNUtility.m in Sources */,
|
||||
@@ -1586,7 +1592,7 @@
|
||||
8CBD3DC72149B9AD0070C963 /* AppDelegate.m in Sources */,
|
||||
DC974AFF251748B300A139EC /* SeismicFiltersViewController.swift in Sources */,
|
||||
DC105641251E7ECE002579BB /* UIFont+Extensions.swift in Sources */,
|
||||
8CA46BA12194532E00C63C16 /* SismaAnnotation.m in Sources */,
|
||||
8CA46BA12194532E00C63C16 /* EQNMapAnnotationSeismic.m in Sources */,
|
||||
DCB28CEE24FB8400001F557E /* SettingsViewController.swift in Sources */,
|
||||
DCB528212560161C005288E5 /* AlertSimulatorViewController.swift in Sources */,
|
||||
DCC76BD8251F56050005C4DC /* SeismicCardSettingsViewController.swift in Sources */,
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
//
|
||||
// ReteSismiDettagliMappa.h
|
||||
// Earthquake Network
|
||||
//
|
||||
// Refactored by Andrea Busi on 26/09/2020.
|
||||
// Copyright © 2020 Earthquake Network. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DettagliMappaViewController.h"
|
||||
#import "EQNSisma.h"
|
||||
|
||||
|
||||
@interface ReteSismiDettagliMappa : DettagliMappaViewController
|
||||
@property (nonatomic, strong, nullable) EQNSisma *sisma;
|
||||
@end
|
||||
@@ -1,77 +0,0 @@
|
||||
//
|
||||
// ReteSismiDettagliMappa.m
|
||||
// Earthquake Network
|
||||
//
|
||||
// Refactored by Andrea Busi on 26/09/2020.
|
||||
// Copyright © 2020 Earthquake Network. All rights reserved.
|
||||
//
|
||||
|
||||
#import "ReteSismiDettagliMappa.h"
|
||||
#import "SismaAnnotation.h"
|
||||
#import "EQNAdsUtility.h"
|
||||
|
||||
@interface ReteSismiDettagliMappa ()
|
||||
@property (nonatomic, strong) GADBannerView *bannerView;
|
||||
@end
|
||||
|
||||
@implementation ReteSismiDettagliMappa
|
||||
|
||||
#pragma mark - View Lifecycle
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
[self setupUI];
|
||||
|
||||
for (EQNSisma *sismi in [EQNManager defaultManager].retiSismiche ) {
|
||||
[self creaMarcherWithSegnalazione:sismi];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (void)setupUI
|
||||
{
|
||||
self.mapView.delegate = self;
|
||||
self.bannerView = [EQNAdsUtility ottieniBannerWithController:self position:YES];
|
||||
|
||||
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"]
|
||||
style:UIBarButtonItemStyleDone
|
||||
target:self
|
||||
action:@selector(chiudi:)];
|
||||
self.navigationController.navigationItem.leftBarButtonItem = backButton;
|
||||
}
|
||||
|
||||
- (void)creaMarcherWithSegnalazione:(id)segnalazione
|
||||
{
|
||||
[super creaMarcherWithSegnalazione:segnalazione];
|
||||
|
||||
SismaAnnotation *anAnnotation = [[SismaAnnotation alloc] initWithTitle:self.sisma.place location:self.sisma.coordinate.coordinate intensita:[self.sisma.magnitude doubleValue]];
|
||||
|
||||
[self.mapView addAnnotation:anAnnotation];
|
||||
|
||||
MKCoordinateSpan span = MKCoordinateSpanMake(10.5, 10.5);
|
||||
MKCoordinateRegion region = MKCoordinateRegionMake(self.sisma.coordinate.coordinate, span);
|
||||
[self.mapView setCenterCoordinate:self.sisma.coordinate.coordinate animated:NO];
|
||||
[self.mapView setRegion:region animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - MKMapViewDelegate
|
||||
|
||||
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
|
||||
{
|
||||
if ([annotation isKindOfClass:[SismaAnnotation class]]) {
|
||||
SismaAnnotation *anLocation = (SismaAnnotation *)annotation;
|
||||
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:IDENTIFIER_ANNOTATION_SISMI];
|
||||
if (annotationView == nil) {
|
||||
annotationView = anLocation.annotationView;
|
||||
} else {
|
||||
annotationView.annotation = anLocation;
|
||||
}
|
||||
return annotationView;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// SeismicNetworksMapDetailViewController.swift
|
||||
// Earthquake Network
|
||||
//
|
||||
// Created by Andrea Busi on 21/02/21.
|
||||
// Copyright © 2021 Earthquake Network. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MapKit
|
||||
|
||||
class SeismicNetworksMapDetailViewController: EQNBaseViewController, MKMapViewDelegate {
|
||||
|
||||
// MARK: - UI
|
||||
|
||||
@IBOutlet private weak var mapView: MKMapView!
|
||||
|
||||
// MARK: - State
|
||||
|
||||
var seismic: EQNSisma?
|
||||
|
||||
|
||||
// MARK: - View Lifecycle
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
setupUI()
|
||||
|
||||
if let seismic = seismic {
|
||||
addMarker(for: seismic)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func setupUI() {
|
||||
let closeButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(closeTapped(_:)))
|
||||
navigationItem.rightBarButtonItem = closeButton
|
||||
}
|
||||
|
||||
private func addMarker(for seismic: EQNSisma) {
|
||||
let annotation = EQNMapAnnotationSeismic(title: seismic.place, location: seismic.coordinate.coordinate, intensita: seismic.magnitude.doubleValue)
|
||||
mapView.addAnnotation(annotation)
|
||||
|
||||
let span = MKCoordinateSpan(latitudeDelta: 10.5, longitudeDelta: 10.5)
|
||||
let region = MKCoordinateRegion(center: seismic.coordinate.coordinate, span: span)
|
||||
mapView.setCenter(seismic.coordinate.coordinate, animated: false)
|
||||
mapView.setRegion(region, animated: true)
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
@objc private func closeTapped(_ sender: Any) {
|
||||
dismiss(animated: true)
|
||||
}
|
||||
|
||||
// MARK: - MKMapViewDelegate
|
||||
|
||||
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
|
||||
if let sismaAnnotation = annotation as? EQNMapAnnotationSeismic {
|
||||
var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: EQNMapAnnotationSeismicIdentifier)
|
||||
if annotationView == nil {
|
||||
annotationView = sismaAnnotation.annotationView()
|
||||
} else {
|
||||
annotationView?.annotation = sismaAnnotation
|
||||
}
|
||||
return annotationView
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -66,8 +66,8 @@ class SeismicNetworksViewController: EQNBaseViewController, UITableViewDelegate,
|
||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||
switch segue.identifier {
|
||||
case Self.SegueIdentifierMap:
|
||||
if let seismic = sender as? EQNSisma, let navController = segue.destination as? UINavigationController, let controller = navController.viewControllers.first as? ReteSismiDettagliMappa {
|
||||
controller.sisma = seismic
|
||||
if let seismic = sender as? EQNSisma, let navController = segue.destination as? UINavigationController, let controller = navController.viewControllers.first as? SeismicNetworksMapDetailViewController {
|
||||
controller.seismic = seismic
|
||||
}
|
||||
case Self.SegueIdentifierFilters:
|
||||
if let controller = segue.destination as? SeismicFiltersViewController {
|
||||
|
||||
@@ -103,9 +103,6 @@ static NSString * const EQNAdMobAppIdAdaptiveBanner = @"ca-app-pub-0053870219990
|
||||
#define IDENTIFIER_ANNOTATION_RETESMARTPHONE @"IDENTIFIER_ANNOTATION_RETESMARTPHONE"
|
||||
// pastequakes
|
||||
#define IDENTIFIER_ANNOTATION_PASTQUAKES @"IDENTIFIER_ANNOTATION_PASTQUAKES"
|
||||
|
||||
// sismi
|
||||
#define IDENTIFIER_ANNOTATION_SISMI @"IDENTIFIER_ANNOTATION_SISMI"
|
||||
// rete smartphone notifiche
|
||||
#define IDENTIFIER_ANNOTATION_RS_NOTIFICA @"IDENTIFIER_ANNOTATION_RS_NOTIFICA"
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#import "EQNNotificheReteSismiche.h"
|
||||
#import "EQNSisma.h"
|
||||
#import "EQNBaseViewController.h"
|
||||
#import "ReteSismiDettagliMappa.h"
|
||||
#import "SettingsBaseViewController.h"
|
||||
#import "PastquakesAnnotation.h"
|
||||
#import "EQNGeneratoreURLServer.h"
|
||||
#import "ServerRequest.h"
|
||||
#import "EQNMapAnnotationSeismic.h"
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// EQNMapAnnotationSeismic.h
|
||||
// Earthquake Network
|
||||
//
|
||||
// Refactored by Andrea Busi
|
||||
// Copyright © 2021 Earthquake Network. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <MapKit/MapKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
static NSString * const EQNMapAnnotationSeismicIdentifier = @"EQNMapAnnotationSeismicIdentifier";
|
||||
|
||||
|
||||
@interface EQNMapAnnotationSeismic : NSObject <MKAnnotation>
|
||||
|
||||
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
|
||||
@property (nonatomic, copy) NSString *title;
|
||||
@property (nonatomic, readonly) double magnitude;
|
||||
|
||||
- (instancetype)initWithTitle:(NSString *)title location:(CLLocationCoordinate2D)coordinate intensita:(double)magnitude;
|
||||
|
||||
- (MKAnnotationView *)annotationView;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+16
-16
@@ -1,20 +1,21 @@
|
||||
//
|
||||
// SismaAnnotation.m
|
||||
// EQNMapAnnotationSeismic.m
|
||||
// Earthquake Network
|
||||
//
|
||||
// Created by Luca Beretta on 08/11/18.
|
||||
// Copyright © 2018 Luca Beretta. All rights reserved.
|
||||
// Refactored by Andrea Busi
|
||||
// Copyright © 2021 Earthquake Network. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SismaAnnotation.h"
|
||||
#import "EQNMapAnnotationSeismic.h"
|
||||
|
||||
@implementation SismaAnnotation
|
||||
@implementation EQNMapAnnotationSeismic
|
||||
|
||||
-(id)initWithTitle:(NSString *)title location:(CLLocationCoordinate2D )coordinate intensita:(double)magnitude{
|
||||
#pragma mark - Init
|
||||
|
||||
- (instancetype)initWithTitle:(NSString *)title location:(CLLocationCoordinate2D )coordinate intensita:(double)magnitude{
|
||||
|
||||
self = [super init];
|
||||
if (self) {
|
||||
|
||||
_title = title;
|
||||
_coordinate = coordinate;
|
||||
_magnitude = magnitude;
|
||||
@@ -22,24 +23,23 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
-(MKAnnotationView *)annotationView{
|
||||
|
||||
MKAnnotationView *annotationView = [[MKAnnotationView alloc] initWithAnnotation:self reuseIdentifier:IDENTIFIER_ANNOTATION_SISMI];
|
||||
#pragma mark - Annotation
|
||||
|
||||
- (MKAnnotationView *)annotationView
|
||||
{
|
||||
MKAnnotationView *annotationView = [[MKAnnotationView alloc] initWithAnnotation:self reuseIdentifier:EQNMapAnnotationSeismicIdentifier];
|
||||
annotationView.enabled = YES;
|
||||
annotationView.canShowCallout = YES;
|
||||
NSString *imageString;
|
||||
|
||||
NSLog(@"magnitudo %f", self.magnitude);
|
||||
|
||||
if(self.magnitude > 4.0){
|
||||
if (self.magnitude > 4.0){
|
||||
imageString = @"dyamond_red";
|
||||
|
||||
}else if (self.magnitude < 3.0){
|
||||
} else if (self.magnitude < 3.0) {
|
||||
imageString = @"dyamond_green";
|
||||
|
||||
}else{
|
||||
} else {
|
||||
imageString = @"dyamond_yellow";
|
||||
|
||||
}
|
||||
|
||||
annotationView.image = [UIImage imageNamed:imageString];
|
||||
@@ -368,11 +368,11 @@ In più sostieni il progetto di ricerca il quale non riceve finanziamenti estern
|
||||
<outlet property="bannerContainerView" destination="Nac-25-EPW" id="aJ3-kF-jA3"/>
|
||||
<outlet property="expandeCollapseButton" destination="HTN-07-s5p" id="lxP-Im-NME"/>
|
||||
<outlet property="tableView" destination="q4o-YO-KLX" id="tee-h5-dZi"/>
|
||||
<segue destination="LHm-XT-f2y" kind="presentation" identifier="ShowMapDetail" id="say-mL-Iyg"/>
|
||||
<segue destination="rZ4-xN-lLk" kind="presentation" identifier="ShowSettings" modalPresentationStyle="overCurrentContext" modalTransitionStyle="crossDissolve" id="5R7-S8-R7P"/>
|
||||
<segue destination="lTI-GM-Lum" kind="presentation" identifier="ShowSeismicNetworks" id="JKE-mg-BIk"/>
|
||||
<segue destination="6LP-zk-O1z" kind="presentation" identifier="ShowFilters" modalPresentationStyle="overCurrentContext" modalTransitionStyle="crossDissolve" id="Nzu-iH-UgB"/>
|
||||
<segue destination="Rfp-kt-2Kx" kind="presentation" identifier="ShowCardSettings" modalPresentationStyle="overCurrentContext" modalTransitionStyle="crossDissolve" id="VWw-16-xGw"/>
|
||||
<segue destination="6Ia-ax-PLl" kind="presentation" identifier="ShowMapDetail" id="UNr-Av-Xcw"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="34i-9D-p3O" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
@@ -1457,53 +1457,50 @@ In più sostieni il progetto di ricerca il quale non riceve finanziamenti estern
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-10929" y="-7374"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="DjR-k2-Uke">
|
||||
<objects>
|
||||
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="LHm-XT-f2y" sceneMemberID="viewController">
|
||||
<toolbarItems/>
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="zMO-g0-QNp">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="56"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<nil name="viewControllers"/>
|
||||
<connections>
|
||||
<segue destination="g91-vR-Oi1" kind="relationship" relationship="rootViewController" id="YJC-in-eGh"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="ynl-Z3-Typ" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-7586" y="-5464"/>
|
||||
</scene>
|
||||
<!--Rete Sismi Dettagli Mappa-->
|
||||
<!--Seismic Networks Map Detail View Controller-->
|
||||
<scene sceneID="Sdn-cf-5DS">
|
||||
<objects>
|
||||
<viewController id="g91-vR-Oi1" customClass="ReteSismiDettagliMappa" sceneMemberID="viewController">
|
||||
<viewController id="g91-vR-Oi1" customClass="SeismicNetworksMapDetailViewController" customModule="Earthquake_Network" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="IDp-uY-aLk">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="842"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="U9W-fH-WlC">
|
||||
<rect key="frame" x="0.0" y="56" width="414" height="752"/>
|
||||
<rect key="frame" x="0.0" y="56" width="414" height="702"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="g91-vR-Oi1" id="D0c-pw-wKq"/>
|
||||
</connections>
|
||||
</mapView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ncH-7F-a3K">
|
||||
<rect key="frame" x="0.0" y="758" width="414" height="50"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="Bwj-hF-heI"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="Zod-NC-YLT"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Zod-NC-YLT" firstAttribute="bottom" secondItem="U9W-fH-WlC" secondAttribute="bottom" id="EOv-ch-LrG"/>
|
||||
<constraint firstItem="ncH-7F-a3K" firstAttribute="bottom" secondItem="Zod-NC-YLT" secondAttribute="bottom" id="3FB-XQ-wdb"/>
|
||||
<constraint firstItem="ncH-7F-a3K" firstAttribute="top" secondItem="U9W-fH-WlC" secondAttribute="bottom" id="UR6-zp-txx"/>
|
||||
<constraint firstItem="U9W-fH-WlC" firstAttribute="trailing" secondItem="Zod-NC-YLT" secondAttribute="trailing" id="auD-wh-YAA"/>
|
||||
<constraint firstItem="ncH-7F-a3K" firstAttribute="leading" secondItem="Zod-NC-YLT" secondAttribute="leading" id="mZi-y4-Eu2"/>
|
||||
<constraint firstItem="Zod-NC-YLT" firstAttribute="trailing" secondItem="ncH-7F-a3K" secondAttribute="trailing" id="pj6-Iv-JRe"/>
|
||||
<constraint firstItem="U9W-fH-WlC" firstAttribute="leading" secondItem="Zod-NC-YLT" secondAttribute="leading" id="ruS-YM-kiK"/>
|
||||
<constraint firstItem="U9W-fH-WlC" firstAttribute="top" secondItem="Zod-NC-YLT" secondAttribute="top" id="wkd-21-Q06"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="h9X-ff-rCA"/>
|
||||
<connections>
|
||||
<outlet property="bannerContainerHeightConstraint" destination="Bwj-hF-heI" id="7hG-Ai-1vh"/>
|
||||
<outlet property="bannerContainerView" destination="ncH-7F-a3K" id="ee8-UF-HHJ"/>
|
||||
<outlet property="mapView" destination="U9W-fH-WlC" id="QAC-GP-eaH"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="tNk-gG-6jK" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-6854" y="-5464"/>
|
||||
<point key="canvasLocation" x="-6815.9420289855079" y="-5464.2857142857138"/>
|
||||
</scene>
|
||||
<!--Settings-->
|
||||
<scene sceneID="nIl-RI-AZv">
|
||||
@@ -2560,6 +2557,25 @@ Sisma rilevato da 10 smartphone</string>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-7691.3043478260879" y="-7441.0714285714284"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="kQU-hR-Qtg">
|
||||
<objects>
|
||||
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="6Ia-ax-PLl" sceneMemberID="viewController">
|
||||
<toolbarItems/>
|
||||
<navigationItem key="navigationItem" id="fda-TG-1Z9"/>
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="nEk-36-kMO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="56"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<nil name="viewControllers"/>
|
||||
<connections>
|
||||
<segue destination="g91-vR-Oi1" kind="relationship" relationship="rootViewController" id="KfK-Za-MMz"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Bu7-hO-QIb" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-7726.0869565217399" y="-5464.2857142857138"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="eq_icon_pro" width="166" height="166"/>
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
//
|
||||
// SismaAnnotation.h
|
||||
// Earthquake Network
|
||||
//
|
||||
// Created by Luca Beretta on 08/11/18.
|
||||
// Copyright © 2018 Luca Beretta. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <MapKit/MapKit.h>
|
||||
#import "Costanti.h"
|
||||
|
||||
@interface SismaAnnotation : NSObject <MKAnnotation>
|
||||
|
||||
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
|
||||
@property (nonatomic, copy) NSString *title;
|
||||
@property (nonatomic, readonly) double magnitude;
|
||||
|
||||
-(id)initWithTitle:(NSString *)title location:(CLLocationCoordinate2D )coordinate intensita:(double)magnitude;
|
||||
-(MKAnnotationView *)annotationView ;
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user