本文整理汇总了C++中ImportParameter::GetOptimizationMaxMag方法的典型用法代码示例。如果您正苦于以下问题:C++ ImportParameter::GetOptimizationMaxMag方法的具体用法?C++ ImportParameter::GetOptimizationMaxMag怎么用?C++ ImportParameter::GetOptimizationMaxMag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImportParameter
的用法示例。
在下文中一共展示了ImportParameter::GetOptimizationMaxMag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Import
bool Import(const ImportParameter& parameter,
Progress& progress)
{
// TODO: verify parameter
TypeConfigRef typeConfig(new TypeConfig());
std::list<ImportModule*> modules;
if (parameter.GetAreaWayMinMag()<=parameter.GetOptimizationMaxMag()) {
progress.Error("Area way index minimum magnification is <= than optimization max magnification");
}
progress.SetStep("Loading type config");
if (!typeConfig->LoadFromOSTFile(parameter.GetTypefile())) {
progress.Error("Cannot load type configuration!");
return false;
}
progress.Info("Number of types: "+NumberToString(typeConfig->GetTypes().size()));
progress.Info("Number of node types: "+NumberToString(typeConfig->GetNodeTypes().size())+" "+NumberToString(typeConfig->GetNodeTypeIdBytes())+" byte(s)");
progress.Info("Number of way types: "+NumberToString(typeConfig->GetWayTypes().size())+" "+NumberToString(typeConfig->GetWayTypeIdBytes())+" byte(s)");
progress.Info("Number of area types: "+NumberToString(typeConfig->GetAreaTypes().size())+" "+NumberToString(typeConfig->GetAreaTypeIdBytes())+" byte(s)");
typeConfig->RegisterNameTag("name",0);
typeConfig->RegisterNameTag("place_name",1);
/*
typeConfig->RegisterNameAltTag("name:ru",0);
typeConfig->RegisterNameAltTag("place_name:ru",1);
*/
/* 1 */
modules.push_back(new TypeDataGenerator());
/* 2 */
modules.push_back(new Preprocess());
/* 3 */
modules.push_back(new RawNodeIndexGenerator(AppendFileToDir(parameter.GetDestinationDirectory(),
"rawnodes.dat"),
AppendFileToDir(parameter.GetDestinationDirectory(),
"rawnode.idx")));
/* 4 */
modules.push_back(new RawWayIndexGenerator(AppendFileToDir(parameter.GetDestinationDirectory(),
"rawways.dat"),
AppendFileToDir(parameter.GetDestinationDirectory(),
"rawway.idx")));
/* 5 */
modules.push_back(new RawRelationIndexGenerator(AppendFileToDir(parameter.GetDestinationDirectory(),
"rawrels.dat"),
AppendFileToDir(parameter.GetDestinationDirectory(),
"rawrel.idx")));
/* 6 */
modules.push_back(new RelAreaDataGenerator());
/* 7 */
modules.push_back(new WayAreaDataGenerator());
/* 8 */
modules.push_back(new MergeAreaDataGenerator());
/* 9 */
modules.push_back(new MergeAreasGenerator());
/* 10 */
modules.push_back(new WayWayDataGenerator());
/* 11 */
modules.push_back(new OptimizeAreaWayIdsGenerator());
/* 12 */
modules.push_back(new NodeDataGenerator());
/* 13 */
modules.push_back(new SortNodeDataGenerator());
/* 14 */
modules.push_back(new SortWayDataGenerator());
/* 15 */
modules.push_back(new AreaNodeIndexGenerator());
/* 16 */
modules.push_back(new AreaWayIndexGenerator());
/* 17 */
modules.push_back(new AreaAreaIndexGenerator());
/* 18 */
modules.push_back(new WaterIndexGenerator());
/* 19 */
modules.push_back(new OptimizeAreasLowZoomGenerator());
/* 20 */
modules.push_back(new OptimizeWaysLowZoomGenerator());
/* 21 */
modules.push_back(new LocationIndexGenerator());
//.........这里部分代码省略.........
示例3: 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;
//.........这里部分代码省略.........