Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't allow qgsgeometry_cast to cast away const #60944

Merged
merged 5 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ Abstract base class for all geometries
sipType = sipType_QgsPolygon;
else if ( qgsgeometry_cast<QgsCurvePolygon *>( sipCpp ) != nullptr )
sipType = sipType_QgsCurvePolygon;
else if ( qgsgeometry_cast<QgsTriangulatedSurface *>( sipCpp ) != nullptr )
sipType = sipType_QgsTriangulatedSurface;
else if ( qgsgeometry_cast<QgsPolyhedralSurface *>( sipCpp ) != nullptr )
sipType = sipType_QgsPolyhedralSurface;
else if ( qgsgeometry_cast<QgsSurface *>( sipCpp ) != nullptr )
sipType = sipType_QgsSurface;
else if ( qgsgeometry_cast<QgsMultiPoint *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiPoint;
else if ( qgsgeometry_cast<QgsMultiLineString *>( sipCpp ) != nullptr )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ corresponds to the last point in the line.
%End


QgsBox3D calculateBoundingBox3d() const /Deprecated="Since 3.34. use calculateBoundingBox3D() instead"/;
QgsBox3D calculateBoundingBox3d() const /Deprecated="Since 3.34. Use calculateBoundingBox3D() instead."/;
%Docstring
Calculates the minimal 3D bounding box for the geometry.

Expand All @@ -864,7 +864,7 @@ Calculates the minimal 3D bounding box for the geometry.

.. deprecated:: 3.34

use :py:func:`~QgsLineString.calculateBoundingBox3D` instead
Use :py:func:`~QgsLineString.calculateBoundingBox3D` instead.
%End

virtual QgsBox3D calculateBoundingBox3D() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ Abstract base class for all geometries
sipType = sipType_QgsPolygon;
else if ( qgsgeometry_cast<QgsCurvePolygon *>( sipCpp ) != nullptr )
sipType = sipType_QgsCurvePolygon;
else if ( qgsgeometry_cast<QgsTriangulatedSurface *>( sipCpp ) != nullptr )
sipType = sipType_QgsTriangulatedSurface;
else if ( qgsgeometry_cast<QgsPolyhedralSurface *>( sipCpp ) != nullptr )
sipType = sipType_QgsPolyhedralSurface;
else if ( qgsgeometry_cast<QgsSurface *>( sipCpp ) != nullptr )
sipType = sipType_QgsSurface;
else if ( qgsgeometry_cast<QgsMultiPoint *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiPoint;
else if ( qgsgeometry_cast<QgsMultiLineString *>( sipCpp ) != nullptr )
Expand Down
4 changes: 2 additions & 2 deletions python/core/auto_generated/geometry/qgslinestring.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ corresponds to the last point in the line.
%End


QgsBox3D calculateBoundingBox3d() const /Deprecated="Since 3.34. use calculateBoundingBox3D() instead"/;
QgsBox3D calculateBoundingBox3d() const /Deprecated="Since 3.34. Use calculateBoundingBox3D() instead."/;
%Docstring
Calculates the minimal 3D bounding box for the geometry.

Expand All @@ -864,7 +864,7 @@ Calculates the minimal 3D bounding box for the geometry.

.. deprecated:: 3.34

use :py:func:`~QgsLineString.calculateBoundingBox3D` instead
Use :py:func:`~QgsLineString.calculateBoundingBox3D` instead.
%End

virtual QgsBox3D calculateBoundingBox3D() const;
Expand Down
22 changes: 11 additions & 11 deletions src/3d/qgsrubberband3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,13 @@ void QgsRubberBand3D::reset()

void QgsRubberBand3D::addPoint( const QgsPoint &pt )
{
if ( QgsPolygon *polygon = qgsgeometry_cast<QgsPolygon *>( mGeometry.constGet() ) )
if ( QgsPolygon *polygon = qgsgeometry_cast<QgsPolygon *>( mGeometry.get() ) )
{
QgsLineString *exteriorRing = qgsgeometry_cast<QgsLineString *>( polygon->exteriorRing() );
const int lastVertexIndex = exteriorRing->numPoints() - 1;
exteriorRing->insertVertex( QgsVertexId( 0, 0, lastVertexIndex ), pt );
}
else if ( QgsLineString *lineString = qgsgeometry_cast<QgsLineString *>( mGeometry.constGet() ) )
else if ( QgsLineString *lineString = qgsgeometry_cast<QgsLineString *>( mGeometry.get() ) )
{
lineString->addVertex( pt );
// transform linestring to polygon if we have enough vertices
Expand Down Expand Up @@ -345,13 +345,13 @@ void QgsRubberBand3D::setGeometry( const QgsGeometry &geometry )
void QgsRubberBand3D::removeLastPoint()
{
QgsLineString *lineString = nullptr;
if ( QgsPolygon *polygon = qgsgeometry_cast<QgsPolygon *>( mGeometry.constGet() ) )
if ( QgsPolygon *polygon = qgsgeometry_cast<QgsPolygon *>( mGeometry.get() ) )
{
lineString = qgsgeometry_cast<QgsLineString *>( polygon->exteriorRing() );
const int lastVertexIndex = lineString->numPoints() - 2;
lineString->deleteVertex( QgsVertexId( 0, 0, lastVertexIndex ) );
}
else if ( ( lineString = qgsgeometry_cast<QgsLineString *>( mGeometry.constGet() ) ) )
else if ( ( lineString = qgsgeometry_cast<QgsLineString *>( mGeometry.get() ) ) )
{
const int lastVertexIndex = lineString->numPoints() - 1;
lineString->deleteVertex( QgsVertexId( 0, 0, lastVertexIndex ) );
Expand All @@ -361,7 +361,7 @@ void QgsRubberBand3D::removeLastPoint()
return;
}

if ( lineString->numPoints() < 3 && !qgsgeometry_cast<QgsLineString *>( mGeometry.constGet() ) )
if ( lineString->numPoints() < 3 && !qgsgeometry_cast<const QgsLineString *>( mGeometry.constGet() ) )
{
mGeometry.set( new QgsLineString( *lineString ) );
}
Expand All @@ -372,13 +372,13 @@ void QgsRubberBand3D::removeLastPoint()
void QgsRubberBand3D::moveLastPoint( const QgsPoint &pt )
{
QgsLineString *lineString = nullptr;
if ( QgsPolygon *polygon = qgsgeometry_cast<QgsPolygon *>( mGeometry.constGet() ) )
if ( QgsPolygon *polygon = qgsgeometry_cast<QgsPolygon *>( mGeometry.get() ) )
{
lineString = qgsgeometry_cast<QgsLineString *>( polygon->exteriorRing() );
const int lastVertexIndex = lineString->numPoints() - 2;
lineString->moveVertex( QgsVertexId( 0, 0, lastVertexIndex ), pt );
}
else if ( ( lineString = qgsgeometry_cast<QgsLineString *>( mGeometry.constGet() ) ) )
else if ( ( lineString = qgsgeometry_cast<QgsLineString *>( mGeometry.get() ) ) )
{
const int lastVertexIndex = lineString->numPoints() - 1;
lineString->moveVertex( QgsVertexId( 0, 0, lastVertexIndex ), pt );
Expand All @@ -396,14 +396,14 @@ void QgsRubberBand3D::updateGeometry()
QgsLineVertexData lineData;
lineData.withAdjacency = true;
lineData.init( Qgis::AltitudeClamping::Absolute, Qgis::AltitudeBinding::Vertex, 0, Qgs3DRenderContext::fromMapSettings( mMapSettings ), mMapSettings->origin() );
if ( QgsPolygon *polygon = qgsgeometry_cast<QgsPolygon *>( mGeometry.constGet() ) )
if ( const QgsPolygon *polygon = qgsgeometry_cast<const QgsPolygon *>( mGeometry.constGet() ) )
{
QgsLineString *lineString = qgsgeometry_cast<QgsLineString *>( polygon->exteriorRing()->clone() );
std::unique_ptr< QgsLineString > lineString( qgsgeometry_cast<QgsLineString *>( polygon->exteriorRing()->clone() ) );
const int lastVertexIndex = lineString->numPoints() - 1;
lineString->deleteVertex( QgsVertexId( 0, 0, lastVertexIndex ) );
lineData.addLineString( *lineString, 0, true );
}
else if ( const QgsLineString *lineString = qgsgeometry_cast<QgsLineString *>( mGeometry.constGet() ) )
else if ( const QgsLineString *lineString = qgsgeometry_cast<const QgsLineString *>( mGeometry.constGet() ) )
{
lineData.addLineString( *lineString, 0, false );
}
Expand All @@ -429,7 +429,7 @@ void QgsRubberBand3D::updateGeometry()

if ( mGeometryType == Qgis::GeometryType::Polygon )
{
if ( const QgsPolygon *polygon = qgsgeometry_cast<QgsPolygon *>( mGeometry.constGet() ) )
if ( const QgsPolygon *polygon = qgsgeometry_cast<const QgsPolygon *>( mGeometry.constGet() ) )
{
QgsTessellator tessellator( mMapSettings->origin().x(), mMapSettings->origin().y(), true );
tessellator.setOutputZUp( true );
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/processing/qgsalgorithmconcavehull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ void QgsConcaveHullAlgorithm::concaveHullGeos( std::unique_ptr<QgsFeatureSink> &
const QgsMultiPoint mp( *qgsgeometry_cast<const QgsMultiPoint *>( geom ) );
for ( auto pit = mp.const_parts_begin(); pit != mp.const_parts_end(); ++pit )
{
allPoints.addPartV2( qgsgeometry_cast<QgsPoint *>( *pit )->clone(), Qgis::WkbType::Point );
allPoints.addPartV2( qgsgeometry_cast<const QgsPoint *>( *pit )->clone(), Qgis::WkbType::Point );
}
}
else
{
allPoints.addPartV2( qgsgeometry_cast<QgsPoint *>( geom )->clone(), Qgis::WkbType::Point );
allPoints.addPartV2( qgsgeometry_cast<const QgsPoint *>( geom )->clone(), Qgis::WkbType::Point );
}
}
const QgsGeometry concaveHull = allPoints.concaveHull( mPercentage, mAllowHoles );
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/processing/qgsalgorithmdelaunaytriangulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ QVariantMap QgsDelaunayTriangulationAlgorithm::processAlgorithm( const QVariantM
const QgsMultiPoint mp( *qgsgeometry_cast< const QgsMultiPoint * >( geom ) );
for ( auto pit = mp.const_parts_begin(); pit != mp.const_parts_end(); ++pit )
{
allPoints.addPartV2( qgsgeometry_cast< QgsPoint * >( *pit )->clone(), Qgis::WkbType::Point );
allPoints.addPartV2( qgsgeometry_cast< const QgsPoint * >( *pit )->clone(), Qgis::WkbType::Point );
}
}
else
{
allPoints.addPartV2( qgsgeometry_cast< QgsPoint * >( geom )->clone(), Qgis::WkbType::Point );
allPoints.addPartV2( qgsgeometry_cast< const QgsPoint * >( geom )->clone(), Qgis::WkbType::Point );
}

return true; }, QgsSpatialIndex::FlagStoreFeatureGeometries );
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmexplode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ std::vector<QgsGeometry> QgsExplodeAlgorithm::curveAsSingleSegments( const QgsCu

case Qgis::WkbType::CompoundCurve:
{
const QgsCompoundCurve *compoundCurve = qgsgeometry_cast<QgsCompoundCurve *>( curve );
const QgsCompoundCurve *compoundCurve = qgsgeometry_cast<const QgsCompoundCurve *>( curve );
for ( int i = 0; i < compoundCurve->nCurves(); ++i )
{
std::vector<QgsGeometry> segments = curveAsSingleSegments( compoundCurve->curveAt( i ), true );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ QVariantMap QgsMeshSurfaceToPolygonAlgorithm::processAlgorithm( const QVariantMa

// individula polygon - can be either polygon or hole in polygon
QgsPolygon *polygon = new QgsPolygon();
polygon->setExteriorRing( qgsgeometry_cast<QgsLineString *>( *pit )->clone() );
polygon->setExteriorRing( qgsgeometry_cast<const QgsLineString *>( *pit )->clone() );

// add first polygon, no need to check anything
if ( polygons.empty() )
Expand Down
6 changes: 3 additions & 3 deletions src/analysis/processing/qgsalgorithmpolygonstolines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ QList<QgsCurve *> QgsPolygonsToLinesAlgorithm::extractRings( const QgsAbstractGe
{
QList<QgsCurve *> rings;

if ( QgsGeometryCollection *collection = qgsgeometry_cast<QgsGeometryCollection *>( geom ) )
if ( const QgsGeometryCollection *collection = qgsgeometry_cast<const QgsGeometryCollection *>( geom ) )
{
QgsGeometryPartIterator parts = collection->parts();
QgsGeometryConstPartIterator parts = collection->parts();
while ( parts.hasNext() )
rings.append( extractRings( parts.next() ) );
}
else if ( QgsCurvePolygon *polygon = qgsgeometry_cast<QgsCurvePolygon *>( geom ) )
else if ( const QgsCurvePolygon *polygon = qgsgeometry_cast<const QgsCurvePolygon *>( geom ) )
{
if ( auto exteriorRing = polygon->exteriorRing() )
rings.append( exteriorRing->clone() );
Expand Down
8 changes: 4 additions & 4 deletions src/analysis/processing/qgsalgorithmvoronoipolygons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ QString QgsVoronoiPolygonsAlgorithm::voronoiWithAttributes( const QVariantMap &p
const QgsMultiPoint mp( *qgsgeometry_cast< const QgsMultiPoint * >( geom ) );
for ( auto pit = mp.const_parts_begin(); pit != mp.const_parts_end(); ++pit )
{
allPoints.addPartV2( qgsgeometry_cast< QgsPoint * >( *pit )->clone(), Qgis::WkbType::Point );
allPoints.addPartV2( qgsgeometry_cast< const QgsPoint * >( *pit )->clone(), Qgis::WkbType::Point );
}
}
else
{
allPoints.addPartV2( qgsgeometry_cast< QgsPoint * >( geom )->clone(), Qgis::WkbType::Point );
allPoints.addPartV2( qgsgeometry_cast< const QgsPoint * >( geom )->clone(), Qgis::WkbType::Point );
}

attributeCache.insert( f.id(), f.attributes() );
Expand Down Expand Up @@ -228,12 +228,12 @@ QString QgsVoronoiPolygonsAlgorithm::voronoiWithoutAttributes( const QVariantMap
const QgsMultiPoint mp( *qgsgeometry_cast<const QgsMultiPoint *>( geom ) );
for ( auto pit = mp.const_parts_begin(); pit != mp.const_parts_end(); ++pit )
{
points->addGeometry( qgsgeometry_cast<QgsPoint *>( *pit )->clone() );
points->addGeometry( qgsgeometry_cast<const QgsPoint *>( *pit )->clone() );
}
}
else
{
points->addGeometry( qgsgeometry_cast<QgsPoint *>( geom )->clone() );
points->addGeometry( qgsgeometry_cast<const QgsPoint *>( geom )->clone() );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ QgsAbstractGeometry *QgsGeometryCheckerUtils::getGeomPart( QgsAbstractGeometry *

const QgsAbstractGeometry *QgsGeometryCheckerUtils::getGeomPart( const QgsAbstractGeometry *geom, int partIdx )
{
if ( QgsGeometryCollection *collection = qgsgeometry_cast<QgsGeometryCollection *>( geom ) )
if ( const QgsGeometryCollection *collection = qgsgeometry_cast<const QgsGeometryCollection *>( geom ) )
{
return collection->geometryN( partIdx );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ void QgsGeometryMissingVertexCheck::collectErrors( const QMap<QString, QgsFeatur
const QgsGeometry geometry = layerFeature.geometry();
const QgsAbstractGeometry *geom = geometry.constGet();

if ( QgsCurvePolygon *polygon = qgsgeometry_cast<QgsCurvePolygon *>( geom ) )
if ( const QgsCurvePolygon *polygon = qgsgeometry_cast<const QgsCurvePolygon *>( geom ) )
{
processPolygon( polygon, featurePool, errors, layerFeature, feedback );
}
else if ( QgsGeometryCollection *collection = qgsgeometry_cast<QgsGeometryCollection *>( geom ) )
else if ( const QgsGeometryCollection *collection = qgsgeometry_cast<const QgsGeometryCollection *>( geom ) )
{
const int numGeometries = collection->numGeometries();
for ( int i = 0; i < numGeometries; ++i )
{
if ( QgsCurvePolygon *polygon = qgsgeometry_cast<QgsCurvePolygon *>( collection->geometryN( i ) ) )
if ( const QgsCurvePolygon *polygon = qgsgeometry_cast<const QgsCurvePolygon *>( collection->geometryN( i ) ) )
{
processPolygon( polygon, featurePool, errors, layerFeature, feedback );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,13 @@ void Qgs3DMapToolPointCloudChangeAttributePaintbrush::generateHighlightArea()
{
const QgsGeometry searchSkeleton = QgsGeometry( new QgsLineString( mDragPositions ) );
const QgsGeometry searchGeometry = searchSkeleton.buffer( mSelectionRubberBand->width() / 2, 6 );
QgsPolygon *searchPolygon = qgsgeometry_cast<QgsPolygon *>( searchGeometry.constGet() );
Q_ASSERT( searchPolygon );
std::unique_ptr< QgsPolygon > searchPolygon( qgsgeometry_cast<const QgsPolygon *>( searchGeometry.constGet() )->clone() );
auto transform = [this]( const QgsPoint &point ) -> QgsPoint {
return Qgs3DUtils::screenPointToMapCoordinates( QPoint( static_cast<int>( point.x() ), static_cast<int>( point.y() ) ), mCanvas->size(), mCanvas->cameraController(), mCanvas->mapSettings() );
};
searchPolygon->addZValue( 0 );
searchPolygon->transformVertices( transform );
mHighlighterRubberBand->setGeometry( QgsGeometry( searchPolygon->clone() ) );
mHighlighterRubberBand->setGeometry( QgsGeometry( std::move( searchPolygon ) ) );
}

void Qgs3DMapToolPointCloudChangeAttributePaintbrush::mousePressEvent( QMouseEvent *event )
Expand Down
10 changes: 5 additions & 5 deletions src/core/expression/qgsexpressionfunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3841,14 +3841,14 @@ static QVariant fcnMakePolygon( const QVariantList &values, const QgsExpressionC

auto polygon = std::make_unique< QgsPolygon >();

const QgsCurve *exteriorRing = qgsgeometry_cast< QgsCurve * >( outerRing.constGet() );
const QgsCurve *exteriorRing = qgsgeometry_cast< const QgsCurve * >( outerRing.constGet() );
if ( !exteriorRing && outerRing.isMultipart() )
{
if ( const QgsGeometryCollection *collection = qgsgeometry_cast< const QgsGeometryCollection * >( outerRing.constGet() ) )
{
if ( collection->numGeometries() == 1 )
{
exteriorRing = qgsgeometry_cast< QgsCurve * >( collection->geometryN( 0 ) );
exteriorRing = qgsgeometry_cast< const QgsCurve * >( collection->geometryN( 0 ) );
}
}
}
Expand All @@ -3868,14 +3868,14 @@ static QVariant fcnMakePolygon( const QVariantList &values, const QgsExpressionC
if ( ringGeom.type() != Qgis::GeometryType::Line || ringGeom.isNull() )
continue;

const QgsCurve *ring = qgsgeometry_cast< QgsCurve * >( ringGeom.constGet() );
const QgsCurve *ring = qgsgeometry_cast< const QgsCurve * >( ringGeom.constGet() );
if ( !ring && ringGeom.isMultipart() )
{
if ( const QgsGeometryCollection *collection = qgsgeometry_cast< const QgsGeometryCollection * >( ringGeom.constGet() ) )
{
if ( collection->numGeometries() == 1 )
{
ring = qgsgeometry_cast< QgsCurve * >( collection->geometryN( 0 ) );
ring = qgsgeometry_cast< const QgsCurve * >( collection->geometryN( 0 ) );
}
}
}
Expand Down Expand Up @@ -4472,7 +4472,7 @@ static QVariant fcnGeomNumRings( const QVariantList &values, const QgsExpression
//find CurvePolygons in collection
for ( int i = 0; i < collection->numGeometries(); ++i )
{
curvePolygon = qgsgeometry_cast< QgsCurvePolygon *>( collection->geometryN( i ) );
curvePolygon = qgsgeometry_cast< const QgsCurvePolygon *>( collection->geometryN( i ) );
if ( !curvePolygon )
continue;

Expand Down
14 changes: 13 additions & 1 deletion src/core/geometry/qgsabstractgeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ class CORE_EXPORT QgsAbstractGeometry
sipType = sipType_QgsPolygon;
else if ( qgsgeometry_cast<QgsCurvePolygon *>( sipCpp ) != nullptr )
sipType = sipType_QgsCurvePolygon;
else if ( qgsgeometry_cast<QgsTriangulatedSurface *>( sipCpp ) != nullptr )
sipType = sipType_QgsTriangulatedSurface;
else if ( qgsgeometry_cast<QgsPolyhedralSurface *>( sipCpp ) != nullptr )
sipType = sipType_QgsPolyhedralSurface;
else if ( qgsgeometry_cast<QgsSurface *>( sipCpp ) != nullptr )
sipType = sipType_QgsSurface;
else if ( qgsgeometry_cast<QgsMultiPoint *>( sipCpp ) != nullptr )
sipType = sipType_QgsMultiPoint;
else if ( qgsgeometry_cast<QgsMultiLineString *>( sipCpp ) != nullptr )
Expand Down Expand Up @@ -1184,10 +1190,16 @@ class CORE_EXPORT QgsAbstractGeometry

#ifndef SIP_RUN

template <class T>
inline T qgsgeometry_cast( QgsAbstractGeometry *geom )
{
return std::remove_pointer<T>::type::cast( geom );
}

template <class T>
inline T qgsgeometry_cast( const QgsAbstractGeometry *geom )
{
return const_cast<T>( std::remove_pointer<T>::type::cast( geom ) );
return std::remove_pointer<T>::type::cast( geom );
}

#endif
Expand Down
19 changes: 18 additions & 1 deletion src/core/geometry/qgscircularstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,31 @@ class CORE_EXPORT QgsCircularString: public QgsCurve
* Cast the \a geom to a QgsCircularString.
* Should be used by qgsgeometry_cast<QgsCircularString *>( geometry ).
*
* \note Not available in Python. Objects will be automatically be converted to the appropriate target type.
* Objects will be automatically converted to the appropriate target type.
*
* \note Not available in Python.
*/
inline static const QgsCircularString *cast( const QgsAbstractGeometry *geom ) // cppcheck-suppress duplInheritedMember
{
if ( geom && QgsWkbTypes::flatType( geom->wkbType() ) == Qgis::WkbType::CircularString )
return static_cast<const QgsCircularString *>( geom );
return nullptr;
}

/**
* Cast the \a geom to a QgsCircularString.
* Should be used by qgsgeometry_cast<QgsCircularString *>( geometry ).
*
* Objects will be automatically converted to the appropriate target type.
*
* \note Not available in Python.
*/
inline static QgsCircularString *cast( QgsAbstractGeometry *geom ) // cppcheck-suppress duplInheritedMember
{
if ( geom && QgsWkbTypes::flatType( geom->wkbType() ) == Qgis::WkbType::CircularString )
return static_cast<QgsCircularString *>( geom );
return nullptr;
}
#endif

QgsCircularString *createEmptyWithSameType() const override SIP_FACTORY;
Expand Down
Loading
Loading