Skip to content

Commit

Permalink
Moved 3D symbol class implementations into separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Sep 15, 2017
1 parent 12a0063 commit 870d96e
Show file tree
Hide file tree
Showing 28 changed files with 514 additions and 440 deletions.
13 changes: 11 additions & 2 deletions src/3d/CMakeLists.txt
Expand Up @@ -2,7 +2,6 @@
# sources

SET(QGIS_3D_SRCS
abstract3dsymbol.cpp
cameracontroller.cpp
lineentity.cpp
map3d.cpp
Expand All @@ -22,6 +21,11 @@ SET(QGIS_3D_SRCS
chunks/chunkloader.cpp
chunks/chunknode.cpp

symbols/qgsabstract3dsymbol.cpp
symbols/qgsline3dsymbol.cpp
symbols/qgspoint3dsymbol.cpp
symbols/qgspolygon3dsymbol.cpp

terrain/demterraingenerator.cpp
terrain/demterraintilegeometry.cpp
terrain/flatterraingenerator.cpp
Expand Down Expand Up @@ -64,7 +68,6 @@ QT5_ADD_RESOURCES(QGIS_3D_RCC_SRCS shaders.qrc)

SET(QGIS_3D_HDRS
aabb.h
abstract3dsymbol.h
cameracontroller.h
lineentity.h
map3d.h
Expand All @@ -84,6 +87,11 @@ SET(QGIS_3D_HDRS
chunks/chunkloader.h
chunks/chunknode.h

symbols/qgsabstract3dsymbol.h
symbols/qgsline3dsymbol.h
symbols/qgspoint3dsymbol.h
symbols/qgspolygon3dsymbol.h

terrain/demterraingenerator.h
terrain/demterraintilegeometry.h
terrain/flatterraingenerator.h
Expand All @@ -99,6 +107,7 @@ SET(QGIS_3D_HDRS
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/chunks
${CMAKE_CURRENT_SOURCE_DIR}/symbols
${CMAKE_CURRENT_SOURCE_DIR}/terrain
${CMAKE_SOURCE_DIR}/src/core/
${CMAKE_SOURCE_DIR}/src/core/geometry
Expand Down
151 changes: 0 additions & 151 deletions src/3d/abstract3dsymbol.cpp

This file was deleted.

86 changes: 0 additions & 86 deletions src/3d/abstract3dsymbol.h

This file was deleted.

14 changes: 7 additions & 7 deletions src/3d/lineentity.cpp
@@ -1,6 +1,6 @@
#include "lineentity.h"

#include "abstract3dsymbol.h"
#include "qgsline3dsymbol.h"
#include "polygongeometry.h"
#include "map3d.h"
#include "terraingenerator.h"
Expand All @@ -11,14 +11,14 @@
#include "qgsgeos.h"


LineEntity::LineEntity( const Map3D &map, QgsVectorLayer *layer, const Line3DSymbol &symbol, Qt3DCore::QNode *parent )
LineEntity::LineEntity( const Map3D &map, QgsVectorLayer *layer, const QgsLine3DSymbol &symbol, Qt3DCore::QNode *parent )
: Qt3DCore::QEntity( parent )
{
addEntityForSelectedLines( map, layer, symbol );
addEntityForNotSelectedLines( map, layer, symbol );
}

Qt3DExtras::QPhongMaterial *LineEntity::material( const Line3DSymbol &symbol ) const
Qt3DExtras::QPhongMaterial *LineEntity::material( const QgsLine3DSymbol &symbol ) const
{
Qt3DExtras::QPhongMaterial *material = new Qt3DExtras::QPhongMaterial;

Expand All @@ -30,7 +30,7 @@ Qt3DExtras::QPhongMaterial *LineEntity::material( const Line3DSymbol &symbol ) c
return material;
}

void LineEntity::addEntityForSelectedLines( const Map3D &map, QgsVectorLayer *layer, const Line3DSymbol &symbol )
void LineEntity::addEntityForSelectedLines( const Map3D &map, QgsVectorLayer *layer, const QgsLine3DSymbol &symbol )
{
// build the default material
Qt3DExtras::QPhongMaterial *mat = material( symbol );
Expand All @@ -50,7 +50,7 @@ void LineEntity::addEntityForSelectedLines( const Map3D &map, QgsVectorLayer *la
entity->setParent( this );
}

void LineEntity::addEntityForNotSelectedLines( const Map3D &map, QgsVectorLayer *layer, const Line3DSymbol &symbol )
void LineEntity::addEntityForNotSelectedLines( const Map3D &map, QgsVectorLayer *layer, const QgsLine3DSymbol &symbol )
{
// build the default material
Qt3DExtras::QPhongMaterial *mat = material( symbol );
Expand All @@ -69,13 +69,13 @@ void LineEntity::addEntityForNotSelectedLines( const Map3D &map, QgsVectorLayer
entity->setParent( this );
}

LineEntityNode::LineEntityNode( const Map3D &map, QgsVectorLayer *layer, const Line3DSymbol &symbol, const QgsFeatureRequest &req, Qt3DCore::QNode *parent )
LineEntityNode::LineEntityNode( const Map3D &map, QgsVectorLayer *layer, const QgsLine3DSymbol &symbol, const QgsFeatureRequest &req, Qt3DCore::QNode *parent )
: Qt3DCore::QEntity( parent )
{
addComponent( renderer( map, symbol, layer, req ) );
}

Qt3DRender::QGeometryRenderer *LineEntityNode::renderer( const Map3D &map, const Line3DSymbol &symbol, const QgsVectorLayer *layer, const QgsFeatureRequest &request )
Qt3DRender::QGeometryRenderer *LineEntityNode::renderer( const Map3D &map, const QgsLine3DSymbol &symbol, const QgsVectorLayer *layer, const QgsFeatureRequest &request )
{
QgsPointXY origin( map.originX, map.originY );

Expand Down
14 changes: 7 additions & 7 deletions src/3d/lineentity.h
Expand Up @@ -7,7 +7,7 @@

class Map3D;
class PolygonGeometry;
class Line3DSymbol;
class QgsLine3DSymbol;

class QgsVectorLayer;
class QgsFeatureRequest;
Expand All @@ -17,22 +17,22 @@ class QgsFeatureRequest;
class LineEntity : public Qt3DCore::QEntity
{
public:
LineEntity( const Map3D &map, QgsVectorLayer *layer, const Line3DSymbol &symbol, Qt3DCore::QNode *parent = nullptr );
LineEntity( const Map3D &map, QgsVectorLayer *layer, const QgsLine3DSymbol &symbol, Qt3DCore::QNode *parent = nullptr );

private:
void addEntityForSelectedLines( const Map3D &map, QgsVectorLayer *layer, const Line3DSymbol &symbol );
void addEntityForNotSelectedLines( const Map3D &map, QgsVectorLayer *layer, const Line3DSymbol &symbol );
void addEntityForSelectedLines( const Map3D &map, QgsVectorLayer *layer, const QgsLine3DSymbol &symbol );
void addEntityForNotSelectedLines( const Map3D &map, QgsVectorLayer *layer, const QgsLine3DSymbol &symbol );

Qt3DExtras::QPhongMaterial *material( const Line3DSymbol &symbol ) const;
Qt3DExtras::QPhongMaterial *material( const QgsLine3DSymbol &symbol ) const;
};

class LineEntityNode : public Qt3DCore::QEntity
{
public:
LineEntityNode( const Map3D &map, QgsVectorLayer *layer, const Line3DSymbol &symbol, const QgsFeatureRequest &req, Qt3DCore::QNode *parent = nullptr );
LineEntityNode( const Map3D &map, QgsVectorLayer *layer, const QgsLine3DSymbol &symbol, const QgsFeatureRequest &req, Qt3DCore::QNode *parent = nullptr );

private:
Qt3DRender::QGeometryRenderer *renderer( const Map3D &map, const Line3DSymbol &symbol, const QgsVectorLayer *layer, const QgsFeatureRequest &req );
Qt3DRender::QGeometryRenderer *renderer( const Map3D &map, const QgsLine3DSymbol &symbol, const QgsVectorLayer *layer, const QgsFeatureRequest &req );

PolygonGeometry *mGeometry;
};
Expand Down

0 comments on commit 870d96e

Please sign in to comment.