Skip to content

Commit

Permalink
fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCaha committed Oct 5, 2024
1 parent 1843f32 commit 62fa703
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions src/analysis/processing/qgsalgorithmmeshsurfacetopolygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,11 @@ QVariantMap QgsMeshSurfaceToPolygonAlgorithm::processAlgorithm( const QVariantMa

QgsGeometry lines;
QgsMeshFace face;
QMap<std::pair<int, int>, int> edges; // edge as key and count of edge occurence as value
QMap<std::pair<int, int>, int> edges; // edge as key and count of edge usage as value
std::pair<int, int> edge;

feedback->setProgressText( "Parsing mesh faces to extract edges." );
if ( feedback )
feedback->setProgressText( "Parsing mesh faces to extract edges." );

for ( int i = 0; i < mNativeMesh.faceCount(); i++ )
{
Expand Down Expand Up @@ -172,12 +173,15 @@ QVariantMap QgsMeshSurfaceToPolygonAlgorithm::processAlgorithm( const QVariantMa
}
}

feedback->setProgress( 100 * i / mNativeMesh.faceCount() );
if ( feedback )
feedback->setProgress( 100 * i / mNativeMesh.faceCount() );
}

feedback->setProgress( 0 );
feedback->setProgressText( "Parsing mesh edges." );

if ( feedback )
{
feedback->setProgress( 0 );
feedback->setProgressText( "Parsing mesh edges." );
}
std::unique_ptr<QgsMultiLineString> multiLineString( new QgsMultiLineString() );

int i = 0;
Expand All @@ -195,15 +199,16 @@ QVariantMap QgsMeshSurfaceToPolygonAlgorithm::processAlgorithm( const QVariantMa
std::unique_ptr<QgsLineString> line( new QgsLineString( mNativeMesh.vertex( it.key().first ), mNativeMesh.vertex( it.key().second ) ) );
multiLineString->addGeometry( line.release() );
}
if ( feedback )
feedback->setProgress( 100 * i / edges.size() );

feedback->setProgress( 100 * i / edges.size() );
i++;
}

feedback->setProgressText( "Creating final geometry." );

if ( feedback )
{
feedback->setProgressText( "Creating final geometry." );
if ( feedback->isCanceled() )
return QVariantMap();
}
Expand All @@ -221,6 +226,12 @@ QVariantMap QgsMeshSurfaceToPolygonAlgorithm::processAlgorithm( const QVariantMa
{
for ( auto pit = multiLinesAbstract->const_parts_begin(); pit != multiLinesAbstract->const_parts_end(); ++pit )
{
if ( feedback )
{
if ( feedback->isCanceled() )
return QVariantMap();
}

std::unique_ptr<QgsPolygon> polygon = std::make_unique<QgsPolygon>();
polygon->setExteriorRing( qgsgeometry_cast< QgsLineString * >( *pit )->clone() );
multiPolygon->addGeometry( polygon.release() );
Expand Down Expand Up @@ -260,7 +271,6 @@ QVariantMap QgsMeshSurfaceToPolygonAlgorithm::processAlgorithm( const QVariantMa
return QVariantMap();
}


QVariantMap ret;
ret[QStringLiteral( "OUTPUT" )] = identifier;

Expand Down

0 comments on commit 62fa703

Please sign in to comment.