21#ifndef QGSSGCGAL_GEOMETRY_H
22#define QGSSGCGAL_GEOMETRY_H
33#include <QtGui/qmatrix4x4.h>
43class CORE_EXPORT QgsSfcgalGeometry
54 SIP_SKIP QgsSfcgalGeometry( sfcgal::shared_geom sfcgalGeom );
63 QgsSfcgalGeometry(
const QgsAbstractGeometry *qgsGeom )
SIP_THROW( QgsSfcgalException );
70 QgsSfcgalGeometry(
const QgsAbstractGeometry &qgsGeom )
SIP_THROW( QgsSfcgalException );
77 QgsSfcgalGeometry(
const QgsGeometry &qgsGeom )
SIP_THROW( QgsSfcgalException );
84 QgsSfcgalGeometry(
const QString &wkt )
SIP_THROW( QgsSfcgalException );
91 QgsSfcgalGeometry(
const QgsSfcgalGeometry &otherGeom )
SIP_THROW( QgsSfcgalException );
96 QgsSfcgalGeometry &operator=(
const QgsSfcgalGeometry &other ) =
default;
102 SIP_SKIP sfcgal::shared_geom sfcgalGeometry()
const {
return mSfcgalGeom; }
110 std::unique_ptr<QgsAbstractGeometry> asQgisGeometry() const
SIP_THROW( QgsSfcgalException );
120 Qgis::WkbType wkbType() const
SIP_THROW( QgsSfcgalException );
131 QString geometryType() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException )
SIP_HOLDGIL;
136 std::unique_ptr<QgsSfcgalGeometry> clone() const;
145 static std::unique_ptr<QgsSfcgalGeometry> fromWkb( const QgsConstWkbPtr &wkbPtr )
SIP_THROW( QgsSfcgalException );
155 QByteArray asWkb( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() ) const
SIP_THROW( QgsSfcgalException );
164 static std::unique_ptr<QgsSfcgalGeometry> fromWkt( const QString &wkt )
SIP_THROW( QgsSfcgalException );
174 QString asWkt(
int precision = -1 ) const
SIP_THROW( QgsSfcgalException );
186 std::unique_ptr<QgsSfcgalGeometry> boundary() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
197 bool operator==( const QgsSfcgalGeometry &other ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
208 bool operator!=( const QgsSfcgalGeometry &other ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
221 bool fuzzyEqual( const QgsSfcgalGeometry &other,
double epsilon ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
233 int dimension() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
246 int partCount() const
SIP_THROW( QgsSfcgalException );
258 bool addZValue(
double zValue = 0 )
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
270 bool addMValue(
double mValue = 0 )
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
281 bool dropZValue()
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
292 bool dropMValue()
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
302 void swapXy()
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
310 bool isValid() const
SIP_THROW( QgsSfcgalException );
318 bool isEmpty() const
SIP_THROW( QgsSfcgalException );
329 double area(
bool withDiscretization = false ) const
SIP_THROW( QgsSfcgalException );
342 double volume(
bool withDiscretization = false ) const
SIP_THROW( QgsSfcgalException );
355 double length() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
369 bool isSimple() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
381 QgsPoint centroid() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
394 std::unique_ptr<QgsSfcgalGeometry> translate( const QgsVector3D &translation ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
405 std::unique_ptr<QgsSfcgalGeometry> scale( const QgsVector3D &scaleFactor, const QgsPoint ¢er = QgsPoint() ) const
SIP_THROW( QgsSfcgalException );
416 std::unique_ptr<QgsSfcgalGeometry> rotate2D(
double angle, const QgsPoint ¢er ) const
SIP_THROW( QgsSfcgalException );
428 std::unique_ptr<QgsSfcgalGeometry> rotate3D(
double angle, const QgsVector3D &axisVector, const QgsPoint ¢er = QgsPoint() ) const
SIP_THROW( QgsSfcgalException );
440 std::unique_ptr<QgsSfcgalGeometry> transform( const QMatrix4x4 &mat ) const
SIP_THROW( QgsSfcgalException );
450 bool intersects( const QgsAbstractGeometry *otherGeom ) const
SIP_THROW( QgsSfcgalException );
460 bool intersects( const QgsSfcgalGeometry &otherGeom ) const
SIP_THROW( QgsSfcgalException );
470 std::unique_ptr<QgsSfcgalGeometry> intersection( const QgsAbstractGeometry *otherGeom ) const
SIP_THROW( QgsSfcgalException );
480 std::unique_ptr<QgsSfcgalGeometry> intersection( const QgsSfcgalGeometry &otherGeom ) const
SIP_THROW( QgsSfcgalException );
490 std::unique_ptr<QgsSfcgalGeometry> combine( const QVector<QgsAbstractGeometry *> &geomList ) const
SIP_THROW( QgsSfcgalException );
500 std::unique_ptr<QgsSfcgalGeometry> difference( const QgsAbstractGeometry *otherGeom ) const
SIP_THROW( QgsSfcgalException );
510 std::unique_ptr<QgsSfcgalGeometry> difference( const QgsSfcgalGeometry &otherGeom ) const
SIP_THROW( QgsSfcgalException );
518 std::unique_ptr<QgsSfcgalGeometry> triangulate() const
SIP_THROW( QgsSfcgalException );
526 std::unique_ptr<QgsSfcgalGeometry> convexHull() const
SIP_THROW( QgsSfcgalException );
537 std::unique_ptr<QgsSfcgalGeometry> envelope() const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
549 bool covers( const QgsSfcgalGeometry &otherGeom ) const
SIP_THROW( QgsSfcgalException );
564 std::unique_ptr<QgsSfcgalGeometry> buffer3D(
double radius,
int segments, Qgis::JoinStyle3D joinStyle3D ) const
SIP_THROW( QgsSfcgalException );
578 std::unique_ptr<QgsSfcgalGeometry> buffer2D(
double radius,
int segments, Qgis::JoinStyle joinStyle ) const
SIP_THROW( QgsSfcgalException );
592 std::unique_ptr<QgsSfcgalGeometry> simplify(
double tolerance,
bool preserveTopology ) const
SIP_THROW( QgsNotSupportedException, QgsSfcgalException );
603 std::unique_ptr<QgsSfcgalGeometry> extrude( const QgsVector3D &extrusion ) const
SIP_THROW( QgsSfcgalException );
615 std::unique_ptr<QgsSfcgalGeometry> approximateMedialAxis() const
SIP_THROW( QgsSfcgalException );
625 SIP_SKIP QgsSfcgalGeometry( sfcgal::shared_prim sfcgalPrim, sfcgal::primitiveType type );
633 static std::unique_ptr<QgsSfcgalGeometry> createCube(
double size )
SIP_THROW( QgsSfcgalException );
643 QList<std::pair<QString, QString>> primitiveParameters() const
SIP_THROW( QgsSfcgalException );
652 QVariant primitiveParameter( const QString &name ) const
SIP_THROW( QgsSfcgalException );
662 void primitiveSetParameter( const QString &name, const QVariant &value )
SIP_THROW( QgsSfcgalException );
670 std::unique_ptr<QgsSfcgalGeometry> primitiveAsPolyhedralSurface() const
SIP_THROW( QgsSfcgalException );
678 QMatrix4x4 primitiveTransform() const
SIP_THROW( QgsSfcgalException );
685 void clearCache() const;
689 sfcgal::shared_geom workingGeom() const;
691 sfcgal::shared_geom mSfcgalGeom;
692 bool mIsPrimitive = false;
694#if SFCGAL_VERSION >= SFCGAL_MAKE_VERSION( 2, 3, 0 )
695 void setPrimitiveTranslate(
const QgsVector3D &translation );
696 void setPrimitiveScale(
const QgsVector3D &scaleFactor,
const QgsPoint ¢er );
697 void setPrimitiveRotation(
double angle,
const QgsVector3D &axisVector,
const QgsPoint ¢er );
699 sfcgal::shared_prim mSfcgalPrim;
700 sfcgal::primitiveType mPrimType;
701 QMatrix4x4 mPrimTransform;
#define SIP_IF_MODULE(condition)
#define SIP_THROW(name,...)