diff --git a/vcpkg/ports/qgis-qt6/poly2tri.patch b/vcpkg/ports/qgis-qt6/poly2tri.patch deleted file mode 100644 index f288176965..0000000000 --- a/vcpkg/ports/qgis-qt6/poly2tri.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --color -ur a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt 2022-08-11 11:41:29.950949570 +0200 -+++ b/CMakeLists.txt 2022-08-11 11:41:58.519950745 +0200 -@@ -389,7 +389,7 @@ - endif() - - if (NOT WITH_INTERNAL_POLY2TRI) -- find_package(Poly2Tri REQUIRED) -+ find_package(poly2tri REQUIRED) - endif() - - if (WITH_SPATIALITE) diff --git a/vcpkg/ports/qgis-qt6/poly2tri/common/shapes.h b/vcpkg/ports/qgis-qt6/poly2tri/common/shapes.h deleted file mode 100644 index 5b90ea6c3d..0000000000 --- a/vcpkg/ports/qgis-qt6/poly2tri/common/shapes.h +++ /dev/null @@ -1,325 +0,0 @@ -/* - * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Include guard -#ifndef SHAPES_H -#define SHAPES_H - -#include -#include -#include -#include - -namespace p2t { - -struct Edge; - -struct Point { - - double x, y; - - /// Default constructor does nothing (for performance). - Point() - { - x = 0.0; - y = 0.0; - } - - /// The edges this point constitutes an upper ending point - std::vector edge_list; - - /// Construct using coordinates. - Point(double x, double y) : x(x), y(y) {} - - /// Set this point to all zeros. - void set_zero() - { - x = 0.0; - y = 0.0; - } - - /// Set this point to some specified coordinates. - void set(double x_, double y_) - { - x = x_; - y = y_; - } - - /// Negate this point. - Point operator -() const - { - Point v; - v.set(-x, -y); - return v; - } - - /// Add a point to this point. - void operator +=(const Point& v) - { - x += v.x; - y += v.y; - } - - /// Subtract a point from this point. - void operator -=(const Point& v) - { - x -= v.x; - y -= v.y; - } - - /// Multiply this point by a scalar. - void operator *=(double a) - { - x *= a; - y *= a; - } - - /// Get the length of this point (the norm). - double Length() const - { - return std::sqrt(x * x + y * y); - } - - /// Convert this point into a unit point. Returns the Length. - double Normalize() - { - double len = Length(); - x /= len; - y /= len; - return len; - } - -}; - -// Represents a simple polygon's edge -struct Edge { - - Point* p, *q; - - /// Constructor - Edge(Point& p1, Point& p2) : p(&p1), q(&p2) - { - if (p1.y > p2.y) { - q = &p1; - p = &p2; - } else if (p1.y == p2.y) { - if (p1.x > p2.x) { - q = &p1; - p = &p2; - } else if (p1.x == p2.x) { - // Repeat points - assert(false); - } - } - - q->edge_list.push_back(this); - } -}; - -// Triangle-based data structures are know to have better performance than quad-edge structures -// See: J. Shewchuk, "Triangle: Engineering a 2D Quality Mesh Generator and Delaunay Triangulator" -// "Triangulations in CGAL" -class Triangle { -public: - -/// Constructor -Triangle(Point& a, Point& b, Point& c); - -/// Flags to determine if an edge is a Constrained edge -bool constrained_edge[3]; -/// Flags to determine if an edge is a Delauney edge -bool delaunay_edge[3]; - -Point* GetPoint(const int& index); -Point* PointCW(Point& point); -Point* PointCCW(Point& point); -Point* OppositePoint(Triangle& t, Point& p); - -Triangle* GetNeighbor(const int& index); -void MarkNeighbor(Point* p1, Point* p2, Triangle* t); -void MarkNeighbor(Triangle& t); - -void MarkConstrainedEdge(const int index); -void MarkConstrainedEdge(Edge& edge); -void MarkConstrainedEdge(Point* p, Point* q); - -int Index(const Point* p); -int EdgeIndex(const Point* p1, const Point* p2); - -Triangle* NeighborCW(Point& point); -Triangle* NeighborCCW(Point& point); -bool GetConstrainedEdgeCCW(Point& p); -bool GetConstrainedEdgeCW(Point& p); -void SetConstrainedEdgeCCW(Point& p, bool ce); -void SetConstrainedEdgeCW(Point& p, bool ce); -bool GetDelunayEdgeCCW(Point& p); -bool GetDelunayEdgeCW(Point& p); -void SetDelunayEdgeCCW(Point& p, bool e); -void SetDelunayEdgeCW(Point& p, bool e); - -bool Contains(Point* p); -bool Contains(const Edge& e); -bool Contains(Point* p, Point* q); -void Legalize(Point& point); -void Legalize(Point& opoint, Point& npoint); -/** - * Clears all references to all other triangles and points - */ -void Clear(); -void ClearNeighbor(Triangle *triangle ); -void ClearNeighbors(); -void ClearDelunayEdges(); - -inline bool IsInterior(); -inline void IsInterior(bool b); - -Triangle& NeighborAcross(Point& opoint); - -void DebugPrint(); - -private: - -/// Triangle points -Point* points_[3]; -/// Neighbor list -Triangle* neighbors_[3]; - -/// Has this triangle been marked as an interior triangle? -bool interior_; -}; - -inline bool cmp(const Point* a, const Point* b) -{ - if (a->y < b->y) { - return true; - } else if (a->y == b->y) { - // Make sure q is point with greater x value - if (a->x < b->x) { - return true; - } - } - return false; -} - -/// Add two points_ component-wise. -inline Point operator +(const Point& a, const Point& b) -{ - return Point(a.x + b.x, a.y + b.y); -} - -/// Subtract two points_ component-wise. -inline Point operator -(const Point& a, const Point& b) -{ - return Point(a.x - b.x, a.y - b.y); -} - -/// Multiply point by scalar -inline Point operator *(double s, const Point& a) -{ - return Point(s * a.x, s * a.y); -} - -inline bool operator ==(const Point& a, const Point& b) -{ - return a.x == b.x && a.y == b.y; -} - -inline bool operator !=(const Point& a, const Point& b) -{ - return !(a.x == b.x) && !(a.y == b.y); -} - -/// Peform the dot product on two vectors. -inline double Dot(const Point& a, const Point& b) -{ - return a.x * b.x + a.y * b.y; -} - -/// Perform the cross product on two vectors. In 2D this produces a scalar. -inline double Cross(const Point& a, const Point& b) -{ - return a.x * b.y - a.y * b.x; -} - -/// Perform the cross product on a point and a scalar. In 2D this produces -/// a point. -inline Point Cross(const Point& a, double s) -{ - return Point(s * a.y, -s * a.x); -} - -/// Perform the cross product on a scalar and a point. In 2D this produces -/// a point. -inline Point Cross(const double s, const Point& a) -{ - return Point(-s * a.y, s * a.x); -} - -inline Point* Triangle::GetPoint(const int& index) -{ - return points_[index]; -} - -inline Triangle* Triangle::GetNeighbor(const int& index) -{ - return neighbors_[index]; -} - -inline bool Triangle::Contains(Point* p) -{ - return p == points_[0] || p == points_[1] || p == points_[2]; -} - -inline bool Triangle::Contains(const Edge& e) -{ - return Contains(e.p) && Contains(e.q); -} - -inline bool Triangle::Contains(Point* p, Point* q) -{ - return Contains(p) && Contains(q); -} - -inline bool Triangle::IsInterior() -{ - return interior_; -} - -inline void Triangle::IsInterior(bool b) -{ - interior_ = b; -} - -} - -#endif - - diff --git a/vcpkg/ports/qgis-qt6/poly2tri/common/utils.h b/vcpkg/ports/qgis-qt6/poly2tri/common/utils.h deleted file mode 100644 index 8744b6d240..0000000000 --- a/vcpkg/ports/qgis-qt6/poly2tri/common/utils.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef UTILS_H -#define UTILS_H - -// Otherwise #defines like M_PI are undeclared under Visual Studio -#define _USE_MATH_DEFINES - -#include -#include - -#ifndef M_PI -#define M_PI (3.14159265358979323846) -#endif - -namespace p2t { - -const double PI_3div4 = 3 * M_PI / 4; -const double PI_div2 = 1.57079632679489661923; -const double EPSILON = 1e-12; - -enum Orientation { CW, CCW, COLLINEAR }; - -/** - * Forumla to calculate signed area
- * Positive if CCW
- * Negative if CW
- * 0 if collinear
- *
- * A[P1,P2,P3]  =  (x1*y2 - y1*x2) + (x2*y3 - y2*x3) + (x3*y1 - y3*x1)
- *              =  (x1-x3)*(y2-y3) - (y1-y3)*(x2-x3)
- * 
- */ -Orientation Orient2d(Point& pa, Point& pb, Point& pc) -{ - double detleft = (pa.x - pc.x) * (pb.y - pc.y); - double detright = (pa.y - pc.y) * (pb.x - pc.x); - double val = detleft - detright; - if (val > -EPSILON && val < EPSILON) { - return COLLINEAR; - } else if (val > 0) { - return CCW; - } - return CW; -} - -/* -bool InScanArea(Point& pa, Point& pb, Point& pc, Point& pd) -{ - double pdx = pd.x; - double pdy = pd.y; - double adx = pa.x - pdx; - double ady = pa.y - pdy; - double bdx = pb.x - pdx; - double bdy = pb.y - pdy; - - double adxbdy = adx * bdy; - double bdxady = bdx * ady; - double oabd = adxbdy - bdxady; - - if (oabd <= EPSILON) { - return false; - } - - double cdx = pc.x - pdx; - double cdy = pc.y - pdy; - - double cdxady = cdx * ady; - double adxcdy = adx * cdy; - double ocad = cdxady - adxcdy; - - if (ocad <= EPSILON) { - return false; - } - - return true; -} - -*/ - -bool InScanArea(Point& pa, Point& pb, Point& pc, Point& pd) -{ - double oadb = (pa.x - pb.x)*(pd.y - pb.y) - (pd.x - pb.x)*(pa.y - pb.y); - if (oadb >= -EPSILON) { - return false; - } - - double oadc = (pa.x - pc.x)*(pd.y - pc.y) - (pd.x - pc.x)*(pa.y - pc.y); - if (oadc <= EPSILON) { - return false; - } - return true; -} - -} - -#endif - diff --git a/vcpkg/ports/qgis-qt6/poly2tri/poly2tri.h b/vcpkg/ports/qgis-qt6/poly2tri/poly2tri.h deleted file mode 100644 index 042cb3dcb3..0000000000 --- a/vcpkg/ports/qgis-qt6/poly2tri/poly2tri.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef POLY2TRI_H -#define POLY2TRI_H - -#include "common/shapes.h" -#include "sweep/cdt.h" - -#endif - diff --git a/vcpkg/ports/qgis-qt6/poly2tri/sweep/advancing_front.h b/vcpkg/ports/qgis-qt6/poly2tri/sweep/advancing_front.h deleted file mode 100644 index bab73d449c..0000000000 --- a/vcpkg/ports/qgis-qt6/poly2tri/sweep/advancing_front.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ADVANCED_FRONT_H -#define ADVANCED_FRONT_H - -#include "../common/shapes.h" - -namespace p2t { - -struct Node; - -// Advancing front node -struct Node { - Point* point; - Triangle* triangle; - - Node* next; - Node* prev; - - double value; - - Node(Point& p) : point(&p), triangle(NULL), next(NULL), prev(NULL), value(p.x) - { - } - - Node(Point& p, Triangle& t) : point(&p), triangle(&t), next(NULL), prev(NULL), value(p.x) - { - } - -}; - -// Advancing front -class AdvancingFront { -public: - -AdvancingFront(Node& head, Node& tail); -// Destructor -~AdvancingFront(); - -Node* head(); -void set_head(Node* node); -Node* tail(); -void set_tail(Node* node); -Node* search(); -void set_search(Node* node); - -/// Locate insertion point along advancing front -Node* LocateNode(const double& x); - -Node* LocatePoint(const Point* point); - -private: - -Node* head_, *tail_, *search_node_; - -Node* FindSearchNode(const double& x); -}; - -inline Node* AdvancingFront::head() -{ - return head_; -} -inline void AdvancingFront::set_head(Node* node) -{ - head_ = node; -} - -inline Node* AdvancingFront::tail() -{ - return tail_; -} -inline void AdvancingFront::set_tail(Node* node) -{ - tail_ = node; -} - -inline Node* AdvancingFront::search() -{ - return search_node_; -} - -inline void AdvancingFront::set_search(Node* node) -{ - search_node_ = node; -} - -} - -#endif diff --git a/vcpkg/ports/qgis-qt6/poly2tri/sweep/cdt.h b/vcpkg/ports/qgis-qt6/poly2tri/sweep/cdt.h deleted file mode 100644 index e7b703de1b..0000000000 --- a/vcpkg/ports/qgis-qt6/poly2tri/sweep/cdt.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CDT_H -#define CDT_H - -#include "advancing_front.h" -#include "sweep_context.h" -#include "sweep.h" - -/** - * - * @author Mason Green - * - */ - -namespace p2t { - -class CDT -{ -public: - - /** - * Constructor - add polyline with non repeating points - * - * @param polyline - */ - CDT(std::vector polyline); - - /** - * Destructor - clean up memory - */ - ~CDT(); - - /** - * Add a hole - * - * @param polyline - */ - void AddHole(std::vector polyline); - - /** - * Add a steiner point - * - * @param point - */ - void AddPoint(Point* point); - - /** - * Triangulate - do this AFTER you've added the polyline, holes, and Steiner points - */ - void Triangulate(); - - /** - * Get CDT triangles - */ - std::vector GetTriangles(); - - /** - * Get triangle map - */ - std::list GetMap(); - - private: - - /** - * Internals - */ - - SweepContext* sweep_context_; - Sweep* sweep_; - -}; - -} - -#endif diff --git a/vcpkg/ports/qgis-qt6/poly2tri/sweep/sweep.h b/vcpkg/ports/qgis-qt6/poly2tri/sweep/sweep.h deleted file mode 100644 index 9bb0b5d869..0000000000 --- a/vcpkg/ports/qgis-qt6/poly2tri/sweep/sweep.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** - * Sweep-line, Constrained Delauney Triangulation (CDT) See: Domiter, V. and - * Zalik, B.(2008)'Sweep-line algorithm for constrained Delaunay triangulation', - * International Journal of Geographical Information Science - * - * "FlipScan" Constrained Edge Algorithm invented by Thomas Åhlén, thahlen@gmail.com - */ - -#ifndef SWEEP_H -#define SWEEP_H - -#include - -namespace p2t { - -class SweepContext; -struct Node; -struct Point; -struct Edge; -class Triangle; - -class Sweep -{ -public: - - /** - * Triangulate - * - * @param tcx - */ - void Triangulate(SweepContext& tcx); - - /** - * Destructor - clean up memory - */ - ~Sweep(); - -private: - - /** - * Start sweeping the Y-sorted point set from bottom to top - * - * @param tcx - */ - void SweepPoints(SweepContext& tcx); - - /** - * Find closes node to the left of the new point and - * create a new triangle. If needed new holes and basins - * will be filled to. - * - * @param tcx - * @param point - * @return - */ - Node& PointEvent(SweepContext& tcx, Point& point); - - /** - * - * - * @param tcx - * @param edge - * @param node - */ - void EdgeEvent(SweepContext& tcx, Edge* edge, Node* node); - - void EdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* triangle, Point& point); - - /** - * Creates a new front triangle and legalize it - * - * @param tcx - * @param point - * @param node - * @return - */ - Node& NewFrontTriangle(SweepContext& tcx, Point& point, Node& node); - - /** - * Adds a triangle to the advancing front to fill a hole. - * @param tcx - * @param node - middle node, that is the bottom of the hole - */ - void Fill(SweepContext& tcx, Node& node); - - /** - * Returns true if triangle was legalized - */ - bool Legalize(SweepContext& tcx, Triangle& t); - - /** - * Requirement:
- * 1. a,b and c form a triangle.
- * 2. a and d is know to be on opposite side of bc
- *
-   *                a
-   *                +
-   *               / \
-   *              /   \
-   *            b/     \c
-   *            +-------+
-   *           /    d    \
-   *          /           \
-   * 
- * Fact: d has to be in area B to have a chance to be inside the circle formed by - * a,b and c
- * d is outside B if orient2d(a,b,d) or orient2d(c,a,d) is CW
- * This preknowledge gives us a way to optimize the incircle test - * @param a - triangle point, opposite d - * @param b - triangle point - * @param c - triangle point - * @param d - point opposite a - * @return true if d is inside circle, false if on circle edge - */ - bool Incircle(Point& pa, Point& pb, Point& pc, Point& pd); - - /** - * Rotates a triangle pair one vertex CW - *
-   *       n2                    n2
-   *  P +-----+             P +-----+
-   *    | t  /|               |\  t |
-   *    |   / |               | \   |
-   *  n1|  /  |n3           n1|  \  |n3
-   *    | /   |    after CW   |   \ |
-   *    |/ oT |               | oT \|
-   *    +-----+ oP            +-----+
-   *       n4                    n4
-   * 
- */ - void RotateTrianglePair(Triangle& t, Point& p, Triangle& ot, Point& op); - - /** - * Fills holes in the Advancing Front - * - * - * @param tcx - * @param n - */ - void FillAdvancingFront(SweepContext& tcx, Node& n); - - // Decision-making about when to Fill hole. - // Contributed by ToolmakerSteve2 - bool LargeHole_DontFill(Node* node); - bool AngleExceeds90Degrees(Point* origin, Point* pa, Point* pb); - bool AngleExceedsPlus90DegreesOrIsNegative(Point* origin, Point* pa, Point* pb); - double Angle(Point& origin, Point& pa, Point& pb); - - /** - * - * @param node - middle node - * @return the angle between 3 front nodes - */ - double HoleAngle(Node& node); - - /** - * The basin angle is decided against the horizontal line [1,0] - */ - double BasinAngle(Node& node); - - /** - * Fills a basin that has formed on the Advancing Front to the right - * of given node.
- * First we decide a left,bottom and right node that forms the - * boundaries of the basin. Then we do a reqursive fill. - * - * @param tcx - * @param node - starting node, this or next node will be left node - */ - void FillBasin(SweepContext& tcx, Node& node); - - /** - * Recursive algorithm to fill a Basin with triangles - * - * @param tcx - * @param node - bottom_node - * @param cnt - counter used to alternate on even and odd numbers - */ - void FillBasinReq(SweepContext& tcx, Node* node); - - bool IsShallow(SweepContext& tcx, Node& node); - - bool IsEdgeSideOfTriangle(Triangle& triangle, Point& ep, Point& eq); - - void FillEdgeEvent(SweepContext& tcx, Edge* edge, Node* node); - - void FillRightAboveEdgeEvent(SweepContext& tcx, Edge* edge, Node* node); - - void FillRightBelowEdgeEvent(SweepContext& tcx, Edge* edge, Node& node); - - void FillRightConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node); - - void FillRightConvexEdgeEvent(SweepContext& tcx, Edge* edge, Node& node); - - void FillLeftAboveEdgeEvent(SweepContext& tcx, Edge* edge, Node* node); - - void FillLeftBelowEdgeEvent(SweepContext& tcx, Edge* edge, Node& node); - - void FillLeftConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node); - - void FillLeftConvexEdgeEvent(SweepContext& tcx, Edge* edge, Node& node); - - void FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t, Point& p); - - /** - * After a flip we have two triangles and know that only one will still be - * intersecting the edge. So decide which to contiune with and legalize the other - * - * @param tcx - * @param o - should be the result of an orient2d( eq, op, ep ) - * @param t - triangle 1 - * @param ot - triangle 2 - * @param p - a point shared by both triangles - * @param op - another point shared by both triangles - * @return returns the triangle still intersecting the edge - */ - Triangle& NextFlipTriangle(SweepContext& tcx, int o, Triangle& t, Triangle& ot, Point& p, Point& op); - - /** - * When we need to traverse from one triangle to the next we need - * the point in current triangle that is the opposite point to the next - * triangle. - * - * @param ep - * @param eq - * @param ot - * @param op - * @return - */ - Point& NextFlipPoint(Point& ep, Point& eq, Triangle& ot, Point& op); - - /** - * Scan part of the FlipScan algorithm
- * When a triangle pair isn't flippable we will scan for the next - * point that is inside the flip triangle scan area. When found - * we generate a new flipEdgeEvent - * - * @param tcx - * @param ep - last point on the edge we are traversing - * @param eq - first point on the edge we are traversing - * @param flipTriangle - the current triangle sharing the point eq with edge - * @param t - * @param p - */ - void FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle& flip_triangle, Triangle& t, Point& p); - - void FinalizationPolygon(SweepContext& tcx); - - std::vector nodes_; - -}; - -} - -#endif diff --git a/vcpkg/ports/qgis-qt6/poly2tri/sweep/sweep_context.h b/vcpkg/ports/qgis-qt6/poly2tri/sweep/sweep_context.h deleted file mode 100644 index c110a74417..0000000000 --- a/vcpkg/ports/qgis-qt6/poly2tri/sweep/sweep_context.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SWEEP_CONTEXT_H -#define SWEEP_CONTEXT_H - -#include -#include -#include - -namespace p2t { - -// Initial triangle factor, seed triangle will extend 30% of -// PointSet width to both left and right. -const double kAlpha = 0.3; - -struct Point; -class Triangle; -struct Node; -struct Edge; -class AdvancingFront; - -class SweepContext { -public: - -/// Constructor -SweepContext(std::vector polyline); -/// Destructor -~SweepContext(); - -void set_head(Point* p1); - -Point* head(); - -void set_tail(Point* p1); - -Point* tail(); - -int point_count(); - -Node& LocateNode(Point& point); - -void RemoveNode(Node* node); - -void CreateAdvancingFront(std::vector nodes); - -/// Try to map a node to all sides of this triangle that don't have a neighbor -void MapTriangleToNodes(Triangle& t); - -void AddToMap(Triangle* triangle); - -Point* GetPoint(const int& index); - -Point* GetPoints(); - -void RemoveFromMap(Triangle* triangle); - -void AddHole(std::vector polyline); - -void AddPoint(Point* point); - -AdvancingFront* front(); - -void MeshClean(Triangle& triangle); - -std::vector GetTriangles(); -std::list GetMap(); - -std::vector edge_list; - -struct Basin { - Node* left_node; - Node* bottom_node; - Node* right_node; - double width; - bool left_highest; - - Basin() : left_node(NULL), bottom_node(NULL), right_node(NULL), width(0.0), left_highest(false) - { - } - - void Clear() - { - left_node = NULL; - bottom_node = NULL; - right_node = NULL; - width = 0.0; - left_highest = false; - } -}; - -struct EdgeEvent { - Edge* constrained_edge; - bool right; - - EdgeEvent() : constrained_edge(NULL), right(false) - { - } -}; - -Basin basin; -EdgeEvent edge_event; - -private: - -friend class Sweep; - -std::vector triangles_; -std::list map_; -std::vector points_; - -// Advancing front -AdvancingFront* front_; -// head point used with advancing front -Point* head_; -// tail point used with advancing front -Point* tail_; - -Node *af_head_, *af_middle_, *af_tail_; - -void InitTriangulation(); -void InitEdges(std::vector polyline); - -}; - -inline AdvancingFront* SweepContext::front() -{ - return front_; -} - -inline int SweepContext::point_count() -{ - return int(points_.size()); -} - -inline void SweepContext::set_head(Point* p1) -{ - head_ = p1; -} - -inline Point* SweepContext::head() -{ - return head_; -} - -inline void SweepContext::set_tail(Point* p1) -{ - tail_ = p1; -} - -inline Point* SweepContext::tail() -{ - return tail_; -} - -} - -#endif diff --git a/vcpkg/ports/qgis-qt6/poly2tri1.patch b/vcpkg/ports/qgis-qt6/poly2tri1.patch new file mode 100644 index 0000000000..f9f28885b1 --- /dev/null +++ b/vcpkg/ports/qgis-qt6/poly2tri1.patch @@ -0,0 +1,65 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2318388f5086..368c86b65476 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -398,7 +398,7 @@ if(WITH_CORE) + endif() + + if (NOT WITH_INTERNAL_POLY2TRI) +- find_package(Poly2Tri REQUIRED) ++ find_package(poly2tri REQUIRED) + endif() + + if (WITH_SPATIALITE) +diff --git a/cmake/FindPoly2Tri.cmake b/cmake/FindPoly2Tri.cmake +deleted file mode 100644 +index 87fb34f3475b..000000000000 +--- a/cmake/FindPoly2Tri.cmake ++++ /dev/null +@@ -1,24 +0,0 @@ +-# Find Poly2Tri +-# ~~~~~~~~~ +-# Copyright (c) 2020, Peter Petrik +-# Redistribution and use is allowed according to the terms of the BSD license. +-# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +-# +-# +-# Once run this will define: +-# Poly2Tri_FOUND - System has Poly2Tri +-# Poly2Tri_INCLUDE_DIR - The Poly2Tri include directory +-# Poly2Tri_LIBRARY - The library needed to use Poly2Tri +- +-find_path(Poly2Tri_INCLUDE_DIR poly2tri.h +- HINTS $ENV{LIB_DIR}/include) +- +-find_library(Poly2Tri_LIBRARY NAMES poly2tri libpoly2tri +- HINTS $ENV{LIB_DIR}/lib) +- +-include(FindPackageHandleStandardArgs) +- +-find_package_handle_standard_args(Poly2Tri DEFAULT_MSG +- Poly2Tri_LIBRARY Poly2Tri_INCLUDE_DIR) +- +-mark_as_advanced( Poly2Tri_INCLUDE_DIR Poly2Tri_LIBRARY ) +diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt +index 1dd8bfa49bf3..9b3229480ea7 100644 +--- a/src/core/CMakeLists.txt ++++ b/src/core/CMakeLists.txt +@@ -973,8 +973,6 @@ if (WITH_INTERNAL_POLY2TRI) + ${CMAKE_SOURCE_DIR}/external/poly2tri/sweep/sweep.cc + ) + include_directories(${CMAKE_SOURCE_DIR}/external/poly2tri) +-else () +- include_directories(${Poly2Tri_INCLUDE_DIR}) + endif () + + file(GLOB JSON_HELP_FILES "${CMAKE_SOURCE_DIR}/resources/function_help/json/*") +@@ -2347,7 +2345,7 @@ if(ENABLE_MODELTEST) + endif() + + if (NOT WITH_INTERNAL_POLY2TRI) +- target_link_libraries(qgis_core ${Poly2Tri_LIBRARY}) ++ target_link_libraries(qgis_core poly2tri::poly2tri) + endif() + + if(HAVE_OPENCL) diff --git a/vcpkg/ports/qgis-qt6/poly2tri2.patch b/vcpkg/ports/qgis-qt6/poly2tri2.patch new file mode 100644 index 0000000000..860d742597 --- /dev/null +++ b/vcpkg/ports/qgis-qt6/poly2tri2.patch @@ -0,0 +1,37 @@ +diff --git a/cmake/Findpoly2tri.cmake b/cmake/Findpoly2tri.cmake +new file mode 100644 +index 000000000000..8e3c8030ac53 +--- /dev/null ++++ b/cmake/Findpoly2tri.cmake +@@ -0,0 +1,31 @@ ++# Find poly2tri ++# ~~~~~~~~~~~~~ ++# Copyright (c) 2020, Peter Petrik ++# Redistribution and use is allowed according to the terms of the BSD license. ++# For details see the accompanying COPYING-CMAKE-SCRIPTS file. ++# ++# ++# Once run this will define: ++# poly2tri_FOUND - System has poly2tri ++# poly2tri::poly2tri - Target ++ ++find_package(poly2tri CONFIG) ++if(NOT poly2tri_FOUND) ++ find_path(poly2tri_INCLUDE_DIR poly2tri.h ++ HINTS $ENV{LIB_DIR}/include) ++ ++ find_library(poly2tri_LIBRARY NAMES poly2tri libpoly2tri ++ HINTS $ENV{LIB_DIR}/lib) ++ ++ include(FindPackageHandleStandardArgs) ++ ++ find_package_handle_standard_args(poly2tri DEFAULT_MSG ++ poly2tri_LIBRARY poly2tri_INCLUDE_DIR) ++ ++ ++ add_library(poly2tri::poly2tri UNKNOWN IMPORTED) ++ target_link_libraries(poly2tri::poly2tri INTERFACE ${poly2tri_LIBRARY}) ++ target_include_directories(poly2tri::poly2tri INTERFACE ${poly2tri_INCLUDE_DIR}) ++ set_target_properties(poly2tri::poly2tri PROPERTIES IMPORTED_LOCATION ${poly2tri_LIBRARY}) ++ mark_as_advanced(poly2tri_INCLUDE_DIR poly2tri_LIBRARY) ++endif() diff --git a/vcpkg/ports/qgis-qt6/portfile.cmake b/vcpkg/ports/qgis-qt6/portfile.cmake index 70b146741e..4d67d36152 100644 --- a/vcpkg/ports/qgis-qt6/portfile.cmake +++ b/vcpkg/ports/qgis-qt6/portfile.cmake @@ -15,9 +15,10 @@ vcpkg_from_github( exiv2.patch crssync.patch bigobj.patch - poly2tri.patch mesh.patch wrongattributeerrormessage.patch + poly2tri1.patch + poly2tri2.patch ) file(REMOVE ${SOURCE_PATH}/cmake/FindQtKeychain.cmake) @@ -26,7 +27,6 @@ file(REMOVE ${SOURCE_PATH}/cmake/FindGEOS.cmake) file(REMOVE ${SOURCE_PATH}/cmake/FindEXIV2.cmake) file(REMOVE ${SOURCE_PATH}/cmake/FindExpat.cmake) file(REMOVE ${SOURCE_PATH}/cmake/FindIconv.cmake) -file(REMOVE ${SOURCE_PATH}/cmake/FindPoly2Tri.cmake) vcpkg_find_acquire_program(FLEX) vcpkg_find_acquire_program(BISON) @@ -38,6 +38,7 @@ list(APPEND QGIS_OPTIONS "-DWITH_SPATIALITE:BOOL=ON") list(APPEND QGIS_OPTIONS "-DWITH_QSPATIALITE:BOOL=OFF") list(APPEND QGIS_OPTIONS "-DWITH_PDAL:BOOL=OFF") list(APPEND QGIS_OPTIONS "-DWITH_DRACO:BOOL=ON") +list(APPEND QGIS_OPTIONS "-DWITH_INTERNAL_POLY2TRI:BOOL=OFF") list(APPEND QGIS_OPTIONS "-DBISON_EXECUTABLE=${BISON}") list(APPEND QGIS_OPTIONS "-DFLEX_EXECUTABLE=${FLEX}") @@ -157,8 +158,6 @@ if(VCPKG_TARGET_IS_WINDOWS) set( SPATIALINDEX_LIB_NAME "spatialindex-32" ) endif() FIND_LIB_OPTIONS(SPATIALINDEX ${SPATIALINDEX_LIB_NAME} ${SPATIALINDEX_LIB_NAME}d LIBRARY ${VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX}) - list(APPEND QGIS_OPTIONS -DWITH_INTERNAL_POLY2TRI=OFF) - list(APPEND QGIS_OPTIONS -DPoly2Tri_LIBRARY=poly2tri::poly2tri) else() # Build in UNIX list(APPEND QGIS_OPTIONS -DGSL_INCLUDE_DIR:PATH=${CURRENT_INSTALLED_DIR}/include) list(APPEND QGIS_OPTIONS -DPROJ_INCLUDE_DIR:PATH=${CURRENT_INSTALLED_DIR}/include) @@ -169,21 +168,6 @@ else() # Build in UNIX FIND_LIB_OPTIONS(FCGI fcgi fcgi LIBRARY ${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}) list(APPEND QGIS_OPTIONS -DFCGI_INCLUDE_DIR="${CURRENT_INSTALLED_DIR}/include/fastcgi") endif() - list(APPEND QGIS_OPTIONS -DWITH_INTERNAL_POLY2TRI=OFF) - if(EXISTS "${CURRENT_INSTALLED_DIR}/lib/libqt_poly2tri.a") - set(QT_POLY2TRI_DIR_RELEASE "${CURRENT_INSTALLED_DIR}/lib") - set(QT_POLY2TRI_DIR_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib") - elseif(EXISTS "${Qt6_DIR}/../../libqt_poly2tri.a") - set(QT_POLY2TRI_DIR_RELEASE "${Qt6_DIR}/../..") - set(QT_POLY2TRI_DIR_DEBUG "${Qt6_DIR}/../..") - else() - list(APPEND QGIS_OPTIONS -DPoly2Tri_LIBRARY=poly2tri::poly2tri) - endif() - if(DEFINED QT_POLY2TRI_DIR_RELEASE) - list(APPEND QGIS_OPTIONS -DPoly2Tri_INCLUDE_DIR:PATH=${CMAKE_CURRENT_LIST_DIR}/poly2tri) - list(APPEND QGIS_OPTIONS_DEBUG -DPoly2Tri_LIBRARY:PATH=${QT_POLY2TRI_DIR_DEBUG}/debug/lib/libqt_poly2tri_debug.a) # static qt only - list(APPEND QGIS_OPTIONS_RELEASE -DPoly2Tri_LIBRARY:PATH=${QT_POLY2TRI_DIR_RELEASE}/lib/libqt_poly2tri.a) # static qt only - endif() endif() if(VCPKG_TARGET_IS_IOS)