Skip to content
Permalink
Browse files

Qgs-ification of terrain classes

  • Loading branch information
wonder-sk committed Sep 25, 2017
1 parent 7c01d2f commit 53c9852786e738e9db92d4df67bb83086354d00f
Showing with 391 additions and 307 deletions.
  1. +24 −22 src/3d/CMakeLists.txt
  2. +3 −3 src/3d/qgs3dmapscene.cpp
  3. +3 −3 src/3d/qgs3dmapscene.h
  4. +6 −6 src/3d/qgs3dmapsettings.cpp
  5. +4 −4 src/3d/qgs3dmapsettings.h
  6. +1 −1 src/3d/qgs3dutils.cpp
  7. +1 −1 src/3d/symbols/qgsline3dsymbol_p.cpp
  8. +0 −1 src/3d/symbols/qgspoint3dsymbol_p.cpp
  9. +0 −1 src/3d/symbols/qgspolygon3dsymbol_p.cpp
  10. +32 −31 src/3d/terrain/{demterraingenerator.cpp → qgsdemterraingenerator.cpp}
  11. +16 −16 src/3d/terrain/{demterraingenerator.h → qgsdemterraingenerator.h}
  12. +4 −1 src/3d/terrain/{demterraintilegeometry.cpp → qgsdemterraintilegeometry_p.cpp}
  13. +15 −3 src/3d/terrain/{demterraintilegeometry.h → qgsdemterraintilegeometry_p.h}
  14. +22 −21 src/3d/terrain/{flatterraingenerator.cpp → qgsflatterraingenerator.cpp}
  15. +8 −8 src/3d/terrain/{flatterraingenerator.h → qgsflatterraingenerator.h}
  16. +32 −33 src/3d/terrain/{terrain.cpp → qgsterrainentity_p.cpp}
  17. +23 −15 src/3d/terrain/{terrain.h → qgsterrainentity_p.h}
  18. +9 −9 src/3d/terrain/{terraingenerator.cpp → qgsterraingenerator.cpp}
  19. +9 −42 src/3d/terrain/{terraingenerator.h → qgsterraingenerator.h}
  20. +13 −9 src/3d/terrain/{maptexturegenerator.cpp → qgsterraintexturegenerator_p.cpp}
  21. +17 −5 src/3d/terrain/{maptexturegenerator.h → qgsterraintexturegenerator_p.h}
  22. +14 −13 src/3d/terrain/{maptextureimage.cpp → qgsterraintextureimage_p.cpp}
  23. +20 −7 src/3d/terrain/{maptextureimage.h → qgsterraintextureimage_p.h}
  24. +47 −0 src/3d/terrain/qgsterraintileentity_p.h
  25. +16 −12 src/3d/terrain/{terrainchunkloader.cpp → qgsterraintileloader_p.cpp}
  26. +22 −10 src/3d/terrain/{terrainchunkloader.h → qgsterraintileloader_p.h}
  27. +3 −3 src/3d/terrain/quantizedmeshterraingenerator.h
  28. +12 −12 src/3d/testapp/main.cpp
  29. +1 −1 src/3d/testapp/window3d.cpp
  30. +12 −12 src/app/3d/qgs3dmapconfigwidget.cpp
  31. +2 −2 src/app/qgisapp.cpp
