diff --git a/generator/feature_sorter.cpp b/generator/feature_sorter.cpp index 9009fbcf48..52d83992c3 100644 --- a/generator/feature_sorter.cpp +++ b/generator/feature_sorter.cpp @@ -538,10 +538,10 @@ namespace feature } }; - bool GenerateFinalFeatures(string const & path, string const & name, int mapType) + bool GenerateFinalFeatures(feature::GenerateInfo const & info, string const & name, int mapType) { - string const srcFilePath = my::JoinFoldersToPath(path, name + DATA_FILE_EXTENSION_TMP); - string const datFilePath = my::JoinFoldersToPath(path, name + DATA_FILE_EXTENSION); + string const srcFilePath = my::JoinFoldersToPath(info.m_tmpDir, name + DATA_FILE_EXTENSION_TMP); + string const datFilePath = my::JoinFoldersToPath(info.m_targetDir, name + DATA_FILE_EXTENSION); // stores cellIds for middle points CalculateMidPoints midPoints; @@ -578,7 +578,7 @@ namespace feature // languages try { - FileReader reader(path + "metainfo/" + name + ".meta"); + FileReader reader(info.m_targetDir + "metainfo/" + name + ".meta"); string buffer; reader.ReadAsString(buffer); strings::Tokenize(buffer, "|", DoStoreLanguages(header)); @@ -614,7 +614,6 @@ namespace feature } // remove old not-sorted dat file - FileWriter::DeleteFileX(srcFilePath); FileWriter::DeleteFileX(datFilePath + DATA_FILE_TAG); return true; diff --git a/generator/feature_sorter.hpp b/generator/feature_sorter.hpp index 310be20847..9797aaea83 100644 --- a/generator/feature_sorter.hpp +++ b/generator/feature_sorter.hpp @@ -1,4 +1,5 @@ #pragma once +#include "generator/generate_info.hpp" #include "geometry/point2d.hpp" #include "geometry/simplification.hpp" @@ -14,7 +15,7 @@ namespace feature /// Final generation of data from input feature-dat-file. /// @param path - path to folder with countries; /// @param name - name of generated country; - bool GenerateFinalFeatures(string const & path, string const & name, int mapType); + bool GenerateFinalFeatures(feature::GenerateInfo const & info, string const & name, int mapType); template inline bool are_points_equal(PointT const & p1, PointT const & p2) diff --git a/generator/generate_info.hpp b/generator/generate_info.hpp index 35d4b2be3a..8a65695f4a 100644 --- a/generator/generate_info.hpp +++ b/generator/generate_info.hpp @@ -15,7 +15,7 @@ struct GenerateInfo } string m_tmpDir; - string m_datFilePrefix; + string m_targetDir; string m_datFileSuffix; string m_addressFile; diff --git a/generator/generator_tool/generator_tool.cpp b/generator/generator_tool/generator_tool.cpp index f6763843dc..f29aeff992 100644 --- a/generator/generator_tool/generator_tool.cpp +++ b/generator/generator_tool/generator_tool.cpp @@ -97,8 +97,9 @@ int main(int argc, char ** argv) } feature::GenerateInfo genInfo; - genInfo.m_tmpDir = FLAGS_intermediate_data_path; - + genInfo.m_tmpDir = FLAGS_intermediate_data_path.empty() ? path : FLAGS_intermediate_data_path; + genInfo.m_targetDir = path; + // load classificator only if necessary if (FLAGS_make_coasts || FLAGS_generate_features || FLAGS_generate_geometry || FLAGS_generate_index || FLAGS_generate_search_index || @@ -114,20 +115,7 @@ int main(int argc, char ** argv) { LOG(LINFO, ("Generating final data ...")); - if (FLAGS_split_by_polygons) - { - // do split by countries - genInfo.m_datFilePrefix = path; - } - else - { - // Used for one country generation - append destination file. - // FLAGS_output may be empty for FLAGS_make_coasts flag. - genInfo.m_datFilePrefix = path + FLAGS_output; - } - genInfo.m_datFileSuffix = DATA_FILE_EXTENSION_TMP; - genInfo.m_splitByPolygons = FLAGS_split_by_polygons; genInfo.m_createWorld = FLAGS_generate_world; genInfo.m_makeCoasts = FLAGS_make_coasts; @@ -171,7 +159,7 @@ int main(int argc, char ** argv) if (country == WORLD_COASTS_FILE_NAME) mapType = feature::DataHeader::worldcoasts; - if (!feature::GenerateFinalFeatures(path, country, mapType)) + if (!feature::GenerateFinalFeatures(genInfo, country, mapType)) { // If error - move to next bucket without index generation continue; diff --git a/generator/osm_source.cpp b/generator/osm_source.cpp index 2fb711920e..fad178ff0e 100644 --- a/generator/osm_source.cpp +++ b/generator/osm_source.cpp @@ -236,8 +236,7 @@ namespace if (info.m_emitCoasts) { - m_coastsHolder.reset(new feature::FeaturesCollector( - info.m_datFilePrefix + WORLD_COASTS_FILE_NAME + info.m_datFileSuffix)); + m_coastsHolder.reset(new feature::FeaturesCollector(m_srcCoastsFile)); } } else diff --git a/generator/polygonizer.hpp b/generator/polygonizer.hpp index 98297ec06b..d9ed46c551 100644 --- a/generator/polygonizer.hpp +++ b/generator/polygonizer.hpp @@ -51,7 +51,7 @@ namespace feature public: template explicit Polygonizer(TInfo const & info) - : m_prefix(info.m_datFilePrefix), m_suffix(info.m_datFileSuffix) + : m_prefix(info.m_tmpDir), m_suffix(info.m_datFileSuffix) #if PARALLEL_POLYGONIZER , m_ThreadPoolSemaphore(m_ThreadPool.maxThreadCount() * 8) #endif @@ -62,7 +62,7 @@ namespace feature if (info.m_splitByPolygons) { - CHECK(borders::LoadCountriesList(info.m_datFilePrefix, m_countries), + CHECK(borders::LoadCountriesList(info.m_targetDir, m_countries), ("Error loading country polygons files")); } else @@ -153,6 +153,7 @@ namespace feature if (country->m_index == -1) { m_Names.push_back(country->m_name); + LOG(LINFO, ("Output country file:", m_prefix + country->m_name + m_suffix)); m_Buckets.push_back(new FeatureOutT(m_prefix + country->m_name + m_suffix)); country->m_index = m_Buckets.size()-1; } diff --git a/generator/world_map_generator.hpp b/generator/world_map_generator.hpp index 2ed903569c..856a353712 100644 --- a/generator/world_map_generator.hpp +++ b/generator/world_map_generator.hpp @@ -3,6 +3,7 @@ #include "generator/feature_merger.hpp" #include "indexer/scales.hpp" +#include "base/logging.hpp" #include "defines.hpp" @@ -20,8 +21,9 @@ class WorldMapGenerator public: template explicit EmitterImpl(TInfo const & info) - : m_output(info.m_datFilePrefix + WORLD_FILE_NAME + info.m_datFileSuffix) + : m_output(info.m_tmpDir + WORLD_FILE_NAME + info.m_datFileSuffix) { + LOG(LINFO, ("Output World file:", info.m_tmpDir + WORLD_FILE_NAME + info.m_datFileSuffix)); } /// This function is called after merging linear features. diff --git a/tools/unix/generate_planet.sh b/tools/unix/generate_planet.sh index ecc7a8cef1..ff0480e182 100755 --- a/tools/unix/generate_planet.sh +++ b/tools/unix/generate_planet.sh @@ -317,7 +317,7 @@ if [ "$MODE" == "mwm" ]; then putmode "Step 5: Building all MWMs of regions and of the whole world into $TARGET" # 3rd pass - do in parallel # but separate exceptions for world files to finish them earlier - PARAMS="--data_path=$TARGET --user_resource_path=$DATA_PATH/ --node_storage=$NODE_STORAGE -generate_geometry -generate_index" + PARAMS="--data_path=$TARGET --intermediate_data_path=$INTDIR/ --user_resource_path=$DATA_PATH/ --node_storage=$NODE_STORAGE -generate_geometry -generate_index" if [ -n "$OPT_WORLD" ]; then ( "$GENERATOR_TOOL" $PARAMS --output=World 2>> "$LOG_PATH/World.log" @@ -327,7 +327,7 @@ if [ "$MODE" == "mwm" ]; then fi PARAMS_WITH_SEARCH="$PARAMS -generate_search_index" - for file in "$TARGET"/*.mwm.tmp; do + for file in "$INTDIR"/*.mwm.tmp; do if [[ "$file" != *minsk-pass* && "$file" != *World* ]]; then BASENAME="$(basename "$file" .mwm.tmp)" "$GENERATOR_TOOL" $PARAMS_WITH_SEARCH --output="$BASENAME" 2>> "$LOG_PATH/$BASENAME.log" &