Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
251 additions
and 155 deletions.
- +78 −0 python/core/auto_generated/qgsgeometryfixes.sip.in
- +3 −43 python/core/auto_generated/qgsvectorlayer.sip.in
- +1 −0 python/core/core_auto.sip
- +2 −0 src/core/CMakeLists.txt
- +52 −0 src/core/qgsgeometryfixes.cpp
- +96 −0 src/core/qgsgeometryfixes.h
- +14 −41 src/core/qgsvectorlayer.cpp
- +5 −71 src/core/qgsvectorlayer.h
@@ -0,0 +1,78 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgsgeometryfixes.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsGeometryFixes | ||
{ | ||
%Docstring | ||
The QgsGeometryFixes class contains options to | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsgeometryfixes.h" | ||
%End | ||
public: | ||
QgsGeometryFixes(); | ||
|
||
bool removeDuplicateNodes() const; | ||
%Docstring | ||
Automatically remove duplicate nodes on all geometries which are edited on this layer. | ||
|
||
.. versionadded:: 3.4 | ||
%End | ||
|
||
void setRemoveDuplicateNodes( bool value ); | ||
%Docstring | ||
Automatically remove duplicate nodes on all geometries which are edited on this layer. | ||
|
||
.. versionadded:: 3.4 | ||
%End | ||
|
||
double geometryPrecision() const; | ||
%Docstring | ||
The precision in which geometries on this layer should be saved. | ||
Geometries which are edited on this layer will be rounded to multiples of this value (snap to grid). | ||
Set to 0.0 to disable. | ||
|
||
.. versionadded:: 3.4 | ||
%End | ||
|
||
void setGeometryPrecision( double value ); | ||
%Docstring | ||
The precision in which geometries on this layer should be saved. | ||
Geometries which are edited on this layer will be rounded to multiples of this value (snap to grid). | ||
Set to 0.0 to disable. | ||
|
||
.. versionadded:: 3.4 | ||
%End | ||
|
||
bool isActive() const; | ||
%Docstring | ||
Determines if at least one fix is enabled. | ||
|
||
.. versionadded:: 3.4 | ||
%End | ||
|
||
void apply( QgsGeometry &geometry ) const; | ||
%Docstring | ||
Apply any fixes configured on this class to ``geometry``. | ||
|
||
.. versionadded:: 3.4 | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgsgeometryfixes.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
@@ -0,0 +1,52 @@ | ||
/*************************************************************************** | ||
qgsgeometryfixes.cpp | ||
------------------- | ||
begin : Aug 23, 2018 | ||
copyright : (C) 2018 by Matthias Kuhn | ||
email : matthias@opengis.ch | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* 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. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsgeometryfixes.h" | ||
|
||
bool QgsGeometryFixes::removeDuplicateNodes() const | ||
{ | ||
return mRemoveDuplicateNodes; | ||
} | ||
|
||
void QgsGeometryFixes::setRemoveDuplicateNodes( bool value ) | ||
{ | ||
mRemoveDuplicateNodes = value; | ||
} | ||
|
||
double QgsGeometryFixes::geometryPrecision() const | ||
{ | ||
return mGeometryPrecision; | ||
} | ||
|
||
void QgsGeometryFixes::setGeometryPrecision( double value ) | ||
{ | ||
mGeometryPrecision = value; | ||
} | ||
|
||
bool QgsGeometryFixes::isActive() const | ||
{ | ||
return mGeometryPrecision != 0.0 || mRemoveDuplicateNodes; | ||
} | ||
|
||
void QgsGeometryFixes::apply( QgsGeometry &geometry ) const | ||
{ | ||
if ( mGeometryPrecision != 0.0 ) | ||
geometry = geometry.snappedToGrid( mGeometryPrecision, mGeometryPrecision ); | ||
|
||
if ( mRemoveDuplicateNodes ) | ||
geometry.removeDuplicateNodes(); | ||
} |
@@ -0,0 +1,96 @@ | ||
/*************************************************************************** | ||
qgsgeometryfixes.h | ||
------------------- | ||
begin : Aug 23, 2018 | ||
copyright : (C) 2018 by Matthias Kuhn | ||
email : matthias@opengis.ch | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* 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 QGSGEOMETRYFIXES_H | ||
#define QGSGEOMETRYFIXES_H | ||
|
||
#include "qgsgeometry.h" | ||
|
||
/** | ||
* The QgsGeometryFixes class contains options to | ||
This comment has been minimized.
This comment has been minimized.
m-kuhn
Author
Member
|
||
*/ | ||
class CORE_EXPORT QgsGeometryFixes | ||
{ | ||
public: | ||
QgsGeometryFixes() = default; | ||
|
||
/** | ||
* Automatically remove duplicate nodes on all geometries which are edited on this layer. | ||
* | ||
* \since QGIS 3.4 | ||
*/ | ||
bool removeDuplicateNodes() const; | ||
|
||
/** | ||
* Automatically remove duplicate nodes on all geometries which are edited on this layer. | ||
* | ||
* \since QGIS 3.4 | ||
*/ | ||
void setRemoveDuplicateNodes( bool value ); | ||
|
||
/** | ||
* The precision in which geometries on this layer should be saved. | ||
* Geometries which are edited on this layer will be rounded to multiples of this value (snap to grid). | ||
* Set to 0.0 to disable. | ||
* | ||
* \since QGIS 3.4 | ||
*/ | ||
double geometryPrecision() const; | ||
|
||
/** | ||
* The precision in which geometries on this layer should be saved. | ||
* Geometries which are edited on this layer will be rounded to multiples of this value (snap to grid). | ||
* Set to 0.0 to disable. | ||
* | ||
* \since QGIS 3.4 | ||
*/ | ||
void setGeometryPrecision( double value ); | ||
|
||
/** | ||
* Determines if at least one fix is enabled. | ||
* | ||
* \since QGIS 3.4 | ||
*/ | ||
bool isActive() const; | ||
|
||
/** | ||
* Apply any fixes configured on this class to \a geometry. | ||
* | ||
* \since QGIS 3.4 | ||
*/ | ||
void apply( QgsGeometry &geometry ) const; | ||
|
||
private: | ||
|
||
/** | ||
* Automatically remove duplicate nodes on all geometries which are edited on this layer. | ||
* | ||
* \since QGIS 3.4 | ||
*/ | ||
bool mRemoveDuplicateNodes = false; | ||
|
||
/** | ||
* The precision in which geometries on this layer should be saved. | ||
* Geometries which are edited on this layer will be rounded to multiples of this value (snap to grid). | ||
* Set to 0.0 to disable. | ||
* | ||
* \since QGIS 3.4 | ||
*/ | ||
double mGeometryPrecision = 0.0; | ||
}; | ||
|
||
#endif // QGSGEOMETRYFIXES_H |
Oops, something went wrong.
?