@@ -27,16 +27,16 @@ SET(QGIS_3D_SRCS
symbols/qgspolygon3dsymbol.cpp
symbols/qgspolygon3dsymbol_p.cpp

terrain/demterraingenerator.cpp
terrain/demterraintilegeometry.cpp
terrain/flatterraingenerator.cpp
terrain/maptexturegenerator.cpp
terrain/maptextureimage.cpp
terrain/qgsdemterraingenerator.cpp
terrain/qgsdemterraintilegeometry_p.cpp
terrain/qgsflatterraingenerator.cpp
terrain/qgsterrainentity_p.cpp
terrain/qgsterraingenerator.cpp
terrain/qgsterraintexturegenerator_p.cpp
terrain/qgsterraintextureimage_p.cpp
terrain/qgsterraintileloader_p.cpp
#terrain/quantizedmeshgeometry.cpp
#terrain/quantizedmeshterraingenerator.cpp
terrain/terrain.cpp
terrain/terrainchunkloader.cpp
terrain/terraingenerator.cpp

poly2tri/common/shapes.cc
poly2tri/sweep/advancing_front.cc
@@ -54,12 +54,13 @@ SET(QGIS_3D_MOC_HDRS
chunks/chunkedentity.h
chunks/chunkloader.h

terrain/demterraingenerator.h
terrain/demterraintilegeometry.h
terrain/maptexturegenerator.h
terrain/maptextureimage.h
terrain/terrain.h
terrain/terraingenerator.h
terrain/qgsdemterraingenerator.h
terrain/qgsdemterraintilegeometry_p.h
terrain/qgsterrainentity_p.h
terrain/qgsterraingenerator.h
terrain/qgsterraintexturegenerator_p.h
terrain/qgsterraintextureimage_p.h
terrain/qgsterraintileentity_p.h
)

QT5_WRAP_CPP(QGIS_3D_MOC_SRCS ${QGIS_3D_MOC_HDRS})
@@ -95,16 +96,17 @@ SET(QGIS_3D_HDRS
symbols/qgspolygon3dsymbol.h
symbols/qgspolygon3dsymbol_p.h

terrain/demterraingenerator.h
terrain/demterraintilegeometry.h
terrain/flatterraingenerator.h
terrain/maptexturegenerator.h
terrain/maptextureimage.h
terrain/qgsdemterraingenerator.h
terrain/qgsdemterraintilegeometry_p.h
terrain/qgsflatterraingenerator.h
terrain/qgsterrainentity_p.h
terrain/qgsterraingenerator.h
terrain/qgsterraintexturegenerator_p.h
terrain/qgsterraintextureimage_p.h
terrain/qgsterraintileentity_p.h
terrain/qgsterraintileloader_p.h
#terrain/quantizedmeshgeometry.h
#terrain/quantizedmeshterraingenerator.h
terrain/terrain.h
terrain/terrainchunkloader.h
terrain/terraingenerator.h
)

INCLUDE_DIRECTORIES(
@@ -15,8 +15,8 @@
#include "chunknode.h"
#include "qgsvectorlayer.h"
#include "qgs3dmapsettings.h"
#include "terrain.h"
#include "terraingenerator.h"
#include "qgsterrainentity_p.h"
#include "qgsterraingenerator.h"
//#include "testchunkloader.h"
#include "chunkedentity.h"
#include "qgs3dutils.h"
@@ -279,7 +279,7 @@ void Qgs3DMapScene::createTerrainDeferred()
double tile0width = mMap.terrainGenerator()->extent().width();
int maxZoomLevel = Qgs3DUtils::maxZoomLevel( tile0width, mMap.mapTileResolution(), mMap.maxTerrainGroundError() );

mTerrain = new Terrain( maxZoomLevel, mMap );
mTerrain = new QgsTerrainEntity( maxZoomLevel, mMap );
//mTerrain->setEnabled(false);
mTerrain->setParent( this );

@@ -24,7 +24,7 @@ namespace Qt3DExtras
class QgsMapLayer;
class QgsCameraController;
class Qgs3DMapSettings;
class Terrain;
class QgsTerrainEntity;
class ChunkedEntity;

/** \ingroup 3d
@@ -41,7 +41,7 @@ class _3D_EXPORT Qgs3DMapScene : public Qt3DCore::QEntity
//! Returns camera controller
QgsCameraController *cameraController() { return mCameraController; }
//! Returns terrain entity
Terrain *terrain() { return mTerrain; }
QgsTerrainEntity *terrain() { return mTerrain; }

//! Resets camera view to show the whole scene (top view)
void viewZoomFull();
@@ -64,7 +64,7 @@ class _3D_EXPORT Qgs3DMapScene : public Qt3DCore::QEntity
//! Provides a way to have a synchronous function executed each frame
Qt3DLogic::QFrameAction *mFrameAction;
QgsCameraController *mCameraController;
Terrain *mTerrain;
QgsTerrainEntity *mTerrain;
//! Forward renderer provided by 3D window
Qt3DExtras::QForwardRenderer *mForwardRenderer;
QList<ChunkedEntity *> chunkEntities;
@@ -1,7 +1,7 @@
#include "qgs3dmapsettings.h"

#include "flatterraingenerator.h"
#include "demterraingenerator.h"
#include "qgsflatterraingenerator.h"
#include "qgsdemterraingenerator.h"
//#include "quantizedmeshterraingenerator.h"
#include "qgsvectorlayer3drenderer.h"

@@ -85,7 +85,7 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte
QString terrainGenType = elemTerrainGenerator.attribute( "type" );
if ( terrainGenType == "dem" )
{
mTerrainGenerator.reset( new DemTerrainGenerator );
mTerrainGenerator.reset( new QgsDemTerrainGenerator );
}
else if ( terrainGenType == "quantized-mesh" )
{
@@ -96,7 +96,7 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte
}
else // "flat"
{
FlatTerrainGenerator *flatGen = new FlatTerrainGenerator;
QgsFlatTerrainGenerator *flatGen = new QgsFlatTerrainGenerator;
flatGen->setCrs( crs );
mTerrainGenerator.reset( flatGen );
}
@@ -162,7 +162,7 @@ QDomElement Qgs3DMapSettings::writeXml( QDomDocument &doc, const QgsReadWriteCon
}
elemTerrain.appendChild( elemMapLayers );
QDomElement elemTerrainGenerator = doc.createElement( "generator" );
elemTerrainGenerator.setAttribute( "type", TerrainGenerator::typeToString( mTerrainGenerator->type() ) );
elemTerrainGenerator.setAttribute( "type", QgsTerrainGenerator::typeToString( mTerrainGenerator->type() ) );
mTerrainGenerator->writeXml( elemTerrainGenerator );
elemTerrain.appendChild( elemTerrainGenerator );
elem.appendChild( elemTerrain );
@@ -321,7 +321,7 @@ float Qgs3DMapSettings::maxTerrainGroundError() const
return mMaxTerrainGroundError;
}

void Qgs3DMapSettings::setTerrainGenerator( TerrainGenerator *gen )
void Qgs3DMapSettings::setTerrainGenerator( QgsTerrainGenerator *gen )
{
mTerrainGenerator.reset( gen );
emit terrainGeneratorChanged();
@@ -14,7 +14,7 @@ class QgsMapLayer;
class QgsRasterLayer;

class QgsAbstract3DRenderer;
class TerrainGenerator;
class QgsTerrainGenerator;


class QgsReadWriteContext;
@@ -99,9 +99,9 @@ class _3D_EXPORT Qgs3DMapSettings : public QObject

//! Sets terrain generator. It takes care of producing terrain tiles from the input data.
//! Takes ownership of the generator
void setTerrainGenerator( TerrainGenerator *gen );
void setTerrainGenerator( QgsTerrainGenerator *gen );
//! Returns terrain generator. It takes care of producing terrain tiles from the input data.
TerrainGenerator *terrainGenerator() const { return mTerrainGenerator.get(); }
QgsTerrainGenerator *terrainGenerator() const { return mTerrainGenerator.get(); }

//
// 3D renderers
@@ -148,7 +148,7 @@ class _3D_EXPORT Qgs3DMapSettings : public QObject
QColor mBackgroundColor; //!< Background color of the scene
QColor mSelectionColor;
double mTerrainVerticalScale; //!< Multiplier of terrain heights to make the terrain shape more pronounced
std::unique_ptr<TerrainGenerator> mTerrainGenerator; //!< Implementation of the terrain generation
std::unique_ptr<QgsTerrainGenerator> mTerrainGenerator; //!< Implementation of the terrain generation
int mMapTileResolution; //!< Size of map textures of tiles in pixels (width/height)
float mMaxTerrainScreenError; //!< Maximum allowed terrain error in pixels (determines when tiles are switched to more detailed ones)
float mMaxTerrainGroundError; //!< Maximum allowed horizontal map error in map units (determines how many zoom levels will be used)
@@ -8,7 +8,7 @@
#include "qgsabstractgeometry.h"
#include "qgsvectorlayer.h"

#include "terraingenerator.h"
#include "qgsterraingenerator.h"



@@ -3,7 +3,7 @@
#include "qgsline3dsymbol.h"
#include "qgstessellatedpolygongeometry.h"
#include "qgs3dmapsettings.h"
#include "terraingenerator.h"
//#include "qgsterraingenerator.h"
#include "qgs3dutils.h"

#include "qgsvectorlayer.h"
@@ -27,7 +27,6 @@

#include "qgspoint3dsymbol.h"
#include "qgs3dmapsettings.h"
#include "terraingenerator.h"

#include "qgsvectorlayer.h"
#include "qgspoint.h"
@@ -3,7 +3,6 @@
#include "qgspolygon3dsymbol.h"
#include "qgstessellatedpolygongeometry.h"
#include "qgs3dmapsettings.h"
#include "terraingenerator.h"
#include "qgs3dutils.h"

#include <Qt3DCore/QTransform>

0 comments on commit 53c9852

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