| 614 | |
| 615 | |
| 616 | QHash<const Symbol*, Symbol*> Map::importMap( |
| 617 | const Map& imported_map, |
| 618 | ImportMode mode, |
| 619 | std::vector<bool>* filter, |
| 620 | int symbol_insert_pos, |
| 621 | bool merge_duplicate_symbols) |
| 622 | { |
| 623 | QTransform q_transform; |
| 624 | if (mode.testFlag(GeorefImport)) |
| 625 | { |
| 626 | /// \todo Test and review import of georeferenced and non-georeferenced maps, in all combinations. |
| 627 | /// \todo Handle rotation of patterns and text, cf. Object::transform. |
| 628 | const auto& georef = getGeoreferencing(); |
| 629 | const auto& other_georef = imported_map.getGeoreferencing(); |
| 630 | const auto src_origin = MapCoordF { other_georef.getMapRefPoint() }; |
| 631 | |
| 632 | bool ok0, ok1, ok2; |
| 633 | PassPointList passpoints; |
| 634 | passpoints.resize(3); |
| 635 | passpoints[0].src_coords = src_origin; |
| 636 | passpoints[0].dest_coords = georef.toMapCoordF(&other_georef, passpoints[0].src_coords, &ok0); |
| 637 | passpoints[1].src_coords = src_origin + MapCoordF { 128.0, 0.0 }; // 128 mm off horizontally |
| 638 | passpoints[1].dest_coords = georef.toMapCoordF(&other_georef, passpoints[1].src_coords, &ok1); |
| 639 | passpoints[2].src_coords = src_origin + MapCoordF { 0.0, 128.0 }; // 128 mm off vertically |
| 640 | passpoints[2].dest_coords = georef.toMapCoordF(&other_georef, passpoints[2].src_coords, &ok2); |
| 641 | if (ok0 && ok1 && ok2 |
| 642 | && !passpoints.estimateNonIsometricSimilarityTransform(&q_transform)) |
| 643 | { |
| 644 | /// \todo proper error message |
| 645 | qDebug("Failed to calculate transformation"); |
| 646 | q_transform.reset(); |
| 647 | } |
| 648 | } |
| 649 | |
| 650 | return importMap(imported_map, mode & ~GeorefImport, q_transform, filter, symbol_insert_pos, merge_duplicate_symbols); |
| 651 | } |
| 652 | |
| 653 | |
| 654 | bool Map::loadFrom(const QString& path, MapView* view) |
no test coverage detected