本文整理汇总了C++中ImportParameter类的典型用法代码示例。如果您正苦于以下问题:C++ ImportParameter类的具体用法?C++ ImportParameter怎么用?C++ ImportParameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImportParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Import
bool OptimizeAreasLowZoomGenerator::Import(const TypeConfigRef& typeConfig,
const ImportParameter& parameter,
Progress& progress)
{
FileOffset indexOffset=0;
FileWriter writer;
Magnification magnification; // Magnification, we optimize for
TypeInfoSet areaTypes; // Types we optimize
std::list<TypeData> areaTypesData;
GetAreaTypesToOptimize(*typeConfig,
areaTypes);
try {
writer.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
OptimizeAreasLowZoom::FILE_AREASOPT_DAT));
//
// Write header
//
writer.WriteFileOffset(indexOffset);
if (!HandleAreas(parameter,
progress,
*typeConfig,
writer,
areaTypes,
areaTypesData)) {
progress.Error("Error while optimizing areas");
return false;
}
// Position of the index
indexOffset=writer.GetPos();
if (!WriteHeader(writer,
areaTypesData,
(uint32_t)parameter.GetOptimizationMaxMag())) {
progress.Error("Cannot write file header");
return false;
}
writer.GotoBegin();
writer.WriteFileOffset(indexOffset);
writer.Close();
}
catch (IOException& e) {
progress.Error(e.GetDescription());
writer.CloseFailsafe();
return false;
}
return true;
}
示例2: Initialize
bool Preprocess::Initialize(const ImportParameter& parameter)
{
coordPageCount=0;
currentPageId=std::numeric_limits<PageId>::max();
nodeCount=0;
wayCount=0;
areaCount=0;
relationCount=0;
coastlineCount=0;
lastNodeId=std::numeric_limits<OSMId>::min();
lastWayId=std::numeric_limits<OSMId>::min();
lastRelationId=std::numeric_limits<OSMId>::min();
nodeSortingError=false;
waySortingError=false;
relationSortingError=false;
nodeWriter.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
"rawnodes.dat"));
nodeWriter.Write(nodeCount);
wayWriter.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
"rawways.dat"));
wayWriter.Write(wayCount+areaCount);
relationWriter.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
"rawrels.dat"));
relationWriter.Write(relationCount);
coastlineWriter.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
"rawcoastline.dat"));
coastlineWriter.Write(coastlineCount);
coordWriter.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
"coord.dat"));
FileOffset offset=0;
coordWriter.Write(coordPageSize);
coordWriter.Write(offset);
coordWriter.FlushCurrentBlockWithZeros(coordPageSize*2*sizeof(uint32_t));
coordPageCount++;
lats.resize(coordPageSize);
lons.resize(coordPageSize);
isSet.resize(coordPageSize);
return !nodeWriter.HasError() &&
!wayWriter.HasError() &&
!relationWriter.HasError() &&
!coastlineWriter.HasError() &&
!coordWriter.HasError();
}
示例3: GetAreas
bool OptimizeAreasLowZoomGenerator::GetAreas(const TypeConfig& typeConfig,
const ImportParameter& parameter,
Progress& progress,
FileScanner& scanner,
const TypeInfoSet& types,
std::vector<std::list<AreaRef> >& areas,
TypeInfoSet& loadedTypes)
{
uint32_t areaCount=0;
size_t collectedAreasCount=0;
loadedTypes=types;
progress.SetAction("Collecting area data to optimize");
scanner.GotoBegin();
scanner.Read(areaCount);
for (uint32_t a=1; a<=areaCount; a++) {
AreaRef area=std::make_shared<Area>();
progress.SetProgress(a,areaCount);
area->Read(typeConfig,
scanner);
if (loadedTypes.IsSet(area->GetType())) {
areas[area->GetType()->GetIndex()].push_back(area);
collectedAreasCount++;
while (collectedAreasCount>parameter.GetOptimizationMaxWayCount() &&
loadedTypes.Size()>1) {
TypeInfoRef victimType;
for (auto &type : loadedTypes) {
if (areas[type->GetIndex()].size()>0 &&
(!victimType ||
areas[type->GetIndex()].size()<areas[victimType->GetIndex()].size())) {
victimType=type;
}
}
assert(victimType);
collectedAreasCount-=areas[victimType->GetIndex()].size();
areas[victimType->GetIndex()].clear();
loadedTypes.Remove(victimType);
}
}
}
progress.Info("Collected "+NumberToString(collectedAreasCount)+" areas for "+NumberToString(loadedTypes.Size())+" types");
return !scanner.HasError();
}
示例4: ExecuteModules
static bool ExecuteModules(std::list<ImportModule*>& modules,
const ImportParameter& parameter,
Progress& progress,
const TypeConfigRef& typeConfig)
{
StopClock overAllTimer;
size_t currentStep=1;
for (const auto& module : modules) {
if (currentStep>=parameter.GetStartStep() &&
currentStep<=parameter.GetEndStep()) {
StopClock timer;
bool success;
progress.SetStep(std::string("Step #")+
NumberToString(currentStep)+
" - "+
module->GetDescription());
success=module->Import(typeConfig,
parameter,
progress);
timer.Stop();
progress.Info(std::string("=> ")+timer.ResultString()+" second(s)");
if (!success) {
progress.Error(std::string("Error while executing step '")+module->GetDescription()+"'!");
return false;
}
}
currentStep++;
}
overAllTimer.Stop();
progress.Info(std::string("=> ")+overAllTimer.ResultString()+" second(s)");
return true;
}
示例5: FitsIndexCriteria
bool AreaWayIndexGenerator::FitsIndexCriteria(const ImportParameter& parameter,
Progress& progress,
const TypeInfo& typeInfo,
const TypeData& typeData,
const CoordCountMap& cellFillCount)
{
if (typeData.indexCells==0) {
return true;
}
size_t entryCount=0;
size_t max=0;
for (CoordCountMap::const_iterator cell=cellFillCount.begin();
cell!=cellFillCount.end();
++cell) {
entryCount+=cell->second;
max=std::max(max,cell->second);
}
// Average number of entries per tile cell
double average=entryCount*1.0/cellFillCount.size();
// If the fill rate of the index is too low, we use this index level anyway
if (typeData.indexCells/(1.0*typeData.cellXCount*typeData.cellYCount)<=
parameter.GetAreaWayIndexMinFillRate()) {
progress.Warning(typeInfo.GetName()+" ("+NumberToString(typeInfo.GetId())+") is not well distributed");
return true;
}
// If average fill size and max fill size for tile cells
// is within limits, store it now.
if (max<=parameter.GetAreaWayIndexCellSizeMax() &&
average<=parameter.GetAreaWayIndexCellSizeAverage()) {
return true;
}
return false;
}
示例6: ProcessFiles
bool Preprocess::ProcessFiles(const TypeConfigRef& typeConfig,
const ImportParameter& parameter,
Progress& progress,
Callback& callback)
{
for (const auto& filename : parameter.GetMapfiles()) {
if (filename.length()>=4 &&
filename.substr(filename.length()-4)==".osm") {
#if defined(HAVE_LIB_XML)
PreprocessOSM preprocess(callback);
if (!preprocess.Import(typeConfig,
parameter,
progress,
filename)) {
return false;
}
#else
progress.Error("Support for the OSM file format is not enabled!");
return false;
#endif
}
else if (filename.length()>=4 &&
filename.substr(filename.length()-4)==".pbf") {
#if defined(HAVE_LIB_PROTOBUF)
PreprocessPBF preprocess(callback);
if (!preprocess.Import(typeConfig,
parameter,
progress,
filename)) {
return false;
}
#else
progress.Error("Support for the PBF file format is not enabled!");
return false;
#endif
}
else {
progress.Error("Sorry, this file type is not yet supported!");
return false;
}
}
return true;
}
示例7: WriteIndexLevel
bool AreaAreaIndexGenerator::WriteIndexLevel(const ImportParameter& parameter,
FileWriter& writer,
int level,
std::map<Pixel,AreaLeaf>& leafs)
{
for (std::map<Pixel,AreaLeaf>::iterator leaf=leafs.begin();
leaf!=leafs.end();
++leaf) {
writer.GetPos(leaf->second.offset);
assert(!leaf->second.areas.empty() ||
leaf->second.children[0]!=0 ||
leaf->second.children[1]!=0 ||
leaf->second.children[2]!=0 ||
leaf->second.children[3]!=0);
if (level<(int)parameter.GetAreaAreaIndexMaxMag()) {
for (size_t c=0; c<4; c++) {
if (leaf->second.children[c]==0) {
writer.WriteNumber(0);
}
else {
writer.WriteNumber(leaf->second.children[c]);
}
}
}
FileOffset lastOffset;
// Areas
writer.WriteNumber((uint32_t)leaf->second.areas.size());
lastOffset=0;
for (std::list<Entry>::const_iterator entry=leaf->second.areas.begin();
entry!=leaf->second.areas.end();
entry++) {
writer.WriteNumber(entry->type);
// Since objects are inserted in file position order, we do not need
// to sort objects by file offset at this place
writer.WriteNumber(entry->offset-lastOffset);
lastOffset=entry->offset;
}
}
return !writer.HasError();
}
示例8: BeforeProcessingStart
bool WayLocationProcessorFilter::BeforeProcessingStart(const ImportParameter& parameter,
Progress& progress,
const TypeConfig& typeConfig)
{
overallDataCount=0;
nameReader=new NameFeatureValueReader(typeConfig);
locationReader=new LocationFeatureValueReader(typeConfig);
try {
writer.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
SortWayDataGenerator::WAYADDRESS_DAT));
writer.Write(overallDataCount);
}
catch (IOException& e) {
progress.Error(e.GetDescription());
return false;
}
return true;
}
示例9: Import
bool Preprocess::Import(const ImportParameter& parameter,
Progress& progress,
const TypeConfig& typeConfig)
{
if (parameter.GetMapfile().length()>=4 &&
parameter.GetMapfile().substr(parameter.GetMapfile().length()-4)==".osm") {
#if defined(HAVE_LIB_XML)
PreprocessOSM preprocess;
return preprocess.Import(parameter,
progress,
typeConfig);
#else
progress.Error("Support for the OSM file format is not enabled!");
#endif
}
if (parameter.GetMapfile().length()>=4 &&
parameter.GetMapfile().substr(parameter.GetMapfile().length()-4)==".pbf") {
#if defined(HAVE_LIB_PROTOBUF)
PreprocessPBF preprocess;
return preprocess.Import(parameter,
progress,
typeConfig);
#else
progress.Error("Support for the PBF file format is not enabled!");
return false;
#endif
}
progress.Error("Sorry, this file type is not yet supported!");
return false;
}
示例10: HandleAreas
bool OptimizeAreasLowZoomGenerator::HandleAreas(const ImportParameter& parameter,
Progress& progress,
const TypeConfig& typeConfig,
FileWriter& writer,
const TypeInfoSet& types,
std::list<TypeData>& typesData)
{
FileScanner scanner;
// Everything smaller than 2mm should get dropped. Width, height and DPI come from the Nexus 4
double dpi=320.0;
double pixel=2.0/* mm */ * dpi / 25.4 /* inch */;
progress.Info("Minimum visible size in pixel: "+NumberToString((unsigned long)pixel));
try {
scanner.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
AreaDataFile::AREAS_DAT),
FileScanner::Sequential,
parameter.GetWayDataMemoryMaped());
TypeInfoSet typesToProcess(types);
std::vector<std::list<AreaRef> > allAreas(typeConfig.GetTypeCount());
while (true) {
//
// Load type data
//
TypeInfoSet loadedTypes;
if (!GetAreas(typeConfig,
parameter,
progress,
scanner,
typesToProcess,
allAreas,
loadedTypes)) {
return false;
}
typesToProcess.Remove(loadedTypes);
for (const auto& type : loadedTypes) {
progress.SetAction("Optimizing type "+ type->GetName());
for (uint32_t level=parameter.GetOptimizationMinMag();
level<=parameter.GetOptimizationMaxMag();
level++) {
Magnification magnification; // Magnification, we optimize for
std::list<AreaRef> optimizedAreas;
magnification.SetLevel(level);
OptimizeAreas(allAreas[type->GetIndex()],
optimizedAreas,
1280,768,
dpi,
pixel,
magnification,
parameter.GetOptimizationWayMethod());
if (optimizedAreas.empty()) {
progress.Debug("Empty optimization result for level "+NumberToString(level)+", no index generated");
TypeData typeData;
typeData.type=type;
typeData.optLevel=level;
typesData.push_back(typeData);
continue;
}
progress.Info("Optimized from "+NumberToString(allAreas[type->GetIndex()].size())+" to "+NumberToString(optimizedAreas.size())+" areas");
/*
size_t optAreas=optimizedAreas.size();
size_t optRoles=0;
size_t optNodes=0;
for (std::list<AreaRef>::const_iterator a=optimizedAreas.begin();
a!=optimizedAreas.end();
++a) {
AreaRef area=*a;
optRoles+=area->rings.size();
for (size_t r=0; r<area->rings.size(); r++) {
optNodes+=area->rings[r].nodes.size();
}
}*/
/*
std::cout << "Areas: " << origAreas << " => " << optAreas << std::endl;
std::cout << "Roles: " << origRoles << " => " << optRoles << std::endl;
std::cout << "Nodes: " << origNodes << " => " << optNodes << std::endl;*/
TypeData typeData;
//.........这里部分代码省略.........
示例11: Import
bool AreaAreaIndexGenerator::Import(const TypeConfigRef& typeConfig,
const ImportParameter& parameter,
Progress& progress)
{
FileScanner scanner;
size_t areas=0; // Number of areas found
size_t areasConsumed=0; // Number of areas consumed
std::vector<double> cellWidth;
std::vector<double> cellHeight;
std::map<Pixel,AreaLeaf> leafs;
std::map<Pixel,AreaLeaf> newAreaLeafs;
cellWidth.resize(parameter.GetAreaAreaIndexMaxMag()+1);
cellHeight.resize(parameter.GetAreaAreaIndexMaxMag()+1);
for (size_t i=0; i<cellWidth.size(); i++) {
cellWidth[i]=360.0/pow(2.0,(int)i);
}
for (size_t i=0; i<cellHeight.size(); i++) {
cellHeight[i]=180.0/pow(2.0,(int)i);
}
//
// Writing index file
//
progress.SetAction("Generating 'areaarea.idx'");
FileWriter writer;
FileOffset topLevelOffset=0;
FileOffset topLevelOffsetOffset; // Offset of the toplevel entry
if (!writer.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
"areaarea.idx"))) {
progress.Error("Cannot create 'areaarea.idx'");
return false;
}
if (!scanner.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
"areas.dat"),
FileScanner::Sequential,
parameter.GetWayDataMemoryMaped())) {
progress.Error("Cannot open 'areas.dat'");
return false;
}
writer.WriteNumber((uint32_t)parameter.GetAreaAreaIndexMaxMag()); // MaxMag
if (!writer.GetPos(topLevelOffsetOffset)) {
progress.Error("Cannot read current file position");
return false;
}
if (!writer.WriteFileOffset(topLevelOffset)) {
progress.Error("Cannot write top level entry offset");
return false;
}
int l=parameter.GetAreaAreaIndexMaxMag();
while (l>=0) {
size_t areaLevelEntries=0;
progress.Info(std::string("Storing level ")+NumberToString(l)+"...");
newAreaLeafs.clear();
SetOffsetOfChildren(leafs,newAreaLeafs);
leafs=newAreaLeafs;
// Areas
if (areas==0 ||
(areas>0 && areas>areasConsumed)) {
uint32_t areaCount=0;
progress.Info(std::string("Scanning areas.dat for areas of index level ")+NumberToString(l)+"...");
if (!scanner.GotoBegin()) {
progress.Error("Cannot go to begin of way file");
}
if (!scanner.Read(areaCount)) {
progress.Error("Error while reading number of data entries in file");
return false;
}
areas=0;
for (uint32_t a=1; a<=areaCount; a++) {
progress.SetProgress(a,areaCount);
FileOffset offset;
Area area;
scanner.GetPos(offset);
if (!area.Read(typeConfig,
scanner)) {
//.........这里部分代码省略.........
示例12: 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()) {
//.........这里部分代码省略.........
示例13: 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;
//.........这里部分代码省略.........
示例14: ScanAreaIds
bool OptimizeAreaWayIdsGenerator::ScanAreaIds(const ImportParameter& parameter,
Progress& progress,
const TypeConfig& typeConfig,
NodeUseMap& nodeUseMap)
{
FileScanner scanner;
uint32_t dataCount=0;
progress.SetAction("Scanning ids from 'areas2.tmp'");
if (!scanner.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
"areas2.tmp"),
FileScanner::Sequential,
parameter.GetAreaDataMemoryMaped())) {
progress.Error(std::string("Cannot open '")+scanner.GetFilename()+"'");
return false;
}
if (!scanner.Read(dataCount)) {
progress.Error("Error while reading number of data entries in file");
return false;
}
for (uint32_t current=1; current<=dataCount; current++) {
uint8_t type;
Id id;
Area data;
progress.SetProgress(current,dataCount);
if (!scanner.Read(type) ||
!scanner.Read(id) ||
!data.ReadImport(typeConfig,
scanner)) {
progress.Error(std::string("Error while reading data entry ")+
NumberToString(current)+" of "+
NumberToString(dataCount)+
" in file '"+
scanner.GetFilename()+"'");
return false;
}
for (const auto& ring: data.rings) {
std::unordered_set<Id> nodeIds;
if (!ring.GetType()->CanRoute()) {
continue;
}
for (const auto id: ring.ids) {
if (nodeIds.find(id)==nodeIds.end()) {
nodeUseMap.SetNodeUsed(id);
nodeIds.insert(id);
}
}
}
}
if (!scanner.Close()) {
progress.Error(std::string("Error while closing file '")+
scanner.GetFilename()+"'");
return false;
}
return true;
}
示例15: CopyWays
bool OptimizeAreaWayIdsGenerator::CopyWays(const ImportParameter& parameter,
Progress& progress,
const TypeConfig& typeConfig,
NodeUseMap& nodeUseMap)
{
FileScanner scanner;
FileWriter writer;
uint32_t dataCount=0;
progress.SetAction("Copy data from 'wayway.tmp' to 'ways.tmp'");
if (!scanner.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
"wayway.tmp"),
FileScanner::Sequential,
parameter.GetWayDataMemoryMaped())) {
progress.Error(std::string("Cannot open '")+scanner.GetFilename()+"'");
return false;
}
if (!scanner.Read(dataCount)) {
progress.Error("Error while reading number of data entries in file");
return false;
}
if (!writer.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
"ways.tmp"))) {
progress.Error(std::string("Cannot create '")+writer.GetFilename()+"'");
return false;
}
writer.Write(dataCount);
for (uint32_t current=1; current<=dataCount; current++) {
uint8_t type;
Id id;
Way data;
progress.SetProgress(current,dataCount);
if (!scanner.Read(type) ||
!scanner.Read(id) ||
!data.Read(typeConfig,
scanner)) {
progress.Error(std::string("Error while reading data entry ")+
NumberToString(current)+" of "+
NumberToString(dataCount)+
" in file '"+
scanner.GetFilename()+"'");
return false;
}
for (auto& id : data.ids) {
if (!nodeUseMap.IsNodeUsedAtLeastTwice(id)) {
id=0;
}
}
if (!writer.Write(type) ||
!writer.Write(id) ||
!data.Write(typeConfig,
writer)) {
progress.Error(std::string("Error while writing data entry to file '")+
writer.GetFilename()+"'");
return false;
}
}
if (!scanner.Close()) {
progress.Error(std::string("Error while closing file '")+
scanner.GetFilename()+"'");
return false;
}
if (!writer.Close()) {
progress.Error(std::string("Error while closing file '")+
writer.GetFilename()+"'");
return false;
}
return true;
}