`BaseClusterPlacemarkManager` inheritance updated, optional casts removed
This commit is contained in:
parent
f91453a065
commit
2b1511657d
|
|
@ -25,9 +25,8 @@ import MapKit
|
|||
import UIKit
|
||||
|
||||
open class AppleClusterPlacemarkManager<Model>: BaseClusterPlacemarkManager<MKAnnotationView,
|
||||
[ApplePlacemarkManager<Model>],
|
||||
MKMapRect,
|
||||
CLLocationCoordinate2D>,
|
||||
ApplePlacemarkManager<Model>,
|
||||
MKMapRect>,
|
||||
MKMapViewDelegate {
|
||||
|
||||
public weak var mapViewDelegate: MKMapViewDelegate?
|
||||
|
|
|
|||
|
|
@ -25,9 +25,8 @@ import GoogleMapsUtils
|
|||
import GoogleMaps
|
||||
|
||||
open class GoogleClusterPlacemarkManager<Model>: BaseClusterPlacemarkManager<GMSMarker,
|
||||
[GooglePlacemarkManager<Model>],
|
||||
GMSCoordinateBounds,
|
||||
CLLocationCoordinate2D>,
|
||||
GooglePlacemarkManager<Model>,
|
||||
GMSCoordinateBounds>,
|
||||
GMUClusterRendererDelegate,
|
||||
GMUClusterManagerDelegate,
|
||||
GMUClusterIconGenerator {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
//
|
||||
|
||||
/// Available marker states on any map
|
||||
public enum MarkerState {
|
||||
public enum MarkerState: String {
|
||||
|
||||
/// A state where a map point is selected and a marker is highlighted
|
||||
case selected
|
||||
|
|
|
|||
|
|
@ -24,39 +24,20 @@
|
|||
Base cluster placemark manager
|
||||
|
||||
- Parameters:
|
||||
- `Placemark`: a generic parameter describing a cluster placemark itself
|
||||
- `ClusterDataModel`: an array of single placemarks managers for a cluster
|
||||
- `ClusterPoints`: a collection of cluster placemark objects
|
||||
- `Position`: a type of a single manager's placemark position
|
||||
- `ClusterPlacemark`: a generic parameter describing a cluster placemark itself
|
||||
- `ItemPlacemarkManager`: a single placemarks manager element of array for a cluster
|
||||
- `ClusterBounds`: a collection of cluster placemark objects
|
||||
*/
|
||||
open class BaseClusterPlacemarkManager<Placemark, ClusterDataModel, ClusterPoints, Position: Equatable>:
|
||||
BasePlacemarkManager<Placemark, ClusterDataModel, ClusterPoints> {
|
||||
open class BaseClusterPlacemarkManager<ClusterPlacemark, ItemPlacemarkManager: PlacemarkManager, ClusterBounds>:
|
||||
BasePlacemarkManager<ClusterPlacemark, [ItemPlacemarkManager], ClusterBounds> where ItemPlacemarkManager.Position : Equatable {
|
||||
|
||||
/// Manual selecting of a placemark with an incoming point coordinates
|
||||
open func selectMarker(with point: Position) {
|
||||
guard let dataModel = dataModel as? Array<any PlacemarkManager> else {
|
||||
return
|
||||
}
|
||||
|
||||
dataModel
|
||||
.filter {
|
||||
guard let placemarkPosition = $0.placemarkPosition as? Position else {
|
||||
return false
|
||||
}
|
||||
|
||||
return placemarkPosition == point
|
||||
}
|
||||
.forEach {
|
||||
$0.state = .selected
|
||||
}
|
||||
open func selectMarker(with point: ItemPlacemarkManager.Position) {
|
||||
dataModel.filter { $0.placemarkPosition == point }.forEach { $0.state = .selected }
|
||||
}
|
||||
|
||||
/// Manual state resetting of all placemarks with currently selected state
|
||||
open func resetMarkersState() {
|
||||
guard let dataModel = dataModel as? Array<any PlacemarkManager> else {
|
||||
return
|
||||
}
|
||||
|
||||
dataModel.filter { $0.state == .selected }.forEach { $0.state = .default }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,8 @@ import UIKit
|
|||
import CoreLocation
|
||||
|
||||
open class YandexClusterPlacemarkManager<Model>: BaseClusterPlacemarkManager<YMKCluster,
|
||||
[YandexPlacemarkManager<Model>],
|
||||
[YMKPoint],
|
||||
YMKPoint>,
|
||||
YandexPlacemarkManager<Model>,
|
||||
[YMKPoint]>,
|
||||
YMKClusterListener,
|
||||
YMKClusterTapListener {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue