Skip to content
Permalink
Browse files

Fix 3d renderer does not work with multipoint layers

  • Loading branch information
nyalldawson committed Nov 9, 2017
1 parent 4c78526 commit df7a1d01be63ef18a0b2f8e6258f42fae96dd1b4
Showing with 7 additions and 8 deletions.
  1. +6 −7 src/3d/qgs3dutils.cpp
  2. +1 −1 src/3d/qgs3dutils.h
@@ -172,14 +172,15 @@ QList<QVector3D> Qgs3DUtils::positions( const Qgs3DMapSettings &map, QgsVectorLa
continue;

const QgsAbstractGeometry *g = f.geometry().constGet();
if ( const QgsPoint *pt = qgsgeometry_cast< const QgsPoint *>( g ) )
for ( auto it = g->vertices_begin(); it != g->vertices_end(); ++it )
{
QgsPoint pt = *it;
float geomZ = 0;
if ( pt->is3D() )
if ( pt.is3D() )
{
geomZ = pt->z();
geomZ = pt.z();
}
float terrainZ = map.terrainGenerator()->heightAt( pt->x(), pt->y(), map ) * map.terrainVerticalScale();
float terrainZ = map.terrainGenerator()->heightAt( pt.x(), pt.y(), map ) * map.terrainVerticalScale();
float h;
switch ( altClamp )
{
@@ -193,11 +194,9 @@ QList<QVector3D> Qgs3DUtils::positions( const Qgs3DMapSettings &map, QgsVectorLa
h = terrainZ + geomZ;
break;
}
positions.append( QVector3D( pt->x() - map.originX(), h, -( pt->y() - map.originY() ) ) );
positions.append( QVector3D( pt.x() - map.originX(), h, -( pt.y() - map.originY() ) ) );
//qDebug() << positions.last();
}
else
qDebug() << "not a point";
}

return positions;
@@ -75,7 +75,7 @@ class _3D_EXPORT Qgs3DUtils
static QMatrix4x4 stringToMatrix4x4( const QString &str );

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

0 comments on commit df7a1d0

Please sign in to comment.
You can’t perform that action at this time.