diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2021-10-25 12:47:39 +0200 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2021-10-27 11:24:58 +0200 |
commit | e7bc51e4c5c07389c1d028e7a42c238688ca43ee (patch) | |
tree | c3f861e22b32f90e017b168a1b2a3ac0fccf17f1 /src/location/declarativemaps/qdeclarativepolylinemapitem.cpp | |
parent | 23f32792ad53e23bbafbff6d7667f0bb0f69fc53 (diff) | |
download | qtlocation-e7bc51e4c5c07389c1d028e7a42c238688ca43ee.tar.gz |
QtLocation: adapt to build with external QtPositioning
This includes fixing some includes to use the full path to
QtPositioing/private/header_name_p.h and also fixes related to the
reworked clipper wrapper.
Task-number: QTBUG-97084
Change-Id: I15ce8d739beb2f190df9f5af01a7cb1642a6b2a2
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/declarativemaps/qdeclarativepolylinemapitem.cpp')
-rw-r--r-- | src/location/declarativemaps/qdeclarativepolylinemapitem.cpp | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp index 9d5472ab..88ebef25 100644 --- a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp +++ b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp @@ -38,11 +38,11 @@ #include "qdeclarativepolylinemapitem_p_p.h" #include "qdeclarativerectanglemapitem_p_p.h" #include "qdeclarativecirclemapitem_p_p.h" -#include "qlocationutils_p.h" +#include <QtPositioning/private/qlocationutils_p.h> #include "qdeclarativegeomapitemutils_p.h" #include "error_messages_p.h" #include "locationvaluetypehelper_p.h" -#include "qdoublevector2d_p.h" +#include <QtPositioning/private/qdoublevector2d_p.h> #include <QtLocation/private/qgeomap_p.h> #include <QtPositioning/private/qwebmercator_p.h> @@ -87,18 +87,6 @@ struct ThreadPool // to have a thread pool with max 1 thread for geometry proces Q_GLOBAL_STATIC(ThreadPool, threadPool) -static const double kClipperScaleFactor = 281474976710656.0; // 48 bits of precision - -static inline IntPoint toIntPoint(const double x, const double y) -{ - return IntPoint(cInt(x * kClipperScaleFactor), cInt(y * kClipperScaleFactor)); -} - -static IntPoint toIntPoint(const QDoubleVector2D &p) -{ - return toIntPoint(p.x(), p.y()); -} - static bool get_line_intersection(const double p0_x, const double p0_y, const double p1_x, @@ -161,13 +149,6 @@ static QList<QList<QDoubleVector2D> > clipLine( edges.push_back({ { poly.at(i-1).x(), poly.at(i-1).y(), poly.at(i).x(), poly.at(i).y() } }); edges.push_back({ { poly.at(poly.size()-1).x(), poly.at(poly.size()-1).y(), poly.at(0).x(), poly.at(0).y() } }); - // Build Path to check for containment, for edges not intersecting - // This step could be speeded up by forcing the orientation of the polygon, and testing the cross products in the step - // below, thus avoiding to resort to clipper. - Path clip; - for (const auto &v: poly) - clip.push_back(toIntPoint(v)); - // Step 2: check each segment against each edge QList<QDoubleVector2D> subLine; std::array<double, 4> intersections = { { 0.0, 0.0, 0.0, 0.0 } }; @@ -178,8 +159,8 @@ static QList<QList<QDoubleVector2D> > clipLine( double previousT = t; double i_x, i_y; - const int firstContained = c2t::clip2tri::pointInPolygon(toIntPoint(l.at(i).x(), l.at(i).y()), clip); - const int secondContained = c2t::clip2tri::pointInPolygon(toIntPoint(l.at(i+1).x(), l.at(i+1).y()), clip); + const int firstContained = QClipperUtils::pointInPolygon(l.at(i), poly); + const int secondContained = QClipperUtils::pointInPolygon(l.at(i+1), poly); if (firstContained && secondContained) { // Second most common condition, test early and skip inner loop if possible if (!subLine.size()) |