[generator] Fixed bug with missing building-address.

This commit is contained in:
vng 2015-11-11 17:33:19 +03:00
parent b91856ccad
commit 584871b339
4 changed files with 34 additions and 2 deletions

View file

@ -138,7 +138,7 @@ bool FeatureBuilder1::RemoveInvalidTypes()
return feature::RemoveNoDrawableTypes(m_params.m_Types,
m_params.GetGeomType(),
m_params.name.IsEmpty());
m_params.IsEmptyNames());
}
bool FeatureBuilder1::FormatFullAddress(string & res) const

View file

@ -179,3 +179,30 @@ UNIT_TEST(FBuilder_WithoutName)
TEST(!fb.RemoveInvalidTypes(), ());
}
}
UNIT_TEST(FBuilder_PointAddress)
{
classificator::Load();
char const * arr[][2] = {
{ "addr:housenumber", "39/79" }
};
OsmElement e;
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
FeatureParams params;
ftype::GetNameAndType(&e, params);
TEST_EQUAL(params.m_Types.size(), 1, ());
TEST(params.IsTypeExist(GetType({"building", "address"})), ());
TEST_EQUAL(params.house.Get(), "39/79", ());
FeatureBuilder1 fb;
fb.SetParams(params);
fb.SetCenter(m2::PointD(0, 0));
TEST(fb.PreSerialize(), ());
TEST(fb.RemoveInvalidTypes(), ());
TEST(fb.CheckValid(), ());
}

View file

@ -146,6 +146,11 @@ string FeatureParamsBase::DebugString() const
(!ref.empty() ? " Ref:" + ref : ""));
}
bool FeatureParamsBase::IsEmptyNames() const
{
return name.IsEmpty() && house.IsEmpty() && ref.empty();
}
namespace
{

View file

@ -131,8 +131,8 @@ struct FeatureParamsBase
bool operator == (FeatureParamsBase const & rhs) const;
bool CheckValid() const;
string DebugString() const;
bool IsEmptyNames() const;
template <class TSink>
void Write(TSink & sink, uint8_t header) const