mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
#8725-R: never simplifying the first two or last two vertices in a line
This ensure that the angles at the line start and end are the same after simplification
This commit is contained in:
parent
2c67e511cd
commit
42fd6a2bdb
@ -203,7 +203,7 @@ bool QgsMapToPixelSimplifier::simplifyWkbGeometry( int simplifyFlags, QGis::WkbT
|
||||
memcpy( &x, sourceWkb, sizeof( double ) ); sourceWkb += sizeOfDoubleX;
|
||||
memcpy( &y, sourceWkb, sizeof( double ) ); sourceWkb += sizeOfDoubleY;
|
||||
|
||||
if ( i == 0 || !canbeGeneralizable || QgsMapToPixelSimplifier::calculateLengthSquared2D( x, y, lastX, lastY ) > map2pixelTol )
|
||||
if ( i == 0 || !canbeGeneralizable || QgsMapToPixelSimplifier::calculateLengthSquared2D( x, y, lastX, lastY ) > map2pixelTol || ( !isaLinearRing && ( i == 1 || i >= numPoints - 2 ) ) )
|
||||
{
|
||||
memcpy( ptr, &x, sizeof( double ) ); lastX = x; ptr++;
|
||||
memcpy( ptr, &y, sizeof( double ) ); lastY = y; ptr++;
|
||||
|
@ -113,7 +113,7 @@ bool QgsOgrMapToPixelSimplifier::simplifyOgrGeometry( QGis::GeometryType geometr
|
||||
memcpy( &x, xsourcePtr, sizeof( double ) ); xsourcePtr += xStride;
|
||||
memcpy( &y, ysourcePtr, sizeof( double ) ); ysourcePtr += yStride;
|
||||
|
||||
if ( i == 0 || !canbeGeneralizable || QgsMapToPixelSimplifier::calculateLengthSquared2D( x, y, lastX, lastY ) > map2pixelTol )
|
||||
if ( i == 0 || !canbeGeneralizable || QgsMapToPixelSimplifier::calculateLengthSquared2D( x, y, lastX, lastY ) > map2pixelTol || ( geometryType == QGis::Line && ( i == 1 || i >= numPoints - 2 ) ) )
|
||||
{
|
||||
memcpy( xtargetPtr, &x, sizeof( double ) ); lastX = x; xtargetPtr += xStride;
|
||||
memcpy( ytargetPtr, &y, sizeof( double ) ); lastY = y; ytargetPtr += yStride;
|
||||
@ -140,7 +140,7 @@ bool QgsOgrMapToPixelSimplifier::simplifyOgrGeometry( OGRGeometry* geometry, boo
|
||||
OGRLineString* lineString = ( OGRLineString* )geometry;
|
||||
|
||||
int numPoints = lineString->getNumPoints();
|
||||
if (( isaLinearRing && numPoints <= 5 ) || ( !isaLinearRing && numPoints <= 2 ) ) return false;
|
||||
if (( isaLinearRing && numPoints <= 5 ) || ( !isaLinearRing && numPoints <= 4 ) ) return false;
|
||||
|
||||
OGREnvelope env;
|
||||
geometry->getEnvelope( &env );
|
||||
|
Loading…
x
Reference in New Issue
Block a user