本文整理汇总了C++中ImportParameter::GetRawWayBlockSize方法的典型用法代码示例。如果您正苦于以下问题:C++ ImportParameter::GetRawWayBlockSize方法的具体用法?C++ ImportParameter::GetRawWayBlockSize怎么用?C++ ImportParameter::GetRawWayBlockSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImportParameter
的用法示例。
在下文中一共展示了ImportParameter::GetRawWayBlockSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAreas
/**
* Load areas which has a one for the types given by types. If at leats one node
* in one of the outer rings of the areas is marked in nodeUseMap as "used at least twice",
* index it into the areas map.
*
* If the number of indexed areas is bigger than parameter.GetRawWayBlockSize() types are
* dropped form areas until the number is again below the lmit.
*/
bool MergeAreasGenerator::GetAreas(const ImportParameter& parameter,
Progress& progress,
const TypeConfig& typeConfig,
const TypeInfoSet& candidateTypes,
TypeInfoSet& loadedTypes,
const std::unordered_set<Id>& nodeUseMap,
FileScanner& scanner,
FileWriter& writer,
std::vector<AreaMergeData>& mergeJob,
uint32_t& areasWritten)
{
bool firstCall=areasWritten==0; // We are called for the first time
uint32_t areaCount=0;
size_t collectedAreasCount=0;
size_t typesWithAreas=0;
for (auto& data : mergeJob) {
data.areaCount=0;
}
loadedTypes=candidateTypes;
scanner.GotoBegin();
scanner.Read(areaCount);
for (uint32_t a=1; a<=areaCount; a++) {
uint8_t type;
Id id;
AreaRef area=std::make_shared<Area>();
progress.SetProgress(a,areaCount);
scanner.Read(type);
scanner.Read(id);
area->ReadImport(typeConfig,
scanner);
mergeJob[area->GetType()->GetIndex()].areaCount++;
// This is an area of a type that does not get merged,
// we directly store it in the target file.
if (!loadedTypes.IsSet(area->GetType())) {
if (firstCall) {
writer.Write(type);
writer.Write(id);
area->WriteImport(typeConfig,
writer);
areasWritten++;
}
continue;
}
bool isMergeCandidate=false;
for (const auto& ring: area->rings) {
if (!ring.IsOuterRing()) {
continue;
}
for (const auto node : ring.nodes) {
if (nodeUseMap.find(node.GetId())!=nodeUseMap.end()) {
isMergeCandidate=true;
break;
}
}
if (isMergeCandidate) {
break;
}
}
if (!isMergeCandidate) {
continue;
}
if (mergeJob[area->GetType()->GetIndex()].areas.empty()) {
typesWithAreas++;
}
mergeJob[area->GetType()->GetIndex()].areas.push_back(area);
collectedAreasCount++;
while (collectedAreasCount>parameter.GetRawWayBlockSize() &&
typesWithAreas>1) {
TypeInfoRef victimType;
//.........这里部分代码省略.........