Files
comaps/iphone/Maps/Classes/CarPlay/MWMCarPlaySearchResultObject.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

44 lines
1.3 KiB
Plaintext

#import "MWMCarPlaySearchResultObject.h"
#import "MWMSearch.h"
#import "SearchResult.h"
#import "SwiftBridge.h"
#include "search/result.hpp"
#include "indexer/classificator.hpp"
#include "geometry/mercator.hpp"
#include "platform/localization.hpp"
@interface MWMCarPlaySearchResultObject()
@property(assign, nonatomic, readwrite) NSInteger originalRow;
@property(strong, nonatomic, readwrite) NSString *title;
@property(strong, nonatomic, readwrite) NSString *address;
@property(assign, nonatomic, readwrite) CLLocationCoordinate2D coordinate;
@property(assign, nonatomic, readwrite) CGPoint mercatorPoint;
@end
@implementation MWMCarPlaySearchResultObject
- (instancetype)initForRow:(NSInteger)row {
self = [super init];
if (self) {
self.originalRow = row;
NSInteger containerIndex = [MWMSearch containerIndexWithRow:row];
SearchItemType type = [MWMSearch resultTypeWithRow:row];
if (type == SearchItemTypeRegular) {
auto const & result = [MWMSearch resultWithContainerIndex:containerIndex];
self.title = result.titleText;
self.address = result.addressText;
self.coordinate = result.coordinate;
auto const pivot = mercator::FromLatLon(result.coordinate.latitude, result.coordinate.longitude);
self.mercatorPoint = CGPointMake(pivot.x, pivot.y);
return self;
}
}
return nil;
}
@end