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

[elevation profile] add tolerance for lines and polyons #54964

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8b9f8fe
feat(elevation_profile): add tolerance support for lines
jmkerloch May 11, 2023
61b1ad1
fix(elevation_profile): improve nan values handling in distance map
benoitdm-oslandia Aug 2, 2023
c633058
fix(elevation_profile): switch to no buffer profile computation when …
benoitdm-oslandia Aug 2, 2023
ea756df
fix(elevation_profile): fix how point in mDistanceToHeightMap are gen…
benoitdm-oslandia Aug 2, 2023
4644266
fix(elevation_profile): decrease offset position for nan (end of line…
benoitdm-oslandia Aug 2, 2023
3b161c3
refactor(elevation_profile): simplify mFeedback->isCanceled() and g.i…
benoitdm-oslandia May 23, 2023
fa12235
refactor(elevation_profile): refactor lambda to function to reduce du…
benoitdm-oslandia Jul 12, 2023
6a95a2b
fix(elevation_profile): fix and add python tests to handle tolerance …
benoitdm-oslandia May 26, 2023
3dcf388
feat(elevation_profile): add c++ tests for line
benoitdm-oslandia Jul 12, 2023
0f203d2
fix(elevation_profile): fix bug for line when extrusion is set
benoitdm-oslandia Jul 12, 2023
71c39f3
feat(elevation_profile): add tolerance support for polygon
benoitdm-oslandia Jul 12, 2023
1b9e2ae
fix(elevation_profile): rename var to improve readability
benoitdm-oslandia Aug 25, 2023
1151fc8
fix(elevation_profile): resolve bug when using tolerance and polygons
benoitdm-oslandia Aug 25, 2023
02734b5
fix(profileGenerator): refix #54422 and simplify algorithm
benoitdm-oslandia Oct 20, 2023
fb386e0
fix(elevation_profile): add geos version verification in test
benoitdm-oslandia Nov 2, 2023
5c31f26
fix(elevation_profile): rename mProfileBoxXX mProfileBufferedCurveXX
benoitdm-oslandia Feb 9, 2024
7123f3b
fix(elevation_profile): generateProfileForLines and generateProfileFo…
benoitdm-oslandia Feb 9, 2024
fd03cdf
fix(elevation_profile): migrate c++ test testqgselevationprofile.cpp …
benoitdm-oslandia Feb 9, 2024
f1d0d73
fix(elevation_profile): remove useless test in processTriangleInterse…
benoitdm-oslandia Feb 12, 2024
ad6f359
fix(profileelevation): add comment to explain why extrusion is disabl…
benoitdm-oslandia Feb 13, 2024
f20543a
fix(elevation_profile): revert vertice loop to pointer loop
benoitdm-oslandia Feb 26, 2024
9dc6248
fix(elevation_profile): filter polygon when vertices count < 4
benoitdm-oslandia Feb 26, 2024
a68a0ad
fix(elevation_profile): use featGeomPart instead of feature geometry …
benoitdm-oslandia Feb 26, 2024
6f60665
fix(elevetion_profile): replace `request.setFilterRect` by `request.s…
benoitdm-oslandia Feb 26, 2024
5b123f8
fix(elevation_profile): add fix when intersecting polygons vs wall.
benoitdm-oslandia Feb 27, 2024
83a7a50
fix(elevation_profile): adjust tolerance tests for geos 3.12 and add …
benoitdm-oslandia Mar 1, 2024
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
87 changes: 39 additions & 48 deletions src/core/elevation/qgsabstractprofilesurfacegenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,67 +297,58 @@ void QgsAbstractProfileSurfaceResults::renderResults( QgsProfileRenderContext &c
break;
}

auto checkLine = [this]( QPolygonF & currentLine, QgsProfileRenderContext & context, double minZ, double maxZ,
double prevDistance, double currentPartStartDistance )
{
if ( currentLine.length() > 1 )
{
switch ( symbology )
{
case Qgis::ProfileSurfaceSymbology::Line:
mLineSymbol->renderPolyline( currentLine, nullptr, context.renderContext() );
break;
case Qgis::ProfileSurfaceSymbology::FillBelow:
currentLine.append( context.worldTransform().map( QPointF( prevDistance, minZ ) ) );
currentLine.append( context.worldTransform().map( QPointF( currentPartStartDistance, minZ ) ) );
currentLine.append( currentLine.at( 0 ) );
mFillSymbol->renderPolygon( currentLine, nullptr, nullptr, context.renderContext() );
break;
case Qgis::ProfileSurfaceSymbology::FillAbove:
currentLine.append( context.worldTransform().map( QPointF( prevDistance, maxZ ) ) );
currentLine.append( context.worldTransform().map( QPointF( currentPartStartDistance, maxZ ) ) );
currentLine.append( currentLine.at( 0 ) );
mFillSymbol->renderPolygon( currentLine, nullptr, nullptr, context.renderContext() );
break;
}
}
};

QPolygonF currentLine;
double prevDistance = std::numeric_limits< double >::quiet_NaN();
double currentPartStartDistance = 0;
for ( auto pointIt = mDistanceToHeightMap.constBegin(); pointIt != mDistanceToHeightMap.constEnd(); ++pointIt )
{
if ( std::isnan( pointIt.value() ) )
if ( currentLine.empty() ) // new part
{
if ( currentLine.length() > 1 )
{
switch ( symbology )
{
case Qgis::ProfileSurfaceSymbology::Line:
mLineSymbol->renderPolyline( currentLine, nullptr, context.renderContext() );
break;
case Qgis::ProfileSurfaceSymbology::FillBelow:
currentLine.append( context.worldTransform().map( QPointF( prevDistance, minZ ) ) );
currentLine.append( context.worldTransform().map( QPointF( currentPartStartDistance, minZ ) ) );
currentLine.append( currentLine.at( 0 ) );
mFillSymbol->renderPolygon( currentLine, nullptr, nullptr, context.renderContext() );
break;
case Qgis::ProfileSurfaceSymbology::FillAbove:
currentLine.append( context.worldTransform().map( QPointF( prevDistance, maxZ ) ) );
currentLine.append( context.worldTransform().map( QPointF( currentPartStartDistance, maxZ ) ) );
currentLine.append( currentLine.at( 0 ) );
mFillSymbol->renderPolygon( currentLine, nullptr, nullptr, context.renderContext() );
break;
}
}
prevDistance = pointIt.key();
currentLine.clear();
continue;
if ( std::isnan( pointIt.value() ) ) // skip emptiness
continue;
currentPartStartDistance = pointIt.key();
}
if ( currentLine.length() < 1 )

if ( std::isnan( pointIt.value() ) )
{
currentPartStartDistance = pointIt.key();
checkLine( currentLine, context, minZ, maxZ, prevDistance, currentPartStartDistance );
currentLine.clear();
}
currentLine.append( context.worldTransform().map( QPointF( pointIt.key(), pointIt.value() ) ) );
prevDistance = pointIt.key();
}
if ( currentLine.length() > 1 )
{
switch ( symbology )
else
{
case Qgis::ProfileSurfaceSymbology::Line:
mLineSymbol->renderPolyline( currentLine, nullptr, context.renderContext() );
break;
case Qgis::ProfileSurfaceSymbology::FillBelow:
currentLine.append( context.worldTransform().map( QPointF( prevDistance, minZ ) ) );
currentLine.append( context.worldTransform().map( QPointF( currentPartStartDistance, minZ ) ) );
currentLine.append( currentLine.at( 0 ) );
mFillSymbol->renderPolygon( currentLine, nullptr, nullptr, context.renderContext() );
break;
case Qgis::ProfileSurfaceSymbology::FillAbove:
currentLine.append( context.worldTransform().map( QPointF( prevDistance, maxZ ) ) );
currentLine.append( context.worldTransform().map( QPointF( currentPartStartDistance, maxZ ) ) );
currentLine.append( currentLine.at( 0 ) );
mFillSymbol->renderPolygon( currentLine, nullptr, nullptr, context.renderContext() );
break;
currentLine.append( context.worldTransform().map( QPointF( pointIt.key(), pointIt.value() ) ) );
prevDistance = pointIt.key();
}
}

checkLine( currentLine, context, minZ, maxZ, prevDistance, currentPartStartDistance );

switch ( symbology )
{
case Qgis::ProfileSurfaceSymbology::Line:
Expand Down
Loading
Loading