Skip to content

Commit dba8cc0

Browse files
committedAug 13, 2017
Convert more calls to qgsgeometry_cast
1 parent d9ad859 commit dba8cc0

17 files changed

+89
-89
lines changed
 

‎src/analysis/vector/qgsgeometrysnapper.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,9 @@ void QgsSnapIndex::addGeometry( const QgsAbstractGeometry *geom )
332332
{
333333
int nVerts = geom->vertexCount( iPart, iRing );
334334

335-
if ( dynamic_cast< const QgsSurface * >( geom ) )
335+
if ( qgsgeometry_cast< const QgsSurface * >( geom ) )
336336
nVerts--;
337-
else if ( const QgsCurve *curve = dynamic_cast< const QgsCurve * >( geom ) )
337+
else if ( const QgsCurve *curve = qgsgeometry_cast< const QgsCurve * >( geom ) )
338338
{
339339
if ( curve->isClosed() )
340340
nVerts--;
@@ -510,7 +510,7 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl
510510
( mode == EndPointPreferClosest || mode == EndPointPreferNodes || mode == EndPointToEndPoint ) )
511511
return geometry;
512512

513-
QgsPoint center = dynamic_cast< const QgsPoint * >( geometry.geometry() ) ? *static_cast< const QgsPoint * >( geometry.geometry() ) :
513+
QgsPoint center = qgsgeometry_cast< const QgsPoint * >( geometry.geometry() ) ? *static_cast< const QgsPoint * >( geometry.geometry() ) :
514514
QgsPoint( geometry.geometry()->boundingBox().center() );
515515

516516
QgsSnapIndex refSnapIndex( center, 10 * snapTolerance );
@@ -607,7 +607,7 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl
607607
}
608608

