mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-05 20:23:48 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -57,8 +57,7 @@ void TestGeometryLoader::Load(uint32_t featureId, RoadGeometry & road)
|
||||
road = it->second;
|
||||
}
|
||||
|
||||
void TestGeometryLoader::AddRoad(uint32_t featureId, bool oneWay, float speed,
|
||||
RoadGeometry::Points const & points)
|
||||
void TestGeometryLoader::AddRoad(uint32_t featureId, bool oneWay, float speed, RoadGeometry::Points const & points)
|
||||
{
|
||||
auto const it = m_roads.find(featureId);
|
||||
CHECK(it == m_roads.end(), ("Already contains feature", featureId));
|
||||
@@ -76,8 +75,8 @@ void TestGeometryLoader::SetPassThroughAllowed(uint32_t featureId, bool passThro
|
||||
std::shared_ptr<EdgeEstimator> CreateEstimatorForCar(std::shared_ptr<TrafficStash> trafficStash)
|
||||
{
|
||||
auto const carModel = CarModelFactory({}).GetVehicleModel();
|
||||
return EdgeEstimator::Create(VehicleType::Car, *carModel, trafficStash,
|
||||
nullptr /* DataSource */, nullptr /* NumMwmIds */);
|
||||
return EdgeEstimator::Create(VehicleType::Car, *carModel, trafficStash, nullptr /* DataSource */,
|
||||
nullptr /* NumMwmIds */);
|
||||
}
|
||||
|
||||
std::shared_ptr<EdgeEstimator> CreateEstimatorForCar(traffic::TrafficCache const & trafficCache)
|
||||
@@ -97,11 +96,9 @@ Joint MakeJoint(std::vector<RoadPoint> const & points)
|
||||
}
|
||||
|
||||
std::unique_ptr<IndexGraph> BuildIndexGraph(std::unique_ptr<TestGeometryLoader> geometryLoader,
|
||||
std::shared_ptr<EdgeEstimator> estimator,
|
||||
std::vector<Joint> const & joints)
|
||||
std::shared_ptr<EdgeEstimator> estimator, std::vector<Joint> const & joints)
|
||||
{
|
||||
auto graph = std::make_unique<IndexGraph>(std::make_shared<Geometry>(std::move(geometryLoader)),
|
||||
estimator);
|
||||
auto graph = std::make_unique<IndexGraph>(std::make_shared<Geometry>(std::move(geometryLoader)), estimator);
|
||||
graph->Import(joints);
|
||||
return graph;
|
||||
}
|
||||
|
||||
@@ -21,11 +21,13 @@ namespace generator
|
||||
/// 30, 3,
|
||||
/// 40, 4
|
||||
/// \param outputFilePath full path to an output file where the mapping is saved.
|
||||
void ReEncodeOsmIdsToFeatureIdsMapping(std::string const & mappingContent,
|
||||
std::string const & outputFilePath);
|
||||
void ReEncodeOsmIdsToFeatureIdsMapping(std::string const & mappingContent, std::string const & outputFilePath);
|
||||
} // namespace generator
|
||||
|
||||
namespace traffic { class TrafficCache; }
|
||||
namespace traffic
|
||||
{
|
||||
class TrafficCache;
|
||||
}
|
||||
|
||||
namespace routing
|
||||
{
|
||||
@@ -35,8 +37,7 @@ public:
|
||||
// GeometryLoader overrides:
|
||||
void Load(uint32_t featureId, routing::RoadGeometry & road) override;
|
||||
|
||||
void AddRoad(uint32_t featureId, bool oneWay, float speed,
|
||||
routing::RoadGeometry::Points const & points);
|
||||
void AddRoad(uint32_t featureId, bool oneWay, float speed, routing::RoadGeometry::Points const & points);
|
||||
|
||||
void SetPassThroughAllowed(uint32_t featureId, bool passThroughAllowed);
|
||||
|
||||
@@ -53,4 +54,3 @@ std::unique_ptr<IndexGraph> BuildIndexGraph(std::unique_ptr<TestGeometryLoader>
|
||||
std::shared_ptr<EdgeEstimator> estimator,
|
||||
std::vector<Joint> const & joints);
|
||||
} // namespace routing
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ uint64_t GenUniqueId()
|
||||
|
||||
vector<m2::PointD> MakePoly(m2::RectD const & rect)
|
||||
{
|
||||
return { rect.LeftBottom(), rect.RightBottom(), rect.RightTop(), rect.LeftTop(), rect.LeftBottom() };
|
||||
return {rect.LeftBottom(), rect.RightBottom(), rect.RightTop(), rect.LeftTop(), rect.LeftBottom()};
|
||||
}
|
||||
|
||||
StringUtf8Multilang MakeName(string const & name, string const & lang)
|
||||
@@ -54,16 +54,25 @@ StringUtf8Multilang MakeName(string const & name, string const & lang)
|
||||
} // namespace
|
||||
|
||||
// TestFeature -------------------------------------------------------------------------------------
|
||||
TestFeature::TestFeature() : m_id(GenUniqueId()), m_center(0, 0), m_type(Type::Unknown) { Init(); }
|
||||
TestFeature::TestFeature() : m_id(GenUniqueId()), m_center(0, 0), m_type(Type::Unknown)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
TestFeature::TestFeature(StringUtf8Multilang name)
|
||||
: m_id(GenUniqueId()), m_center(0, 0), m_type(Type::Unknown), m_names(std::move(name))
|
||||
: m_id(GenUniqueId())
|
||||
, m_center(0, 0)
|
||||
, m_type(Type::Unknown)
|
||||
, m_names(std::move(name))
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
TestFeature::TestFeature(m2::PointD const & center, StringUtf8Multilang name)
|
||||
: m_id(GenUniqueId()), m_center(center), m_type(Type::Point), m_names(std::move(name))
|
||||
: m_id(GenUniqueId())
|
||||
, m_center(center)
|
||||
, m_type(Type::Point)
|
||||
, m_names(std::move(name))
|
||||
{
|
||||
Init();
|
||||
}
|
||||
@@ -75,7 +84,11 @@ TestFeature::TestFeature(m2::RectD const & boundary, StringUtf8Multilang name)
|
||||
}
|
||||
|
||||
TestFeature::TestFeature(vector<m2::PointD> geometry, StringUtf8Multilang name, Type type)
|
||||
: m_id(GenUniqueId()), m_center(0, 0), m_geometry(std::move(geometry)), m_type(type), m_names(std::move(name))
|
||||
: m_id(GenUniqueId())
|
||||
, m_center(0, 0)
|
||||
, m_geometry(std::move(geometry))
|
||||
, m_type(type)
|
||||
, m_names(std::move(name))
|
||||
{
|
||||
ASSERT(!m_geometry.empty(), ());
|
||||
Init();
|
||||
@@ -145,23 +158,25 @@ void TestFeature::Serialize(FeatureBuilder & fb) const
|
||||
}
|
||||
|
||||
// TestPlace -------------------------------------------------------------------------------------
|
||||
TestPlace::TestPlace(m2::PointD const & center, string const & name, string const & lang,
|
||||
uint32_t type, uint8_t rank /* = 0 */)
|
||||
: TestFeature(center, MakeName(name, lang)), m_type(type), m_rank(rank)
|
||||
{
|
||||
}
|
||||
TestPlace::TestPlace(m2::PointD const & center, string const & name, string const & lang, uint32_t type,
|
||||
uint8_t rank /* = 0 */)
|
||||
: TestFeature(center, MakeName(name, lang))
|
||||
, m_type(type)
|
||||
, m_rank(rank)
|
||||
{}
|
||||
|
||||
TestPlace::TestPlace(m2::PointD const & center, StringUtf8Multilang const & name,
|
||||
uint32_t type, uint8_t rank)
|
||||
: TestFeature(center, name), m_type(type), m_rank(rank)
|
||||
{
|
||||
}
|
||||
TestPlace::TestPlace(m2::PointD const & center, StringUtf8Multilang const & name, uint32_t type, uint8_t rank)
|
||||
: TestFeature(center, name)
|
||||
, m_type(type)
|
||||
, m_rank(rank)
|
||||
{}
|
||||
|
||||
TestPlace::TestPlace(std::vector<m2::PointD> const & boundary, std::string const & name, std::string const & lang,
|
||||
uint32_t type, uint8_t rank)
|
||||
: TestFeature(boundary, MakeName(name, lang), Type::Area), m_type(type), m_rank(rank)
|
||||
{
|
||||
}
|
||||
: TestFeature(boundary, MakeName(name, lang), Type::Area)
|
||||
, m_type(type)
|
||||
, m_rank(rank)
|
||||
{}
|
||||
|
||||
void TestPlace::Serialize(FeatureBuilder & fb) const
|
||||
{
|
||||
@@ -191,13 +206,11 @@ TestCountry::TestCountry(m2::PointD const & center, std::string const & name, st
|
||||
|
||||
TestState::TestState(m2::PointD const & center, string const & name, string const & lang)
|
||||
: TestPlace(center, name, lang, classif().GetTypeByPath({"place", "state"}))
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
TestSea::TestSea(m2::PointD const & center, std::string const & name, std::string const & lang)
|
||||
: TestPlace(center, name, lang, classif().GetTypeByPath({"place", "sea"}))
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
uint32_t TestCity::GetCityType()
|
||||
{
|
||||
@@ -206,40 +219,35 @@ uint32_t TestCity::GetCityType()
|
||||
|
||||
TestCity::TestCity(m2::PointD const & center, string const & name, string const & lang, uint8_t rank)
|
||||
: TestPlace(center, name, lang, GetCityType(), rank)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
TestCity::TestCity(m2::PointD const & center, StringUtf8Multilang const & name, uint8_t rank)
|
||||
: TestPlace(center, name, GetCityType(), rank)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
TestCity::TestCity(vector<m2::PointD> const & boundary, string const & name, string const & lang, uint8_t rank)
|
||||
: TestPlace(boundary, name, lang, GetCityType(), rank)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
TestVillage::TestVillage(m2::PointD const & center, string const & name, string const & lang, uint8_t rank)
|
||||
: TestPlace(center, name, lang, classif().GetTypeByPath({"place", "village"}), rank)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
TestSuburb::TestSuburb(m2::PointD const & center, string const & name, string const & lang)
|
||||
: TestPlace(center, name, lang, classif().GetTypeByPath({"place", "suburb"}))
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
// TestStreet --------------------------------------------------------------------------------------
|
||||
TestStreet::TestStreet(vector<m2::PointD> const & points, string const & name, string const & lang)
|
||||
: TestFeature(points, MakeName(name, lang), Type::Line)
|
||||
{
|
||||
SetType({ "highway", "living_street" });
|
||||
SetType({"highway", "living_street"});
|
||||
}
|
||||
|
||||
TestStreet::TestStreet(vector<m2::PointD> const & points, StringUtf8Multilang const & name)
|
||||
: TestFeature(points, name, Type::Line)
|
||||
{
|
||||
SetType({ "highway", "living_street" });
|
||||
SetType({"highway", "living_street"});
|
||||
}
|
||||
|
||||
void TestStreet::SetType(base::StringIL const & e)
|
||||
@@ -266,8 +274,7 @@ string TestStreet::ToDebugString() const
|
||||
// TestSquare --------------------------------------------------------------------------------------
|
||||
TestSquare::TestSquare(m2::RectD const & rect, string const & name, string const & lang)
|
||||
: TestFeature(rect, MakeName(name, lang))
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void TestSquare::Serialize(FeatureBuilder & fb) const
|
||||
{
|
||||
@@ -354,9 +361,9 @@ void TestPOI::SetTypes(std::initializer_list<base::StringIL> const & types)
|
||||
// TestMultilingualPOI -----------------------------------------------------------------------------
|
||||
TestMultilingualPOI::TestMultilingualPOI(m2::PointD const & center, string const & defaultName,
|
||||
std::map<string, string> const & multilingualNames)
|
||||
: TestPOI(center, defaultName, "default"), m_multilingualNames(multilingualNames)
|
||||
{
|
||||
}
|
||||
: TestPOI(center, defaultName, "default")
|
||||
, m_multilingualNames(multilingualNames)
|
||||
{}
|
||||
|
||||
void TestMultilingualPOI::Serialize(FeatureBuilder & fb) const
|
||||
{
|
||||
@@ -382,21 +389,22 @@ string TestMultilingualPOI::ToDebugString() const
|
||||
}
|
||||
|
||||
// TestBuilding ------------------------------------------------------------------------------------
|
||||
TestBuilding::TestBuilding(m2::PointD const & center, string const & name,
|
||||
string const & houseNumber, string const & lang)
|
||||
: TestFeature(center, MakeName(name, lang)), m_houseNumber(houseNumber)
|
||||
{
|
||||
}
|
||||
TestBuilding::TestBuilding(m2::PointD const & center, string const & name, string const & houseNumber,
|
||||
string const & lang)
|
||||
: TestFeature(center, MakeName(name, lang))
|
||||
, m_houseNumber(houseNumber)
|
||||
{}
|
||||
|
||||
TestBuilding::TestBuilding(m2::PointD const & center, string const & name,
|
||||
string const & houseNumber, string_view street, string const & lang)
|
||||
: TestFeature(center, MakeName(name, lang)), m_houseNumber(houseNumber)
|
||||
TestBuilding::TestBuilding(m2::PointD const & center, string const & name, string const & houseNumber,
|
||||
string_view street, string const & lang)
|
||||
: TestFeature(center, MakeName(name, lang))
|
||||
, m_houseNumber(houseNumber)
|
||||
{
|
||||
m_addr.Set(AddressData::Type::Street, street);
|
||||
}
|
||||
|
||||
TestBuilding::TestBuilding(m2::RectD const & boundary, string const & name,
|
||||
string const & houseNumber, string_view street, string const & lang)
|
||||
TestBuilding::TestBuilding(m2::RectD const & boundary, string const & name, string const & houseNumber,
|
||||
string_view street, string const & lang)
|
||||
: TestFeature(boundary, MakeName(name, lang))
|
||||
, m_houseNumber(houseNumber)
|
||||
{
|
||||
@@ -422,16 +430,14 @@ void TestBuilding::Serialize(FeatureBuilder & fb) const
|
||||
string TestBuilding::ToDebugString() const
|
||||
{
|
||||
ostringstream os;
|
||||
os << "TestBuilding [" << DebugPrint(m_names) << ", " << m_houseNumber << ", "
|
||||
<< DebugPrint(m_center) << "]";
|
||||
os << "TestBuilding [" << DebugPrint(m_names) << ", " << m_houseNumber << ", " << DebugPrint(m_center) << "]";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
// TestPark ----------------------------------------------------------------------------------------
|
||||
TestPark::TestPark(vector<m2::PointD> const & boundary, string const & name, string const & lang)
|
||||
: TestFeature(boundary, MakeName(name, lang), Type::Area)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void TestPark::Serialize(FeatureBuilder & fb) const
|
||||
{
|
||||
@@ -452,8 +458,7 @@ string TestPark::ToDebugString() const
|
||||
// TestRoad ----------------------------------------------------------------------------------------
|
||||
TestRoad::TestRoad(vector<m2::PointD> const & points, string const & name, string const & lang)
|
||||
: TestFeature(points, MakeName(name, lang), Type::Line)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void TestRoad::Serialize(FeatureBuilder & fb) const
|
||||
{
|
||||
@@ -471,6 +476,9 @@ string TestRoad::ToDebugString() const
|
||||
}
|
||||
|
||||
// Functions ---------------------------------------------------------------------------------------
|
||||
string DebugPrint(TestFeature const & feature) { return feature.ToDebugString(); }
|
||||
string DebugPrint(TestFeature const & feature)
|
||||
{
|
||||
return feature.ToDebugString();
|
||||
}
|
||||
} // namespace tests_support
|
||||
} // namespace generator
|
||||
|
||||
@@ -15,8 +15,14 @@
|
||||
#include <vector>
|
||||
|
||||
class FeatureType;
|
||||
namespace feature { class FeatureBuilder; }
|
||||
namespace osm { class Editor; }
|
||||
namespace feature
|
||||
{
|
||||
class FeatureBuilder;
|
||||
}
|
||||
namespace osm
|
||||
{
|
||||
class Editor;
|
||||
}
|
||||
|
||||
namespace generator
|
||||
{
|
||||
@@ -76,12 +82,11 @@ private:
|
||||
class TestPlace : public TestFeature
|
||||
{
|
||||
public:
|
||||
TestPlace(m2::PointD const & center, std::string const & name, std::string const & lang,
|
||||
uint32_t type, uint8_t rank = 0);
|
||||
TestPlace(m2::PointD const & center, StringUtf8Multilang const & name,
|
||||
uint32_t type, uint8_t rank);
|
||||
TestPlace(std::vector<m2::PointD> const & boundary, std::string const & name, std::string const & lang,
|
||||
uint32_t type, uint8_t rank);
|
||||
TestPlace(m2::PointD const & center, std::string const & name, std::string const & lang, uint32_t type,
|
||||
uint8_t rank = 0);
|
||||
TestPlace(m2::PointD const & center, StringUtf8Multilang const & name, uint32_t type, uint8_t rank);
|
||||
TestPlace(std::vector<m2::PointD> const & boundary, std::string const & name, std::string const & lang, uint32_t type,
|
||||
uint8_t rank);
|
||||
|
||||
// TestFeature overrides:
|
||||
void Serialize(feature::FeatureBuilder & fb) const override;
|
||||
@@ -116,6 +121,7 @@ public:
|
||||
class TestCity : public TestPlace
|
||||
{
|
||||
static uint32_t GetCityType();
|
||||
|
||||
public:
|
||||
TestCity(m2::PointD const & center, std::string const & name, std::string const & lang, uint8_t rank);
|
||||
TestCity(m2::PointD const & center, StringUtf8Multilang const & name, uint8_t rank);
|
||||
@@ -167,10 +173,8 @@ class TestPOI : public TestFeature
|
||||
public:
|
||||
TestPOI(m2::PointD const & center, std::string const & name, std::string const & lang);
|
||||
|
||||
static std::pair<TestPOI, FeatureID> AddWithEditor(osm::Editor & editor,
|
||||
MwmSet::MwmId const & mwmId,
|
||||
std::string const & enName,
|
||||
m2::PointD const & pt);
|
||||
static std::pair<TestPOI, FeatureID> AddWithEditor(osm::Editor & editor, MwmSet::MwmId const & mwmId,
|
||||
std::string const & enName, m2::PointD const & pt);
|
||||
|
||||
// TestFeature overrides:
|
||||
void Serialize(feature::FeatureBuilder & fb) const override;
|
||||
@@ -217,10 +221,7 @@ public:
|
||||
std::string ToDebugString() const override;
|
||||
|
||||
void SetType(uint32_t type) { m_type = type; }
|
||||
void SetPlace(std::string_view place)
|
||||
{
|
||||
m_addr.Set(feature::AddressData::Type::Place, place);
|
||||
}
|
||||
void SetPlace(std::string_view place) { m_addr.Set(feature::AddressData::Type::Place, place); }
|
||||
|
||||
private:
|
||||
std::string m_houseNumber;
|
||||
|
||||
@@ -34,9 +34,7 @@ bool MakeFakeBordersFile(std::string const & intemediatePath, std::string const
|
||||
if (code != Platform::EError::ERR_OK && code != Platform::EError::ERR_FILE_ALREADY_EXISTS)
|
||||
return false;
|
||||
|
||||
std::vector<m2::PointD> points = {
|
||||
{-180.0, -90.0}, {180.0, -90.0}, {180.0, 90.0}, {-180.0, 90.0}, {-180.0, -90.0}
|
||||
};
|
||||
std::vector<m2::PointD> points = {{-180.0, -90.0}, {180.0, -90.0}, {180.0, 90.0}, {-180.0, 90.0}, {-180.0, -90.0}};
|
||||
borders::DumpBorderToPolyFile(borderPath, filename, {m2::RegionD{std::move(points)}});
|
||||
return true;
|
||||
}
|
||||
@@ -61,7 +59,8 @@ void TestRawGenerator::SetupTmpFolder(std::string const & tmpPath)
|
||||
CHECK(Platform::MkDirChecked(tmpPath), ());
|
||||
}
|
||||
|
||||
void TestRawGenerator::BuildFB(std::string const & osmFilePath, std::string const & mwmName, bool makeWorld /* = false */)
|
||||
void TestRawGenerator::BuildFB(std::string const & osmFilePath, std::string const & mwmName,
|
||||
bool makeWorld /* = false */)
|
||||
{
|
||||
m_genInfo.m_nodeStorageType = feature::GenerateInfo::NodeStorageType::Index;
|
||||
m_genInfo.m_osmFileName = osmFilePath;
|
||||
@@ -69,7 +68,7 @@ void TestRawGenerator::BuildFB(std::string const & osmFilePath, std::string cons
|
||||
|
||||
CHECK(GenerateIntermediateData(m_genInfo), ());
|
||||
|
||||
//CHECK(MakeFakeBordersFile(GetTmpPath(), mwmName), ());
|
||||
// CHECK(MakeFakeBordersFile(GetTmpPath(), mwmName), ());
|
||||
|
||||
m_genInfo.m_tmpDir = m_genInfo.m_targetDir = GetTmpPath();
|
||||
m_genInfo.m_fileName = mwmName;
|
||||
@@ -115,9 +114,7 @@ void TestRawGenerator::BuildRouting(std::string const & mwmName, std::string con
|
||||
{
|
||||
using namespace routing_builder;
|
||||
CountryParentNameGetterFn const parentGetter = [&countryName](std::string const & name)
|
||||
{
|
||||
return (name != countryName ? countryName : std::string());
|
||||
};
|
||||
{ return (name != countryName ? countryName : std::string()); };
|
||||
|
||||
std::string const filePath = GetMwmPath(mwmName);
|
||||
std::string const osmToFeatureFilename = filePath + OSM2FEATURE_FILE_EXTENSION;
|
||||
@@ -159,5 +156,5 @@ bool TestRawGenerator::IsWorld(std::string const & mwmName) const
|
||||
return (mwmName == WORLD_FILE_NAME);
|
||||
}
|
||||
|
||||
} // namespace tests_support
|
||||
} // namespace generator
|
||||
} // namespace tests_support
|
||||
} // namespace generator
|
||||
|
||||
@@ -31,16 +31,15 @@ public:
|
||||
|
||||
routing::FeatureIdToOsmId LoadFID2OsmID(std::string const & mwmName);
|
||||
|
||||
template <class FnT> void ForEachFB(std::string const & mwmName, FnT && fn)
|
||||
template <class FnT>
|
||||
void ForEachFB(std::string const & mwmName, FnT && fn)
|
||||
{
|
||||
using namespace feature;
|
||||
ForEachFeatureRawFormat(m_genInfo.GetTmpFileName(mwmName), [&fn](FeatureBuilder const & fb, uint64_t)
|
||||
{
|
||||
fn(fb);
|
||||
});
|
||||
ForEachFeatureRawFormat(m_genInfo.GetTmpFileName(mwmName), [&fn](FeatureBuilder const & fb, uint64_t) { fn(fb); });
|
||||
}
|
||||
|
||||
template <class FnT> void ForEachFeature(std::string const & mwmName, FnT && fn)
|
||||
template <class FnT>
|
||||
void ForEachFeature(std::string const & mwmName, FnT && fn)
|
||||
{
|
||||
FrozenDataSource dataSource;
|
||||
auto const res = dataSource.RegisterMap(platform::LocalCountryFile::MakeTemporary(GetMwmPath(mwmName)));
|
||||
@@ -61,5 +60,5 @@ public:
|
||||
static char const * kWikidataFilename;
|
||||
};
|
||||
|
||||
} // namespace tests_support
|
||||
} // namespace generator
|
||||
} // namespace tests_support
|
||||
} // namespace generator
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "defines.hpp"
|
||||
|
||||
|
||||
namespace generator
|
||||
{
|
||||
namespace tests_support
|
||||
@@ -57,15 +56,12 @@ bool WriteRegionDataForTests(string const & path, vector<string> const & languag
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TestMwmBuilder::TestMwmBuilder(platform::LocalCountryFile & file, DataHeader::MapType type,
|
||||
uint32_t version)
|
||||
TestMwmBuilder::TestMwmBuilder(platform::LocalCountryFile & file, DataHeader::MapType type, uint32_t version)
|
||||
: m_file(file)
|
||||
, m_type(type)
|
||||
, m_collector(
|
||||
std::make_unique<FeaturesCollector>(m_file.GetPath(MapFileType::Map) + EXTENSION_TMP))
|
||||
, m_collector(std::make_unique<FeaturesCollector>(m_file.GetPath(MapFileType::Map) + EXTENSION_TMP))
|
||||
, m_version(version)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
TestMwmBuilder::~TestMwmBuilder()
|
||||
{
|
||||
@@ -101,9 +97,7 @@ bool TestMwmBuilder::Add(FeatureBuilder & fb)
|
||||
if (!feature::PreprocessForWorldMap(fb))
|
||||
return false;
|
||||
break;
|
||||
case DataHeader::MapType::WorldCoasts:
|
||||
CHECK(false, ("Coasts are not supported in test builder"));
|
||||
break;
|
||||
case DataHeader::MapType::WorldCoasts: CHECK(false, ("Coasts are not supported in test builder")); break;
|
||||
}
|
||||
|
||||
auto const & isCityTownOrVillage = ftypes::IsCityTownOrVillageChecker::Instance();
|
||||
@@ -127,8 +121,7 @@ bool TestMwmBuilder::Add(FeatureBuilder & fb)
|
||||
return true;
|
||||
}
|
||||
|
||||
void TestMwmBuilder::SetPostcodesData(string const & postcodesPath,
|
||||
indexer::PostcodePointsDatasetType postcodesType,
|
||||
void TestMwmBuilder::SetPostcodesData(string const & postcodesPath, indexer::PostcodePointsDatasetType postcodesType,
|
||||
std::shared_ptr<storage::CountryInfoGetter> const & countryInfoGetter)
|
||||
{
|
||||
m_postcodesPath = postcodesPath;
|
||||
@@ -153,8 +146,7 @@ void TestMwmBuilder::Finish()
|
||||
info.m_tmpDir = m_file.GetDirectory();
|
||||
info.m_intermediateDir = m_file.GetDirectory();
|
||||
info.m_versionDate = static_cast<uint32_t>(base::YYMMDDToSecondsSinceEpoch(m_version));
|
||||
CHECK(GenerateFinalFeatures(info, m_file.GetCountryFile().GetName(), m_type),
|
||||
("Can't sort features."));
|
||||
CHECK(GenerateFinalFeatures(info, m_file.GetCountryFile().GetName(), m_type), ("Can't sort features."));
|
||||
|
||||
CHECK(base::DeleteFileX(tmpFilePath), ());
|
||||
|
||||
@@ -165,14 +157,13 @@ void TestMwmBuilder::Finish()
|
||||
|
||||
CHECK(indexer::BuildIndexFromDataFile(path, path), ("Can't build geometry index."));
|
||||
|
||||
CHECK(indexer::BuildSearchIndexFromDataFile(m_file.GetCountryName(), info,
|
||||
true /* forceRebuild */, 1 /* threadsCount */),
|
||||
CHECK(indexer::BuildSearchIndexFromDataFile(m_file.GetCountryName(), info, true /* forceRebuild */,
|
||||
1 /* threadsCount */),
|
||||
("Can't build search index."));
|
||||
|
||||
if (!m_postcodesPath.empty() && m_postcodesCountryInfoGetter)
|
||||
{
|
||||
CHECK(indexer::BuildPostcodePointsWithInfoGetter(m_file.GetDirectory(), m_file.GetCountryName(),
|
||||
m_postcodesType,
|
||||
CHECK(indexer::BuildPostcodePointsWithInfoGetter(m_file.GetDirectory(), m_file.GetCountryName(), m_postcodesType,
|
||||
m_postcodesPath, true /* forceRebuild */,
|
||||
*m_postcodesCountryInfoGetter),
|
||||
("Can't build postcodes section."));
|
||||
@@ -186,8 +177,7 @@ void TestMwmBuilder::Finish()
|
||||
CHECK(generator::BuildCitiesIdsForTesting(path), ());
|
||||
}
|
||||
|
||||
CHECK(indexer::BuildCentersTableFromDataFile(path, true /* forceRebuild */),
|
||||
("Can't build centers table."));
|
||||
CHECK(indexer::BuildCentersTableFromDataFile(path, true /* forceRebuild */), ("Can't build centers table."));
|
||||
|
||||
CHECK(search::SearchRankTableBuilder::CreateIfNotExists(path), ());
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace feature
|
||||
{
|
||||
class FeaturesCollector;
|
||||
class FeatureBuilder;
|
||||
}
|
||||
} // namespace feature
|
||||
namespace platform
|
||||
{
|
||||
class LocalCountryFile;
|
||||
@@ -42,8 +42,7 @@ public:
|
||||
void AddSafe(TestFeature const & feature);
|
||||
bool Add(feature::FeatureBuilder & fb);
|
||||
|
||||
void SetPostcodesData(std::string const & postcodesPath,
|
||||
indexer::PostcodePointsDatasetType postcodesType,
|
||||
void SetPostcodesData(std::string const & postcodesPath, indexer::PostcodePointsDatasetType postcodesType,
|
||||
std::shared_ptr<storage::CountryInfoGetter> const & countryInfoGetter);
|
||||
|
||||
void SetMwmLanguages(std::vector<std::string> const & languages);
|
||||
|
||||
@@ -35,10 +35,7 @@ void TestWithCustomMwms::Cleanup(LocalCountryFile const & file)
|
||||
void TestWithCustomMwms::DeregisterMap(std::string const & name)
|
||||
{
|
||||
auto const file = CountryFile(name);
|
||||
auto it = base::FindIf(m_files, [&file](LocalCountryFile const & f)
|
||||
{
|
||||
return f.GetCountryFile() == file;
|
||||
});
|
||||
auto it = base::FindIf(m_files, [&file](LocalCountryFile const & f) { return f.GetCountryFile() == file; });
|
||||
|
||||
if (it == m_files.end())
|
||||
return;
|
||||
@@ -77,17 +74,12 @@ void TestWithCustomMwms::RegisterLocalMapsInViewport(m2::RectD const & viewport)
|
||||
auto const countriesInfo = storage::CountryInfoReader::CreateCountryInfoGetter(GetPlatform());
|
||||
|
||||
RegisterLocalMapsImpl([&](std::string const & name)
|
||||
{
|
||||
return countriesInfo->GetLimitRectForLeaf(name).IsIntersect(viewport);
|
||||
});
|
||||
{ return countriesInfo->GetLimitRectForLeaf(name).IsIntersect(viewport); });
|
||||
}
|
||||
|
||||
void TestWithCustomMwms::RegisterLocalMapsByPrefix(std::string const & prefix)
|
||||
{
|
||||
RegisterLocalMapsImpl([&](std::string const & name)
|
||||
{
|
||||
return name.starts_with(prefix);
|
||||
});
|
||||
RegisterLocalMapsImpl([&](std::string const & name) { return name.starts_with(prefix); });
|
||||
}
|
||||
|
||||
} // namespace tests_support
|
||||
|
||||
@@ -75,7 +75,8 @@ public:
|
||||
void RegisterLocalMapsByPrefix(std::string const & prefix);
|
||||
|
||||
protected:
|
||||
template <class FnT> void RegisterLocalMapsImpl(FnT && check);
|
||||
template <class FnT>
|
||||
void RegisterLocalMapsImpl(FnT && check);
|
||||
|
||||
static void Cleanup(platform::LocalCountryFile const & file);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user