"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/core/geometry/qgsgeos.cpp" between
QGIS-final-3_10_5.tar.gz and QGIS-final-3_10_6.tar.gz

About: QGIS (Quantum GIS) is a Geographic Information System that supports vector, raster, and database formats. Long-term release (3.10.x series).

qgsgeos.cpp  (QGIS-final-3_10_5):qgsgeos.cpp  (QGIS-final-3_10_6)
skipping to change at line 1089 skipping to change at line 1089
int nCoordDims = GEOSGeom_getCoordinateDimension_r( geosinit.ctxt, geos ); int nCoordDims = GEOSGeom_getCoordinateDimension_r( geosinit.ctxt, geos );
int nDims = GEOSGeom_getDimensions_r( geosinit.ctxt, geos ); int nDims = GEOSGeom_getDimensions_r( geosinit.ctxt, geos );
bool hasZ = ( nCoordDims == 3 ); bool hasZ = ( nCoordDims == 3 );
bool hasM = ( ( nDims - nCoordDims ) == 1 ); bool hasM = ( ( nDims - nCoordDims ) == 1 );
switch ( GEOSGeomTypeId_r( geosinit.ctxt, geos ) ) switch ( GEOSGeomTypeId_r( geosinit.ctxt, geos ) )
{ {
case GEOS_POINT: // a point case GEOS_POINT: // a point
{ {
const GEOSCoordSequence *cs = GEOSGeom_getCoordSeq_r( geosinit.ctxt, geos ); const GEOSCoordSequence *cs = GEOSGeom_getCoordSeq_r( geosinit.ctxt, geos );
return std::unique_ptr<QgsAbstractGeometry>( coordSeqPoint( cs, 0, hasZ, h unsigned int nPoints = 0;
asM ).clone() ); GEOSCoordSeq_getSize_r( geosinit.ctxt, cs, &nPoints );
return nPoints > 0 ? std::unique_ptr<QgsAbstractGeometry>( coordSeqPoint(
cs, 0, hasZ, hasM ).clone() ) : nullptr;
} }
case GEOS_LINESTRING: case GEOS_LINESTRING:
{ {
return sequenceToLinestring( geos, hasZ, hasM ); return sequenceToLinestring( geos, hasZ, hasM );
} }
case GEOS_POLYGON: case GEOS_POLYGON:
{ {
return fromGeosPolygon( geos ); return fromGeosPolygon( geos );
} }
case GEOS_MULTIPOINT: case GEOS_MULTIPOINT:
{ {
std::unique_ptr< QgsMultiPoint > multiPoint( new QgsMultiPoint() ); std::unique_ptr< QgsMultiPoint > multiPoint( new QgsMultiPoint() );
int nParts = GEOSGetNumGeometries_r( geosinit.ctxt, geos ); int nParts = GEOSGetNumGeometries_r( geosinit.ctxt, geos );
multiPoint->reserve( nParts ); multiPoint->reserve( nParts );
for ( int i = 0; i < nParts; ++i ) for ( int i = 0; i < nParts; ++i )
{ {
const GEOSCoordSequence *cs = GEOSGeom_getCoordSeq_r( geosinit.ctxt, GEO SGetGeometryN_r( geosinit.ctxt, geos, i ) ); const GEOSCoordSequence *cs = GEOSGeom_getCoordSeq_r( geosinit.ctxt, GEO SGetGeometryN_r( geosinit.ctxt, geos, i ) );
if ( cs ) if ( cs )
{ {
multiPoint->addGeometry( coordSeqPoint( cs, 0, hasZ, hasM ).clone() ); unsigned int nPoints = 0;
GEOSCoordSeq_getSize_r( geosinit.ctxt, cs, &nPoints );
if ( nPoints > 0 )
multiPoint->addGeometry( coordSeqPoint( cs, 0, hasZ, hasM ).clone()
);
} }
} }
return std::move( multiPoint ); return std::move( multiPoint );
} }
case GEOS_MULTILINESTRING: case GEOS_MULTILINESTRING:
{ {
std::unique_ptr< QgsMultiLineString > multiLineString( new QgsMultiLineStr ing() ); std::unique_ptr< QgsMultiLineString > multiLineString( new QgsMultiLineStr ing() );
int nParts = GEOSGetNumGeometries_r( geosinit.ctxt, geos ); int nParts = GEOSGetNumGeometries_r( geosinit.ctxt, geos );
multiLineString->reserve( nParts ); multiLineString->reserve( nParts );
for ( int i = 0; i < nParts; ++i ) for ( int i = 0; i < nParts; ++i )
skipping to change at line 2154 skipping to change at line 2159
try try
{ {
geos.reset( GEOSLineMerge_r( geosinit.ctxt, mGeos.get() ) ); geos.reset( GEOSLineMerge_r( geosinit.ctxt, mGeos.get() ) );
} }
CATCH_GEOS_WITH_ERRMSG( QgsGeometry() ); CATCH_GEOS_WITH_ERRMSG( QgsGeometry() );
return QgsGeometry( fromGeos( geos.get() ) ); return QgsGeometry( fromGeos( geos.get() ) );
} }
QgsGeometry QgsGeos::closestPoint( const QgsGeometry &other, QString *errorMsg ) const QgsGeometry QgsGeos::closestPoint( const QgsGeometry &other, QString *errorMsg ) const
{ {
if ( !mGeos || other.isNull() ) if ( !mGeos || isEmpty() || other.isNull() )
{ {
return QgsGeometry(); return QgsGeometry();
} }
geos::unique_ptr otherGeom( asGeos( other.constGet(), mPrecision ) ); geos::unique_ptr otherGeom( asGeos( other.constGet(), mPrecision ) );
if ( !otherGeom ) if ( !otherGeom )
{ {
return QgsGeometry(); return QgsGeometry();
} }
 End of changes. 3 change blocks. 
4 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)