Skip to content

Commit

Permalink
[3d] Fix 3D polygon symbol to work with geometry collection
Browse files Browse the repository at this point in the history
Some data sources report their geometry type as multi-surface
(a collection of polygons and curve-polygons) and so we should handle
them as well.

(manually backported from 4a554d2)
  • Loading branch information
wonder-sk committed Mar 10, 2019
1 parent bb7ac8f commit 06c9401
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/3d/symbols/qgspolygon3dsymbol_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,21 @@ Qt3DRender::QGeometryRenderer *QgsPolygon3DSymbolEntityNode::renderer( const Qgs
extrusionHeightPerPolygon.append( extrusionHeight );
}
}
else if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( g ) )
{
for ( int i = 0; i < gc->numGeometries(); ++i )
{
const QgsAbstractGeometry *g2 = gc->geometryN( i );
if ( QgsWkbTypes::flatType( g2->wkbType() ) != QgsWkbTypes::Polygon )
continue;
QgsPolygon *polyClone = static_cast< const QgsPolygon *>( g2 )->clone();
Qgs3DUtils::clampAltitudes( polyClone, symbol.altitudeClamping(), symbol.altitudeBinding(), height, map );
polygons.append( polyClone );
fids.append( f.id() );
if ( hasDDExtrusion )
extrusionHeightPerPolygon.append( extrusionHeight );
}
}
else
qDebug() << "not a polygon";
}
Expand Down

0 comments on commit 06c9401

Please sign in to comment.