Skip to content
Permalink
Browse files

Moved 3D symbol class implementations into separate files

  • Loading branch information
wonder-sk committed Aug 15, 2017
1 parent 12a0063 commit 870d96e26884b47e17d546ffce7798fc9d441784
@@ -2,7 +2,6 @@
# sources

SET(QGIS_3D_SRCS
abstract3dsymbol.cpp
cameracontroller.cpp
lineentity.cpp
map3d.cpp
@@ -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
@@ -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
@@ -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
@@ -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

This file was deleted.

This file was deleted.

@@ -1,6 +1,6 @@
#include "lineentity.h"

#include "abstract3dsymbol.h"
#include "qgsline3dsymbol.h"
#include "polygongeometry.h"
#include "map3d.h"
#include "terraingenerator.h"
@@ -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;

@@ -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 );
@@ -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 );
@@ -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 );

@@ -7,7 +7,7 @@

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

class QgsVectorLayer;
class QgsFeatureRequest;
@@ -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;
};

0 comments on commit 870d96e

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