Skip to content

Commit

Permalink
qgssymbol: Add support for qgspolyhedralsurface
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitjano authored and lbartoletti committed Sep 9, 2024
1 parent 5753ec9 commit 9f18b92
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/core/symbology/qgssymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <random>

#include "qgssymbol.h"
#include "qgspolyhedralsurface.h"
#include "qgssymbollayer.h"

#include "qgsgeometrygeneratorsymbollayer.h"
Expand Down Expand Up @@ -1823,6 +1824,21 @@ void QgsSymbol::renderFeature( const QgsFeature &feature, QgsRenderContext &cont
break;
}

case Qgis::WkbType::PolyhedralSurface:
{
const QgsPolyhedralSurface *polySurface = qgsgeometry_cast<const QgsPolyhedralSurface *>( processedGeometry );

const int num = polySurface->numPatches();
for ( int i = 0; i < num; ++i )
{
if ( context.renderingStopped() )
break;

getPartGeometry( polySurface->patchN( i ), i );
}
break;
}

default:
QgsDebugError( QStringLiteral( "feature %1: unsupported wkb type %2/%3 for rendering" )
.arg( feature.id() )
Expand Down
5 changes: 4 additions & 1 deletion tests/src/python/test_qgssymbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ def testGeometryRendering(self):
'reference_image': 'multicurve'},
{'name': 'CurvePolygon_no_arc', # refs #14028
'wkt': 'CURVEPOLYGON(LINESTRING(1 3, 3 5, 4 7, 7 3, 1 3))',
'reference_image': 'curve_polygon_no_arc'}]
'reference_image': 'curve_polygon_no_arc'},
{'name': 'PolyhedralSurface',
'wkt': 'POLYHEDRALSURFACE Z(((0.0 0.0 1.0,0.0 1.0 0.0,0.0 0.0 0.0,0.0 0.0 1.0)),((0.0 0.0 1.0,0.0 0.0 1.0,0.0 0.0 0.0,0.0 0.0 1.0)),((0.0 0.0 0.0,0.0 0.0 1.0,0.0 0.0 0.0,0.0 0.0 0.0)),((0.0 0.0 0.0,0.0 0.0 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2.0)),((1.0 1.0 2.0,2.0 1.0 1.0,2.0 1.0 1.0,1.0 1.0 2.0)),((1.0 1.0 2.0,2.0 1.0 1.0,1.0 2.0 1.0,1.0 1.0 2.0)),((1.0 1.0 2.0,1.0 2.0 1.0,1.0 2.0 1.0,1.0 1.0 2.0)),((1.0 1.0 2.0,1.0 2.0 1.0,1.0 1.0 2.0,1.0 1.0 2.0)),((1.0 0.0 0.0,2.0 1.0 1.0,1.0 1.0 2.0,1.0 0.0 0.0)),((0.0 0.0 1.0,1.0 0.0 0.0,1.0 1.0 2.0,0.0 0.0 1.0)),((2.0 1.0 1.0,2.0 1.0 1.0,1.0 0.0 0.0,2.0 1.0 1.0)),((1.0 0.0 0.0,2.0 1.0 1.0,1.0 0.0 0.0,1.0 0.0 0.0)))',
'reference_image': 'polyhedral_surface'}]

for test in tests:

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9f18b92

Please sign in to comment.