Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add licence and clean comments
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Dec 3, 2020
1 parent 05149fa commit 4659864
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
19 changes: 18 additions & 1 deletion src/3d/symbols/qgspointcloud3dsymbol_p.cpp
@@ -1,3 +1,18 @@
/***************************************************************************
qgspointcloud3dsymbol_p.cpp
------------------------------
Date : December 2020
Copyright : (C) 2020 by Nedjima Belgacem
Email : belgacem dot nedjima at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgspointcloud3dsymbol_p.h"

///@cond PRIVATE
Expand Down Expand Up @@ -93,6 +108,7 @@ void QgsColorRampPointCloud3DGeometry::makeVertexBuffer( const QgsPointCloud3DSy
vertexBufferData.resize( data.positions.size() * mByteStride );
float *rawVertexArray = reinterpret_cast<float *>( vertexBufferData.data() );
int idx = 0;
Q_ASSERT( data.positions.size() == data.parameter.size() );
for ( int i = 0; i < data.positions.size(); ++i )
{
rawVertexArray[idx++] = data.positions.at( i ).x();
Expand Down Expand Up @@ -133,6 +149,7 @@ void QgsRGBPointCloud3DGeometry::makeVertexBuffer( const QgsPointCloud3DSymbolHa
vertexBufferData.resize( data.positions.size() * mByteStride );
float *rawVertexArray = reinterpret_cast<float *>( vertexBufferData.data() );
int idx = 0;
Q_ASSERT( data.positions.size() == data.colors.size() );
for ( int i = 0; i < data.positions.size(); ++i )
{
rawVertexArray[idx++] = data.positions.at( i ).x();
Expand Down Expand Up @@ -160,7 +177,7 @@ void QgsPointCloud3DSymbolHandler::makeEntity( Qt3DCore::QEntity *parent, const
return;

// Geometry
Qt3DRender::QGeometry *geom = makeGeometry( parent, out );//new QgsPointCloud3DGeometry( parent, out, mSymbol.get() );
Qt3DRender::QGeometry *geom = makeGeometry( parent, out );
Qt3DRender::QGeometryRenderer *gr = new Qt3DRender::QGeometryRenderer;
gr->setPrimitiveType( Qt3DRender::QGeometryRenderer::Points );
gr->setVertexCount( out.positions.count() );
Expand Down
21 changes: 15 additions & 6 deletions src/3d/symbols/qgspointcloud3dsymbol_p.h
@@ -1,3 +1,18 @@
/***************************************************************************
qgspointcloud3dsymbol_p.h
------------------------------
Date : December 2020
Copyright : (C) 2020 by Nedjima Belgacem
Email : belgacem dot nedjima at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSPOINTCLOUD3DSYMBOL_P_H
#define QGSPOINTCLOUD3DSYMBOL_P_H

Expand Down Expand Up @@ -43,8 +58,6 @@ class QgsPointCloud3DSymbolHandler // : public QgsFeature3DHandler
float mZMin = std::numeric_limits<float>::max();
float mZMax = std::numeric_limits<float>::lowest();

// private:

//static void addSceneEntities( const Qgs3DMapSettings &map, const QVector<QVector3D> &positions, const QgsPoint3DSymbol *symbol, Qt3DCore::QEntity *parent );
//static void addMeshEntities( const Qgs3DMapSettings &map, const QVector<QVector3D> &positions, const QgsPoint3DSymbol *symbol, Qt3DCore::QEntity *parent, bool are_selected );
//static Qt3DCore::QTransform *transform( QVector3D position, const QgsPoint3DSymbol *symbol );
Expand Down Expand Up @@ -72,7 +85,6 @@ class QgsSingleColorPointCloud3DSymbolHandler : public QgsPointCloud3DSymbolHand
void processNode( QgsPointCloudIndex *pc, const IndexedPointCloudNode &n, const Qgs3DRenderContext &context ) override;
void finalize( Qt3DCore::QEntity *parent, const Qgs3DRenderContext &context ) override;
private:
// void makeEntity( Qt3DCore::QEntity *parent, const Qgs3DRenderContext &context, PointData &out, bool selected );
Qt3DRender::QGeometry *makeGeometry( Qt3DCore::QNode *parent, const QgsPointCloud3DSymbolHandler::PointData &data ) override;
};

Expand All @@ -85,7 +97,6 @@ class QgsColorRampPointCloud3DSymbolHandler : public QgsPointCloud3DSymbolHandle
void processNode( QgsPointCloudIndex *pc, const IndexedPointCloudNode &n, const Qgs3DRenderContext &context ) override;
void finalize( Qt3DCore::QEntity *parent, const Qgs3DRenderContext &context ) override;
private:
// void makeEntity( Qt3DCore::QEntity *parent, const Qgs3DRenderContext &context, PointData &out, bool selected );
Qt3DRender::QGeometry *makeGeometry( Qt3DCore::QNode *parent, const QgsPointCloud3DSymbolHandler::PointData &data ) override;
};

Expand All @@ -98,14 +109,12 @@ class QgsRGBPointCloud3DSymbolHandler : public QgsPointCloud3DSymbolHandler
void processNode( QgsPointCloudIndex *pc, const IndexedPointCloudNode &n, const Qgs3DRenderContext &context ) override;
void finalize( Qt3DCore::QEntity *parent, const Qgs3DRenderContext &context ) override;
private:
// void makeEntity( Qt3DCore::QEntity *parent, const Qgs3DRenderContext &context, PointData &out, bool selected );
Qt3DRender::QGeometry *makeGeometry( Qt3DCore::QNode *parent, const QgsPointCloud3DSymbolHandler::PointData &data ) override;
};

class QgsPointCloud3DGeometry: public Qt3DRender::QGeometry
{
public:
// QgsPointCloud3DGeometry( Qt3DCore::QNode *parent, const QgsPointCloud3DSymbolHandler::PointData &data, QgsPointCloud3DSymbol *symbol );
QgsPointCloud3DGeometry( Qt3DCore::QNode *parent, QgsPointCloud3DSymbol *symbol );

protected:
Expand Down

0 comments on commit 4659864

Please sign in to comment.