Added mwm timestamp reading.

This commit is contained in:
vng 2014-10-03 21:37:02 +03:00 committed by Alex Zolotarev
parent 8f0e32fe44
commit 453f1eccaf
3 changed files with 22 additions and 8 deletions

View file

@ -3,7 +3,7 @@
#include "../coding/varint.hpp"
#include "../coding/writer.hpp"
#include "../coding/reader.hpp"
#include "../coding/reader_wrapper.hpp"
#include "../base/timer.hpp"
@ -26,10 +26,8 @@ void WriteVersion(Writer & w)
WriteVarUint(w, generatorStartTime);
}
uint32_t ReadVersion(ModelReaderPtr const & r)
template <class TSource> uint32_t ReadVersionT(TSource & src)
{
ReaderSource<ModelReaderPtr> src(r);
size_t const prologSize = ARRAY_SIZE(MWM_PROLOG);
char prolog[prologSize];
src.Read(prolog, prologSize);
@ -40,4 +38,17 @@ uint32_t ReadVersion(ModelReaderPtr const & r)
return ReadVarUint<uint32_t>(src);
}
uint32_t ReadVersion(ModelReaderPtr const & r)
{
ReaderSource<ModelReaderPtr> src(r);
return ReadVersionT(src);
}
uint32_t ReadTimestamp(ReaderSrc & src)
{
(void)ReadVersionT(src);
return ReadVarUint<uint32_t>(src);
}
}

View file

@ -5,9 +5,15 @@
class ModelReaderPtr;
class Writer;
class ReaderSrc;
namespace ver
{
void WriteVersion(Writer & w);
/// @return See feature::DataHeader::Version for more details.
uint32_t ReadVersion(ModelReaderPtr const & r);
/// @return Data timestamp in yymmdd format.
uint32_t ReadTimestamp(ReaderSrc & src);
}

View file

@ -186,9 +186,6 @@ char const * STREET_TOKENS_SEPARATOR = "\t -,.";
int const HN_NEARBY_DISTANCE = 4;
double const STREET_CONNECTION_MAX_ANGLE = math::pi / 2.0;
size_t const HN_COUNT_FOR_ODD_TEST = 16;
/// @todo We need FeatureType::BEST_GEOMETRY for tests (compare with ethalon),
/// but 15 - is enough for production code.
int const HOUSE_READING_SCALE = FeatureType::BEST_GEOMETRY;
//double const HN_MIN_READ_OFFSET_M = 50.0;
//int const HN_NEARBY_INDEX_RANGE = 5;
double const HN_MAX_CONNECTION_DIST_M = 300.0;
@ -818,7 +815,7 @@ void HouseDetector::ReadHouse(FeatureType const & f, Street * st, ProjectionCalc
HouseMapT::iterator const it = m_id2house.find(f.GetID());
bool const isNew = it == m_id2house.end();
m2::PointD const pt = isNew ? f.GetLimitRect(HOUSE_READING_SCALE).Center() : it->second->GetPosition();
m2::PointD const pt = isNew ? f.GetLimitRect(FeatureType::BEST_GEOMETRY).Center() : it->second->GetPosition();
HouseProjection pr;
if (calc.GetProjection(pt, pr))