mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Convert more calls to qgsgeometry_cast
This commit is contained in:
parent
d9ad859a81
commit
dba8cc0f6c
@ -332,9 +332,9 @@ void QgsSnapIndex::addGeometry( const QgsAbstractGeometry *geom )
|
||||
{
|
||||
int nVerts = geom->vertexCount( iPart, iRing );
|
||||
|
||||
if ( dynamic_cast< const QgsSurface * >( geom ) )
|
||||
if ( qgsgeometry_cast< const QgsSurface * >( geom ) )
|
||||
nVerts--;
|
||||
else if ( const QgsCurve *curve = dynamic_cast< const QgsCurve * >( geom ) )
|
||||
else if ( const QgsCurve *curve = qgsgeometry_cast< const QgsCurve * >( geom ) )
|
||||
{
|
||||
if ( curve->isClosed() )
|
||||
nVerts--;
|
||||
@ -510,7 +510,7 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl
|
||||
( mode == EndPointPreferClosest || mode == EndPointPreferNodes || mode == EndPointToEndPoint ) )
|
||||
return geometry;
|
||||
|
||||
QgsPoint center = dynamic_cast< const QgsPoint * >( geometry.geometry() ) ? *static_cast< const QgsPoint * >( geometry.geometry() ) :
|
||||
QgsPoint center = qgsgeometry_cast< const QgsPoint * >( geometry.geometry() ) ? *static_cast< const QgsPoint * >( geometry.geometry() ) :
|
||||
QgsPoint( geometry.geometry()->boundingBox().center() );
|
||||
|
||||
QgsSnapIndex refSnapIndex( center, 10 * snapTolerance );
|
||||
@ -607,7 +607,7 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl
|
||||
}
|
||||
|
||||
//nothing more to do for points
|
||||
if ( dynamic_cast< const QgsPoint * >( subjGeom ) )
|
||||
if ( qgsgeometry_cast< const QgsPoint * >( subjGeom ) )
|
||||
return QgsGeometry( subjGeom );
|
||||
//or for end point snapping
|
||||
if ( mode == EndPointPreferClosest || mode == EndPointPreferNodes || mode == EndPointToEndPoint )
|
||||
@ -715,7 +715,7 @@ int QgsGeometrySnapper::polyLineSize( const QgsAbstractGeometry *geom, int iPart
|
||||
{
|
||||
int nVerts = geom->vertexCount( iPart, iRing );
|
||||
|
||||
if ( dynamic_cast< const QgsSurface * >( geom ) )
|
||||
if ( qgsgeometry_cast< const QgsSurface * >( geom ) )
|
||||
{
|
||||
QgsPoint front = geom->vertexAt( QgsVertexId( iPart, iRing, 0 ) );
|
||||
QgsPoint back = geom->vertexAt( QgsVertexId( iPart, iRing, nVerts - 1 ) );
|
||||
|
@ -63,7 +63,7 @@ static bool isEndpointAtVertexIndex( const QgsGeometry &geom, int vertexIndex )
|
||||
{
|
||||
for ( int i = 0; i < multiCurve->numGeometries(); ++i )
|
||||
{
|
||||
QgsCurve *part = dynamic_cast<QgsCurve *>( multiCurve->geometryN( i ) );
|
||||
QgsCurve *part = qgsgeometry_cast<QgsCurve *>( multiCurve->geometryN( i ) );
|
||||
Q_ASSERT( part );
|
||||
if ( vertexIndex < part->numPoints() )
|
||||
return vertexIndex == 0 || vertexIndex == part->numPoints() - 1;
|
||||
@ -93,7 +93,7 @@ int adjacentVertexIndexToEndpoint( const QgsGeometry &geom, int vertexIndex )
|
||||
int offset = 0;
|
||||
for ( int i = 0; i < multiCurve->numGeometries(); ++i )
|
||||
{
|
||||
QgsCurve *part = dynamic_cast<QgsCurve *>( multiCurve->geometryN( i ) );
|
||||
QgsCurve *part = qgsgeometry_cast<QgsCurve *>( multiCurve->geometryN( i ) );
|
||||
Q_ASSERT( part );
|
||||
if ( vertexIndex < part->numPoints() )
|
||||
return vertexIndex == 0 ? offset + 1 : offset + part->numPoints() - 2;
|
||||
|
@ -155,7 +155,7 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
|
||||
QgsGeometry *geom = new QgsGeometry( cp );
|
||||
geom->avoidIntersections( QgsProject::instance()->avoidIntersectionsLayers() );
|
||||
|
||||
const QgsCurvePolygon *cpGeom = dynamic_cast<const QgsCurvePolygon *>( geom->geometry() );
|
||||
const QgsCurvePolygon *cpGeom = qgsgeometry_cast<const QgsCurvePolygon *>( geom->geometry() );
|
||||
if ( !cpGeom )
|
||||
{
|
||||
stopCapturing();
|
||||
|
@ -1620,7 +1620,7 @@ static QVariant fcnGeomZ( const QVariantList &values, const QgsExpressionContext
|
||||
//if single point, return the point's z coordinate
|
||||
if ( geom.type() == QgsWkbTypes::PointGeometry && !geom.isMultipart() )
|
||||
{
|
||||
QgsPoint *point = dynamic_cast< QgsPoint * >( geom.geometry() );
|
||||
QgsPoint *point = qgsgeometry_cast< QgsPoint * >( geom.geometry() );
|
||||
if ( point )
|
||||
return point->z();
|
||||
}
|
||||
@ -1637,7 +1637,7 @@ static QVariant fcnGeomM( const QVariantList &values, const QgsExpressionContext
|
||||
//if single point, return the point's m value
|
||||
if ( geom.type() == QgsWkbTypes::PointGeometry && !geom.isMultipart() )
|
||||
{
|
||||
QgsPoint *point = dynamic_cast< QgsPoint * >( geom.geometry() );
|
||||
QgsPoint *point = qgsgeometry_cast< QgsPoint * >( geom.geometry() );
|
||||
if ( point )
|
||||
return point->m();
|
||||
}
|
||||
@ -1769,7 +1769,7 @@ static QVariant fcnInteriorRingN( const QVariantList &values, const QgsExpressio
|
||||
if ( geom.isNull() )
|
||||
return QVariant();
|
||||
|
||||
QgsCurvePolygon *curvePolygon = dynamic_cast< QgsCurvePolygon * >( geom.geometry() );
|
||||
QgsCurvePolygon *curvePolygon = qgsgeometry_cast< QgsCurvePolygon * >( geom.geometry() );
|
||||
if ( !curvePolygon )
|
||||
return QVariant();
|
||||
|
||||
@ -1791,7 +1791,7 @@ static QVariant fcnGeometryN( const QVariantList &values, const QgsExpressionCon
|
||||
if ( geom.isNull() )
|
||||
return QVariant();
|
||||
|
||||
QgsGeometryCollection *collection = dynamic_cast< QgsGeometryCollection * >( geom.geometry() );
|
||||
QgsGeometryCollection *collection = qgsgeometry_cast< QgsGeometryCollection * >( geom.geometry() );
|
||||
if ( !collection )
|
||||
return QVariant();
|
||||
|
||||
@ -1938,7 +1938,7 @@ static QVariant fcnMakeLine( const QVariantList &values, const QgsExpressionCont
|
||||
if ( geom.type() != QgsWkbTypes::PointGeometry || geom.isMultipart() )
|
||||
continue;
|
||||
|
||||
QgsPoint *point = dynamic_cast< QgsPoint * >( geom.geometry() );
|
||||
QgsPoint *point = qgsgeometry_cast< QgsPoint * >( geom.geometry() );
|
||||
if ( !point )
|
||||
continue;
|
||||
|
||||
@ -1961,7 +1961,7 @@ static QVariant fcnMakePolygon( const QVariantList &values, const QgsExpressionC
|
||||
return QVariant();
|
||||
|
||||
QgsPolygonV2 *polygon = new QgsPolygonV2();
|
||||
polygon->setExteriorRing( dynamic_cast< QgsCurve * >( outerRing.geometry()->clone() ) );
|
||||
polygon->setExteriorRing( qgsgeometry_cast< QgsCurve * >( outerRing.geometry()->clone() ) );
|
||||
|
||||
for ( int i = 1; i < values.count(); ++i )
|
||||
{
|
||||
@ -1972,7 +1972,7 @@ static QVariant fcnMakePolygon( const QVariantList &values, const QgsExpressionC
|
||||
if ( ringGeom.type() != QgsWkbTypes::LineGeometry || ringGeom.isMultipart() || ringGeom.isNull() )
|
||||
continue;
|
||||
|
||||
polygon->addInteriorRing( dynamic_cast< QgsCurve * >( ringGeom.geometry()->clone() ) );
|
||||
polygon->addInteriorRing( qgsgeometry_cast< QgsCurve * >( ringGeom.geometry()->clone() ) );
|
||||
}
|
||||
|
||||
return QVariant::fromValue( QgsGeometry( polygon ) );
|
||||
@ -1993,7 +1993,7 @@ static QVariant fcnMakeTriangle( const QVariantList &values, const QgsExpression
|
||||
if ( geom.type() != QgsWkbTypes::PointGeometry || geom.isMultipart() )
|
||||
return QVariant();
|
||||
|
||||
QgsPoint *point = dynamic_cast< QgsPoint * >( geom.geometry() );
|
||||
QgsPoint *point = qgsgeometry_cast< QgsPoint * >( geom.geometry() );
|
||||
if ( !point )
|
||||
return QVariant();
|
||||
|
||||
@ -2022,7 +2022,7 @@ static QVariant fcnMakeCircle( const QVariantList &values, const QgsExpressionCo
|
||||
parent->setEvalErrorString( QObject::tr( "Segment must be greater than 2" ) );
|
||||
return QVariant();
|
||||
}
|
||||
QgsPoint *point = static_cast< QgsPoint * >( geom.geometry() );
|
||||
QgsPoint *point = qgsgeometry_cast< QgsPoint * >( geom.geometry() );
|
||||
QgsCircle circ( *point, radius );
|
||||
return QVariant::fromValue( QgsGeometry( circ.toPolygon( segment ) ) );
|
||||
}
|
||||
@ -2045,7 +2045,7 @@ static QVariant fcnMakeEllipse( const QVariantList &values, const QgsExpressionC
|
||||
parent->setEvalErrorString( QObject::tr( "Segment must be greater than 2" ) );
|
||||
return QVariant();
|
||||
}
|
||||
QgsPoint *point = static_cast< QgsPoint * >( geom.geometry() );
|
||||
QgsPoint *point = qgsgeometry_cast< QgsPoint * >( geom.geometry() );
|
||||
QgsEllipse elp( *point, majorAxis, minorAxis, azimuth );
|
||||
return QVariant::fromValue( QgsGeometry( elp.toPolygon( segment ) ) );
|
||||
}
|
||||
@ -2080,8 +2080,8 @@ static QVariant fcnMakeRegularPolygon( const QVariantList &values, const QgsExpr
|
||||
parent->setEvalErrorString( QObject::tr( "Option can be 0 (inscribed) or 1 (circumscribed)" ) );
|
||||
return QVariant();
|
||||
}
|
||||
QgsPoint *center = static_cast< QgsPoint * >( pt1.geometry() );
|
||||
QgsPoint *corner = static_cast< QgsPoint * >( pt2.geometry() );
|
||||
QgsPoint *center = qgsgeometry_cast< QgsPoint * >( pt1.geometry() );
|
||||
QgsPoint *corner = qgsgeometry_cast< QgsPoint * >( pt2.geometry() );
|
||||
|
||||
QgsRegularPolygon rp = QgsRegularPolygon( *center, *corner, nbEdges, option );
|
||||
|
||||
@ -2245,17 +2245,17 @@ static QVariant fcnGeomNumInteriorRings( const QVariantList &values, const QgsEx
|
||||
if ( geom.isNull() )
|
||||
return QVariant();
|
||||
|
||||
QgsCurvePolygon *curvePolygon = dynamic_cast< QgsCurvePolygon * >( geom.geometry() );
|
||||
QgsCurvePolygon *curvePolygon = qgsgeometry_cast< QgsCurvePolygon * >( geom.geometry() );
|
||||
if ( curvePolygon )
|
||||
return QVariant( curvePolygon->numInteriorRings() );
|
||||
|
||||
QgsGeometryCollection *collection = dynamic_cast< QgsGeometryCollection * >( geom.geometry() );
|
||||
QgsGeometryCollection *collection = qgsgeometry_cast< QgsGeometryCollection * >( geom.geometry() );
|
||||
if ( collection )
|
||||
{
|
||||
//find first CurvePolygon in collection
|
||||
for ( int i = 0; i < collection->numGeometries(); ++i )
|
||||
{
|
||||
curvePolygon = dynamic_cast< QgsCurvePolygon *>( collection->geometryN( i ) );
|
||||
curvePolygon = qgsgeometry_cast< QgsCurvePolygon *>( collection->geometryN( i ) );
|
||||
if ( !curvePolygon )
|
||||
continue;
|
||||
|
||||
@ -2273,19 +2273,19 @@ static QVariant fcnGeomNumRings( const QVariantList &values, const QgsExpression
|
||||
if ( geom.isNull() )
|
||||
return QVariant();
|
||||
|
||||
QgsCurvePolygon *curvePolygon = dynamic_cast< QgsCurvePolygon * >( geom.geometry() );
|
||||
QgsCurvePolygon *curvePolygon = qgsgeometry_cast< QgsCurvePolygon * >( geom.geometry() );
|
||||
if ( curvePolygon )
|
||||
return QVariant( curvePolygon->ringCount() );
|
||||
|
||||
bool foundPoly = false;
|
||||
int ringCount = 0;
|
||||
QgsGeometryCollection *collection = dynamic_cast< QgsGeometryCollection * >( geom.geometry() );
|
||||
QgsGeometryCollection *collection = qgsgeometry_cast< QgsGeometryCollection * >( geom.geometry() );
|
||||
if ( collection )
|
||||
{
|
||||
//find CurvePolygons in collection
|
||||
for ( int i = 0; i < collection->numGeometries(); ++i )
|
||||
{
|
||||
curvePolygon = dynamic_cast< QgsCurvePolygon *>( collection->geometryN( i ) );
|
||||
curvePolygon = qgsgeometry_cast< QgsCurvePolygon *>( collection->geometryN( i ) );
|
||||
if ( !curvePolygon )
|
||||
continue;
|
||||
|
||||
@ -2350,7 +2350,7 @@ static QVariant fcnIsClosed( const QVariantList &values, const QgsExpressionCont
|
||||
if ( fGeom.isNull() )
|
||||
return QVariant();
|
||||
|
||||
QgsCurve *curve = dynamic_cast< QgsCurve * >( fGeom.geometry() );
|
||||
QgsCurve *curve = qgsgeometry_cast< QgsCurve * >( fGeom.geometry() );
|
||||
if ( !curve )
|
||||
return QVariant();
|
||||
|
||||
@ -2544,7 +2544,7 @@ static QVariant fcnReverse( const QVariantList &values, const QgsExpressionConte
|
||||
if ( fGeom.isNull() )
|
||||
return QVariant();
|
||||
|
||||
QgsCurve *curve = dynamic_cast< QgsCurve * >( fGeom.geometry() );
|
||||
QgsCurve *curve = qgsgeometry_cast< QgsCurve * >( fGeom.geometry() );
|
||||
if ( !curve )
|
||||
return QVariant();
|
||||
|
||||
@ -2559,7 +2559,7 @@ static QVariant fcnExteriorRing( const QVariantList &values, const QgsExpression
|
||||
if ( fGeom.isNull() )
|
||||
return QVariant();
|
||||
|
||||
QgsCurvePolygon *curvePolygon = dynamic_cast< QgsCurvePolygon * >( fGeom.geometry() );
|
||||
QgsCurvePolygon *curvePolygon = qgsgeometry_cast< QgsCurvePolygon * >( fGeom.geometry() );
|
||||
if ( !curvePolygon || !curvePolygon->exteriorRing() )
|
||||
return QVariant();
|
||||
|
||||
@ -2622,8 +2622,8 @@ static QVariant fcnAzimuth( const QVariantList &values, const QgsExpressionConte
|
||||
QgsGeometry fGeom1 = QgsExpressionUtils::getGeometry( values.at( 0 ), parent );
|
||||
QgsGeometry fGeom2 = QgsExpressionUtils::getGeometry( values.at( 1 ), parent );
|
||||
|
||||
const QgsPoint *pt1 = dynamic_cast<const QgsPoint *>( fGeom1.geometry() );
|
||||
const QgsPoint *pt2 = dynamic_cast<const QgsPoint *>( fGeom2.geometry() );
|
||||
const QgsPoint *pt1 = qgsgeometry_cast<const QgsPoint *>( fGeom1.geometry() );
|
||||
const QgsPoint *pt2 = qgsgeometry_cast<const QgsPoint *>( fGeom2.geometry() );
|
||||
|
||||
if ( !pt1 || !pt2 )
|
||||
{
|
||||
@ -2705,8 +2705,8 @@ static QVariant fcnInclination( const QVariantList &values, const QgsExpressionC
|
||||
QgsGeometry fGeom1 = QgsExpressionUtils::getGeometry( values.at( 0 ), parent );
|
||||
QgsGeometry fGeom2 = QgsExpressionUtils::getGeometry( values.at( 1 ), parent );
|
||||
|
||||
const QgsPoint *pt1 = dynamic_cast<const QgsPoint *>( fGeom1.geometry() );
|
||||
const QgsPoint *pt2 = dynamic_cast<const QgsPoint *>( fGeom2.geometry() );
|
||||
const QgsPoint *pt1 = qgsgeometry_cast<const QgsPoint *>( fGeom1.geometry() );
|
||||
const QgsPoint *pt2 = qgsgeometry_cast<const QgsPoint *>( fGeom2.geometry() );
|
||||
|
||||
if ( ( fGeom1.type() != QgsWkbTypes::PointGeometry ) || ( fGeom2.type() != QgsWkbTypes::PointGeometry ) ||
|
||||
!pt1 || !pt2 )
|
||||
@ -2774,7 +2774,7 @@ static QVariant fcnOrderParts( const QVariantList &values, const QgsExpressionCo
|
||||
unconstedContext = new QgsExpressionContext();
|
||||
}
|
||||
|
||||
QgsGeometryCollection *collection = dynamic_cast<QgsGeometryCollection *>( fGeom.geometry() );
|
||||
QgsGeometryCollection *collection = qgsgeometry_cast<QgsGeometryCollection *>( fGeom.geometry() );
|
||||
Q_ASSERT( collection ); // Should have failed the multipart check above
|
||||
|
||||
QgsFeatureRequest::OrderBy orderBy;
|
||||
@ -2791,7 +2791,7 @@ static QVariant fcnOrderParts( const QVariantList &values, const QgsExpressionCo
|
||||
|
||||
sorter.sortFeatures( partFeatures, unconstedContext );
|
||||
|
||||
QgsGeometryCollection *orderedGeom = dynamic_cast<QgsGeometryCollection *>( fGeom.geometry()->clone() );
|
||||
QgsGeometryCollection *orderedGeom = qgsgeometry_cast<QgsGeometryCollection *>( fGeom.geometry()->clone() );
|
||||
|
||||
Q_ASSERT( orderedGeom );
|
||||
|
||||
|
@ -598,7 +598,7 @@ bool QgsGeometryCollection::hasCurvedSegments() const
|
||||
QgsAbstractGeometry *QgsGeometryCollection::segmentize( double tolerance, SegmentationToleranceType toleranceType ) const
|
||||
{
|
||||
QgsAbstractGeometry *geom = QgsGeometryFactory::geomFromWkbType( mWkbType );
|
||||
QgsGeometryCollection *geomCollection = dynamic_cast<QgsGeometryCollection *>( geom );
|
||||
QgsGeometryCollection *geomCollection = qgsgeometry_cast<QgsGeometryCollection *>( geom );
|
||||
if ( !geomCollection )
|
||||
{
|
||||
delete geom;
|
||||
|
@ -34,8 +34,8 @@ int QgsGeometryEditUtils::addRing( QgsAbstractGeometry *geom, QgsCurve *ring )
|
||||
}
|
||||
|
||||
QList< QgsCurvePolygon * > polygonList;
|
||||
QgsCurvePolygon *curvePoly = dynamic_cast< QgsCurvePolygon * >( geom );
|
||||
QgsGeometryCollection *multiGeom = dynamic_cast< QgsGeometryCollection * >( geom );
|
||||
QgsCurvePolygon *curvePoly = qgsgeometry_cast< QgsCurvePolygon * >( geom );
|
||||
QgsGeometryCollection *multiGeom = qgsgeometry_cast< QgsGeometryCollection * >( geom );
|
||||
if ( curvePoly )
|
||||
{
|
||||
polygonList.append( curvePoly );
|
||||
@ -45,7 +45,7 @@ int QgsGeometryEditUtils::addRing( QgsAbstractGeometry *geom, QgsCurve *ring )
|
||||
polygonList.reserve( multiGeom->numGeometries() );
|
||||
for ( int i = 0; i < multiGeom->numGeometries(); ++i )
|
||||
{
|
||||
polygonList.append( dynamic_cast< QgsCurvePolygon * >( multiGeom->geometryN( i ) ) );
|
||||
polygonList.append( qgsgeometry_cast< QgsCurvePolygon * >( multiGeom->geometryN( i ) ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -113,7 +113,7 @@ int QgsGeometryEditUtils::addPart( QgsAbstractGeometry *geom, QgsAbstractGeometr
|
||||
}
|
||||
|
||||
//multitype?
|
||||
QgsGeometryCollection *geomCollection = dynamic_cast<QgsGeometryCollection *>( geom );
|
||||
QgsGeometryCollection *geomCollection = qgsgeometry_cast<QgsGeometryCollection *>( geom );
|
||||
if ( !geomCollection )
|
||||
{
|
||||
return 1;
|
||||
@ -188,7 +188,7 @@ bool QgsGeometryEditUtils::deleteRing( QgsAbstractGeometry *geom, int ringNum, i
|
||||
}
|
||||
|
||||
QgsAbstractGeometry *g = geom;
|
||||
QgsGeometryCollection *c = dynamic_cast<QgsGeometryCollection *>( geom );
|
||||
QgsGeometryCollection *c = qgsgeometry_cast<QgsGeometryCollection *>( geom );
|
||||
if ( c )
|
||||
{
|
||||
g = c->geometryN( partNum );
|
||||
@ -215,7 +215,7 @@ bool QgsGeometryEditUtils::deletePart( QgsAbstractGeometry *geom, int partNum )
|
||||
return false;
|
||||
}
|
||||
|
||||
QgsGeometryCollection *c = dynamic_cast<QgsGeometryCollection *>( geom );
|
||||
QgsGeometryCollection *c = qgsgeometry_cast<QgsGeometryCollection *>( geom );
|
||||
if ( !c )
|
||||
{
|
||||
return false;
|
||||
|
@ -357,18 +357,18 @@ static bool lwgeom_make_geos_friendly( QgsAbstractGeometry &geom )
|
||||
|
||||
case QgsWkbTypes::LineString:
|
||||
// lines need at least 2 points
|
||||
return lwline_make_geos_friendly( dynamic_cast<QgsLineString &>( geom ) );
|
||||
return lwline_make_geos_friendly( qgsgeometry_cast<QgsLineString &>( geom ) );
|
||||
break;
|
||||
|
||||
case QgsWkbTypes::Polygon:
|
||||
// polygons need all rings closed and with npoints > 3
|
||||
return lwpoly_make_geos_friendly( dynamic_cast<QgsPolygonV2 &>( geom ) );
|
||||
return lwpoly_make_geos_friendly( qgsgeometry_cast<QgsPolygonV2 &>( geom ) );
|
||||
break;
|
||||
|
||||
case QgsWkbTypes::MultiLineString:
|
||||
case QgsWkbTypes::MultiPolygon:
|
||||
case QgsWkbTypes::GeometryCollection:
|
||||
return lwcollection_make_geos_friendly( dynamic_cast<QgsGeometryCollection &>( geom ) );
|
||||
return lwcollection_make_geos_friendly( qgsgeometry_cast<QgsGeometryCollection &>( geom ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -666,7 +666,7 @@ GEOSGeometry *QgsGeos::linePointDifference( GEOSGeometry *GEOSsplitPoint ) const
|
||||
QgsMultiCurve *multiCurve = nullptr;
|
||||
if ( type == GEOS_MULTILINESTRING )
|
||||
{
|
||||
multiCurve = dynamic_cast<QgsMultiCurve *>( mGeometry->clone() );
|
||||
multiCurve = qgsgeometry_cast<QgsMultiCurve *>( mGeometry->clone() );
|
||||
}
|
||||
else if ( type == GEOS_LINESTRING )
|
||||
{
|
||||
@ -685,7 +685,7 @@ GEOSGeometry *QgsGeos::linePointDifference( GEOSGeometry *GEOSsplitPoint ) const
|
||||
|
||||
|
||||
QgsAbstractGeometry *splitGeom = fromGeos( GEOSsplitPoint );
|
||||
QgsPoint *splitPoint = dynamic_cast<QgsPoint *>( splitGeom );
|
||||
QgsPoint *splitPoint = qgsgeometry_cast<QgsPoint *>( splitGeom );
|
||||
if ( !splitPoint )
|
||||
{
|
||||
delete splitGeom;
|
||||
@ -697,7 +697,7 @@ GEOSGeometry *QgsGeos::linePointDifference( GEOSGeometry *GEOSsplitPoint ) const
|
||||
//For each part
|
||||
for ( int i = 0; i < multiCurve->numGeometries(); ++i )
|
||||
{
|
||||
const QgsLineString *line = dynamic_cast<const QgsLineString *>( multiCurve->geometryN( i ) );
|
||||
const QgsLineString *line = qgsgeometry_cast<const QgsLineString *>( multiCurve->geometryN( i ) );
|
||||
if ( line )
|
||||
{
|
||||
//For each segment
|
||||
@ -1254,7 +1254,7 @@ GEOSGeometry *QgsGeos::asGeos( const QgsAbstractGeometry *geom, double precision
|
||||
}
|
||||
}
|
||||
|
||||
const QgsGeometryCollection *c = dynamic_cast<const QgsGeometryCollection *>( geom );
|
||||
const QgsGeometryCollection *c = qgsgeometry_cast<const QgsGeometryCollection *>( geom );
|
||||
if ( !c )
|
||||
return nullptr;
|
||||
|
||||
|
@ -44,7 +44,7 @@ QgsGeometry QgsInternalGeometryEngine::extrude( double x, double y ) const
|
||||
{
|
||||
QList<QgsLineString *> linesToProcess;
|
||||
|
||||
const QgsMultiCurve *multiCurve = dynamic_cast< const QgsMultiCurve * >( mGeometry );
|
||||
const QgsMultiCurve *multiCurve = qgsgeometry_cast< const QgsMultiCurve * >( mGeometry );
|
||||
if ( multiCurve )
|
||||
{
|
||||
for ( int i = 0; i < multiCurve->partCount(); ++i )
|
||||
@ -53,7 +53,7 @@ QgsGeometry QgsInternalGeometryEngine::extrude( double x, double y ) const
|
||||
}
|
||||
}
|
||||
|
||||
const QgsCurve *curve = dynamic_cast< const QgsCurve * >( mGeometry );
|
||||
const QgsCurve *curve = qgsgeometry_cast< const QgsCurve * >( mGeometry );
|
||||
if ( curve )
|
||||
{
|
||||
linesToProcess << static_cast<QgsLineString *>( curve->segmentize() );
|
||||
@ -241,7 +241,7 @@ QgsGeometry QgsInternalGeometryEngine::poleOfInaccessibility( double precision,
|
||||
if ( precision <= 0 )
|
||||
return QgsGeometry();
|
||||
|
||||
if ( const QgsGeometryCollection *gc = dynamic_cast< const QgsGeometryCollection *>( mGeometry ) )
|
||||
if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( mGeometry ) )
|
||||
{
|
||||
int numGeom = gc->numGeometries();
|
||||
double maxDist = 0;
|
||||
@ -249,7 +249,7 @@ QgsGeometry QgsInternalGeometryEngine::poleOfInaccessibility( double precision,
|
||||
bool found = false;
|
||||
for ( int i = 0; i < numGeom; ++i )
|
||||
{
|
||||
const QgsSurface *surface = dynamic_cast< const QgsSurface * >( gc->geometryN( i ) );
|
||||
const QgsSurface *surface = qgsgeometry_cast< const QgsSurface * >( gc->geometryN( i ) );
|
||||
if ( !surface )
|
||||
continue;
|
||||
|
||||
@ -272,7 +272,7 @@ QgsGeometry QgsInternalGeometryEngine::poleOfInaccessibility( double precision,
|
||||
}
|
||||
else
|
||||
{
|
||||
const QgsSurface *surface = dynamic_cast< const QgsSurface * >( mGeometry );
|
||||
const QgsSurface *surface = qgsgeometry_cast< const QgsSurface * >( mGeometry );
|
||||
if ( !surface )
|
||||
return QgsGeometry();
|
||||
|
||||
@ -494,7 +494,7 @@ QgsGeometry QgsInternalGeometryEngine::orthogonalize( double tolerance, int maxI
|
||||
double lowerThreshold = cos( ( 90 - angleThreshold ) * M_PI / 180.00 );
|
||||
double upperThreshold = cos( angleThreshold * M_PI / 180.0 );
|
||||
|
||||
if ( const QgsGeometryCollection *gc = dynamic_cast< const QgsGeometryCollection *>( mGeometry ) )
|
||||
if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( mGeometry ) )
|
||||
{
|
||||
int numGeom = gc->numGeometries();
|
||||
QList< QgsAbstractGeometry * > geometryList;
|
||||
@ -652,7 +652,7 @@ QgsGeometry QgsInternalGeometryEngine::densifyByCount( int extraNodesPerSegment
|
||||
return QgsGeometry( mGeometry->clone() ); // point geometry, nothing to do
|
||||
}
|
||||
|
||||
if ( const QgsGeometryCollection *gc = dynamic_cast< const QgsGeometryCollection *>( mGeometry ) )
|
||||
if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( mGeometry ) )
|
||||
{
|
||||
int numGeom = gc->numGeometries();
|
||||
QList< QgsAbstractGeometry * > geometryList;
|
||||
@ -687,7 +687,7 @@ QgsGeometry QgsInternalGeometryEngine::densifyByDistance( double distance ) cons
|
||||
return QgsGeometry( mGeometry->clone() ); // point geometry, nothing to do
|
||||
}
|
||||
|
||||
if ( const QgsGeometryCollection *gc = dynamic_cast< const QgsGeometryCollection *>( mGeometry ) )
|
||||
if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( mGeometry ) )
|
||||
{
|
||||
int numGeom = gc->numGeometries();
|
||||
QList< QgsAbstractGeometry * > geometryList;
|
||||
|
@ -46,7 +46,7 @@ QDomElement QgsMultiCurve::asGML2( QDomDocument &doc, int precision, const QStri
|
||||
QDomElement elemMultiLineString = doc.createElementNS( ns, QStringLiteral( "MultiLineString" ) );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsCurve *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsCurve *>( geom ) )
|
||||
{
|
||||
QgsLineString *lineString = static_cast<const QgsCurve *>( geom )->curveToLine();
|
||||
|
||||
@ -66,7 +66,7 @@ QDomElement QgsMultiCurve::asGML3( QDomDocument &doc, int precision, const QStri
|
||||
QDomElement elemMultiCurve = doc.createElementNS( ns, QStringLiteral( "MultiCurve" ) );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsCurve *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsCurve *>( geom ) )
|
||||
{
|
||||
const QgsCurve *curve = static_cast<const QgsCurve *>( geom );
|
||||
|
||||
@ -85,7 +85,7 @@ QString QgsMultiCurve::asJSON( int precision ) const
|
||||
QString json = QStringLiteral( "{\"type\": \"MultiLineString\", \"coordinates\": [" );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsCurve *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsCurve *>( geom ) )
|
||||
{
|
||||
QgsLineString *lineString = static_cast<const QgsCurve *>( geom )->curveToLine();
|
||||
QgsPointSequence pts;
|
||||
@ -119,7 +119,7 @@ QgsMultiCurve *QgsMultiCurve::reversed() const
|
||||
QgsMultiCurve *reversedMultiCurve = new QgsMultiCurve();
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsCurve *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsCurve *>( geom ) )
|
||||
{
|
||||
reversedMultiCurve->addGeometry( static_cast<const QgsCurve *>( geom )->reversed() );
|
||||
}
|
||||
@ -132,7 +132,7 @@ QgsAbstractGeometry *QgsMultiCurve::boundary() const
|
||||
QgsMultiPointV2 *multiPoint = new QgsMultiPointV2();
|
||||
for ( int i = 0; i < mGeometries.size(); ++i )
|
||||
{
|
||||
if ( QgsCurve *curve = dynamic_cast<QgsCurve *>( mGeometries.at( i ) ) )
|
||||
if ( QgsCurve *curve = qgsgeometry_cast<QgsCurve *>( mGeometries.at( i ) ) )
|
||||
{
|
||||
if ( !curve->isClosed() )
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ QDomElement QgsMultiLineString::asGML2( QDomDocument &doc, int precision, const
|
||||
QDomElement elemMultiLineString = doc.createElementNS( ns, QStringLiteral( "MultiLineString" ) );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsLineString *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsLineString *>( geom ) )
|
||||
{
|
||||
const QgsLineString *lineString = static_cast<const QgsLineString *>( geom );
|
||||
|
||||
@ -63,7 +63,7 @@ QDomElement QgsMultiLineString::asGML3( QDomDocument &doc, int precision, const
|
||||
QDomElement elemMultiCurve = doc.createElementNS( ns, QStringLiteral( "MultiCurve" ) );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsLineString *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsLineString *>( geom ) )
|
||||
{
|
||||
const QgsLineString *lineString = static_cast<const QgsLineString *>( geom );
|
||||
|
||||
@ -81,7 +81,7 @@ QString QgsMultiLineString::asJSON( int precision ) const
|
||||
QString json = QStringLiteral( "{\"type\": \"MultiLineString\", \"coordinates\": [" );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsCurve *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsCurve *>( geom ) )
|
||||
{
|
||||
const QgsLineString *lineString = static_cast<const QgsLineString *>( geom );
|
||||
QgsPointSequence pts;
|
||||
|
@ -50,7 +50,7 @@ QDomElement QgsMultiPointV2::asGML2( QDomDocument &doc, int precision, const QSt
|
||||
QDomElement elemMultiPoint = doc.createElementNS( ns, QStringLiteral( "MultiPoint" ) );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsPoint *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsPoint *>( geom ) )
|
||||
{
|
||||
QDomElement elemPointMember = doc.createElementNS( ns, QStringLiteral( "pointMember" ) );
|
||||
elemPointMember.appendChild( geom->asGML2( doc, precision, ns ) );
|
||||
@ -66,7 +66,7 @@ QDomElement QgsMultiPointV2::asGML3( QDomDocument &doc, int precision, const QSt
|
||||
QDomElement elemMultiPoint = doc.createElementNS( ns, QStringLiteral( "MultiPoint" ) );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsPoint *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsPoint *>( geom ) )
|
||||
{
|
||||
QDomElement elemPointMember = doc.createElementNS( ns, QStringLiteral( "pointMember" ) );
|
||||
elemPointMember.appendChild( geom->asGML3( doc, precision, ns ) );
|
||||
@ -84,7 +84,7 @@ QString QgsMultiPointV2::asJSON( int precision ) const
|
||||
QgsPointSequence pts;
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsPoint *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsPoint *>( geom ) )
|
||||
{
|
||||
const QgsPoint *point = static_cast<const QgsPoint *>( geom );
|
||||
pts << *point;
|
||||
|
@ -44,7 +44,7 @@ QDomElement QgsMultiPolygonV2::asGML2( QDomDocument &doc, int precision, const Q
|
||||
QDomElement elemMultiPolygon = doc.createElementNS( ns, QStringLiteral( "MultiPolygon" ) );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsPolygonV2 *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsPolygonV2 *>( geom ) )
|
||||
{
|
||||
QDomElement elemPolygonMember = doc.createElementNS( ns, QStringLiteral( "polygonMember" ) );
|
||||
elemPolygonMember.appendChild( geom->asGML2( doc, precision, ns ) );
|
||||
@ -60,7 +60,7 @@ QDomElement QgsMultiPolygonV2::asGML3( QDomDocument &doc, int precision, const Q
|
||||
QDomElement elemMultiSurface = doc.createElementNS( ns, QStringLiteral( "MultiPolygon" ) );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsPolygonV2 *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsPolygonV2 *>( geom ) )
|
||||
{
|
||||
QDomElement elemSurfaceMember = doc.createElementNS( ns, QStringLiteral( "polygonMember" ) );
|
||||
elemSurfaceMember.appendChild( geom->asGML3( doc, precision, ns ) );
|
||||
@ -77,7 +77,7 @@ QString QgsMultiPolygonV2::asJSON( int precision ) const
|
||||
QString json = QStringLiteral( "{\"type\": \"MultiPolygon\", \"coordinates\": [" );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsPolygonV2 *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsPolygonV2 *>( geom ) )
|
||||
{
|
||||
json += '[';
|
||||
|
||||
@ -140,7 +140,7 @@ QgsAbstractGeometry *QgsMultiPolygonV2::boundary() const
|
||||
QgsMultiLineString *multiLine = new QgsMultiLineString();
|
||||
for ( int i = 0; i < mGeometries.size(); ++i )
|
||||
{
|
||||
if ( QgsPolygonV2 *polygon = dynamic_cast<QgsPolygonV2 *>( mGeometries.at( i ) ) )
|
||||
if ( QgsPolygonV2 *polygon = qgsgeometry_cast<QgsPolygonV2 *>( mGeometries.at( i ) ) )
|
||||
{
|
||||
QgsAbstractGeometry *polygonBoundary = polygon->boundary();
|
||||
|
||||
|
@ -47,7 +47,7 @@ QDomElement QgsMultiSurface::asGML2( QDomDocument &doc, int precision, const QSt
|
||||
QDomElement elemMultiPolygon = doc.createElementNS( ns, QStringLiteral( "MultiPolygon" ) );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsSurface *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsSurface *>( geom ) )
|
||||
{
|
||||
QgsPolygonV2 *polygon = static_cast<const QgsSurface *>( geom )->surfaceToPolygon();
|
||||
|
||||
@ -67,7 +67,7 @@ QDomElement QgsMultiSurface::asGML3( QDomDocument &doc, int precision, const QSt
|
||||
QDomElement elemMultiSurface = doc.createElementNS( ns, QStringLiteral( "MultiSurface" ) );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsSurface *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsSurface *>( geom ) )
|
||||
{
|
||||
QDomElement elemSurfaceMember = doc.createElementNS( ns, QStringLiteral( "surfaceMember" ) );
|
||||
elemSurfaceMember.appendChild( geom->asGML3( doc, precision, ns ) );
|
||||
@ -84,7 +84,7 @@ QString QgsMultiSurface::asJSON( int precision ) const
|
||||
QString json = QStringLiteral( "{\"type\": \"MultiPolygon\", \"coordinates\": [" );
|
||||
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
|
||||
{
|
||||
if ( dynamic_cast<const QgsSurface *>( geom ) )
|
||||
if ( qgsgeometry_cast<const QgsSurface *>( geom ) )
|
||||
{
|
||||
json += '[';
|
||||
|
||||
@ -124,7 +124,7 @@ QString QgsMultiSurface::asJSON( int precision ) const
|
||||
|
||||
bool QgsMultiSurface::addGeometry( QgsAbstractGeometry *g )
|
||||
{
|
||||
if ( !dynamic_cast<QgsSurface *>( g ) )
|
||||
if ( !qgsgeometry_cast<QgsSurface *>( g ) )
|
||||
{
|
||||
delete g;
|
||||
return false;
|
||||
@ -139,7 +139,7 @@ QgsAbstractGeometry *QgsMultiSurface::boundary() const
|
||||
QgsMultiCurve *multiCurve = new QgsMultiCurve();
|
||||
for ( int i = 0; i < mGeometries.size(); ++i )
|
||||
{
|
||||
if ( QgsSurface *surface = dynamic_cast<QgsSurface *>( mGeometries.at( i ) ) )
|
||||
if ( QgsSurface *surface = qgsgeometry_cast<QgsSurface *>( mGeometries.at( i ) ) )
|
||||
{
|
||||
multiCurve->addGeometry( surface->boundary() );
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ double QgsDistanceArea::measure( const QgsAbstractGeometry *geomV2, MeasureType
|
||||
else
|
||||
{
|
||||
//multigeom is sum of measured parts
|
||||
const QgsGeometryCollection *collection = dynamic_cast<const QgsGeometryCollection *>( geomV2 );
|
||||
const QgsGeometryCollection *collection = qgsgeometry_cast<const QgsGeometryCollection *>( geomV2 );
|
||||
if ( collection )
|
||||
{
|
||||
double sum = 0;
|
||||
@ -146,7 +146,7 @@ double QgsDistanceArea::measure( const QgsAbstractGeometry *geomV2, MeasureType
|
||||
|
||||
if ( measureType == Length )
|
||||
{
|
||||
const QgsCurve *curve = dynamic_cast<const QgsCurve *>( geomV2 );
|
||||
const QgsCurve *curve = qgsgeometry_cast<const QgsCurve *>( geomV2 );
|
||||
if ( !curve )
|
||||
{
|
||||
return 0.0;
|
||||
@ -159,7 +159,7 @@ double QgsDistanceArea::measure( const QgsAbstractGeometry *geomV2, MeasureType
|
||||
}
|
||||
else
|
||||
{
|
||||
const QgsSurface *surface = dynamic_cast<const QgsSurface *>( geomV2 );
|
||||
const QgsSurface *surface = qgsgeometry_cast<const QgsSurface *>( geomV2 );
|
||||
if ( !surface )
|
||||
return 0.0;
|
||||
|
||||
@ -216,12 +216,12 @@ double QgsDistanceArea::measurePerimeter( const QgsGeometry &geometry ) const
|
||||
|
||||
//create list with (single) surfaces
|
||||
QList< const QgsSurface * > surfaces;
|
||||
const QgsSurface *surf = dynamic_cast<const QgsSurface *>( geomV2 );
|
||||
const QgsSurface *surf = qgsgeometry_cast<const QgsSurface *>( geomV2 );
|
||||
if ( surf )
|
||||
{
|
||||
surfaces.append( surf );
|
||||
}
|
||||
const QgsMultiSurface *multiSurf = dynamic_cast<const QgsMultiSurface *>( geomV2 );
|
||||
const QgsMultiSurface *multiSurf = qgsgeometry_cast<const QgsMultiSurface *>( geomV2 );
|
||||
if ( multiSurf )
|
||||
{
|
||||
surfaces.reserve( ( surf ? 1 : 0 ) + multiSurf->numGeometries() );
|
||||
|
@ -107,7 +107,7 @@ static QgsGeometry generalizeWkbGeometryByBoundingBox(
|
||||
template<class T>
|
||||
static T *createEmptySameTypeGeom( const T &geom )
|
||||
{
|
||||
T *output( dynamic_cast<T *>( geom.clone() ) );
|
||||
T *output( qgsgeometry_cast<T *>( geom.clone() ) );
|
||||
output->clear();
|
||||
return output;
|
||||
}
|
||||
@ -137,7 +137,7 @@ QgsGeometry QgsMapToPixelSimplifier::simplifyGeometry(
|
||||
// Write the geometry
|
||||
if ( flatType == QgsWkbTypes::LineString || flatType == QgsWkbTypes::CircularString )
|
||||
{
|
||||
const QgsCurve &srcCurve = dynamic_cast<const QgsCurve &>( geometry );
|
||||
const QgsCurve &srcCurve = qgsgeometry_cast<const QgsCurve &>( geometry );
|
||||
std::unique_ptr<QgsCurve> output( createEmptySameTypeGeom( srcCurve ) );
|
||||
double x = 0.0, y = 0.0, lastX = 0.0, lastY = 0.0;
|
||||
QgsRectangle r;
|
||||
@ -267,19 +267,19 @@ QgsGeometry QgsMapToPixelSimplifier::simplifyGeometry(
|
||||
}
|
||||
else if ( flatType == QgsWkbTypes::Polygon )
|
||||
{
|
||||
const QgsPolygonV2 &srcPolygon = dynamic_cast<const QgsPolygonV2 &>( geometry );
|
||||
const QgsPolygonV2 &srcPolygon = qgsgeometry_cast<const QgsPolygonV2 &>( geometry );
|
||||
std::unique_ptr<QgsPolygonV2> polygon( new QgsPolygonV2() );
|
||||
polygon->setExteriorRing( dynamic_cast<QgsCurve *>( simplifyGeometry( simplifyFlags, simplifyAlgorithm, srcPolygon.exteriorRing()->wkbType(), *srcPolygon.exteriorRing(), envelope, map2pixelTol, true ).geometry()->clone() ) );
|
||||
polygon->setExteriorRing( qgsgeometry_cast<QgsCurve *>( simplifyGeometry( simplifyFlags, simplifyAlgorithm, srcPolygon.exteriorRing()->wkbType(), *srcPolygon.exteriorRing(), envelope, map2pixelTol, true ).geometry()->clone() ) );
|
||||
for ( int i = 0; i < srcPolygon.numInteriorRings(); ++i )
|
||||
{
|
||||
const QgsCurve *sub = srcPolygon.interiorRing( i );
|
||||
polygon->addInteriorRing( dynamic_cast<QgsCurve *>( simplifyGeometry( simplifyFlags, simplifyAlgorithm, sub->wkbType(), *sub, envelope, map2pixelTol, true ).geometry()->clone() ) );
|
||||
polygon->addInteriorRing( qgsgeometry_cast<QgsCurve *>( simplifyGeometry( simplifyFlags, simplifyAlgorithm, sub->wkbType(), *sub, envelope, map2pixelTol, true ).geometry()->clone() ) );
|
||||
}
|
||||
return QgsGeometry( polygon.release() );
|
||||
}
|
||||
else if ( QgsWkbTypes::isMultiType( flatType ) )
|
||||
{
|
||||
const QgsGeometryCollection &srcCollection = dynamic_cast<const QgsGeometryCollection &>( geometry );
|
||||
const QgsGeometryCollection &srcCollection = qgsgeometry_cast<const QgsGeometryCollection &>( geometry );
|
||||
std::unique_ptr<QgsGeometryCollection> collection( createEmptySameTypeGeom( srcCollection ) );
|
||||
const int numGeoms = srcCollection.numGeometries();
|
||||
for ( int i = 0; i < numGeoms; ++i )
|
||||
|
@ -396,7 +396,7 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( QgsFeatur
|
||||
QString str = formatDistance( dist );
|
||||
derivedAttributes.insert( tr( "Length" ), str );
|
||||
|
||||
const QgsCurve *curve = dynamic_cast< const QgsCurve * >( feature->geometry().geometry() );
|
||||
const QgsCurve *curve = qgsgeometry_cast< const QgsCurve * >( feature->geometry().geometry() );
|
||||
if ( curve )
|
||||
{
|
||||
str = QLocale::system().toString( curve->nCoordinates() );
|
||||
|
Loading…
x
Reference in New Issue
Block a user