|
|
@@ -109,8 +109,9 @@ class ATMapMarker: NSObject, Codable {
|
|
|
var longitude: CGFloat
|
|
|
var isSelected: Bool
|
|
|
var markerType: any MapMarkerSupportType
|
|
|
+ var tags: [String : String]?
|
|
|
|
|
|
- init(id: String, markerName: String?, customAvatarUrl: String?,location: CLLocationCoordinate2D, markerType: any MapMarkerSupportType, isSelected: Bool = false) {
|
|
|
+ init(id: String, markerName: String?, customAvatarUrl: String?,location: CLLocationCoordinate2D, markerType: any MapMarkerSupportType, isSelected: Bool = false,tags: [String : String]?) {
|
|
|
self.id = id
|
|
|
self.markerName = markerName
|
|
|
self.customAvatarUrl = customAvatarUrl
|
|
|
@@ -118,6 +119,7 @@ class ATMapMarker: NSObject, Codable {
|
|
|
self.longitude = location.longitude
|
|
|
self.markerType = markerType
|
|
|
self.isSelected = isSelected
|
|
|
+ self.tags = tags
|
|
|
}
|
|
|
|
|
|
func update(coordinate: CLLocationCoordinate2D, name: String? = nil, isSelect: Bool) {
|
|
|
@@ -128,7 +130,7 @@ class ATMapMarker: NSObject, Codable {
|
|
|
}
|
|
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
|
- case id, markerName,customAvatarUrl, latitude, longitude, isSelected, markerType
|
|
|
+ case id, markerName,customAvatarUrl, latitude, longitude, isSelected, markerType,tags
|
|
|
}
|
|
|
|
|
|
required init(from decoder: Decoder) throws {
|
|
|
@@ -150,6 +152,9 @@ class ATMapMarker: NSObject, Codable {
|
|
|
// 使用工厂方法创建正确类型的markerType
|
|
|
let rawValue = try container.decode(Int.self, forKey: .markerType)
|
|
|
markerType = MarkerTypeFactory.markerType(from: rawValue)
|
|
|
+
|
|
|
+ ///气泡内容
|
|
|
+ tags = try container.decode([String : String].self, forKey: .tags)
|
|
|
}
|
|
|
|
|
|
func encode(to encoder: Encoder) throws {
|
|
|
@@ -161,6 +166,7 @@ class ATMapMarker: NSObject, Codable {
|
|
|
try container.encode(longitude, forKey: .longitude)
|
|
|
try container.encode(isSelected, forKey: .isSelected)
|
|
|
try container.encode(markerType.rawValue, forKey: .markerType)
|
|
|
+ try container.encode(tags, forKey: .tags)
|
|
|
}
|
|
|
}
|
|
|
|