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 );
133 QString geometryType() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException )
SIP_HOLDGIL;
139 std::unique_ptr<QgsSfcgalGeometry> clone() const;
148 static std::unique_ptr<QgsSfcgalGeometry> fromWkb( const QgsConstWkbPtr &wkbPtr )
SIP_THROW( QgsSfcgalException );
158 QByteArray asWkb( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const
SIP_THROW( QgsSfcgalException );
167 static std::unique_ptr<QgsSfcgalGeometry> fromWkt( const QString &wkt )
SIP_THROW( QgsSfcgalException );
177 QString asWkt(
int precision = -1 ) const
SIP_THROW( QgsSfcgalException );
189 std::unique_ptr<QgsSfcgalGeometry> boundary() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
200 bool operator==( const QgsSfcgalGeometry &other ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
211 bool operator!=( const QgsSfcgalGeometry &other ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
224 bool fuzzyEqual( const QgsSfcgalGeometry &other,
double epsilon ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
236 int dimension() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
249 int partCount() const
SIP_THROW( QgsSfcgalException );
261 bool addZValue(
double zValue = 0 )
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
273 bool addMValue(
double mValue = 0 )
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
284 bool dropZValue()
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
295 bool dropMValue()
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
305 void swapXy()
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
313 bool isValid() const
SIP_THROW( QgsSfcgalException );
321 bool isEmpty() const
SIP_THROW( QgsSfcgalException );
332 double area(
bool withDiscretization = false ) const
SIP_THROW( QgsSfcgalException );
345 double volume(
bool withDiscretization = false ) const
SIP_THROW( QgsSfcgalException );
358 double length() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
372 bool isSimple() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
384 QgsPoint centroid() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
397 std::unique_ptr<QgsSfcgalGeometry> translate( const QgsVector3D &translation ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
408 std::unique_ptr<QgsSfcgalGeometry> scale( const QgsVector3D &scaleFactor, const QgsPoint ¢er = QgsPoint() ) const
SIP_THROW( QgsSfcgalException );
419 std::unique_ptr<QgsSfcgalGeometry> rotate2D(
double angle, const QgsPoint ¢er ) const
SIP_THROW( QgsSfcgalException );
431 std::unique_ptr<QgsSfcgalGeometry> rotate3D(
double angle, const QgsVector3D &axisVector, const QgsPoint ¢er = QgsPoint() ) const
SIP_THROW( QgsSfcgalException );
443 std::unique_ptr<QgsSfcgalGeometry> transform( const QMatrix4x4 &mat ) const
SIP_THROW( QgsSfcgalException );
453 bool intersects( const QgsAbstractGeometry *otherGeom ) const
SIP_THROW( QgsSfcgalException );
463 bool intersects( const QgsSfcgalGeometry &otherGeom ) const
SIP_THROW( QgsSfcgalException );
473 std::unique_ptr<QgsSfcgalGeometry> intersection( const QgsAbstractGeometry *otherGeom ) const
SIP_THROW( QgsSfcgalException );
483 std::unique_ptr<QgsSfcgalGeometry> intersection( const QgsSfcgalGeometry &otherGeom ) const
SIP_THROW( QgsSfcgalException );
493 std::unique_ptr<QgsSfcgalGeometry> combine( const QVector<QgsAbstractGeometry *> &geomList ) const
SIP_THROW( QgsSfcgalException );
503 std::unique_ptr<QgsSfcgalGeometry> difference( const QgsAbstractGeometry *otherGeom ) const
SIP_THROW( QgsSfcgalException );
513 std::unique_ptr<QgsSfcgalGeometry> difference( const QgsSfcgalGeometry &otherGeom ) const
SIP_THROW( QgsSfcgalException );
521 std::unique_ptr<QgsSfcgalGeometry> triangulate() const
SIP_THROW( QgsSfcgalException );
529 std::unique_ptr<QgsSfcgalGeometry> convexHull() const
SIP_THROW( QgsSfcgalException );
540 std::unique_ptr<QgsSfcgalGeometry> envelope() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
552 bool covers( const QgsSfcgalGeometry &otherGeom ) const
SIP_THROW( QgsSfcgalException );
567 std::unique_ptr<QgsSfcgalGeometry> buffer3D(
double radius,
int segments, Qgis::JoinStyle3D joinStyle3D ) const
SIP_THROW( QgsSfcgalException );
581 std::unique_ptr<QgsSfcgalGeometry> buffer2D(
double radius,
int segments, Qgis::JoinStyle joinStyle ) const
SIP_THROW( QgsSfcgalException );
595 std::unique_ptr<QgsSfcgalGeometry> simplify(
double tolerance,
bool preserveTopology ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
606 std::unique_ptr<QgsSfcgalGeometry> extrude( const QgsVector3D &extrusion ) const
SIP_THROW( QgsSfcgalException );
618 std::unique_ptr<QgsSfcgalGeometry> approximateMedialAxis() const
SIP_THROW( QgsSfcgalException );
628 SIP_SKIP QgsSfcgalGeometry( sfcgal::shared_prim sfcgalPrim, sfcgal::primitiveType type );
636 static std::unique_ptr<QgsSfcgalGeometry> createCube(
double size )
SIP_THROW( QgsSfcgalException );
646 QList<std::pair<QString, QString>> primitiveParameters() const
SIP_THROW( QgsSfcgalException );
655 QVariant primitiveParameter( const QString &name ) const
SIP_THROW( QgsSfcgalException );
665 void primitiveSetParameter( const QString &name, const QVariant &value )
SIP_THROW( QgsSfcgalException );
673 std::unique_ptr<QgsSfcgalGeometry> primitiveAsPolyhedralSurface() const
SIP_THROW( QgsSfcgalException );
681 QMatrix4x4 primitiveTransform() const
SIP_THROW( QgsSfcgalException );
688 void clearCache() const;
692 sfcgal::shared_geom workingGeom() const;
694 sfcgal::shared_geom mSfcgalGeom;
695 bool mIsPrimitive = false;
697#if SFCGAL_VERSION_NUM >= SFCGAL_MAKE_VERSION( 2, 3, 0 )
698 void setPrimitiveTranslate(
const QgsVector3D &translation );
699 void setPrimitiveScale(
const QgsVector3D &scaleFactor,
const QgsPoint ¢er );
700 void setPrimitiveRotation(
double angle,
const QgsVector3D &axisVector,
const QgsPoint ¢er );
702 sfcgal::shared_prim mSfcgalPrim;
703 sfcgal::primitiveType mPrimType;
704 QMatrix4x4 mPrimTransform;
#define SIP_IF_MODULE(condition)
#define SIP_THROW(name,...)