-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Template based referenced geometry class
- Loading branch information
1 parent
9502022
commit 1a961e8
Showing
3 changed files
with
216 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/geometry/qgsreferencedgeometry.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
template<T> | ||
class QgsReferencedGeometryPrimitive | ||
{ | ||
%Docstring | ||
A template based class for storing geometry primitives with an associated reference system. | ||
|
||
QgsReferencedGeometryPrimitive classes represent some form of geometry primitive | ||
(such as rectangles) which have an optional coordinate reference system | ||
associated with them. | ||
|
||
.. versionadded:: 3.0 | ||
.. seealso:: QgsReferencedRectangle | ||
.. note:: | ||
|
||
Not available in Python bindings (although SIP file is present for specific implementations). | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsreferencedgeometry.h" | ||
%End | ||
public: | ||
|
||
QgsReferencedGeometryPrimitive( T primitive, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() ); | ||
%Docstring | ||
Constructor for QgsReferencedGeometryPrimitive, for the specified ``primitive`` and ``crs``. | ||
%End | ||
|
||
T primitive() const; | ||
%Docstring | ||
Returns the geometry primitive. | ||
:rtype: T | ||
%End | ||
|
||
T &primitive(); | ||
%Docstring | ||
Returns the geometry primitive. | ||
:rtype: T | ||
%End | ||
|
||
QgsCoordinateReferenceSystem crs() const; | ||
%Docstring | ||
Returns the associated coordinate reference system, or an invalid CRS if | ||
no reference system is set. | ||
.. seealso:: setCrs() | ||
:rtype: QgsCoordinateReferenceSystem | ||
%End | ||
|
||
void setCrs( const QgsCoordinateReferenceSystem &crs ); | ||
%Docstring | ||
Sets the associated ``crs``. Set to an invalid CRS if | ||
no reference system is required. | ||
.. seealso:: crs() | ||
%End | ||
|
||
}; | ||
|
||
|
||
typedef QgsReferencedGeometryPrimitive<QgsRectangle> QgsReferencedGeometryPrimitiveQgsRectangleBase; | ||
|
||
class QgsReferencedRectangle : QgsReferencedGeometryPrimitiveQgsRectangleBase | ||
{ | ||
%Docstring | ||
A QgsRectangle with associated coordinate reference system. | ||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsreferencedgeometry.h" | ||
typedef QgsReferencedGeometryPrimitive<QgsRectangle> QgsReferencedGeometryPrimitiveQgsRectangleBase; | ||
%End | ||
public: | ||
|
||
QgsReferencedRectangle(); | ||
%Docstring | ||
Construct a default optional expression. | ||
It will be disabled and with an empty expression. | ||
%End | ||
|
||
QgsRectangle &rect(); | ||
%Docstring | ||
:rtype: QgsRectangle | ||
%End | ||
|
||
|
||
}; | ||
|
||
|
||
|
||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/geometry/qgsreferencedgeometry.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/*************************************************************************** | ||
qgsreferencedgeometry.h | ||
---------------------- | ||
begin : June 2017 | ||
copyright : (C) 2017 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSREFERENCEDGEOMETRY_H | ||
#define QGSREFERENCEDGEOMETRY_H | ||
|
||
#include "qgis.h" | ||
#include "qgis_sip.h" | ||
#include "qgis_core.h" | ||
#include "qgscoordinatereferencesystem.h" | ||
#include "qgsrectangle.h" | ||
|
||
/** | ||
* \class QgsReferencedGeometryPrimitive | ||
* \ingroup core | ||
* A template based class for storing geometry primitives with an associated reference system. | ||
* | ||
* QgsReferencedGeometryPrimitive classes represent some form of geometry primitive | ||
* (such as rectangles) which have an optional coordinate reference system | ||
* associated with them. | ||
* | ||
* \since QGIS 3.0 | ||
* \see QgsReferencedRectangle | ||
* \note Not available in Python bindings (although SIP file is present for specific implementations). | ||
*/ | ||
template<typename T> | ||
class CORE_EXPORT QgsReferencedGeometryPrimitive | ||
{ | ||
public: | ||
|
||
/** | ||
* Constructor for QgsReferencedGeometryPrimitive, for the specified \a primitive and \a crs. | ||
*/ | ||
QgsReferencedGeometryPrimitive( T primitive, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() ) | ||
: mPrimitive( primitive ) | ||
, mCrs( crs ) | ||
{} | ||
|
||
/** | ||
* Returns the geometry primitive. | ||
*/ | ||
T primitive() const { return mPrimitive; } | ||
|
||
/** | ||
* Returns the geometry primitive. | ||
*/ | ||
T &primitive() { return mPrimitive; } | ||
|
||
/** | ||
* Returns the associated coordinate reference system, or an invalid CRS if | ||
* no reference system is set. | ||
* \see setCrs() | ||
*/ | ||
QgsCoordinateReferenceSystem crs() const { return mCrs; } | ||
|
||
/** | ||
* Sets the associated \a crs. Set to an invalid CRS if | ||
* no reference system is required. | ||
* \see crs() | ||
*/ | ||
void setCrs( const QgsCoordinateReferenceSystem &crs ) { mCrs = crs; } | ||
|
||
private: | ||
|
||
T mPrimitive; | ||
QgsCoordinateReferenceSystem mCrs; | ||
|
||
}; | ||
|
||
/** | ||
* A QgsRectangle with associated coordinate reference system. | ||
* \since QGIS 3.0 | ||
*/ | ||
class CORE_EXPORT QgsReferencedRectangle : public QgsReferencedGeometryPrimitive< QgsRectangle > | ||
{ | ||
public: | ||
|
||
/** | ||
* Construct a default optional expression. | ||
* It will be disabled and with an empty expression. | ||
*/ | ||
QgsReferencedRectangle(); | ||
|
||
QgsRectangle &rect() { return primitive(); } | ||
|
||
|
||
}; | ||
|
||
#endif // QGSREFERENCEDGEOMETRY_H | ||
|
||
|
||
|
||
|