52 Q_PROPERTY(
double x READ x WRITE setX )
53 Q_PROPERTY(
double y READ y WRITE setY )
54 Q_PROPERTY(
double z READ z WRITE setZ )
55 Q_PROPERTY(
double m READ m WRITE setM )
86 QgsPoint(
double x = std::numeric_limits<double>::quiet_NaN(),
double y = std::numeric_limits<double>::quiet_NaN(),
double z = std::numeric_limits<double>::quiet_NaN(),
double m = std::numeric_limits<double>::quiet_NaN(),
Qgis::WkbType wkbType =
Qgis::WkbType::Unknown );
88 QgsPoint( SIP_PYOBJECT x
SIP_TYPEHINT( Optional[Union[
QgsPoint, QPointF,
float]] ) = Py_None, SIP_PYOBJECT y
SIP_TYPEHINT( Optional[
float] ) = Py_None, SIP_PYOBJECT z
SIP_TYPEHINT( Optional[
float] ) = Py_None, SIP_PYOBJECT m
SIP_TYPEHINT( Optional[
float] ) = Py_None, SIP_PYOBJECT wkbType
SIP_TYPEHINT( Optional[
int] ) = Py_None ) [(
double x = 0.0,
double y = 0.0,
double z = 0.0,
double m = 0.0,
Qgis::WkbType wkbType =
Qgis::WkbType::Unknown )];
90 if ( sipCanConvertToType( a0, sipType_QgsPointXY, SIP_NOT_NONE ) && a1 == Py_None && a2 == Py_None && a3 == Py_None && a4 == Py_None )
95 QgsPointXY *p =
reinterpret_cast<QgsPointXY *
>( sipConvertToType( a0, sipType_QgsPointXY, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
98 sipReleaseType( p, sipType_QgsPointXY, state );
102 sipCpp =
new sipQgsPoint(
QgsPoint( *p ) );
105 else if ( sipCanConvertToType( a0, sipType_QPointF, SIP_NOT_NONE ) && a1 == Py_None && a2 == Py_None && a3 == Py_None && a4 == Py_None )
110 QPointF *p =
reinterpret_cast<QPointF *
>( sipConvertToType( a0, sipType_QPointF, 0, SIP_NOT_NONE, &state, &sipIsErr ) );
113 sipReleaseType( p, sipType_QPointF, state );
117 sipCpp =
new sipQgsPoint(
QgsPoint( *p ) );
121 ( a0 == Py_None || PyFloat_AsDouble( a0 ) != -1.0 || !PyErr_Occurred() ) &&
122 ( a1 == Py_None || PyFloat_AsDouble( a1 ) != -1.0 || !PyErr_Occurred() ) &&
123 ( a2 == Py_None || PyFloat_AsDouble( a2 ) != -1.0 || !PyErr_Occurred() ) &&
124 ( a3 == Py_None || PyFloat_AsDouble( a3 ) != -1.0 || !PyErr_Occurred() ) )
126 double x = a0 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a0 );
127 double y = a1 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a1 );
128 double z = a2 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a2 );
129 double m = a3 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a3 );
131 sipCpp =
new sipQgsPoint(
QgsPoint( x, y, z, m, wkbType ) );
135 PyErr_SetString( PyExc_TypeError, QStringLiteral(
"Invalid type in constructor arguments." ).toUtf8().constData() );
156 explicit QgsPoint(
Qgis::WkbType wkbType,
double x = std::numeric_limits<double>::quiet_NaN(),
double y = std::numeric_limits<double>::quiet_NaN(),
double z = std::numeric_limits<double>::quiet_NaN(),
double m = std::numeric_limits<double>::quiet_NaN() )
SIP_SKIP;
160 const QgsPoint *pt = qgsgeometry_cast< const QgsPoint * >( &other );
169 const bool nan1X = std::isnan( mX );
170 const bool nan2X = std::isnan( pt->
x() );
171 if ( nan1X != nan2X )
176 const bool nan1Y = std::isnan( mY );
177 const bool nan2Y = std::isnan( pt->
y() );
178 if ( nan1Y != nan2Y )
185 const bool nan1Z = std::isnan( mZ );
186 const bool nan2Z = std::isnan( pt->
z() );
187 if ( nan1Z != nan2Z )
195 const bool nan1M = std::isnan( mM );
196 const bool nan2M = std::isnan( pt->
m() );
197 if ( nan1M != nan2M )
333 return QPointF( mX, mY );
345 return std::sqrt( ( mX - x ) * ( mX - x ) + ( mY - y ) * ( mY - y ) );
357 return std::sqrt( ( mX - other.x() ) * ( mX - other.x() ) + ( mY - other.y() ) * ( mY - other.y() ) );
369 return ( mX - x ) * ( mX - x ) + ( mY - y ) * ( mY - y );
381 return ( mX - other.x() ) * ( mX - other.x() ) + ( mY - other.y() ) * ( mY - other.y() );
391 double distance3D(
double x,
double y,
double z )
const SIP_HOLDGIL;
409 double distanceSquared3D(
double x,
double y,
double z )
const SIP_HOLDGIL;
463 QgsPoint project(
double distance,
double azimuth,
double inclination = 90.0 ) const
SIP_HOLDGIL;
502 QgsPoint *snappedToGrid(
double hSpacing,
double vSpacing,
double dSpacing = 0,
double mSpacing = 0 ) const override
SIP_FACTORY;
503 bool removeDuplicateNodes(
double epsilon = 4 * std::numeric_limits<
double>::epsilon(),
bool useZValues = false ) override;
504 void clear() override;
506 bool fromWkt( const QString &wkt ) override;
509 QString asWkt(
int precision = 17 ) const override;
513 QString asKml(
int precision = 17 ) const override;
514 void draw( QPainter &p ) const override;
515 QPainterPath asQPainterPath() const override;
517 void transform( const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0 ) override;
520 int vertexNumberFromVertexId(
QgsVertexId id ) const override;
522 bool isValid( QString &error
SIP_OUT,
Qgis::GeometryValidityFlags flags =
Qgis::GeometryValidityFlags() ) const override
SIP_HOLDGIL;
527 bool deleteVertex(
QgsVertexId position ) override;
538 double vertexAngle(
QgsVertexId vertex ) const override;
540 int vertexCount(
int = 0,
int = 0 ) const override;
541 int ringCount(
int = 0 ) const override;
542 int partCount() const override;
545 double segmentLength(
QgsVertexId startVertex ) const override;
549 bool addZValue(
double zValue = 0 ) override;
550 bool addMValue(
double mValue = 0 ) override;
551 bool dropZValue() override;
552 bool dropMValue() override;
553 void swapXy() override;
554 bool convertTo(
Qgis::WkbType type ) override;
573 return static_cast<const QgsPoint *
>( geom );
581 SIP_PYOBJECT __repr__();
583 QString
str = QStringLiteral(
"<QgsPoint: %1>" ).arg( sipCpp->asWkt() );
584 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );