21#ifndef QGSSGCGAL_GEOMETRY_H
22#define QGSSGCGAL_GEOMETRY_H
29#include "qgsabstractgeometry.h"
34#include <QtGui/qmatrix4x4.h>
44class CORE_EXPORT QgsSfcgalGeometry
55 SIP_SKIP QgsSfcgalGeometry( sfcgal::shared_geom sfcgalGeom );
64 QgsSfcgalGeometry(
const QgsAbstractGeometry *qgsGeom )
SIP_THROW( QgsSfcgalException );
71 QgsSfcgalGeometry(
const QgsAbstractGeometry &qgsGeom )
SIP_THROW( QgsSfcgalException );
78 QgsSfcgalGeometry(
const QgsGeometry &qgsGeom )
SIP_THROW( QgsSfcgalException );
85 QgsSfcgalGeometry(
const QString &wkt )
SIP_THROW( QgsSfcgalException );
92 QgsSfcgalGeometry(
const QgsSfcgalGeometry &otherGeom )
SIP_THROW( QgsSfcgalException );
97 QgsSfcgalGeometry &operator=(
const QgsSfcgalGeometry &other ) =
default;
103 SIP_SKIP sfcgal::shared_geom sfcgalGeometry()
const {
return mSfcgalGeom; }
111 std::unique_ptr<QgsAbstractGeometry> asQgisGeometry() const
SIP_THROW( QgsSfcgalException );
121 Qgis::WkbType wkbType() const
SIP_THROW( QgsSfcgalException );
132 QString geometryType() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException )
SIP_HOLDGIL;
137 std::unique_ptr<QgsSfcgalGeometry> clone() const;
146 static std::unique_ptr<QgsSfcgalGeometry> fromWkb( const QgsConstWkbPtr &wkbPtr )
SIP_THROW( QgsSfcgalException );
156 QByteArray asWkb( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const
SIP_THROW( QgsSfcgalException );
165 static std::unique_ptr<QgsSfcgalGeometry> fromWkt( const QString &wkt )
SIP_THROW( QgsSfcgalException );
175 QString asWkt(
int precision = -1 ) const
SIP_THROW( QgsSfcgalException );
187 std::unique_ptr<QgsSfcgalGeometry> boundary() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
198 bool operator==( const QgsSfcgalGeometry &other ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
209 bool operator!=( const QgsSfcgalGeometry &other ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
222 bool fuzzyEqual( const QgsSfcgalGeometry &other,
double epsilon ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
234 int dimension() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
247 int partCount() const
SIP_THROW( QgsSfcgalException );
259 bool addZValue(
double zValue = 0 )
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
271 bool addMValue(
double mValue = 0 )
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
282 bool dropZValue()
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
293 bool dropMValue()
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
303 void swapXy()
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
311 bool isValid() const
SIP_THROW( QgsSfcgalException );
319 bool isEmpty() const
SIP_THROW( QgsSfcgalException );
330 double area(
bool withDiscretization = false ) const
SIP_THROW( QgsSfcgalException );
343 double volume(
bool withDiscretization = false ) const
SIP_THROW( QgsSfcgalException );
356 double length() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
370 bool isSimple() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
382 QgsPoint centroid() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
395 std::unique_ptr<QgsSfcgalGeometry> translate( const QgsVector3D &translation ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
406 std::unique_ptr<QgsSfcgalGeometry> scale( const QgsVector3D &scaleFactor, const QgsPoint ¢er = QgsPoint() ) const
SIP_THROW( QgsSfcgalException );
417 std::unique_ptr<QgsSfcgalGeometry> rotate2D(
double angle, const QgsPoint ¢er ) const
SIP_THROW( QgsSfcgalException );
429 std::unique_ptr<QgsSfcgalGeometry> rotate3D(
double angle, const QgsVector3D &axisVector, const QgsPoint ¢er = QgsPoint() ) const
SIP_THROW( QgsSfcgalException );
441 std::unique_ptr<QgsSfcgalGeometry> transform( const QMatrix4x4 &mat ) const
SIP_THROW( QgsSfcgalException );
451 bool intersects( const QgsAbstractGeometry *otherGeom ) const
SIP_THROW( QgsSfcgalException );
461 bool intersects( const QgsSfcgalGeometry &otherGeom ) const
SIP_THROW( QgsSfcgalException );
471 std::unique_ptr<QgsSfcgalGeometry> intersection( const QgsAbstractGeometry *otherGeom ) const
SIP_THROW( QgsSfcgalException );
481 std::unique_ptr<QgsSfcgalGeometry> intersection( const QgsSfcgalGeometry &otherGeom ) const
SIP_THROW( QgsSfcgalException );
491 std::unique_ptr<QgsSfcgalGeometry> combine( const QVector<QgsAbstractGeometry *> &geomList ) const
SIP_THROW( QgsSfcgalException );
501 std::unique_ptr<QgsSfcgalGeometry> difference( const QgsAbstractGeometry *otherGeom ) const
SIP_THROW( QgsSfcgalException );
511 std::unique_ptr<QgsSfcgalGeometry> difference( const QgsSfcgalGeometry &otherGeom ) const
SIP_THROW( QgsSfcgalException );
519 std::unique_ptr<QgsSfcgalGeometry> triangulate() const
SIP_THROW( QgsSfcgalException );
527 std::unique_ptr<QgsSfcgalGeometry> convexHull() const
SIP_THROW( QgsSfcgalException );
538 std::unique_ptr<QgsSfcgalGeometry> envelope() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
550 bool covers( const QgsSfcgalGeometry &otherGeom ) const
SIP_THROW( QgsSfcgalException );
565 std::unique_ptr<QgsSfcgalGeometry> buffer3D(
double radius,
int segments, Qgis::JoinStyle3D joinStyle3D ) const
SIP_THROW( QgsSfcgalException );
579 std::unique_ptr<QgsSfcgalGeometry> buffer2D(
double radius,
int segments, Qgis::JoinStyle joinStyle ) const
SIP_THROW( QgsSfcgalException );
593 std::unique_ptr<QgsSfcgalGeometry> simplify(
double tolerance,
bool preserveTopology ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
604 std::unique_ptr<QgsSfcgalGeometry> extrude( const QgsVector3D &extrusion ) const
SIP_THROW( QgsSfcgalException );
616 std::unique_ptr<QgsSfcgalGeometry> approximateMedialAxis() const
SIP_THROW( QgsSfcgalException );
626 SIP_SKIP QgsSfcgalGeometry( sfcgal::shared_prim sfcgalPrim, sfcgal::primitiveType type );
634 static std::unique_ptr<QgsSfcgalGeometry> createCube(
double size )
SIP_THROW( QgsSfcgalException );
644 QList<std::pair<QString, QString>> primitiveParameters() const
SIP_THROW( QgsSfcgalException );
653 QVariant primitiveParameter( const QString &name ) const
SIP_THROW( QgsSfcgalException );
663 void primitiveSetParameter( const QString &name, const QVariant &value )
SIP_THROW( QgsSfcgalException );
671 std::unique_ptr<QgsSfcgalGeometry> primitiveAsPolyhedralSurface() const
SIP_THROW( QgsSfcgalException );
679 QMatrix4x4 primitiveTransform() const
SIP_THROW( QgsSfcgalException );
686 void clearCache() const;
690 sfcgal::shared_geom workingGeom() const;
692 sfcgal::shared_geom mSfcgalGeom;
693 bool mIsPrimitive = false;
695#if SFCGAL_VERSION_NUM >= SFCGAL_MAKE_VERSION( 2, 3, 0 )
696 void setPrimitiveTranslate(
const QgsVector3D &translation );
697 void setPrimitiveScale(
const QgsVector3D &scaleFactor,
const QgsPoint ¢er );
698 void setPrimitiveRotation(
double angle,
const QgsVector3D &axisVector,
const QgsPoint ¢er );
700 sfcgal::shared_prim mSfcgalPrim;
701 sfcgal::primitiveType mPrimType;
702 QMatrix4x4 mPrimTransform;
#define SIP_IF_MODULE(condition)
#define SIP_THROW(name,...)