forked from organicmaps/organicmaps
Rename path variables
Set correct place for .tmp files
This commit is contained in:
parent
44aafabd06
commit
e4f39bec79
5 changed files with 24 additions and 15 deletions
|
@ -14,8 +14,13 @@ struct GenerateInfo
|
|||
{
|
||||
}
|
||||
|
||||
// directory for .mwm.tmp files
|
||||
string m_tmpDir;
|
||||
// directory for result .mwm files
|
||||
string m_targetDir;
|
||||
// directory for all intermediate files
|
||||
string m_intermediateDir;
|
||||
|
||||
string m_datFileSuffix;
|
||||
string m_addressFile;
|
||||
|
||||
|
|
|
@ -97,9 +97,14 @@ int main(int argc, char ** argv)
|
|||
}
|
||||
|
||||
feature::GenerateInfo genInfo;
|
||||
genInfo.m_tmpDir = FLAGS_intermediate_data_path.empty() ? path : FLAGS_intermediate_data_path;
|
||||
genInfo.m_targetDir = path;
|
||||
|
||||
genInfo.m_intermediateDir = FLAGS_intermediate_data_path.empty() ? path : my::AddSlashIfNeeded(FLAGS_intermediate_data_path);
|
||||
genInfo.m_targetDir = genInfo.m_tmpDir = path;
|
||||
|
||||
if (!FLAGS_intermediate_data_path.empty()) {
|
||||
genInfo.m_tmpDir = genInfo.m_intermediateDir + "tmp/";
|
||||
pl.MkDir(genInfo.m_tmpDir);
|
||||
}
|
||||
|
||||
// load classificator only if necessary
|
||||
if (FLAGS_make_coasts || FLAGS_generate_features || FLAGS_generate_geometry ||
|
||||
FLAGS_generate_index || FLAGS_generate_search_index ||
|
||||
|
|
|
@ -225,7 +225,8 @@ namespace
|
|||
for (size_t i = 0; i < ARRAY_SIZE(arr); ++i)
|
||||
m_types[i] = c.GetTypeByPath(vector<string>(arr[i], arr[i] + 2));
|
||||
|
||||
m_srcCoastsFile = info.m_tmpDir + WORLD_COASTS_FILE_NAME + info.m_datFileSuffix;
|
||||
m_srcCoastsFile = info.m_intermediateDir + WORLD_COASTS_FILE_NAME + ".geom";
|
||||
string dstCoastsFile = info.m_tmpDir + WORLD_COASTS_FILE_NAME + info.m_datFileSuffix;
|
||||
|
||||
CHECK(!info.m_makeCoasts || !info.m_createWorld,
|
||||
("We can't do make_coasts and generate_world at the same time"));
|
||||
|
@ -236,7 +237,7 @@ namespace
|
|||
|
||||
if (info.m_emitCoasts)
|
||||
{
|
||||
m_coastsHolder.reset(new feature::FeaturesCollector(m_srcCoastsFile));
|
||||
m_coastsHolder.reset(new feature::FeaturesCollector(dstCoastsFile));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -475,10 +476,10 @@ bool GenerateFeaturesImpl(feature::GenerateInfo & info, string const &osmFileTyp
|
|||
{
|
||||
try
|
||||
{
|
||||
NodesHolderT nodes(info.m_tmpDir + NODES_FILE);
|
||||
NodesHolderT nodes(info.m_intermediateDir + NODES_FILE);
|
||||
|
||||
typedef feature::FileHolder<NodesHolderT> HolderT;
|
||||
HolderT holder(nodes, info.m_tmpDir);
|
||||
HolderT holder(nodes, info.m_intermediateDir);
|
||||
holder.LoadIndex();
|
||||
|
||||
MainFeaturesEmitter bucketer(info);
|
||||
|
|
|
@ -25,7 +25,7 @@ if [ $# -lt 1 ]; then
|
|||
echo
|
||||
echo -e "BORDERS_PATH\tPath to *.poly files for cross-mwm routing"
|
||||
echo -e "BORDER\tPath and name of a polygon file for the input"
|
||||
echo -e "COASTS\tPath and name of WorldCoasts.mwm.tmp"
|
||||
echo -e "COASTS\tPath and name of WorldCoasts.geom"
|
||||
echo -e "TARGET\tWhere to put resulting files"
|
||||
echo
|
||||
exit 1
|
||||
|
@ -59,7 +59,7 @@ trap "rm -rf \"${INTDIR}\"" EXIT SIGINT SIGTERM
|
|||
# Create MWM file
|
||||
INTDIR_FLAG="--intermediate_data_path=$INTDIR/ --node_storage=map"
|
||||
GENERATE_EVERYTHING='--generate_features=true --generate_geometry=true --generate_index=true --generate_search_index=true'
|
||||
COASTS="${COASTS-WorldCoasts.mwm.tmp}"
|
||||
COASTS="${COASTS-WorldCoasts.geom}"
|
||||
if [ -f "$COASTS" ]; then
|
||||
if [ ! -f "$TBORDERS/$BASE_NAME.poly" ]; then
|
||||
BORDER="${BORDER:-${BORDERS_PATH:-.}/$BASE_NAME.poly}"
|
||||
|
@ -68,8 +68,7 @@ if [ -f "$COASTS" ]; then
|
|||
CLEAN_POLY=1
|
||||
cp "$BORDER" "$TBORDERS/$BASE_NAME.poly"
|
||||
fi
|
||||
cp "$COASTS" "$INTDIR"
|
||||
[ ! -f "$TARGET/WorldCoasts.mwm.tmp" ] && CLEAN_COASTS_TMP=1
|
||||
cp "$COASTS" "$INTDIR/WorldCoasts.geom"
|
||||
GENERATE_EVERYTHING="$GENERATE_EVERYTHING --emit_coasts=true --split_by_polygons=true"
|
||||
fi
|
||||
if [ "$SOURCE_TYPE" == "o5m" ]; then
|
||||
|
@ -83,7 +82,6 @@ else
|
|||
fail "Unsupported source type: $SOURCE_TYPE"
|
||||
fi
|
||||
|
||||
[ -n "${CLEAN_COASTS_TMP-}" ] && rm "$TARGET/WorldCoasts.mwm.tmp"
|
||||
[ -n "${CLEAN_POLY-}" ] && rm "$TBORDERS/$BASE_NAME.poly"
|
||||
[ -n "${CLEAN_BORDERS-}" ] && rm -r "$TBORDERS"
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ if [ "$MODE" == "coast" ]; then
|
|||
fi
|
||||
done
|
||||
# make a working copy of generated coastlines file
|
||||
[ -n "$OPT_WORLD" ] && cp "$INTCOASTSDIR/WorldCoasts.mwm.tmp" "$INTDIR"
|
||||
[ -n "$OPT_WORLD" ] && cp "$INTCOASTSDIR/WorldCoasts.geom" "$INTDIR"
|
||||
[ -z "$KEEP_INTDIR" ] && rm -r "$INTCOASTSDIR"
|
||||
MODE=inter
|
||||
fi
|
||||
|
@ -303,7 +303,7 @@ fi
|
|||
if [ "$MODE" == "features" ]; then
|
||||
putmode "Step 4: Generating features of everything into $TARGET"
|
||||
# Checking for coastlines, can't build proper mwms without them
|
||||
[ ! -s "$INTDIR/WorldCoasts.mwm.tmp" ] && fail "Please prepare coastlines and put WorldCoasts.mwm.tmp to $INTDIR"
|
||||
[ ! -s "$INTDIR/WorldCoasts.geom" ] && fail "Please prepare coastlines and put WorldCoasts.geom to $INTDIR"
|
||||
# 2nd pass - paralleled in the code
|
||||
PARAMS_SPLIT="-split_by_polygons -generate_features -emit_coasts"
|
||||
[ -n "$OPT_WORLD" ] && PARAMS_SPLIT="$PARAMS_SPLIT -generate_world"
|
||||
|
@ -327,7 +327,7 @@ if [ "$MODE" == "mwm" ]; then
|
|||
fi
|
||||
|
||||
PARAMS_WITH_SEARCH="$PARAMS -generate_search_index"
|
||||
for file in "$INTDIR"/*.mwm.tmp; do
|
||||
for file in "$INTDIR"/tmp/*.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" &
|
||||
|
|
Loading…
Add table
Reference in a new issue