609609
//nothing more to do for points
610-
if ( dynamic_cast< const QgsPoint * >( subjGeom ) )
610+
if ( qgsgeometry_cast< const QgsPoint * >( subjGeom ) )
611611
return QgsGeometry( subjGeom );
612612
//or for end point snapping
613613
if ( mode == EndPointPreferClosest || mode == EndPointPreferNodes || mode == EndPointToEndPoint )
@@ -715,7 +715,7 @@ int QgsGeometrySnapper::polyLineSize( const QgsAbstractGeometry *geom, int iPart
715715
{
716716
int nVerts = geom->vertexCount( iPart, iRing );
717717

718-
if ( dynamic_cast< const QgsSurface * >( geom ) )
718+
if ( qgsgeometry_cast< const QgsSurface * >( geom ) )
719719
{
720720
QgsPoint front = geom->vertexAt( QgsVertexId( iPart, iRing, 0 ) );
721721
QgsPoint back = geom->vertexAt( QgsVertexId( iPart, iRing, nVerts - 1 ) );

‎src/app/nodetool/qgsnodetool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static bool isEndpointAtVertexIndex( const QgsGeometry &geom, int vertexIndex )
6363
{
6464
for ( int i = 0; i < multiCurve->numGeometries(); ++i )
6565
{
66-
QgsCurve *part = dynamic_cast<QgsCurve *>( multiCurve->geometryN( i ) );
66+
QgsCurve *part = qgsgeometry_cast<QgsCurve *>( multiCurve->geometryN( i ) );
6767
Q_ASSERT( part );
6868
if ( vertexIndex < part->numPoints() )
6969
return vertexIndex == 0 || vertexIndex == part->numPoints() - 1;
@@ -93,7 +93,7 @@ int adjacentVertexIndexToEndpoint( const QgsGeometry &geom, int vertexIndex )
9393
int offset = 0;
9494
for ( int i = 0; i < multiCurve->numGeometries(); ++i )
9595
{
96-
QgsCurve *part = dynamic_cast<QgsCurve *>( multiCurve->geometryN( i ) );
96+
QgsCurve *part = qgsgeometry_cast<QgsCurve *>( multiCurve->geometryN( i ) );
9797
Q_ASSERT( part );
9898
if ( vertexIndex < part->numPoints() )
9999
return vertexIndex == 0 ? offset + 1 : offset + part->numPoints() - 2;

‎src/app/qgsmaptooladdpart.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
155155
QgsGeometry *geom = new QgsGeometry( cp );
156156
geom->avoidIntersections( QgsProject::instance()->avoidIntersectionsLayers() );
157157

158-
const QgsCurvePolygon *cpGeom = dynamic_cast<const QgsCurvePolygon *>( geom->geometry() );
158+
const QgsCurvePolygon *cpGeom = qgsgeometry_cast<const QgsCurvePolygon *>( geom->geometry() );
159159
if ( !cpGeom )
160160
{
161161
stopCapturing();

‎src/core/expression/qgsexpressionfunction.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,7 @@ static QVariant fcnGeomZ( const QVariantList &values, const QgsExpressionContext
16201620
//if single point, return the point's z coordinate
16211621
if ( geom.type() == QgsWkbTypes::PointGeometry && !geom.isMultipart() )
16221622
{
1623-
QgsPoint *point = dynamic_cast< QgsPoint * >( geom.geometry() );
1623+
QgsPoint *point = qgsgeometry_cast< QgsPoint * >( geom.geometry() );
16241624
if ( point )
16251625
return point->z();
16261626
}
@@ -1637,7 +1637,7 @@ static QVariant fcnGeomM( const QVariantList &values, const QgsExpressionContext
16371637
//if single point, return the point's m value
16381638
if ( geom.type() == QgsWkbTypes::PointGeometry && !geom.isMultipart() )
16391639
{
1640-
QgsPoint *point = dynamic_cast< QgsPoint * >( geom.geometry() );
1640+
QgsPoint *point = qgsgeometry_cast< QgsPoint * >( geom.geometry() );
16411641
if ( point )
16421642
return point->m();
16431643
}
@@ -1769,7 +1769,7 @@ static QVariant fcnInteriorRingN( const QVariantList &values, const QgsExpressio
17691769
if ( geom.isNull() )
17701770
return QVariant();
17711771

1772-
QgsCurvePolygon *curvePolygon = dynamic_cast< QgsCurvePolygon * >( geom.geometry() );
1772+
QgsCurvePolygon *curvePolygon = qgsgeometry_cast< QgsCurvePolygon * >( geom.geometry() );
17731773
if ( !curvePolygon )
17741774
return QVariant();
17751775

@@ -1791,7 +1791,7 @@ static QVariant fcnGeometryN( const QVariantList &values, const QgsExpressionCon
17911791
if ( geom.isNull() )
17921792
return QVariant();
17931793

1794-
QgsGeometryCollection *collection = dynamic_cast< QgsGeometryCollection * >( geom.geometry() );
1794+
QgsGeometryCollection *collection = qgsgeometry_cast< QgsGeometryCollection * >( geom.geometry() );
17951795
if ( !collection )
17961796
return QVariant();
17971797

@@ -1938,7 +1938,7 @@ static QVariant fcnMakeLine( const QVariantList &values, const QgsExpressionCont
19381938
if ( geom.type() != QgsWkbTypes::PointGeometry || geom.isMultipart() )
19391939
continue;
19401940

1941-
QgsPoint *point = dynamic_cast< QgsPoint * >( geom.geometry() );
1941+
QgsPoint *point = qgsgeometry_cast< QgsPoint * >( geom.geometry() );
19421942
if ( !point )
19431943
continue;
19441944

@@ -1961,7 +1961,7 @@ static QVariant fcnMakePolygon( const QVariantList &values, const QgsExpressionC
19611961
return QVariant();
19621962

19631963
QgsPolygonV2 *polygon = new QgsPolygonV2();
1964-
polygon->setExteriorRing( dynamic_cast< QgsCurve * >( outerRing.geometry()->clone() ) );
1964+
polygon->setExteriorRing( qgsgeometry_cast< QgsCurve * >( outerRing.geometry()->clone() ) );
19651965

19661966
for ( int i = 1; i < values.count(); ++i )
19671967
{
@@ -1972,7 +1972,7 @@ static QVariant fcnMakePolygon( const QVariantList &values, const QgsExpressionC
19721972
if ( ringGeom.type() != QgsWkbTypes::LineGeometry || ringGeom.isMultipart() || ringGeom.isNull() )
19731973
continue;
19741974

1975-
polygon->addInteriorRing( dynamic_cast< QgsCurve * >( ringGeom.geometry()->clone() ) );
1975+
polygon->addInteriorRing( qgsgeometry_cast< QgsCurve * >( ringGeom.geometry()->clone() ) );
19761976
}
19771977

19781978
return QVariant::fromValue( QgsGeometry( polygon ) );
@@ -1993,7 +1993,7 @@ static QVariant fcnMakeTriangle( const QVariantList &values, const QgsExpression
19931993
if ( geom.type() != QgsWkbTypes::PointGeometry || geom.isMultipart() )
19941994
return QVariant();
19951995

1996-
QgsPoint *point = dynamic_cast< QgsPoint * >( geom.geometry() );
1996+
QgsPoint *point = qgsgeometry_cast< QgsPoint * >( geom.geometry() );
19971997
if ( !point )
19981998
return QVariant();
19991999

@@ -2022,7 +2022,7 @@ static QVariant fcnMakeCircle( const QVariantList &values, const QgsExpressionCo
20222022
parent->setEvalErrorString( QObject::tr( "Segment must be greater than 2" ) );
20232023
return QVariant();
20242024
}
2025-
QgsPoint *point = static_cast< QgsPoint * >( geom.geometry() );
2025+
QgsPoint *point = qgsgeometry_cast< QgsPoint * >( geom.geometry() );
20262026
QgsCircle circ( *point, radius );
20272027
return QVariant::fromValue( QgsGeometry( circ.toPolygon( segment ) ) );
20282028
}
@@ -2045,7 +2045,7 @@ static QVariant fcnMakeEllipse( const QVariantList &values, const QgsExpressionC
20452045
parent->setEvalErrorString( QObject::tr( "Segment must be greater than 2" ) );
20462046
return QVariant();
20472047
}
2048-
QgsPoint *point = static_cast< QgsPoint * >( geom.geometry() );
2048+
QgsPoint *point = qgsgeometry_cast< QgsPoint * >( geom.geometry() );
20492049
QgsEllipse elp( *point, majorAxis, minorAxis, azimuth );
20502050
return QVariant::fromValue( QgsGeometry( elp.toPolygon( segment ) ) );
20512051
}
@@ -2080,8 +2080,8 @@ static QVariant fcnMakeRegularPolygon( const QVariantList &values, const QgsExpr
20802080
parent->setEvalErrorString( QObject::tr( "Option can be 0 (inscribed) or 1 (circumscribed)" ) );
20812081
return QVariant();
20822082
}
2083-
QgsPoint *center = static_cast< QgsPoint * >( pt1.geometry() );
2084-
QgsPoint *corner = static_cast< QgsPoint * >( pt2.geometry() );
2083+
QgsPoint *center = qgsgeometry_cast< QgsPoint * >( pt1.geometry() );
2084+
QgsPoint *corner = qgsgeometry_cast< QgsPoint * >( pt2.geometry() );
20852085

20862086
QgsRegularPolygon rp = QgsRegularPolygon( *center, *corner, nbEdges, option );
20872087

@@ -2245,17 +2245,17 @@ static QVariant fcnGeomNumInteriorRings( const QVariantList &values, const QgsEx
22452245
if ( geom.isNull() )
22462246
return QVariant();
22472247

2248-
QgsCurvePolygon *curvePolygon = dynamic_cast< QgsCurvePolygon * >( geom.geometry() );
2248+
QgsCurvePolygon *curvePolygon = qgsgeometry_cast< QgsCurvePolygon * >( geom.geometry() );
22492249
if ( curvePolygon )
22502250
return QVariant( curvePolygon->numInteriorRings() );
22512251

2252-
QgsGeometryCollection *collection = dynamic_cast< QgsGeometryCollection * >( geom.geometry() );
2252+
QgsGeometryCollection *collection = qgsgeometry_cast< QgsGeometryCollection * >( geom.geometry() );
22532253
if ( collection )
22542254
{
22552255
//find first CurvePolygon in collection
22562256
for ( int i = 0; i < collection->numGeometries(); ++i )
22572257
{
2258-
curvePolygon = dynamic_cast< QgsCurvePolygon *>( collection->geometryN( i ) );
2258+
curvePolygon = qgsgeometry_cast< QgsCurvePolygon *>( collection->geometryN( i ) );
22592259
if ( !curvePolygon )
22602260
continue;
22612261

@@ -2273,19 +2273,19 @@ static QVariant fcnGeomNumRings( const QVariantList &values, const QgsExpression
22732273
if ( geom.isNull() )
22742274
return QVariant();
22752275

2276-
QgsCurvePolygon *curvePolygon = dynamic_cast< QgsCurvePolygon * >( geom.geometry() );
2276+
QgsCurvePolygon *curvePolygon = qgsgeometry_cast< QgsCurvePolygon * >( geom.geometry() );
22772277
if ( curvePolygon )
22782278
return QVariant( curvePolygon->ringCount() );
22792279

22802280
bool foundPoly = false;
22812281
int ringCount = 0;
2282-
QgsGeometryCollection *collection = dynamic_cast< QgsGeometryCollection * >( geom.geometry() );
2282+
QgsGeometryCollection *collection = qgsgeometry_cast< QgsGeometryCollection * >( geom.geometry() );
22832283
if ( collection )
22842284
{
22852285
//find CurvePolygons in collection
22862286
for ( int i = 0; i < collection->numGeometries(); ++i )
22872287
{
2288-
curvePolygon = dynamic_cast< QgsCurvePolygon *>( collection->geometryN( i ) );
2288+
curvePolygon = qgsgeometry_cast< QgsCurvePolygon *>( collection->geometryN( i ) );
22892289
if ( !curvePolygon )
22902290
continue;
22912291

@@ -2350,7 +2350,7 @@ static QVariant fcnIsClosed( const QVariantList &values, const QgsExpressionCont
23502350
if ( fGeom.isNull() )
23512351
return QVariant();
23522352

2353-
QgsCurve *curve = dynamic_cast< QgsCurve * >( fGeom.geometry() );
2353+
QgsCurve *curve = qgsgeometry_cast< QgsCurve * >( fGeom.geometry() );
23542354
if ( !curve )
23552355
return QVariant();
23562356

@@ -2544,7 +2544,7 @@ static QVariant fcnReverse( const QVariantList &values, const QgsExpressionConte
25442544
if ( fGeom.isNull() )
25452545
return QVariant();
25462546

2547-
QgsCurve *curve = dynamic_cast< QgsCurve * >( fGeom.geometry() );
2547+
QgsCurve *curve = qgsgeometry_cast< QgsCurve * >( fGeom.geometry() );
25482548
if ( !curve )
25492549
return QVariant();
25502550

@@ -2559,7 +2559,7 @@ static QVariant fcnExteriorRing( const QVariantList &values, const QgsExpression
25592559
if ( fGeom.isNull() )
25602560
return QVariant();
25612561

2562-
QgsCurvePolygon *curvePolygon = dynamic_cast< QgsCurvePolygon * >( fGeom.geometry() );
2562+
QgsCurvePolygon *curvePolygon = qgsgeometry_cast< QgsCurvePolygon * >( fGeom.geometry() );
25632563
if ( !curvePolygon || !curvePolygon->exteriorRing() )
25642564
return QVariant();
25652565

@@ -2622,8 +2622,8 @@ static QVariant fcnAzimuth( const QVariantList &values, const QgsExpressionConte
26222622
QgsGeometry fGeom1 = QgsExpressionUtils::getGeometry( values.at( 0 ), parent );
26232623
QgsGeometry fGeom2 = QgsExpressionUtils::getGeometry( values.at( 1 ), parent );
26242624

2625-
const QgsPoint *pt1 = dynamic_cast<const QgsPoint *>( fGeom1.geometry() );
2626-
const QgsPoint *pt2 = dynamic_cast<const QgsPoint *>( fGeom2.geometry() );
2625+
const QgsPoint *pt1 = qgsgeometry_cast<const QgsPoint *>( fGeom1.geometry() );
2626+
const QgsPoint *pt2 = qgsgeometry_cast<const QgsPoint *>( fGeom2.geometry() );
26272627

26282628
if ( !pt1 || !pt2 )
26292629
{
@@ -2705,8 +2705,8 @@ static QVariant fcnInclination( const QVariantList &values, const QgsExpressionC
27052705
QgsGeometry fGeom1 = QgsExpressionUtils::getGeometry( values.at( 0 ), parent );
27062706
QgsGeometry fGeom2 = QgsExpressionUtils::getGeometry( values.at( 1 ), parent );
27072707

2708-
const QgsPoint *pt1 = dynamic_cast<const QgsPoint *>( fGeom1.geometry() );
2709-
const QgsPoint *pt2 = dynamic_cast<const QgsPoint *>( fGeom2.geometry() );
2708+
const QgsPoint *pt1 = qgsgeometry_cast<const QgsPoint *>( fGeom1.geometry() );
2709+
const QgsPoint *pt2 = qgsgeometry_cast<const QgsPoint *>( fGeom2.geometry() );
27102710

27112711
if ( ( fGeom1.type() != QgsWkbTypes::PointGeometry ) || ( fGeom2.type() != QgsWkbTypes::PointGeometry ) ||
27122712
!pt1 || !pt2 )
@@ -2774,7 +2774,7 @@ static QVariant fcnOrderParts( const QVariantList &values, const QgsExpressionCo
27742774
unconstedContext = new QgsExpressionContext();
27752775
}
27762776

2777-
QgsGeometryCollection *collection = dynamic_cast<QgsGeometryCollection *>( fGeom.geometry() );
2777+
QgsGeometryCollection *collection = qgsgeometry_cast<QgsGeometryCollection *>( fGeom.geometry() );
27782778
Q_ASSERT( collection ); // Should have failed the multipart check above
27792779

27802780
QgsFeatureRequest::OrderBy orderBy;
@@ -2791,7 +2791,7 @@ static QVariant fcnOrderParts( const QVariantList &values, const QgsExpressionCo
27912791

27922792
sorter.sortFeatures( partFeatures, unconstedContext );
27932793

2794-
QgsGeometryCollection *orderedGeom = dynamic_cast<QgsGeometryCollection *>( fGeom.geometry()->clone() );
2794+
QgsGeometryCollection *orderedGeom = qgsgeometry_cast<QgsGeometryCollection *>( fGeom.geometry()->clone() );
27952795

27962796
Q_ASSERT( orderedGeom );
27972797

‎src/core/geometry/qgsgeometrycollection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ bool QgsGeometryCollection::hasCurvedSegments() const
598598
QgsAbstractGeometry *QgsGeometryCollection::segmentize( double tolerance, SegmentationToleranceType toleranceType ) const
599599
{
600600
QgsAbstractGeometry *geom = QgsGeometryFactory::geomFromWkbType( mWkbType );
601-
QgsGeometryCollection *geomCollection = dynamic_cast<QgsGeometryCollection *>( geom );
601+
QgsGeometryCollection *geomCollection = qgsgeometry_cast<QgsGeometryCollection *>( geom );
602602
if ( !geomCollection )
603603
{
604604
delete geom;

‎src/core/geometry/qgsgeometryeditutils.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ int QgsGeometryEditUtils::addRing( QgsAbstractGeometry *geom, QgsCurve *ring )
3434
}
3535

3636
QList< QgsCurvePolygon * > polygonList;
37-
QgsCurvePolygon *curvePoly = dynamic_cast< QgsCurvePolygon * >( geom );
38-
QgsGeometryCollection *multiGeom = dynamic_cast< QgsGeometryCollection * >( geom );
37+
QgsCurvePolygon *curvePoly = qgsgeometry_cast< QgsCurvePolygon * >( geom );
38+
QgsGeometryCollection *multiGeom = qgsgeometry_cast< QgsGeometryCollection * >( geom );
3939
if ( curvePoly )
4040
{
4141
polygonList.append( curvePoly );
@@ -45,7 +45,7 @@ int QgsGeometryEditUtils::addRing( QgsAbstractGeometry *geom, QgsCurve *ring )
4545
polygonList.reserve( multiGeom->numGeometries() );
4646
for ( int i = 0; i < multiGeom->numGeometries(); ++i )
4747
{
48-
polygonList.append( dynamic_cast< QgsCurvePolygon * >( multiGeom->geometryN( i ) ) );
48+
polygonList.append( qgsgeometry_cast< QgsCurvePolygon * >( multiGeom->geometryN( i ) ) );
4949
}
5050
}
5151
else
@@ -113,7 +113,7 @@ int QgsGeometryEditUtils::addPart( QgsAbstractGeometry *geom, QgsAbstractGeometr
113113
}
114114

115115
//multitype?
116-
QgsGeometryCollection *geomCollection = dynamic_cast<QgsGeometryCollection *>( geom );
116+
QgsGeometryCollection *geomCollection = qgsgeometry_cast<QgsGeometryCollection *>( geom );
117117
if ( !geomCollection )
118118
{
119119
return 1;
@@ -188,7 +188,7 @@ bool QgsGeometryEditUtils::deleteRing( QgsAbstractGeometry *geom, int ringNum, i
188188
}
189189

190190
QgsAbstractGeometry *g = geom;
191-
QgsGeometryCollection *c = dynamic_cast<QgsGeometryCollection *>( geom );
191+
QgsGeometryCollection *c = qgsgeometry_cast<QgsGeometryCollection *>( geom );
192192
if ( c )
193193
{
194194
g = c->geometryN( partNum );
@@ -215,7 +215,7 @@ bool QgsGeometryEditUtils::deletePart( QgsAbstractGeometry *geom, int partNum )
215215
return false;
216216
}
217217

218-
QgsGeometryCollection *c = dynamic_cast<QgsGeometryCollection *>( geom );
218+
QgsGeometryCollection *c = qgsgeometry_cast<QgsGeometryCollection *>( geom );
219219
if ( !c )
220220
{
221221
return false;

‎src/core/geometry/qgsgeometrymakevalid.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,18 +357,18 @@ static bool lwgeom_make_geos_friendly( QgsAbstractGeometry &geom )
357357

358358
case QgsWkbTypes::LineString:
359359
// lines need at least 2 points
360-
return lwline_make_geos_friendly( dynamic_cast<QgsLineString &>( geom ) );
360+
return lwline_make_geos_friendly( qgsgeometry_cast<QgsLineString &>( geom ) );
361361
break;
362362

363363
case QgsWkbTypes::Polygon:
364364
// polygons need all rings closed and with npoints > 3
365-
return lwpoly_make_geos_friendly( dynamic_cast<QgsPolygonV2 &>( geom ) );
365+
return lwpoly_make_geos_friendly( qgsgeometry_cast<QgsPolygonV2 &>( geom ) );
366366
break;
367367

368368
case QgsWkbTypes::MultiLineString:
369369
case QgsWkbTypes::MultiPolygon:
370370
case QgsWkbTypes::GeometryCollection:
371-
return lwcollection_make_geos_friendly( dynamic_cast<QgsGeometryCollection &>( geom ) );
371+
return lwcollection_make_geos_friendly( qgsgeometry_cast<QgsGeometryCollection &>( geom ) );
372372
break;
373373

374374
default:

‎src/core/geometry/qgsgeos.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ GEOSGeometry *QgsGeos::linePointDifference( GEOSGeometry *GEOSsplitPoint ) const
666666
QgsMultiCurve *multiCurve = nullptr;
667667
if ( type == GEOS_MULTILINESTRING )
668668
{
669-
multiCurve = dynamic_cast<QgsMultiCurve *>( mGeometry->clone() );
669+
multiCurve = qgsgeometry_cast<QgsMultiCurve *>( mGeometry->clone() );
670670
}
671671
else if ( type == GEOS_LINESTRING )
672672
{
@@ -685,7 +685,7 @@ GEOSGeometry *QgsGeos::linePointDifference( GEOSGeometry *GEOSsplitPoint ) const
685685

686686

687687
QgsAbstractGeometry *splitGeom = fromGeos( GEOSsplitPoint );
688-
QgsPoint *splitPoint = dynamic_cast<QgsPoint *>( splitGeom );
688+
QgsPoint *splitPoint = qgsgeometry_cast<QgsPoint *>( splitGeom );
689689
if ( !splitPoint )
690690
{
691691
delete splitGeom;
@@ -697,7 +697,7 @@ GEOSGeometry *QgsGeos::linePointDifference( GEOSGeometry *GEOSsplitPoint ) const
697697
//For each part
698698
for ( int i = 0; i < multiCurve->numGeometries(); ++i )
699699
{
700-
const QgsLineString *line = dynamic_cast<const QgsLineString *>( multiCurve->geometryN( i ) );
700+
const QgsLineString *line = qgsgeometry_cast<const QgsLineString *>( multiCurve->geometryN( i ) );
701701
if ( line )
702702
{
703703
//For each segment
@@ -1254,7 +1254,7 @@ GEOSGeometry *QgsGeos::asGeos( const QgsAbstractGeometry *geom, double precision
12541254
}
12551255
}
12561256

1257-
const QgsGeometryCollection *c = dynamic_cast<const QgsGeometryCollection *>( geom );
1257+
const QgsGeometryCollection *c = qgsgeometry_cast<const QgsGeometryCollection *>( geom );
12581258
if ( !c )
12591259
return nullptr;
12601260

0 commit comments

Comments
 (0)
Please sign in to comment.