Files
comaps/iphone/CoreApi/CoreApi/Bookmarks/MWMCarPlayBookmarkObject.mm
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

32 lines
1.2 KiB
Plaintext

#import "MWMCarPlayBookmarkObject.h"
#include "Framework.h"
#include "geometry/mercator.hpp"
@interface MWMCarPlayBookmarkObject()
@property(assign, nonatomic, readwrite) MWMMarkID bookmarkId;
@property(strong, nonatomic, readwrite) NSString *prefferedName;
@property(strong, nonatomic, readwrite) NSString *address;
@property(assign, nonatomic, readwrite) CLLocationCoordinate2D coordinate;
@property(assign, nonatomic, readwrite) CGPoint mercatorPoint;
@end
@implementation MWMCarPlayBookmarkObject
- (instancetype)initWithBookmarkId:(MWMMarkID)bookmarkId {
self = [super init];
if (self) {
self.bookmarkId = bookmarkId;
auto const & bm = GetFramework().GetBookmarkManager();
Bookmark const * bookmark = bm.GetBookmark(bookmarkId);
self.prefferedName = @(bookmark->GetPreferredName().c_str());
auto const pivot = bookmark->GetPivot();
self.mercatorPoint = CGPointMake(pivot.x, pivot.y);
auto const & address = GetFramework().GetAddressAtPoint(pivot);
self.address = @(address.FormatAddress().c_str());
auto const location = mercator::ToLatLon(pivot);
self.coordinate = CLLocationCoordinate2DMake(location.m_lat, location.m_lon);
}
return self;
}
@end