Create empty dump file

This commit is contained in:
Sergey Yershov 2015-07-09 16:52:21 +03:00 committed by Alex Zolotarev
parent 4f07a6a5db
commit 085e926826
4 changed files with 14 additions and 4 deletions

View file

@ -40,7 +40,7 @@ public:
//@}
inline feature::Metadata const & GetMetadata() const { return m_params.GetMetadata(); }
// inline list<vector<m2::PointD>> const & GetGeometry() { return m_polygons; }
inline feature::EGeomType GetGeomType() const { return m_params.GetGeomType(); }
inline void AddType(uint32_t type) { m_params.AddType(type); }

View file

@ -25,10 +25,15 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace feature {
FeaturesCollector::FeaturesCollector(string const & fName)
FeaturesCollector::FeaturesCollector(string const & fName, string const &dumpFileName)
: m_datFile(fName)
, m_dumpFileName(dumpFileName)
{
CHECK_EQUAL(GetFileSize(m_datFile), 0, ());
if (!m_dumpFileName.empty())
{
m_dumpFileStream.open(m_dumpFileName.c_str(), ios::binary | ios::trunc | ios::out);
}
}
FeaturesCollector::~FeaturesCollector()
@ -36,6 +41,7 @@ FeaturesCollector::~FeaturesCollector()
FlushBuffer();
/// Check file size
(void)GetFileSize(m_datFile);
m_dumpFileStream.close();
}
uint32_t FeaturesCollector::GetFileSize(FileWriter const & f)

View file

@ -6,6 +6,7 @@
#include "std/vector.hpp"
#include "std/string.hpp"
#include "std/fstream.hpp"
class FeatureBuilder1;
@ -21,6 +22,8 @@ namespace feature
protected:
FileWriter m_datFile;
ofstream m_dumpFileStream;
string m_dumpFileName;
m2::RectD m_bounds;
private:
@ -36,7 +39,7 @@ namespace feature
void Flush();
public:
FeaturesCollector(string const & fName);
FeaturesCollector(string const & fName, string const &dumpFileName = string());
~FeaturesCollector();
void operator() (FeatureBuilder1 const & f);

View file

@ -226,6 +226,7 @@ namespace
m_types[i] = c.GetTypeByPath(vector<string>(arr[i], arr[i] + 2));
m_srcCoastsFile = info.m_intermediateDir + WORLD_COASTS_FILE_NAME + ".geom";
string srcCoastsFileDump = info.m_intermediateDir + WORLD_COASTS_FILE_NAME + ".rawdump";
string dstCoastsFile = info.m_tmpDir + WORLD_COASTS_FILE_NAME + info.m_datFileSuffix;
CHECK(!info.m_makeCoasts || !info.m_createWorld,
@ -246,7 +247,7 @@ namespace
// 20000 - max points count per feature
m_coasts.reset(new CoastlineFeaturesGenerator(Type(NATURAL_COASTLINE), 4, 10, 20000));
m_coastsHolder.reset(new feature::FeaturesCollector(m_srcCoastsFile));
m_coastsHolder.reset(new feature::FeaturesCollector(m_srcCoastsFile, srcCoastsFileDump));
}
if (info.m_createWorld)