Skip to content

Commit df7a1d0

Browse files
committedNov 9, 2017
Fix 3d renderer does not work with multipoint layers
1 parent 4c78526 commit df7a1d0

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed
 

‎src/3d/qgs3dutils.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,15 @@ QList<QVector3D> Qgs3DUtils::positions( const Qgs3DMapSettings &map, QgsVectorLa
172172
continue;
173173

174174
const QgsAbstractGeometry *g = f.geometry().constGet();
175-
if ( const QgsPoint *pt = qgsgeometry_cast< const QgsPoint *>( g ) )
175+
for ( auto it = g->vertices_begin(); it != g->vertices_end(); ++it )
176176
{
177+
QgsPoint pt = *it;
177178
float geomZ = 0;
178-
if ( pt->is3D() )
179+
if ( pt.is3D() )
179180
{
180-
geomZ = pt->z();
181+
geomZ = pt.z();
181182
}
182-
float terrainZ = map.terrainGenerator()->heightAt( pt->x(), pt->y(), map ) * map.terrainVerticalScale();
183+
float terrainZ = map.terrainGenerator()->heightAt( pt.x(), pt.y(), map ) * map.terrainVerticalScale();
183184
float h;
184185
switch ( altClamp )
185186
{
@@ -193,11 +194,9 @@ QList<QVector3D> Qgs3DUtils::positions( const Qgs3DMapSettings &map, QgsVectorLa
193194
h = terrainZ + geomZ;
194195
break;
195196
}
196-
positions.append( QVector3D( pt->x() - map.originX(), h, -( pt->y() - map.originY() ) ) );
197+
positions.append( QVector3D( pt.x() - map.originX(), h, -( pt.y() - map.originY() ) ) );
197198
//qDebug() << positions.last();
198199
}
199-
else
200-
qDebug() << "not a point";
201200
}
202201

203202
return positions;

‎src/3d/qgs3dutils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class _3D_EXPORT Qgs3DUtils
7575
static QMatrix4x4 stringToMatrix4x4( const QString &str );
7676

7777
/**
78-
* Calculates (x,y,z) position of point in the Point vector layers
78+
* Calculates (x,y,z) positions of a (multi)point in the Point vector layers
7979
*/
8080
static QList<QVector3D> positions( const Qgs3DMapSettings &map, QgsVectorLayer *layer, const QgsFeatureRequest &req, AltitudeClamping altClamp );
8181

0 commit comments

Comments
 (0)
Please sign in to comment.