Skip to content

Commit

Permalink
Add additional QGIS patch which upgrades QgsRectangle to a gadget
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Nov 22, 2024
1 parent b2fac7f commit 2787284
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 1 deletion.
34 changes: 33 additions & 1 deletion vcpkg/ports/qgis/locatorcontext.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ diff --git a/src/core/locator/qgslocatorcontext.h b/src/core/locator/qgslocatorc
index 6f19dc35ecc..325e6cc1be2 100644
--- a/src/core/locator/qgslocatorcontext.h
+++ b/src/core/locator/qgslocatorcontext.h
@@ -30,6 +30,12 @@
@@ -30,6 +30,13 @@
*/
class CORE_EXPORT QgsLocatorContext
{
+ Q_GADGET
+
+ Q_PROPERTY( QgsRectangle targetExtent MEMBER targetExtent )
+ Q_PROPERTY( QgsCoordinateReferenceSystem targetExtentCrs MEMBER targetExtentCrs )
+ Q_PROPERTY( QgsCoordinateTransformContext transformContext MEMBER transformContext )
+ Q_PROPERTY( bool usingPrefix MEMBER usingPrefix )
+
public:
Expand All @@ -35,3 +36,34 @@ index f560ae36c08..1657d39d2e6 100644
public:

QgsLocatorResult() = default;
diff --git a/src/core/proj/qgscoordinatetransformcontext.cpp b/src/core/proj/qgscoordinatetransformcontext.cpp
index f61b4079204..4a4dfc8eea6 100644
--- a/src/core/proj/qgscoordinatetransformcontext.cpp
+++ b/src/core/proj/qgscoordinatetransformcontext.cpp
@@ -65,6 +65,11 @@ bool QgsCoordinateTransformContext::operator==( const QgsCoordinateTransformCont
return equal;
}

+bool QgsCoordinateTransformContext::operator!=( const QgsCoordinateTransformContext &rhs ) const
+{
+ return !( *this == rhs );
+}
+
void QgsCoordinateTransformContext::clear()
{
d.detach();
diff --git a/src/core/proj/qgscoordinatetransformcontext.h b/src/core/proj/qgscoordinatetransformcontext.h
index 7f62c7b6e1b..7779a0e0366 100644
--- a/src/core/proj/qgscoordinatetransformcontext.h
+++ b/src/core/proj/qgscoordinatetransformcontext.h
@@ -67,7 +67,8 @@ class CORE_EXPORT QgsCoordinateTransformContext
QgsCoordinateTransformContext( const QgsCoordinateTransformContext &rhs );
QgsCoordinateTransformContext &operator=( const QgsCoordinateTransformContext &rhs ) SIP_SKIP;

- bool operator==( const QgsCoordinateTransformContext &rhs ) const ;
+ bool operator==( const QgsCoordinateTransformContext &rhs ) const;
+ bool operator!=( const QgsCoordinateTransformContext &rhs ) const;

/**
* Clears all stored transform information from the context.

1 change: 1 addition & 0 deletions vcpkg/ports/qgis/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ vcpkg_from_github(
processing.patch # Needed to avoid link issue with tinygltf (ATM embedded into QGIS) and _GEOSQueryCallback defined multiple times
meshoptimizer.patch
locatorcontext.patch # Remove when upgrading to QGIS 3.42
rectangle.patch # Remove when upgrading to QGIS 3.42
)

file(REMOVE ${SOURCE_PATH}/cmake/FindGDAL.cmake)
Expand Down
49 changes: 49 additions & 0 deletions vcpkg/ports/qgis/rectangle.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
diff --git a/src/core/geometry/qgsrectangle.h b/src/core/geometry/qgsrectangle.h
index 81500f6c70d..ec335968a2f 100644
--- a/src/core/geometry/qgsrectangle.h
+++ b/src/core/geometry/qgsrectangle.h
@@ -40,6 +40,20 @@ class QgsBox3D;
*/
class CORE_EXPORT QgsRectangle
{
+ Q_GADGET
+
+ Q_PROPERTY( double xMinimum READ xMinimum WRITE setXMinimum )
+ Q_PROPERTY( double xMaximum READ xMaximum WRITE setXMaximum )
+ Q_PROPERTY( double yMinimum READ yMinimum WRITE setYMinimum )
+ Q_PROPERTY( double yMaximum READ yMaximum WRITE setYMaximum )
+ Q_PROPERTY( double width READ width )
+ Q_PROPERTY( double height READ height )
+ Q_PROPERTY( double area READ area )
+ Q_PROPERTY( double perimeter READ perimeter )
+ Q_PROPERTY( QgsPointXY center READ center )
+ Q_PROPERTY( bool isEmpty READ isEmpty )
+ Q_PROPERTY( bool isNull READ isNull )
+
public:

//! Constructor for a null rectangle
@@ -518,12 +532,12 @@ class CORE_EXPORT QgsRectangle
/**
* Returns a string representation of the rectangle in WKT format.
*/
- QString asWktCoordinates() const;
+ Q_INVOKABLE QString asWktCoordinates() const;

/**
* Returns a string representation of the rectangle as a WKT Polygon.
*/
- QString asWktPolygon() const;
+ Q_INVOKABLE QString asWktPolygon() const;

/**
* Returns a QRectF with same coordinates as the rectangle.
@@ -538,7 +552,7 @@ class CORE_EXPORT QgsRectangle
* Coordinates will be truncated to the specified precision.
* If the specified precision is less than 0, a suitable minimum precision is used.
*/
- QString toString( int precision = 16 ) const;
+ Q_INVOKABLE QString toString( int precision = 16 ) const;

/**
* Returns the rectangle as a polygon.

0 comments on commit 2787284

Please sign in to comment.