forked from organicmaps/organicmaps
[generator] Dedicate CountrySpecifier factory
This commit is contained in:
parent
fc663f4fad
commit
b8413d035c
6 changed files with 35 additions and 11 deletions
|
@ -151,6 +151,8 @@ set(
|
|||
regions/collector_region_info.hpp
|
||||
regions/country_specifier.cpp
|
||||
regions/country_specifier.hpp
|
||||
regions/country_specifier_builder.cpp
|
||||
regions/country_specifier_builder.hpp
|
||||
regions/level_region.hpp
|
||||
regions/locality_point_integrator.cpp
|
||||
regions/locality_point_integrator.hpp
|
||||
|
|
17
generator/regions/country_specifier_builder.cpp
Normal file
17
generator/regions/country_specifier_builder.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "country_specifier_builder.hpp"
|
||||
|
||||
#include "generator/regions/specs/rus.hpp"
|
||||
|
||||
namespace generator
|
||||
{
|
||||
namespace regions
|
||||
{
|
||||
std::unique_ptr<CountrySpecifier> GetCountrySpecifier(std::string const & countryName)
|
||||
{
|
||||
if (countryName == u8"Россия" || countryName == u8"Российская Федерация" || countryName == u8"РФ")
|
||||
return std::make_unique<specs::RusSpecifier>();
|
||||
|
||||
return std::make_unique<CountrySpecifier>();
|
||||
}
|
||||
} // namespace regions
|
||||
} // namespace generator
|
14
generator/regions/country_specifier_builder.hpp
Normal file
14
generator/regions/country_specifier_builder.hpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include "generator/regions/country_specifier.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace generator
|
||||
{
|
||||
namespace regions
|
||||
{
|
||||
std::unique_ptr<CountrySpecifier> GetCountrySpecifier(std::string const & countryName);
|
||||
} // namespace regions
|
||||
} // namespace generator
|
|
@ -1,6 +1,7 @@
|
|||
#include "generator/regions/regions_builder.hpp"
|
||||
|
||||
#include "generator/regions/admin_suburbs_marker.hpp"
|
||||
#include "generator/regions/country_specifier_builder.hpp"
|
||||
#include "generator/regions/place_points_integrator.hpp"
|
||||
#include "generator/regions/specs/rus.hpp"
|
||||
|
||||
|
@ -327,14 +328,5 @@ Node::PtrList RegionsBuilder::BuildCountryRegionTrees(
|
|||
|
||||
return trees;
|
||||
}
|
||||
|
||||
std::unique_ptr<CountrySpecifier> RegionsBuilder::GetCountrySpecifier(
|
||||
std::string const & countryName) const
|
||||
{
|
||||
if (countryName == u8"Россия" || countryName == u8"Российская Федерация" || countryName == u8"РФ")
|
||||
return std::make_unique<specs::RusSpecifier>();
|
||||
|
||||
return std::make_unique<CountrySpecifier>();
|
||||
}
|
||||
} // namespace regions
|
||||
} // namespace generator
|
||||
|
|
|
@ -57,7 +57,6 @@ private:
|
|||
std::vector<Node::Ptr>::const_reverse_iterator FindAreaLowerBoundRely(
|
||||
std::vector<Node::Ptr> const & nodesInAreaOrder,
|
||||
std::vector<Node::Ptr>::const_reverse_iterator forItem) const;
|
||||
std::unique_ptr<CountrySpecifier> GetCountrySpecifier(std::string const & countryName) const;
|
||||
static void InsertIntoSubtree(Node::Ptr & subtree, Node::Ptr && newNode,
|
||||
CountrySpecifier const & countrySpecifier);
|
||||
static bool IsAreaLessRely(Region const & l, Region const & r);
|
||||
|
|
|
@ -17,8 +17,8 @@ public:
|
|||
// CountrySpecifier overrides:
|
||||
void AdjustRegionsLevel(Node::PtrList & outers) override;
|
||||
|
||||
|
||||
private:
|
||||
// CountrySpecifier overrides:
|
||||
PlaceLevel GetSpecificCountryLevel(Region const & region) const override;
|
||||
|
||||
void AdjustMoscowAdministrativeDivisions(Node::PtrList & outers);
|
||||
|
|
Loading…
Add table
Reference in a new issue