| 4206 | } |
| 4207 | |
| 4208 | bool 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 | |
| 4240 | bool MapEditorController::importMapWithReplacement( |
nothing calls this directly
no test coverage detected