Some minor fixes.

This commit is contained in:
vng 2012-05-11 11:22:55 +03:00 committed by Alex Zolotarev
parent 41903e7360
commit bb9a614eda
4 changed files with 32 additions and 30 deletions

View file

@ -2,6 +2,7 @@
#import "BalloonView.h"
#import "Framework.h"
@implementation AddBookmarkVC
- (id) initWithBalloonView:(BalloonView *)view
@ -19,7 +20,9 @@
- (void)onAddClicked
{
GetFramework().AddBookmark(m2::PointD(m_balloon.globalPosition.x, m_balloon.globalPosition.y), [m_balloon.title UTF8String]);
// TODO Get correct bookmark category.
GetFramework().AddBookmark("Default",
Bookmark(m2::PointD(m_balloon.globalPosition.x, m_balloon.globalPosition.y), [m_balloon.title UTF8String]));
[m_balloon hide];
// Don't forget to hide navbar
[self.navigationController setNavigationBarHidden:YES animated:YES];
@ -69,6 +72,7 @@
break;
case 1:
// TODO Get correct bookmark category.
cell.textLabel.text = NSLocalizedString(@"Set", @"Add bookmark dialog - bookmark set");
cell.detailTextLabel.text = @"Default";
break;

View file

@ -1,31 +1,6 @@
#import "BalloonView.h"
#import <QuartzCore/CALayer.h>
static string formatAddress(string const & house, string const & street,
string const & city, string const & country)
{
string result = house;
if (!street.empty())
{
if (!result.empty())
result += ' ';
result += street;
}
if (!city.empty())
{
if (!result.empty())
result += ", ";
result += city;
}
if (!country.empty())
{
if (!result.empty())
result += ", ";
result += country;
}
return result;
}
@implementation BalloonView
@ -144,10 +119,7 @@ static string formatAddress(string const & house, string const & street,
self.title = NSLocalizedString(@"Dropped Pin", @"Unknown Dropped Pin title, when name can't be determined");
else
self.title = [NSString stringWithUTF8String:m_addressInfo.m_name.c_str()];
self.description = [NSString stringWithUTF8String:formatAddress(m_addressInfo.m_house,
m_addressInfo.m_street,
m_addressInfo.m_city,
m_addressInfo.m_country).c_str()];
self.description = [NSString stringWithUTF8String:m_addressInfo.FormatAddress().c_str()];
}
// Overrided property setter to reload another pin image

View file

@ -402,3 +402,27 @@ void Framework::GetAddressInfo(m2::PointD const & pt, AddressInfo & info) const
getLocality.FillLocality(info, *this);
}
}
string Framework::AddressInfo::FormatAddress() const
{
string result = m_house;
if (!m_street.empty())
{
if (!result.empty())
result += ' ';
result += m_street;
}
if (!m_city.empty())
{
if (!result.empty())
result += ", ";
result += m_city;
}
if (!m_country.empty())
{
if (!result.empty())
result += ", ";
result += m_country;
}
return result;
}

View file

@ -220,6 +220,8 @@ public:
{
string m_country, m_city, m_street, m_house, m_name;
vector<string> m_types;
string FormatAddress() const;
};
/// Get address information for point on map.