QGIS API Documentation
4.3.0-Master (9dce731a7a1)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
geometry
qgssurface.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgssurface.h
3
--------------
4
begin : September 2014
5
copyright : (C) 2014 by Marco Hugentobler
6
email : marco at sourcepole dot ch
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
#ifndef QGSSURFACE_H
19
#define QGSSURFACE_H
20
21
#include "qgis_core.h"
22
#include "
qgis_sip.h
"
23
#include "
qgsabstractgeometry.h
"
24
#include "
qgsbox3d.h
"
25
26
class
QgsPolygon
;
27
33
class
CORE_EXPORT
QgsSurface
:
public
QgsAbstractGeometry
34
{
35
public
:
36
QgsBox3D
boundingBox3D
()
const override
37
{
38
if
(
mBoundingBox
.isNull() )
39
{
40
mBoundingBox
=
calculateBoundingBox3D
();
41
}
42
return
mBoundingBox
;
43
}
44
45
bool
isValid
( QString &error
SIP_OUT
,
Qgis::GeometryValidityFlags
flags =
Qgis::GeometryValidityFlags
() )
const override
;
46
47
48
#ifndef SIP_RUN
49
58
inline
static
const
QgsSurface
*
cast
(
const
QgsAbstractGeometry
*geom )
59
{
60
if
( !geom )
61
return
nullptr
;
62
63
const
Qgis::WkbType
flatType =
QgsWkbTypes::flatType
( geom->
wkbType
() );
64
if
( flatType ==
Qgis::WkbType::CurvePolygon
65
|| flatType ==
Qgis::WkbType::Polygon
66
|| flatType ==
Qgis::WkbType::Triangle
67
|| flatType ==
Qgis::WkbType::PolyhedralSurface
68
|| flatType ==
Qgis::WkbType::TIN
)
69
return
static_cast<
const
QgsSurface
*
>
( geom );
70
return
nullptr
;
71
}
72
81
inline
static
QgsSurface
*
cast
(
QgsAbstractGeometry
*geom )
82
{
83
if
( !geom )
84
return
nullptr
;
85
86
const
Qgis::WkbType
flatType =
QgsWkbTypes::flatType
( geom->
wkbType
() );
87
if
( flatType ==
Qgis::WkbType::CurvePolygon
88
|| flatType ==
Qgis::WkbType::Polygon
89
|| flatType ==
Qgis::WkbType::Triangle
90
|| flatType ==
Qgis::WkbType::PolyhedralSurface
91
|| flatType ==
Qgis::WkbType::TIN
)
92
return
static_cast<
QgsSurface
*
>
( geom );
93
return
nullptr
;
94
}
95
#endif
96
protected
:
97
void
clearCache
()
const override
;
98
99
mutable
QgsBox3D
mBoundingBox
;
100
mutable
bool
mHasCachedValidity
=
false
;
101
mutable
QString
mValidityFailureReason
;
102
};
103
104
#endif
// QGSSURFACE_H
Qgis::GeometryValidityFlags
QFlags< GeometryValidityFlag > GeometryValidityFlags
Geometry validity flags.
Definition
qgis.h:2246
Qgis::WkbType
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition
qgis.h:314
Qgis::WkbType::TIN
@ TIN
TIN.
Definition
qgis.h:330
Qgis::WkbType::Polygon
@ Polygon
Polygon.
Definition
qgis.h:318
Qgis::WkbType::Triangle
@ Triangle
Triangle.
Definition
qgis.h:319
Qgis::WkbType::CurvePolygon
@ CurvePolygon
CurvePolygon.
Definition
qgis.h:326
Qgis::WkbType::PolyhedralSurface
@ PolyhedralSurface
PolyhedralSurface.
Definition
qgis.h:329
QgsAbstractGeometry::calculateBoundingBox3D
virtual QgsBox3D calculateBoundingBox3D() const
Calculates the minimal 3D bounding box for the geometry.
Definition
qgsabstractgeometry.cpp:129
QgsAbstractGeometry::isValid
virtual bool isValid(QString &error, Qgis::GeometryValidityFlags flags=Qgis::GeometryValidityFlags()) const =0
Checks validity of the geometry, and returns true if the geometry is valid.
QgsAbstractGeometry::clearCache
virtual void clearCache() const
Clears any cached parameters associated with the geometry, e.g., bounding boxes.
Definition
qgsabstractgeometry.cpp:178
QgsAbstractGeometry::wkbType
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
Definition
qgsabstractgeometry.h:253
QgsAbstractGeometry::QgsAbstractGeometry
QgsAbstractGeometry()=default
QgsBox3D
A 3-dimensional box composed of x, y, z coordinates.
Definition
qgsbox3d.h:45
QgsPolygon
Polygon geometry type.
Definition
qgspolygon.h:37
QgsSurface
Surface geometry type.
Definition
qgssurface.h:34
QgsSurface::mBoundingBox
QgsBox3D mBoundingBox
Definition
qgssurface.h:99
QgsSurface::cast
static QgsSurface * cast(QgsAbstractGeometry *geom)
Cast the geom to a QgsSurface.
Definition
qgssurface.h:81
QgsSurface::boundingBox3D
QgsBox3D boundingBox3D() const override
Returns the 3D bounding box for the geometry.
Definition
qgssurface.h:36
QgsSurface::cast
static const QgsSurface * cast(const QgsAbstractGeometry *geom)
Cast the geom to a QgsSurface.
Definition
qgssurface.h:58
QgsSurface::mValidityFailureReason
QString mValidityFailureReason
Definition
qgssurface.h:101
QgsSurface::mHasCachedValidity
bool mHasCachedValidity
Definition
qgssurface.h:100
QgsWkbTypes::flatType
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
Definition
qgswkbtypes.h:693
qgis_sip.h
SIP_OUT
#define SIP_OUT
Definition
qgis_sip.h:57
qgsabstractgeometry.h
qgsbox3d.h
Generated on
for QGIS API Documentation by
1.17.0