forked from organicmaps/organicmaps
[ios] Fixed bug with distance in pp after bookmark editing.
This commit is contained in:
parent
67a1a2a582
commit
8346f6d3b3
4 changed files with 16 additions and 12 deletions
|
@ -116,6 +116,7 @@
|
|||
|
||||
BookmarkCategory const * category = GetFramework().GetBookmarkManager().GetBmCategory(bac.first);
|
||||
entity.bookmarkCategory = @(category->GetName().c_str());
|
||||
[self.manager changeBookmarkCategory:bac];
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
|
|
|
@ -69,8 +69,6 @@ static NSString * const kPlacePageBookmarkCellIdentifier = @"PlacePageBookmarkCe
|
|||
self.directionArrow.hidden = isMyPosition || !isHeadingAvaible;
|
||||
self.directionButton.hidden = isMyPosition || !isHeadingAvaible;
|
||||
|
||||
self.distanceLabel.text = @"";
|
||||
|
||||
[self.featureTable reloadData];
|
||||
[self layoutSubviews];
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include "map/user_mark.hpp"
|
||||
#include "Framework.h"
|
||||
|
||||
@class MWMPlacePageEntity, MWMPlacePageNavigationBar;
|
||||
@protocol MWMPlacePageViewManagerProtocol;
|
||||
|
@ -29,6 +27,7 @@
|
|||
- (void)viewWillTransitionToSize:(CGSize)size
|
||||
withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator;
|
||||
- (void)reloadBookmark;
|
||||
- (void)changeBookmarkCategory:(BookmarkAndCategory)bac;
|
||||
- (void)dragPlacePage:(CGRect)frame;
|
||||
- (void)showDirectionViewWithTitle:(NSString *)title type:(NSString *)type;
|
||||
- (void)hideDirectionView;
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
#import "MWMPlacePageViewManager.h"
|
||||
#import "MWMPlacePageViewManagerDelegate.h"
|
||||
|
||||
#include "Framework.h"
|
||||
#include "geometry/distance_on_sphere.hpp"
|
||||
#include "platform/measurement_utils.hpp"
|
||||
|
||||
extern NSString * const kBookmarksChangedNotification;
|
||||
|
||||
|
@ -213,6 +214,13 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
[self.delegate apiBack];
|
||||
}
|
||||
|
||||
- (void)changeBookmarkCategory:(BookmarkAndCategory)bac;
|
||||
{
|
||||
BookmarkCategory const * category = GetFramework().GetBmCategory(bac.first);
|
||||
Bookmark const * bookmark = category->GetBookmark(bac.second);
|
||||
m_userMark.reset(new UserMarkCopy(bookmark, false));
|
||||
}
|
||||
|
||||
- (void)addBookmark
|
||||
{
|
||||
Framework & f = GetFramework();
|
||||
|
@ -259,6 +267,7 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
{
|
||||
[self.entity synchronize];
|
||||
[self.placePage reloadBookmark];
|
||||
[self updateDistance];
|
||||
}
|
||||
|
||||
- (void)dragPlacePage:(CGRect)frame
|
||||
|
@ -284,14 +293,11 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
CLLocation * location = [MapsAppDelegate theApp].m_locationManager.lastLocation;
|
||||
if (!location || !m_userMark)
|
||||
return @"";
|
||||
|
||||
double azimut = -1;
|
||||
double north = -1;
|
||||
[[MapsAppDelegate theApp].m_locationManager getNorthRad:north];
|
||||
string distance;
|
||||
CLLocationCoordinate2D const coord = location.coordinate;
|
||||
GetFramework().GetDistanceAndAzimut(m_userMark->GetUserMark()->GetOrg(), coord.latitude, coord.longitude, north,
|
||||
distance, azimut);
|
||||
ms::LatLon const target = MercatorBounds::ToLatLon(m_userMark->GetUserMark()->GetOrg());
|
||||
MeasurementUtils::FormatDistance(ms::DistanceOnEarth(coord.latitude, coord.longitude,
|
||||
target.lat, target.lon), distance);
|
||||
return @(distance.c_str());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue