KOSMIndoorMap

navmeshtransform.cpp
1/*
2 SPDX-FileCopyrightText: 2024 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#include "navmeshtransform.h"
7
8#include <osm/geomath.h>
9
10using namespace KOSMIndoorRouting;
11
12void NavMeshTransform::initialize(OSM::BoundingBox bbox)
13{
14 const auto xScale = OSM::distance(bbox.min.lonF(), bbox.center().latF(), bbox.max.lonF(), bbox.center().latF()) / bbox.widthF();
15 const auto yScale = OSM::distance(bbox.center().lonF(), bbox.min.latF(), bbox.center().lonF(), bbox.max.latF()) / bbox.heightF();
16
17 m_transform = QTransform().scale(xScale, yScale).translate(-bbox.center().lonF(), -bbox.center().latF());
18}
Bounding box, ie.
Definition datatypes.h:95
KOSM_EXPORT double distance(double lat1, double lon1, double lat2, double lon2)
Distance between two coordinates.
Definition geomath.cpp:16
QTransform & scale(qreal sx, qreal sy)
QTransform & translate(qreal dx, qreal dy)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.