本文整理汇总了C++中ImportParameter::GetRawWayDataMemoryMaped方法的典型用法代码示例。如果您正苦于以下问题:C++ ImportParameter::GetRawWayDataMemoryMaped方法的具体用法?C++ ImportParameter::GetRawWayDataMemoryMaped怎么用?C++ ImportParameter::GetRawWayDataMemoryMaped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImportParameter
的用法示例。
在下文中一共展示了ImportParameter::GetRawWayDataMemoryMaped方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Import
bool MergeAreasGenerator::Import(const TypeConfigRef& typeConfig,
const ImportParameter& parameter,
Progress& progress)
{
TypeInfoSet mergeTypes;
FileScanner scanner;
FileWriter writer;
uint32_t areasWritten=0;
for (const auto& type : typeConfig->GetTypes()) {
if (type->CanBeArea() &&
type->GetMergeAreas()) {
mergeTypes.Set(type);
}
}
std::unordered_set<Id> nodeUseMap;
try {
scanner.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
MergeAreaDataGenerator::AREAS_TMP),
FileScanner::Sequential,
parameter.GetRawWayDataMemoryMaped());
if (!ScanAreaNodeIds(progress,
*typeConfig,
scanner,
mergeTypes,
nodeUseMap)) {
return false;
}
uint32_t nodeCount=nodeUseMap.size();
progress.Info("Found "+NumberToString(nodeCount)+" nodes as possible connection points for areas");
/* ------ */
writer.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
AREAS2_TMP));
writer.Write(areasWritten);
while (true) {
TypeInfoSet loadedTypes;
std::vector<AreaMergeData> mergeJob(typeConfig->GetTypeCount());
//
// Load type data
//
progress.SetAction("Collecting area data by type");
if (!GetAreas(parameter,
progress,
*typeConfig,
mergeTypes,
loadedTypes,
nodeUseMap,
scanner,
writer,
mergeJob,
areasWritten)) {
return false;
}
// Merge
progress.SetAction("Merging areas");
for (const auto& type : loadedTypes) {
if (!mergeJob[type->GetIndex()].areas.empty()) {
progress.Info("Merging areas of type "+type->GetName());
MergeAreas(progress,
nodeUseMap,
mergeJob[type->GetIndex()]);
progress.Info("Reduced areas of '"+type->GetName()+"' from "+NumberToString(mergeJob[type->GetIndex()].areaCount)+" to "+NumberToString(mergeJob[type->GetIndex()].areaCount-mergeJob[type->GetIndex()].mergedAway.size()));
mergeJob[type->GetIndex()].areas.clear();
}
}
// Store back merge result
if (!loadedTypes.Empty()) {
if (!WriteMergeResult(progress,
*typeConfig,
scanner,
writer,
loadedTypes,
mergeJob,
areasWritten)) {
return false;
}
mergeTypes.Remove(loadedTypes);
}
if (mergeTypes.Empty()) {
//.........这里部分代码省略.........