mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Template based referenced geometry class
This commit is contained in:
parent
9502022bb5
commit
1a961e8045
108
python/core/geometry/qgsreferencedgeometry.sip
Normal file
108
python/core/geometry/qgsreferencedgeometry.sip
Normal file
@ -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 *
|
||||
************************************************************************/
|
@ -1059,6 +1059,7 @@ SET(QGIS_CORE_HDRS
|
||||
geometry/qgsmultisurface.h
|
||||
geometry/qgspolygon.h
|
||||
geometry/qgsrectangle.h
|
||||
geometry/qgsreferencedgeometry.h
|
||||
geometry/qgsregularpolygon.h
|
||||
geometry/qgstriangle.h
|
||||
geometry/qgssurface.h
|
||||
|
107
src/core/geometry/qgsreferencedgeometry.h
Normal file
107
src/core/geometry/qgsreferencedgeometry.h
Normal file
@ -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
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user