Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
43
iphone/Maps/Classes/CarPlay/MWMCarPlaySearchResultObject.mm
Normal file
43
iphone/Maps/Classes/CarPlay/MWMCarPlaySearchResultObject.mm
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#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
|
||||
Loading…
Add table
Add a link
Reference in a new issue