@@ -54,6 +54,7 @@ class QgsPolygon3DSymbolHandler : public QgsFeature3DHandler
54
54
QList<float > extrusionHeightPerPolygon; // will stay empty if not needed per polygon
55
55
};
56
56
57
+ void processPolygon ( QgsPolygon *polyClone, QgsFeatureId fid, float height, bool hasDDExtrusion, float extrusionHeight, const Qgs3DRenderContext &context, PolygonData &out );
57
58
void makeEntity ( Qt3DCore::QEntity *parent, const Qgs3DRenderContext &context, PolygonData &out, bool selected );
58
59
Qt3DExtras::QPhongMaterial *material ( const QgsPolygon3DSymbol &symbol ) const ;
59
60
@@ -75,6 +76,15 @@ bool QgsPolygon3DSymbolHandler::prepare( const Qgs3DRenderContext &context, QSet
75
76
return true ;
76
77
}
77
78
79
+ void QgsPolygon3DSymbolHandler::processPolygon ( QgsPolygon *polyClone, QgsFeatureId fid, float height, bool hasDDExtrusion, float extrusionHeight, const Qgs3DRenderContext &context, PolygonData &out )
80
+ {
81
+ Qgs3DUtils::clampAltitudes ( polyClone, mSymbol .altitudeClamping (), mSymbol .altitudeBinding (), height, context.map () );
82
+ out.polygons .append ( polyClone );
83
+ out.fids .append ( fid );
84
+ if ( hasDDExtrusion )
85
+ out.extrusionHeightPerPolygon .append ( extrusionHeight );
86
+ }
87
+
78
88
void QgsPolygon3DSymbolHandler::processFeature ( QgsFeature &f, const Qgs3DRenderContext &context )
79
89
{
80
90
if ( f.geometry ().isNull () )
@@ -104,11 +114,7 @@ void QgsPolygon3DSymbolHandler::processFeature( QgsFeature &f, const Qgs3DRender
104
114
if ( const QgsPolygon *poly = qgsgeometry_cast< const QgsPolygon *>( g ) )
105
115
{
106
116
QgsPolygon *polyClone = poly->clone ();
107
- Qgs3DUtils::clampAltitudes ( polyClone, mSymbol .altitudeClamping (), mSymbol .altitudeBinding (), height, context.map () );
108
- out.polygons .append ( polyClone );
109
- out.fids .append ( f.id () );
110
- if ( hasDDExtrusion )
111
- out.extrusionHeightPerPolygon .append ( extrusionHeight );
117
+ processPolygon ( polyClone, f.id (), height, hasDDExtrusion, extrusionHeight, context, out );
112
118
}
113
119
else if ( const QgsMultiPolygon *mpoly = qgsgeometry_cast< const QgsMultiPolygon *>( g ) )
114
120
{
@@ -117,11 +123,19 @@ void QgsPolygon3DSymbolHandler::processFeature( QgsFeature &f, const Qgs3DRender
117
123
const QgsAbstractGeometry *g2 = mpoly->geometryN ( i );
118
124
Q_ASSERT ( QgsWkbTypes::flatType ( g2->wkbType () ) == QgsWkbTypes::Polygon );
119
125
QgsPolygon *polyClone = static_cast < const QgsPolygon *>( g2 )->clone ();
120
- Qgs3DUtils::clampAltitudes ( polyClone, mSymbol .altitudeClamping (), mSymbol .altitudeBinding (), height, context.map () );
121
- out.polygons .append ( polyClone );
122
- out.fids .append ( f.id () );
123
- if ( hasDDExtrusion )
124
- out.extrusionHeightPerPolygon .append ( extrusionHeight );
126
+ processPolygon ( polyClone, f.id (), height, hasDDExtrusion, extrusionHeight, context, out );
127
+ }
128
+ }
129
+ else if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( g ) )
130
+ {
131
+ for ( int i = 0 ; i < gc->numGeometries (); ++i )
132
+ {
133
+ const QgsAbstractGeometry *g2 = gc->geometryN ( i );
134
+ if ( QgsWkbTypes::flatType ( g2->wkbType () ) == QgsWkbTypes::Polygon )
135
+ {
136
+ QgsPolygon *polyClone = static_cast < const QgsPolygon *>( g2 )->clone ();
137
+ processPolygon ( polyClone, f.id (), height, hasDDExtrusion, extrusionHeight, context, out );
138
+ }
125
139
}
126
140
}
127
141
else
0 commit comments