[ios] Fixed merge conflicts with new UserMark

This commit is contained in:
Igor Khmurets 2014-05-21 15:18:58 +03:00 committed by Alex Zolotarev
parent 3e7701a1da
commit 44bac99e1b
15 changed files with 263 additions and 275 deletions

View file

@ -17,9 +17,9 @@
self.title = NSLocalizedString(@"description", nil);
BookmarkCategory const * category = GetFramework().GetBmCategory(self.bookmarkAndCategory.first);
Bookmark bookmark = *(category->GetBookmark(self.bookmarkAndCategory.second));
Bookmark const * bookmark = category->GetBookmark(self.bookmarkAndCategory.second);
self.textView.text = [NSString stringWithUTF8String:bookmark.GetDescription().c_str()];
self.textView.text = [NSString stringWithUTF8String:bookmark->GetDescription().c_str()];
}
- (void)viewDidAppear:(BOOL)animated

View file

@ -8,8 +8,10 @@
+ (NSURL *)getBackUrl:(url_scheme::ApiPoint const &)apiPoint
{
string const str = GetFramework().GenerateApiBackUrl(apiPoint);
return [NSURL URLWithString:[NSString stringWithUTF8String:str.c_str()]];
#warning <#message#>
// string const str = GetFramework().GenerateApiBackUrl(apiPoint);
// return [NSURL URLWithString:[NSString stringWithUTF8String:str.c_str()]];
return nil;
}
+ (void)openAppWithPoint:(url_scheme::ApiPoint const &)apiPoint

View file

@ -152,13 +152,13 @@ const long long LITE_IDL = 431183278L;
- (void)dismissPlacePage
{
[self.placePageView setState:PlacePageStateHidden animated:YES];
[self.containerView.placePage setState:PlacePageStateHidden animated:YES withCallback:YES];
}
- (void)onUserMarkActivated:(UserMark const *)mark
{
[self.placePageView showUserMark:mark];
[self.placePageView setState:PlacePageStateBitShown animated:YES];
[self.containerView.placePage showUserMark:mark];
[self.containerView.placePage setState:PlacePageStatePreview animated:YES withCallback:YES];
}
- (void)onMyPositionClicked:(id)sender
@ -798,17 +798,8 @@ const long long LITE_IDL = 431183278L;
#pragma mark - PlacePageViewDelegate
- (void)placePageView:(PlacePageView *)placePage willEditBookmarkWithInfo:(search::AddressInfo const &)addressInfo point:(m2::PointD const &)point
- (void)placePageView:(PlacePageView *)placePage willShareText:(NSString *)text point:(m2::PointD)point
{
PlacePageVC * vc = [[PlacePageVC alloc] initWithInfo:addressInfo point:CGPointMake(point.x, point.y)];
vc.delegate = self;
// vc.mode = PlacePageVCModeSaved;
[self pushViewController:vc];
}
- (void)placePageView:(PlacePageView *)placePage willShareInfo:(search::AddressInfo const &)addressInfo point:(m2::PointD const &)point
{
NSString * text = [NSString stringWithUTF8String:addressInfo.GetPinName().c_str()];
ShareInfo * info = [[ShareInfo alloc] initWithText:text gX:point.x gY:point.y myPosition:NO];
self.shareActionSheet = [[ShareActionSheet alloc] initWithInfo:info viewController:self];
[self.shareActionSheet show];
@ -855,20 +846,22 @@ const long long LITE_IDL = 431183278L;
- (void)updatePlacePageWithBookmarkAndCategory:(BookmarkAndCategory const &)bookmarkAndCategory
{
[self.containerView.placePage showBookmarkAndCategory:bookmarkAndCategory];
BookmarkCategory const * category = GetFramework().GetBookmarkManager().GetBmCategory(bookmarkAndCategory.first);
Bookmark const * bookmark = category->GetBookmark(bookmarkAndCategory.second);
[self.containerView.placePage showUserMark:bookmark];
[self.containerView.placePage setState:self.containerView.placePage.state animated:YES withCallback:NO];
}
- (void)placePageView:(PlacePageView *)placePage willShareApiPoint:(const url_scheme::ApiPoint &)point
- (void)placePageView:(PlacePageView *)placePage willShareApiPoint:(ApiMarkPoint const *)point
{
NSString * urlString = [NSString stringWithUTF8String:GetFramework().GenerateApiBackUrl(point).c_str()];
NSString * urlString = [NSString stringWithUTF8String:GetFramework().GenerateApiBackUrl(*point).c_str()];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
}
- (void)placePageVC:(PlacePageVC *)placePageVC didUpdateBookmarkAndCategory:(BookmarkAndCategory const &)bookmarkAndCategory
{
Framework & fm = GetFramework();
[self.placePageView showUserMark:fm.GetBmCategory(bookmarkAndCategory.first)->GetBookmark(bookmarkAndCategory.second)];
UserMark const * userMark = GetFramework().GetBmCategory(bookmarkAndCategory.first)->GetBookmark(bookmarkAndCategory.second);
[self.containerView.placePage showUserMark:userMark];
}
#pragma mark - BottomMenuDelegate
@ -1010,7 +1003,7 @@ const long long LITE_IDL = 431183278L;
self.containerView.placePage.statusBarIncluded = NO;
[self.containerView.placePage setState:PlacePageStateHidden animated:YES withCallback:NO];
self.apiTitleLabel.text = [NSString stringWithUTF8String:GetFramework().GetMapApiAppTitle().c_str()];
self.apiTitleLabel.text = [NSString stringWithUTF8String:GetFramework().GetApiDataHolder().GetAppTitle().c_str()];
}
else
{
@ -1029,7 +1022,6 @@ const long long LITE_IDL = 431183278L;
[self setNeedsStatusBarAppearanceUpdate];
[self dismissPopover];
self.searchView.searchBar.apiText = [NSString stringWithUTF8String:GetFramework().GetApiDataHolder().GetAppTitle().c_str()];
_apiMode = apiMode;
}

View file

