QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
geometry
qgssurface.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgscurvepolygon.cpp
3
---------------------
4
begin : August 2017
5
copyright : (C) 2017 by Martà Angelats i Ribera
6
email : marti dot angelats at psig dot cat
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 "
qgssurface.h
"
19
20
#include <memory>
21
22
#include "
qgsgeos.h
"
23
#include "
qgspoint.h
"
24
#include "
qgspolygon.h
"
25
26
bool
QgsSurface::isValid
( QString &error,
Qgis::GeometryValidityFlags
flags )
const
27
{
28
if
( flags == 0 &&
mHasCachedValidity
)
29
{
30
// use cached validity results
31
error =
mValidityFailureReason
;
32
return
error.isEmpty();
33
}
34
35
const
QgsGeos
geos
(
this
, 0,
Qgis::GeosCreationFlags
() );
36
const
bool
res =
geos
.isValid( &error, flags &
Qgis::GeometryValidityFlag::AllowSelfTouchingHoles
,
nullptr
);
37
if
( flags == 0 )
38
{
39
mValidityFailureReason
= !res ? error : QString();
40
mHasCachedValidity
=
true
;
41
}
42
return
res;
43
}
44
45
void
QgsSurface::clearCache
()
const
46
{
47
mBoundingBox
=
QgsBox3D
();
48
mHasCachedValidity
=
false
;
49
mValidityFailureReason
.clear();
50
QgsAbstractGeometry::clearCache
();
51
}
Qgis::GeometryValidityFlag::AllowSelfTouchingHoles
@ AllowSelfTouchingHoles
Indicates that self-touching holes are permitted. OGC validity states that self-touching holes are NO...
Definition
qgis.h:2242
Qgis::GeometryValidityFlags
QFlags< GeometryValidityFlag > GeometryValidityFlags
Geometry validity flags.
Definition
qgis.h:2246
Qgis::GeosCreationFlags
QFlags< GeosCreationFlag > GeosCreationFlags
Geos geometry creation behavior flags.
Definition
qgis.h:2342
QgsAbstractGeometry::clearCache
virtual void clearCache() const
Clears any cached parameters associated with the geometry, e.g., bounding boxes.
Definition
qgsabstractgeometry.cpp:178
QgsBox3D
A 3-dimensional box composed of x, y, z coordinates.
Definition
qgsbox3d.h:45
QgsGeos
Does vector analysis using the GEOS library and handles import, export, and exception handling.
Definition
qgsgeos.h:192
QgsSurface::mBoundingBox
QgsBox3D mBoundingBox
Definition
qgssurface.h:99
QgsSurface::clearCache
void clearCache() const override
Clears any cached parameters associated with the geometry, e.g., bounding boxes.
Definition
qgssurface.cpp:45
QgsSurface::mValidityFailureReason
QString mValidityFailureReason
Definition
qgssurface.h:101
QgsSurface::mHasCachedValidity
bool mHasCachedValidity
Definition
qgssurface.h:100
QgsSurface::isValid
bool isValid(QString &error, Qgis::GeometryValidityFlags flags=Qgis::GeometryValidityFlags()) const override
Checks validity of the geometry, and returns true if the geometry is valid.
Definition
qgssurface.cpp:26
geos
Contains geos related utilities and functions.
Definition
qgsgeos.h:129
qgsgeos.h
qgspoint.h
qgspolygon.h
qgssurface.h
Generated on
for QGIS API Documentation by
1.17.0