QGIS API Documentation  3.17.0-Master (3b262f2a79)
qgsreferencedgeometry.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsreferencedgeometry.cpp
3  ------------------------
4  begin : June 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "qgsreferencedgeometry.h"
19 
21  : mCrs( crs )
22 {}
23 
25  : QgsRectangle( rect )
27 {}
28 
30 {
31  return QgsRectangle::operator==( other ) && crs() == other.crs();
32 }
33 
35 {
36  return !( *this == other );
37 }
38 
40  : QgsPointXY( point )
42 {}
43 
45 {
46  return QgsPointXY::operator==( other ) && crs() == other.crs();
47 }
48 
50 {
51  return !( *this == other );
52 }
53 
55  : QgsGeometry( geom )
57 {}
58 
60 {
61  return QgsReferencedGeometry( QgsGeometry::fromPointXY( point ), point.crs() );
62 }
63 
65 {
66  return QgsReferencedGeometry( QgsGeometry::fromRect( rectangle ), rectangle.crs() );
67 }
68 
A rectangle specified with double values.
Definition: qgsrectangle.h:41
QgsReferencedGeometry()=default
Constructor for QgsReferencedGeometry.
static QgsReferencedGeometry fromReferencedRect(const QgsReferencedRectangle &rectangle)
Construct a new QgsReferencedGeometry from referenced rectangle.
A QgsGeometry with associated coordinate reference system.
static QgsGeometry fromPointXY(const QgsPointXY &point) SIP_HOLDGIL
Creates a new geometry from a QgsPointXY object.
bool operator==(const QgsReferencedRectangle &other) const
A class to represent a 2D point.
Definition: qgspointxy.h:43
bool operator==(const QgsReferencedPointXY &other)
A QgsPointXY with associated coordinate reference system.
QgsReferencedGeometryBase(const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Constructor for QgsReferencedGeometryBase, with the specified crs.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:123
const QgsCoordinateReferenceSystem & crs
QgsCoordinateReferenceSystem crs() const
Returns the associated coordinate reference system, or an invalid CRS if no reference system is set...
bool operator!=(const QgsReferencedRectangle &other) const
A QgsRectangle with associated coordinate reference system.
static QgsReferencedGeometry fromReferencedPointXY(const QgsReferencedPointXY &point)
Construct a new QgsReferencedGeometry from referenced point.
QgsReferencedPointXY()=default
Constructor for QgsReferencedPointXY.
bool operator==(const QgsRectangle &r1) const
Comparison operator.
Definition: qgsrectangle.h:489
bool operator==(const QgsPointXY &other) SIP_HOLDGIL
equality operator
Definition: qgspointxy.h:249
static QgsGeometry fromRect(const QgsRectangle &rect) SIP_HOLDGIL
Creates a new geometry from a QgsRectangle.
This class represents a coordinate reference system (CRS).
QgsReferencedRectangle()=default
Constructor for QgsReferencedRectangle.
bool operator!=(const QgsReferencedPointXY &other)
A base class for geometry primitives which are stored with an associated reference system...