@ -3,9 +3,6 @@
#include "../../map/bookmark.hpp"
#include "../../geometry/point2d.hpp"
namespace search { struct AddressInfo; }
namespace url_scheme { struct ApiPoint; }
typedef NS_ENUM(NSUInteger, PlacePageState) {
PlacePageStateHidden,
PlacePageStatePreview,
@ -15,11 +12,10 @@ typedef NS_ENUM(NSUInteger, PlacePageState) {
@class PlacePageView;
@protocol PlacePageViewDelegate <NSObject>
- (void)placePageView:(PlacePageView *)placePage willEditBookmarkWithInfo:(search::AddressInfo const &)addressInfo point:(const m2::PointD &)point;
- (void)placePageView:(PlacePageView *)placePage willEditProperty:(NSString *)propertyName inBookmarkAndCategory:(BookmarkAndCategory const &)bookmarkAndCategory;
- (void)placePageView:(PlacePageView *)placePage willShareInfo:(search::AddressInfo const &)addressInfo point:(const m2::PointD &)point;
- (void)placePageView:(PlacePageView *)placePage willShareApiPoint:(const url_scheme::ApiPoint &)point;
- (void)placePageView:(PlacePageView *)placePage willShareText:(NSString *)text point:(m2::PointD)point;
- (void)placePageView:(PlacePageView *)placePage willShareApiPoint:(ApiMarkPoint const *)point;
@end
@ -32,7 +28,7 @@ typedef NS_ENUM(NSUInteger, PlacePageState) {
@property (nonatomic, weak) id <PlacePageViewDelegate> delegate;
@property (nonatomic, readonly) m2::PointD pinPoint;
- (m2::PointD)pinPoint;
@property (nonatomic) BOOL statusBarIncluded;

View file

@ -19,13 +19,6 @@ typedef NS_ENUM(NSUInteger, CellRow)
CellRowShare,
};
typedef NS_ENUM(NSUInteger, TableAction)
{
TableActionNone,
TableActionInsert,
TableActionDelete,
};
@interface PlacePageView () <UIGestureRecognizerDelegate, UITableViewDataSource, UITableViewDelegate, LocationObserver, PlacePageShareCellDelegate, PlacePageInfoCellDelegate>
@property (nonatomic) UIView * backgroundView;
@ -42,47 +35,39 @@ typedef NS_ENUM(NSUInteger, TableAction)
@property (nonatomic) UIImageView * editImageView;
@property (nonatomic) UIImageView * arrowImageView;
@property (nonatomic) BOOL isBookmark;
@property (nonatomic) BOOL loadedAsBookmark;
@property (nonatomic) BOOL isApiPoint;
@property (nonatomic) m2::PointD pinPoint;
@property (nonatomic) NSString * title;
@property (nonatomic) NSString * types;
@property (nonatomic) NSString * address;
@property (nonatomic) NSString * info;
@property (nonatomic) NSString * setName;
- (NSString *)title;
- (NSString *)types;
- (NSString *)address;
- (NSString *)info;
- (NSString *)setName;
@end
@implementation PlacePageView
{
CGFloat locationMidY;
CGFloat addressMidY;
CGFloat shareMidY;
UserMark const * m_mark;
BookmarkData * m_bookmarkData;
size_t m_categoryIndex;
}
-(BOOL)isMarkOfType:(UserMark::Type)type
- (BOOL)isMarkOfType:(UserMark::Type)type
{
ASSERT(m_mark != NULL, ());
ASSERT(m_mark->GetContainer() != NULL, ());
if (m_mark == NULL)
return NO;
return m_mark->GetMarkType() == type;
}
-(BOOL)isBookmark
- (BOOL)isBookmark
{
return [self isMarkOfType:UserMark::BOOKMARK];
}
-(BOOL)isApiPoint
- (BOOL)isApiPoint
{
return [self isMarkOfType:UserMark::API];
}
-(BOOL)isEmpty
- (BOOL)isEmpty
{
return m_mark == NULL;
}
@ -94,6 +79,7 @@ typedef NS_ENUM(NSUInteger, TableAction)
self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.clipsToBounds = YES;
m_mark = NULL;
m_bookmarkData = NULL;
self.statusBarIncluded = !SYSTEM_VERSION_IS_LESS_THAN(@"7");
@ -130,7 +116,7 @@ typedef NS_ENUM(NSUInteger, TableAction)
- (void)onLocationError:(location::TLocationError)errorCode
{
NSLog(@"Location error in %@", [[self class] className]);
NSLog(@"Location error %i in %@", errorCode, [[self class] className]);
}
#define ROW_COMMON 0
@ -153,7 +139,7 @@ typedef NS_ENUM(NSUInteger, TableAction)
if (indexPath.row == ROW_COMMON)
return CellRowCommon;
else if (indexPath.row == ROW_SET)
return self.isBookmark ? CellRowSet : CellRowShare;
return [self isBookmark] ? CellRowSet : CellRowShare;
else if (indexPath.row == ROW_INFO)
return CellRowInfo;
else if (indexPath.row == 3)
@ -168,7 +154,7 @@ typedef NS_ENUM(NSUInteger, TableAction)
- (NSInteger)rowsCount
{
return self.isBookmark ? 4 : 2;
return [self isBookmark] ? 4 : 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
@ -177,20 +163,20 @@ typedef NS_ENUM(NSUInteger, TableAction)
if (row == CellRowCommon)
{
PlacePageInfoCell * cell = [tableView dequeueReusableCellWithIdentifier:[PlacePageInfoCell className]];
[cell setAddress:self.address pinPoint:self.pinPoint];
[cell setAddress:[self address] pinPoint:[self pinPoint]];
cell.delegate = self;
return cell;
}
else if (row == CellRowSet)
{
PlacePageEditCell * cell = [tableView dequeueReusableCellWithIdentifier:[PlacePageEditCell className]];
cell.titleLabel.text = self.setName;
cell.titleLabel.text = [self setName];
return cell;
}
else if (row == CellRowInfo)
{
PlacePageEditCell * cell = [tableView dequeueReusableCellWithIdentifier:[PlacePageEditCell className]];
cell.titleLabel.text = self.info;
cell.titleLabel.text = [self info];
return cell;
}
else if (row == CellRowShare)
@ -198,7 +184,7 @@ typedef NS_ENUM(NSUInteger, TableAction)
PlacePageShareCell * cell = [tableView dequeueReusableCellWithIdentifier:[PlacePageShareCell className]];
cell.delegate = self;
if (self.isApiPoint)
[cell setApiAppTitle:[NSString stringWithUTF8String:GetFramework().GetMapApiAppTitle().c_str()]];
[cell setApiAppTitle:[NSString stringWithUTF8String:GetFramework().GetApiDataHolder().GetAppTitle().c_str()]];
else
[cell setApiAppTitle:nil];
return cell;
@ -210,11 +196,11 @@ typedef NS_ENUM(NSUInteger, TableAction)
{
CellRow row = [self cellRowForIndexPath:indexPath];
if (row == CellRowCommon)
return [PlacePageInfoCell cellHeightWithAddress:self.address viewWidth:tableView.width];
return [PlacePageInfoCell cellHeightWithAddress:[self address] viewWidth:tableView.width];
else if (row == CellRowSet)
return [PlacePageEditCell cellHeightWithTextValue:self.setName viewWidth:tableView.width];
return [PlacePageEditCell cellHeightWithTextValue:[self setName] viewWidth:tableView.width];
else if (row == CellRowInfo)
return [PlacePageEditCell cellHeightWithTextValue:self.info viewWidth:tableView.width];
return [PlacePageEditCell cellHeightWithTextValue:[self info] viewWidth:tableView.width];
else if (row == CellRowShare)
return [PlacePageShareCell cellHeight];
return 0;
@ -225,23 +211,19 @@ typedef NS_ENUM(NSUInteger, TableAction)
CellRow row = [self cellRowForIndexPath:indexPath];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (row == CellRowSet)
{
[self.delegate placePageView:self willEditProperty:@"Set" inBookmarkAndCategory:m_bookmarkAndCategory];
}
[self.delegate placePageView:self willEditProperty:@"Set" inBookmarkAndCategory:GetFramework().FindBookmark(m_mark)];
else if (row == CellRowInfo)
{
[self.delegate placePageView:self willEditProperty:@"Description" inBookmarkAndCategory:m_bookmarkAndCategory];
}
[self.delegate placePageView:self willEditProperty:@"Description" inBookmarkAndCategory:GetFramework().FindBookmark(m_mark)];
}
- (void)reloadHeader
{
self.titleLabel.text = self.title;
self.titleLabel.text = [self title];
self.titleLabel.width = [self titleWidth];
[self.titleLabel sizeToFit];
self.titleLabel.origin = CGPointMake(23, 29);
self.typeLabel.text = self.types;
self.typeLabel.text = [self types];
self.typeLabel.width = [self typesWidth];
[self.typeLabel sizeToFit];
self.typeLabel.origin = CGPointMake(self.titleLabel.minX + 1, self.titleLabel.maxY + 1);
@ -261,18 +243,11 @@ typedef NS_ENUM(NSUInteger, TableAction)
- (CGFloat)headerHeight
{
CGFloat titleHeight = [self.title sizeWithDrawSize:CGSizeMake([self titleWidth], 100) font:self.titleLabel.font].height;
CGFloat typesHeight = [self.types sizeWithDrawSize:CGSizeMake([self typesWidth], 30) font:self.typeLabel.font].height;
CGFloat titleHeight = [[self title] sizeWithDrawSize:CGSizeMake([self titleWidth], 100) font:self.titleLabel.font].height;
CGFloat typesHeight = [[self types] sizeWithDrawSize:CGSizeMake([self typesWidth], 30) font:self.typeLabel.font].height;
return MAX(74, titleHeight + typesHeight + 50);
}
- (NSString *)info
{
if (!_info)
return NSLocalizedString(@"description", nil);
return _info;
}
- (void)setState:(PlacePageState)state animated:(BOOL)animated withCallback:(BOOL)withCallback
{
if (withCallback)
@ -287,10 +262,10 @@ typedef NS_ENUM(NSUInteger, TableAction)
- (void)applyState:(PlacePageState)state animated:(BOOL)animated
{
_state = state;
[self updateBookmarkStateAnimated:NO];
[self.tableView reloadData];
[self reloadHeader];
[self alignAnimated:animated];
[self updateBookmarkState:self.isBookmark animated:NO];
self.tableView.contentInset = UIEdgeInsetsMake([self headerHeight], 0, 0, 0);
[self.tableView setContentOffset:CGPointMake(0, -self.tableView.contentInset.top) animated:animated];
}
@ -338,8 +313,8 @@ typedef NS_ENUM(NSUInteger, TableAction)
CGFloat fullHeight = [self headerHeight] + [PlacePageInfoCell cellHeightWithAddress:self.address viewWidth:self.tableView.width] + [PlacePageShareCell cellHeight];
if (self.isBookmark)
{
fullHeight += [PlacePageEditCell cellHeightWithTextValue:self.setName viewWidth:self.tableView.width];
fullHeight += [PlacePageEditCell cellHeightWithTextValue:self.info viewWidth:self.tableView.width];
fullHeight += [PlacePageEditCell cellHeightWithTextValue:[self setName] viewWidth:self.tableView.width];
fullHeight += [PlacePageEditCell cellHeightWithTextValue:[self info] viewWidth:self.tableView.width];
}
fullHeight = MIN(fullHeight, [self maxHeight]);
self.headerSeparator.maxY = [self headerHeight];
@ -371,38 +346,28 @@ typedef NS_ENUM(NSUInteger, TableAction)
} completion:^(BOOL finished) {}];
}
- (void)updateBookmarkState:(BOOL)isBookmark animated:(BOOL)animated
- (void)updateBookmarkStateAnimated:(BOOL)animated
{
self.bookmarkButton.selected = isBookmark;
TableAction action = TableActionNone;
if (isBookmark && !_isBookmark)
action = TableActionInsert;
else if (!isBookmark && _isBookmark)
action = TableActionDelete;
if (isBookmark)
{
BookmarkCategory const * category = GetFramework().GetBmCategory(m_bookmarkAndCategory.first);
self.setName = [NSString stringWithUTF8String:category->GetName().c_str()];
Bookmark const bookmark = *category->GetBookmark(m_bookmarkAndCategory.second);
self.info = bookmark.GetDescription().empty() ? nil : [NSString stringWithUTF8String:bookmark.GetDescription().c_str()];
}
_isBookmark = isBookmark;
NSIndexPath * indexPath1 = [NSIndexPath indexPathForRow:ROW_SET inSection:0];
NSIndexPath * indexPath2 = [NSIndexPath indexPathForRow:ROW_INFO inSection:0];
if (action != TableActionNone)
if (self.bookmarkButton.selected != [self isBookmark])
{
if (action == TableActionInsert)
NSTimeInterval delay = 0;
if ([self isBookmark] && !self.bookmarkButton.selected)
{
delay = 0;
[self.tableView insertRowsAtIndexPaths:@[indexPath1, indexPath2] withRowAnimation:UITableViewRowAnimationFade];
else if (action == TableActionDelete)
}
else if (![self isBookmark] && self.bookmarkButton.selected)
{
delay = 0.07;
[self.tableView deleteRowsAtIndexPaths:@[indexPath1, indexPath2] withRowAnimation:UITableViewRowAnimationFade];
[self performAfterDelay:(action == TableActionDelete ? 0.07 : 0) block:^{
}
[self performAfterDelay:delay block:^{
[self alignAnimated:YES];
}];
}
self.bookmarkButton.selected = [self isBookmark];
[self updateEditImageViewAnimated:animated];
}
@ -423,20 +388,16 @@ typedef NS_ENUM(NSUInteger, TableAction)
- (void)bookmarkCategoryDeletedNotification:(NSNotification *)notification
{
if (m_bookmarkAndCategory.first == [[notification object] integerValue])
{
if (GetFramework().FindBookmark(m_mark).first == [[notification object] integerValue])
[self deleteBookmark];
}
}
- (void)bookmarkDeletedNotification:(NSNotification *)notification
{
BookmarkAndCategory bookmarkAndCategory;
[[notification object] getValue:&bookmarkAndCategory];
if (bookmarkAndCategory == m_bookmarkAndCategory)
{
if (bookmarkAndCategory == GetFramework().FindBookmark(m_mark))
[self deleteBookmark];
}
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {}
@ -503,7 +464,7 @@ typedef NS_ENUM(NSUInteger, TableAction)
- (void)titleTap:(UITapGestureRecognizer *)sender
{
if (self.isBookmark && self.state == PlacePageStateOpened)
[self.delegate placePageView:self willEditProperty:@"Name" inBookmarkAndCategory:m_bookmarkAndCategory];
[self.delegate placePageView:self willEditProperty:@"Name" inBookmarkAndCategory:GetFramework().FindBookmark(m_mark)];
}
- (void)tap:(UITapGestureRecognizer *)sender
@ -514,13 +475,6 @@ typedef NS_ENUM(NSUInteger, TableAction)
[self setState:PlacePageStateOpened animated:YES withCallback:YES];
}
- (void)shareButtonPressed:(id)sender
{
search::AddressInfo info;
GetFramework().GetAddressInfoForGlobalPoint(m_mark->GetOrg(), info);
[self.delegate placePageView:self willShareInfo:info point:m_mark->GetOrg()];
}
- (void)bookmarkButtonPressed:(UIButton *)sender
{
if (self.isBookmark)
@ -535,90 +489,138 @@ typedef NS_ENUM(NSUInteger, TableAction)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
}
- (void)showPoint:(m2::PointD const &)point addressInfo:(search::AddressInfo const &)addressInfo
{
self.isApiPoint = NO;
[self processPoint:point addressInfo:addressInfo];
}
- (void)showUserMark:(UserMark const *)mark
{
m_apiPoint = apiPoint;
Framework & framework = GetFramework();
m2::PointD point;
point.x = MercatorBounds::LonToX(apiPoint.m_lon);
point.y = MercatorBounds::LatToY(apiPoint.m_lat);
search::AddressInfo addressInfo;
framework.GetAddressInfoForGlobalPoint(point, addressInfo);
self.isApiPoint = YES;
self.title = [NSString stringWithUTF8String:apiPoint.m_name.c_str()];
[self processPoint:point addressInfo:addressInfo];
m_mark = mark;
UserMark::Type type = mark->GetMarkType();
switch (type)
{
case UserMark::BOOKMARK:
[self bookmarkActivated:static_cast<Bookmark const *>(mark)];
break;
case UserMark::API:
[self userMarkActivated:mark];
break;
case UserMark::POI:
[self userMarkActivated:mark];
break;
case UserMark::SEARCH:
[self userMarkActivated:mark];
break;
default:
break;
}
}
- (void)bookmarkActivated:(Bookmark const *)data
- (void)bookmarkActivated:(Bookmark const *)bookmark
{
self.loadedAsBookmark = NO;
self.pinPoint = point;
m_addressInfo = addressInfo;
if (!self.isApiPoint)
self.title = addressInfo.GetPinName().empty() ? NSLocalizedString(@"dropped_pin", nil) : [NSString stringWithUTF8String:addressInfo.GetPinName().c_str()];
self.types = addressInfo.GetPinType().empty() ? nil : [NSString stringWithUTF8String:addressInfo.GetPinType().c_str()];
self.address = [NSString stringWithUTF8String:addressInfo.FormatAddress().c_str()];
self.isBookmark = NO;
// delete m_bookmarkData;
m_categoryIndex = GetFramework().FindBookmark(bookmark).first;
m_bookmarkData = new BookmarkData(bookmark->GetName(), bookmark->GetType());
m_bookmarkData->SetDescription(bookmark->GetDescription());
m_bookmarkData->SetTimeStamp(bookmark->GetTimeStamp());
m_bookmarkData->SetScale(bookmark->GetScale());
}
- (void)showBookmark:(Bookmark const &)bookmark
- (void)userMarkActivated:(UserMark const *)mark
{
Framework & framework = GetFramework();
self.loadedAsBookmark = NO;
self.isApiPoint = NO;
self.pinPoint = bookmark.GetOrg();
search::AddressInfo addressInfo;
framework.GetAddressInfoForGlobalPoint(self.pinPoint, addressInfo);
addressInfo.m_name = bookmark.GetName();
m_addressInfo = addressInfo;
self.title = addressInfo.GetPinName().empty() ? NSLocalizedString(@"dropped_pin", nil) : [NSString stringWithUTF8String:addressInfo.GetPinName().c_str()];
self.types = addressInfo.GetPinType().empty() ? nil : [NSString stringWithUTF8String:addressInfo.GetPinType().c_str()];
self.isBookmark = NO;
// delete m_bookmarkData;
m_bookmarkData = NULL;
}
- (void)processName:(string const &)name type:(string const &)type address:(string const &)address
- (m2::PointD)pinPoint
{
Framework & framework = GetFramework();
return m_mark ? m_mark->GetOrg() : m2::PointD();
}
m_bookmarkAndCategory = bookmarkAndCategory;
self.loadedAsBookmark = YES;
self.isApiPoint = NO;
- (NSString *)title
{
if ([self isMarkOfType:UserMark::BOOKMARK])
{
Bookmark const * bookmark = static_cast<Bookmark const *>(m_mark);
return bookmark->GetName().empty() ? NSLocalizedString(@"dropped_pin", nil) : [NSString stringWithUTF8String:bookmark->GetName().c_str()];
}
else if ([self isMarkOfType:UserMark::API])
{
ApiMarkPoint const * apiMark = static_cast<ApiMarkPoint const *>(m_mark);
return apiMark->GetName().empty() ? NSLocalizedString(@"dropped_pin", nil) : [NSString stringWithUTF8String:apiMark->GetName().c_str()];
}
else if ([self isMarkOfType:UserMark::POI])
{
PoiMarkPoint const * poiMark = static_cast<PoiMarkPoint const *>(m_mark);
search::AddressInfo addressInfo = poiMark->GetInfo();
return addressInfo.GetPinName().empty() ? NSLocalizedString(@"dropped_pin", nil) : [NSString stringWithUTF8String:addressInfo.GetPinName().c_str()];
}
else if (m_mark)
{
search::AddressInfo addressInfo;
GetFramework().GetAddressInfoForGlobalPoint(m_mark->GetOrg(), addressInfo);
return addressInfo.GetPinName().empty() ? NSLocalizedString(@"dropped_pin", nil) : [NSString stringWithUTF8String:addressInfo.GetPinName().c_str()];
}
else
{
return @"";
}
}
BookmarkCategory const * category = framework.GetBmCategory(bookmarkAndCategory.first);
self.setName = [NSString stringWithUTF8String:category->GetName().c_str()];
m_bookmark = *(category->GetBookmark(bookmarkAndCategory.second));
self.pinPoint = m_bookmark.GetOrg();
- (NSString *)types
{
if ([self isMarkOfType:UserMark::BOOKMARK])
{
Bookmark const * bookmark = static_cast<Bookmark const *>(m_mark);
return bookmark->GetType().empty() ? @"" : [NSString stringWithUTF8String:bookmark->GetType().c_str()];
}
else if (m_mark)
{
search::AddressInfo addressInfo;
GetFramework().GetAddressInfoForGlobalPoint(m_mark->GetOrg(), addressInfo);
return addressInfo.GetPinType().empty() ? @"" : [NSString stringWithUTF8String:addressInfo.GetPinType().c_str()];
}
else
{
return @"";
}
}
search::AddressInfo addressInfo;
framework.GetAddressInfoForGlobalPoint(self.pinPoint, addressInfo);
addressInfo.m_name = m_bookmark.GetName();
m_addressInfo = addressInfo;
- (NSString *)setName
{
if ([self isMarkOfType:UserMark::BOOKMARK])
{
Framework & framework = GetFramework();
BookmarkCategory const * category = framework.GetBmCategory(framework.FindBookmark(m_mark).first);
return [NSString stringWithUTF8String:category->GetName().c_str()];
}
else
{
return @"";
}
}
self.address = [NSString stringWithUTF8String:addressInfo.FormatAddress().c_str()];
- (NSString *)info
{
if ([self isMarkOfType:UserMark::BOOKMARK])
{
Bookmark const * bookmark = static_cast<Bookmark const *>(m_mark);
return bookmark->GetDescription().empty() ? NSLocalizedString(@"description", nil) : [NSString stringWithUTF8String:bookmark->GetDescription().c_str()];
}
else
{
return @"";
}
}
self.title = m_bookmark.GetName().empty() ? NSLocalizedString(@"dropped_pin", nil) : [NSString stringWithUTF8String:m_bookmark.GetName().c_str()];
self.info = m_bookmark.GetDescription().empty() ? nil : [NSString stringWithUTF8String:m_bookmark.GetDescription().c_str()];
self.types = m_bookmark.GetType().empty() ? nil : [NSString stringWithUTF8String:m_bookmark.GetType().c_str()];
self.isBookmark = YES;
- (NSString *)address
{
if (m_mark)
{
search::AddressInfo addressInfo;
GetFramework().GetAddressInfoForGlobalPoint(m_mark->GetOrg(), addressInfo);
return [NSString stringWithUTF8String:addressInfo.FormatAddress().c_str()];
}
else
{
return @"";
}
}
- (UIImage *)iconImageWithImage:(UIImage *)image
@ -635,47 +637,55 @@ typedef NS_ENUM(NSUInteger, TableAction)
- (void)deleteBookmark
{
BookmarkCategory * category = GetFramework().GetBmCategory(m_bookmarkAndCategory.first);
Framework & framework = GetFramework();
BookmarkAndCategory const & bookmarkAndCategory = framework.FindBookmark(m_mark);
BookmarkCategory * category = framework.GetBmCategory(bookmarkAndCategory.first);
// delete m_mark;
m_mark = UserMarkContainer::UserMarkForPoi(self.pinPoint);
if (category)
category->DeleteBookmark(m_bookmarkAndCategory.second);
[self updateBookmarkState:NO animated:YES];
{
category->DeleteBookmark(bookmarkAndCategory.second);
category->SaveToKMLFile();
}
framework.ActivateAddressMark([self pinPoint]);
[self reloadHeader];
[self updateBookmarkStateAnimated:YES];
}
- (void)addBookmark
{
Framework & framework = GetFramework();
if (self.loadedAsBookmark)
if (m_bookmarkData)
{
size_t categoryIndex = m_bookmarkAndCategory.first;
BookmarkCategory const * category = framework.GetBmCategory(categoryIndex);
BookmarkCategory const * category = framework.GetBmCategory(m_categoryIndex);
if (!category)
categoryIndex = framework.LastEditedBMCategory();
m_categoryIndex = framework.LastEditedBMCategory();
Bookmark bookmark(m_bookmark.GetOrg(), m_bookmark.GetName(), m_bookmark.GetType());
bookmark.SetDescription(m_bookmark.GetDescription());
bookmark.SetTimeStamp(m_bookmark.GetTimeStamp());
bookmark.SetScale(m_bookmark.GetScale());
framework.AddBookmark(categoryIndex, bookmark);
size_t bookmarkIndex = framework.GetBookmarkManager().AddBookmark(m_categoryIndex, self.pinPoint, *m_bookmarkData);
m_mark = category->GetBookmark(bookmarkIndex);
}
else
{
size_t categoryIndex = framework.LastEditedBMCategory();
std::string const & name = m_addressInfo.GetPinName().empty() ? [NSLocalizedString(@"dropped_pin", nil) UTF8String] : m_addressInfo.GetPinName().c_str();
Bookmark bookmark(self.pinPoint, name, "placemark-red");
m_bookmarkAndCategory = BookmarkAndCategory(categoryIndex, framework.AddBookmark(categoryIndex, bookmark));
BookmarkData data = BookmarkData([[self title] UTF8String], "placemark-red");
size_t bookmarkIndex = framework.AddBookmark(categoryIndex, self.pinPoint, data);
BookmarkCategory * const category = framework.GetBmCategory(categoryIndex);
// delete m_mark;
m_mark = category->GetBookmark(bookmarkIndex);
}
[self updateBookmarkState:YES animated:YES];
[self reloadHeader];
[self updateBookmarkStateAnimated:YES];
}
- (void)shareCellDidPressApiButton:(PlacePageShareCell *)cell
{
[self.delegate placePageView:self willShareApiPoint:m_apiPoint];
[self.delegate placePageView:self willShareApiPoint:static_cast<ApiMarkPoint const *>(m_mark)];
}
- (void)shareCellDidPressShareButton:(PlacePageShareCell *)cell
{
[self.delegate placePageView:self willShareInfo:m_addressInfo point:self.pinPoint];
[self.delegate placePageView:self willShareText:[self title] point:self.pinPoint];
}
- (UIView *)wrapView
@ -763,17 +773,7 @@ typedef NS_ENUM(NSUInteger, TableAction)
_headerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
[_headerView addSubview:self.titleLabel];
self.titleLabel.text = self.title;
self.titleLabel.width = [self titleWidth];
[self.titleLabel sizeToFit];
self.titleLabel.origin = CGPointMake(23, 29);
[_headerView addSubview:self.typeLabel];
self.typeLabel.text = self.types;
self.typeLabel.width = [self typesWidth];
[self.typeLabel sizeToFit];
self.typeLabel.origin = CGPointMake(self.titleLabel.minX + 1, self.titleLabel.maxY + 1);
[_headerView addSubview:self.bookmarkButton];
self.bookmarkButton.center = CGPointMake(_headerView.width - 32, 42);
@ -850,11 +850,6 @@ typedef NS_ENUM(NSUInteger, TableAction)
return _arrowImageView;
}
- (m2::PointD)pinPoint
{
return m_mark->GetOrg();
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];

View file

@ -244,12 +244,6 @@ typedef enum {APIPOINT, POI, MYPOSITION} Type;
}
}
- (NSURL *)getBackUrl
{
string const str = GetFramework().GenerateApiBackUrl(m_apiPoint);
return [NSURL URLWithString:[NSString stringWithUTF8String:str.c_str()]];
}
- (void)orientationChanged
{
[self.placeAndCompass drawView];

View file

@ -322,7 +322,6 @@ static void OnSearchResultCallback(search::Results const & results)
if (self.state == SearchViewStateResults)
{
Framework & framework = GetFramework();
framework.GetBookmarkManager().AdditionalPoiLayerClear();
framework.GetBalloonManager().RemovePin();
framework.GetBalloonManager().Dismiss();
framework.Invalidate();

View file

@ -31,10 +31,6 @@
9746492818EEE2F8004B4658 /* ToolbarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9746492618EEE2F8004B4658 /* ToolbarView.m */; };
9747264318323080006B7CB7 /* UIKitCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = 9747264118323080006B7CB7 /* UIKitCategories.m */; };
9747264418323080006B7CB7 /* UIKitCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = 9747264118323080006B7CB7 /* UIKitCategories.m */; };
9747277B18328E65006B7CB7 /* BottomMenu.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9747277818328E65006B7CB7 /* BottomMenu.mm */; };
9747277C18328E65006B7CB7 /* BottomMenu.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9747277818328E65006B7CB7 /* BottomMenu.mm */; };
9747277D18328E65006B7CB7 /* BottomMenuCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9747277A18328E65006B7CB7 /* BottomMenuCell.m */; };
9747277E18328E65006B7CB7 /* BottomMenuCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9747277A18328E65006B7CB7 /* BottomMenuCell.m */; };
9747278418338F0C006B7CB7 /* UIViewController+Navigation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9747278318338F0C006B7CB7 /* UIViewController+Navigation.m */; };
9747278518338F0C006B7CB7 /* UIViewController+Navigation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9747278318338F0C006B7CB7 /* UIViewController+Navigation.m */; };
9769D6EF1912BF3000CA6158 /* ContainerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9769D6EE1912BF3000CA6158 /* ContainerView.mm */; };
@ -67,6 +63,10 @@
978F9248183B6671000D6C7C /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 978F9246183B6671000D6C7C /* Main_iPhone.storyboard */; };
978F9253183BD530000D6C7C /* NavigationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978F9252183BD530000D6C7C /* NavigationController.mm */; };
978F9254183BD530000D6C7C /* NavigationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978F9252183BD530000D6C7C /* NavigationController.mm */; };
97A0EEFA192F3B43009B2779 /* BottomMenu.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97A0EEF7192F3B43009B2779 /* BottomMenu.mm */; };
97A0EEFB192F3B43009B2779 /* BottomMenu.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97A0EEF7192F3B43009B2779 /* BottomMenu.mm */; };
97A0EEFC192F3B43009B2779 /* BottomMenuCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97A0EEF9192F3B43009B2779 /* BottomMenuCell.m */; };
97A0EEFD192F3B43009B2779 /* BottomMenuCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97A0EEF9192F3B43009B2779 /* BottomMenuCell.m */; };
97A8000C18B21363000C07A2 /* SearchView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97A8000B18B21363000C07A2 /* SearchView.mm */; };
97A8000D18B21363000C07A2 /* SearchView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97A8000B18B21363000C07A2 /* SearchView.mm */; };
97A8001018B21395000C07A2 /* SearchBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97A8000F18B21395000C07A2 /* SearchBar.mm */; };
@ -1447,10 +1447,6 @@
9746492618EEE2F8004B4658 /* ToolbarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ToolbarView.m; sourceTree = "<group>"; };
9747264118323080006B7CB7 /* UIKitCategories.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIKitCategories.m; path = Categories/UIKitCategories.m; sourceTree = "<group>"; };
9747264218323080006B7CB7 /* UIKitCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIKitCategories.h; path = Categories/UIKitCategories.h; sourceTree = "<group>"; };
9747277718328E65006B7CB7 /* BottomMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BottomMenu.h; path = ../BottomMenu.h; sourceTree = "<group>"; };
9747277818328E65006B7CB7 /* BottomMenu.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = BottomMenu.mm; path = ../BottomMenu.mm; sourceTree = "<group>"; };
9747277918328E65006B7CB7 /* BottomMenuCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BottomMenuCell.h; path = ../BottomMenuCell.h; sourceTree = "<group>"; };
9747277A18328E65006B7CB7 /* BottomMenuCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BottomMenuCell.m; path = ../BottomMenuCell.m; sourceTree = "<group>"; };
9747278218338F0C006B7CB7 /* UIViewController+Navigation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIViewController+Navigation.h"; path = "Classes/UIViewController+Navigation.h"; sourceTree = "<group>"; };
9747278318338F0C006B7CB7 /* UIViewController+Navigation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIViewController+Navigation.m"; path = "Classes/UIViewController+Navigation.m"; sourceTree = "<group>"; };
9769D6ED1912BF3000CA6158 /* ContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContainerView.h; sourceTree = "<group>"; };
@ -1479,6 +1475,10 @@
978F9246183B6671000D6C7C /* Main_iPhone.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main_iPhone.storyboard; sourceTree = "<group>"; };
978F9251183BD530000D6C7C /* NavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigationController.h; sourceTree = "<group>"; };
978F9252183BD530000D6C7C /* NavigationController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NavigationController.mm; sourceTree = "<group>"; };
97A0EEF6192F3B43009B2779 /* BottomMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BottomMenu.h; sourceTree = "<group>"; };
97A0EEF7192F3B43009B2779 /* BottomMenu.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BottomMenu.mm; sourceTree = "<group>"; };
97A0EEF8192F3B43009B2779 /* BottomMenuCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BottomMenuCell.h; sourceTree = "<group>"; };
97A0EEF9192F3B43009B2779 /* BottomMenuCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BottomMenuCell.m; sourceTree = "<group>"; };
97A8000A18B21363000C07A2 /* SearchView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchView.h; sourceTree = "<group>"; };
97A8000B18B21363000C07A2 /* SearchView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SearchView.mm; sourceTree = "<group>"; };
97A8000E18B21395000C07A2 /* SearchBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchBar.h; sourceTree = "<group>"; };
@ -2609,18 +2609,6 @@
name = Categories;
sourceTree = "<group>";
};
9747277618328E65006B7CB7 /* Bottom Menu */ = {
isa = PBXGroup;
children = (
9747277718328E65006B7CB7 /* BottomMenu.h */,
9747277818328E65006B7CB7 /* BottomMenu.mm */,
9747277918328E65006B7CB7 /* BottomMenuCell.h */,
9747277A18328E65006B7CB7 /* BottomMenuCell.m */,
);
name = "Bottom Menu";
path = SideToolbar;
sourceTree = "<group>";
};
9770A04618AD19D300126E5C /* More Apps */ = {
isa = PBXGroup;
children = (
@ -2656,6 +2644,17 @@
name = Cells;
sourceTree = "<group>";
};
97A0EEFE192F3B48009B2779 /* Bottom Menu */ = {
isa = PBXGroup;
children = (
97A0EEF6192F3B43009B2779 /* BottomMenu.h */,
97A0EEF7192F3B43009B2779 /* BottomMenu.mm */,
97A0EEF8192F3B43009B2779 /* BottomMenuCell.h */,
97A0EEF9192F3B43009B2779 /* BottomMenuCell.m */,
);
name = "Bottom Menu";
sourceTree = "<group>";
};
97A8000918B210DC000C07A2 /* Search */ = {
isa = PBXGroup;
children = (
@ -2674,7 +2673,7 @@
97B4E9271851DAB300BEC5D7 /* Custom Views */ = {
isa = PBXGroup;
children = (
9747277618328E65006B7CB7 /* Bottom Menu */,
97A0EEFE192F3B48009B2779 /* Bottom Menu */,
97D092AD190A67CA00FF645B /* Place Page */,
97A8000918B210DC000C07A2 /* Search */,
9746492518EEE2F8004B4658 /* ToolbarView.h */,
@ -5062,6 +5061,7 @@
buildActionMask = 2147483647;
files = (
1D60589B0D05DD56006BFB54 /* main.mm in Sources */,
97A0EEFA192F3B43009B2779 /* BottomMenu.mm in Sources */,
9747278418338F0C006B7CB7 /* UIViewController+Navigation.m in Sources */,
1D3623260D0F684500981E51 /* MapsAppDelegate.mm in Sources */,
9746492718EEE2F8004B4658 /* ToolbarView.m in Sources */,
@ -5078,6 +5078,7 @@
FA34BECA1338D72F00FFB2A7 /* CustomAlertView.mm in Sources */,
97F61781183E6172009919E2 /* LocationButton.mm in Sources */,
9747264318323080006B7CB7 /* UIKitCategories.m in Sources */,
97A0EEFC192F3B43009B2779 /* BottomMenuCell.m in Sources */,
97719D421843AF1E00BDD815 /* ScopeView.m in Sources */,
97D092B9190AA69700FF645B /* SmallCompassView.mm in Sources */,
97A8001418B2140A000C07A2 /* SearchUniversalCell.m in Sources */,
@ -5108,11 +5109,9 @@
97C98522186AE3CF00AF7E9E /* AppInfo.mm in Sources */,
978F9242183B660F000D6C7C /* SelectableCell.m in Sources */,
CB252D6F16FF82C9001E41E9 /* Statistics.mm in Sources */,
9747277D18328E65006B7CB7 /* BottomMenuCell.m in Sources */,
978F9244183B660F000D6C7C /* SwitchCell.m in Sources */,
EDB811A3175E1A9C00E36BF2 /* TwoButtonsView.m in Sources */,
97ABBA4518C8DF620079333C /* PlacePageView.mm in Sources */,
9747277B18328E65006B7CB7 /* BottomMenu.mm in Sources */,
97F61794183E7445009919E2 /* LinkCell.m in Sources */,
EDCB4E8E175E67120005AA35 /* PlacePreviewViewController.mm in Sources */,
97D092B1190A681F00FF645B /* PlacePageInfoCell.mm in Sources */,
@ -5152,6 +5151,7 @@
FAFB08EF151215EE0041901D /* RenderBuffer.mm in Sources */,
97DEA09718D75BB000C5F963 /* ContextViews.mm in Sources */,
978F9254183BD530000D6C7C /* NavigationController.mm in Sources */,
97A0EEFD192F3B43009B2779 /* BottomMenuCell.m in Sources */,
97C9851F186AE3C500AF7E9E /* Reachability.m in Sources */,
97ABBA4618C8DF620079333C /* PlacePageView.mm in Sources */,
9789DB5B188D94F9007C6FAE /* InterstitialView.mm in Sources */,
@ -5235,14 +5235,13 @@
97C98622186C487900AF7E9E /* MPLegacyInterstitialCustomEventAdapter.m in Sources */,
97C98620186C487900AF7E9E /* MPInterstitialCustomEventAdapter.m in Sources */,
978F9243183B660F000D6C7C /* SelectableCell.m in Sources */,
97A0EEFB192F3B43009B2779 /* BottomMenu.mm in Sources */,
97C985FE186C487900AF7E9E /* CFilteringJSONSerializer.m in Sources */,
97C98625186C487900AF7E9E /* MPMRAIDBannerCustomEvent.m in Sources */,
CB252D7016FF82C9001E41E9 /* Statistics.mm in Sources */,
9747277E18328E65006B7CB7 /* BottomMenuCell.m in Sources */,
9778E99E191A5B6600AD850A /* BookmarkDescriptionVC.mm in Sources */,
978F9245183B660F000D6C7C /* SwitchCell.m in Sources */,
EDB811A4175E1A9C00E36BF2 /* TwoButtonsView.m in Sources */,
9747277C18328E65006B7CB7 /* BottomMenu.mm in Sources */,
97F61795183E7445009919E2 /* LinkCell.m in Sources */,
97C98623186C487900AF7E9E /* MPInstanceProvider.m in Sources */,
97C98606186C487900AF7E9E /* CJSONSerializer.m in Sources */,

View file

@ -87,12 +87,12 @@ public:
}
void SetData(BookmarkData const & data) { m_data = data; }
BookmarkData const & GetData() { return m_data; }
virtual Type GetMarkType() const { return BOOKMARK; }
m2::PointD const & GetOrg() const { return m_org; }
string const & GetName() const { return m_name; }
void SetName(string const & name) { m_name = name; }
string const & GetName() const { return m_data.GetName(); }
void SetName(string const & name) { m_data.SetName(name); }
/// @return Now its a bookmark color - name of icon file
string const & GetType() const { return m_data.GetType(); }
//void SetType(string const & type) { m_type = type; }

View file

@ -197,12 +197,13 @@ size_t BookmarkManager::MoveBookmark(size_t bmIndex, size_t curCatIndex, size_t
BookmarkCategory * cat = m_framework.GetBmCategory(curCatIndex);
Bookmark * bm = cat->GetBookmark(bmIndex);
Bookmark bmCopy = Bookmark(*bm);
BookmarkData data = bm->GetData();
m2::PointD ptOrg = bm->GetOrg();
cat->DeleteBookmark(bmIndex);
cat->SaveToKMLFile();
return m_framework.AddBookmark(newCatIndex, bmCopy);
return m_framework.AddBookmark(newCatIndex, ptOrg, data);
}
void BookmarkManager::ReplaceBookmark(size_t catIndex, size_t bmIndex, BookmarkData const & bm)

View file

@ -40,7 +40,7 @@ public:
void LoadBookmark(string const & filePath);
/// Client should know where it adds bookmark
size_t AddBookmark(size_t categoryIndex, BookmarkData & bm);
size_t AddBookmark(size_t categoryIndex, m2::PointD const & ptOrg, BookmarkData & bm);
/// Client should know where it moves bookmark
size_t MoveBookmark(size_t bmIndex, size_t curCatIndex, size_t newCatIndex);
void ReplaceBookmark(size_t catIndex, size_t bmIndex, BookmarkData const & bm);

View file

@ -1115,6 +1115,8 @@ void Framework::ShowSearchResult(search::Result const & res)
SearchMarkPoint * mark = static_cast<SearchMarkPoint *>(m_bmManager.UserMarksAddMark(type, ptOrg));
mark->SetInfo(info);
m_balloonManager.OnClick(GtoP(res.GetFeatureCenter()), true);
int scale;
m2::PointD center;
@ -1578,16 +1580,18 @@ string Framework::CodeGe0url(double lat, double lon, double zoomLevel, string co
return res;
}
string Framework::GenerateApiBackUrl(url_scheme::ApiPoint const & point)
string Framework::GenerateApiBackUrl(ApiMarkPoint const & point)
{
string res = m_ParsedMapApi.GetGlobalBackUrl();
if (!res.empty())
{
res += "pin?ll=" + strings::to_string(point.m_lat) + "," + strings::to_string(point.m_lon);
if (!point.m_name.empty())
res += "&n=" + UrlEncode(point.m_name);
if (!point.m_id.empty())
res += "&id=" + UrlEncode(point.m_id);
double lat, lon;
point.GetLatLon(lat, lon);
res += "pin?ll=" + strings::to_string(lat) + "," + strings::to_string(lon);
if (!point.GetName().empty())
res += "&n=" + UrlEncode(point.GetName());
if (!point.GetID().empty())
res += "&id=" + UrlEncode(point.GetID());
}
return res;
}

View file

@ -179,7 +179,7 @@ public:
void LoadBookmarks();
/// @return Created bookmark index in category.
size_t AddBookmark(size_t categoryIndex, BookmarkData & bm);
size_t AddBookmark(size_t categoryIndex, m2::PointD const & ptOrg, BookmarkData & bm);
/// @return New moved bookmark index in category.
size_t MoveBookmark(size_t bmIndex, size_t curCatIndex, size_t newCatIndex);
void ReplaceBookmark(size_t catIndex, size_t bmIndex, BookmarkData const & bm);
@ -437,7 +437,7 @@ public:
/// @name Api
//@{
string GenerateApiBackUrl(url_scheme::ApiPoint const & point);
string GenerateApiBackUrl(ApiMarkPoint const & point);
url_scheme::ParsedMapApi const & GetApiDataHolder() const { return m_ParsedMapApi; }
private:

View file

@ -115,7 +115,12 @@ void AddressInfo::MakeFrom(Result const & res)
// assign name if it's not equal with type
string name = res.GetString();
if (name != type)
m_name.swap(name);
m_name.swap(name);
}
void AddressInfo::SetPinName(string const & name)
{
m_name = name;
}
string AddressInfo::GetPinName() const

View file

@ -139,6 +139,7 @@ struct AddressInfo
void MakeFrom(search::Result const & res);
void SetPinName(string const & name);
string GetPinName() const;
string GetPinType() const;