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

Method importMap

src/core/map.cpp:616–651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

614
615
616QHash<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
654bool Map::loadFrom(const QString& path, MapView* view)

Callers 3

importTestMethod · 0.45
mergeISOMFunction · 0.45
applyMethod · 0.45

Calls 15

testFlagMethod · 0.80
getMapRefPointMethod · 0.80
toMapCoordFMethod · 0.80
getNumColorsMethod · 0.80
getNumSymbolsMethod · 0.80
determineSymbolsInUseMethod · 0.80
determineColorsInUseMethod · 0.80
importSetMethod · 0.80
importPartMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected