MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / importOgrFile

Method importOgrFile

src/gui/map/map_editor.cpp:4208–4237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4206}
4207
4208bool MapEditorController::importOgrFile(const QString& filename)
4209{
4210#if MAPPER_USE_GDAL
4211 OgrTemplate ogr_template {filename, map};
4212 if (!ogr_template.setupAndLoad(window, main_view))
4213 return false;
4214
4215 auto template_map = ogr_template.takeTemplateMap();
4216 if (Q_UNLIKELY(!template_map))
4217 return false;
4218
4219 TemplateTransform transform;
4220 if (!ogr_template.isTemplateGeoreferenced())
4221 {
4222 ogr_template.getTransform(transform);
4223 template_map->applyOnAllObjects(transform.makeObjectTransform());
4224 template_map->setGeoreferencing(map->getGeoreferencing());
4225 }
4226 auto template_scale = (transform.template_scale_x + transform.template_scale_y) / 2;
4227 template_scale *= qreal(template_map->getScaleDenominator()) / map->getScaleDenominator();
4228 if (!qFuzzyCompare(template_scale, 1))
4229 {
4230 template_map->scaleAllSymbols(template_scale);
4231 }
4232
4233 return importMapWithReplacement(*template_map, Map::MinimalObjectImport | Map::GeorefImport, filename);
4234#else
4235 return false;
4236#endif
4237}
4238
4239
4240bool MapEditorController::importMapWithReplacement(

Callers

nothing calls this directly

Calls 9

setupAndLoadMethod · 0.80
takeTemplateMapMethod · 0.80
getTransformMethod · 0.80
makeObjectTransformMethod · 0.80
setGeoreferencingMethod · 0.80
scaleAllSymbolsMethod · 0.80
applyOnAllObjectsMethod · 0.45
getScaleDenominatorMethod · 0.45

Tested by

no test coverage detected