Skip to content

Commit

Permalink
Merge branch 'master' into extendMapTool
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Nov 15, 2018
2 parents 574a57f + 767e9a5 commit c292e69
Show file tree
Hide file tree
Showing 92 changed files with 2,028 additions and 174 deletions.
28 changes: 25 additions & 3 deletions CMakeLists.txt
Expand Up @@ -16,6 +16,7 @@ SET(CPACK_PACKAGE_VERSION_PATCH "0")
SET(COMPLETE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
SET(RELEASE_NAME "Master")
PROJECT(qgis VERSION ${COMPLETE_VERSION})

IF (APPLE)
SET(QGIS_APP_NAME "QGIS")
ELSE (APPLE)
Expand Down Expand Up @@ -68,6 +69,20 @@ IF(NOT MSVC)
endif(USE_CCACHE)
endif(NOT MSVC)

IF (IOS)
SET (DEFAULT_FORCE_STATIC_LIBS TRUE)
ELSE (IOS)
SET (DEFAULT_FORCE_STATIC_LIBS FALSE)
ENDIF (IOS)
SET (FORCE_STATIC_LIBS ${DEFAULT_FORCE_STATIC_LIBS} CACHE BOOL "Determines whether libraries should be static only")
MARK_AS_ADVANCED(FORCE_STATIC_LIBS)

IF(FORCE_STATIC_LIBS)
SET(LIBRARY_TYPE STATIC)
ELSE (FORCE_STATIC_LIBS)
SET(LIBRARY_TYPE SHARED)
ENDIF (FORCE_STATIC_LIBS)

# in generated makefiles use relative paths so the project dir is moveable
# Note commented out since it cause problems but it would be nice to resolve these and enable
#
Expand Down Expand Up @@ -316,6 +331,15 @@ IF(WITH_CORE)
#############################################################
# search for Qt5
SET(QT_MIN_VERSION 5.9.0)

# Use Qt5SerialPort optionally for GPS
SET (WITH_QT5SERIALPORT TRUE CACHE BOOL "Determines whether Qt5SerialPort should be tried for GPS positioning")
IF (WITH_QT5SERIALPORT)
FIND_PACKAGE(Qt5SerialPort REQUIRED)
# following variable is used in qgsconfig.h
SET (HAVE_QT5SERIALPORT TRUE)
ENDIF(WITH_QT5SERIALPORT)

FIND_PACKAGE(Qt5Core QUIET)
FIND_PACKAGE(Qt5Gui REQUIRED)
FIND_PACKAGE(Qt5Widgets REQUIRED)
Expand All @@ -324,7 +348,6 @@ IF(WITH_CORE)
FIND_PACKAGE(Qt5Svg REQUIRED)
FIND_PACKAGE(Qt5Concurrent REQUIRED)
FIND_PACKAGE(Qt5PrintSupport REQUIRED)
FIND_PACKAGE(Qt5SerialPort REQUIRED)
FIND_PACKAGE(Qt5Positioning)
IF (WITH_QTWEBKIT)
FIND_PACKAGE(Qt5WebKit REQUIRED)
Expand Down Expand Up @@ -352,7 +375,7 @@ IF(WITH_CORE)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Android")
FIND_PACKAGE(Qt5AndroidExtras)
ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Android")
FIND_PACKAGE(QtQmlTools REQUIRED)
FIND_PACKAGE(QtQmlTools)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Android")

# following variable is used in qgsconfig.h
Expand Down Expand Up @@ -412,7 +435,6 @@ SET(QML_IMPORT_PATH "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" CACHE PATH "QML director
SET (ENABLE_TESTS TRUE CACHE BOOL "Build unit tests?")
IF (ENABLE_TESTS)
SET( QT_USE_QTTEST TRUE )
ADD_DEFINITIONS(-DENABLE_TESTS)
ENABLE_TESTING()
# Adds some testing specific build targets e.g. make Experimental
INCLUDE(Dart)
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindSpatiaLite.cmake
Expand Up @@ -24,7 +24,7 @@ include(CheckLibraryExists)

# try to use sqlite framework on mac
# want clean framework path, not unix compatibility path
IF (APPLE)
IF (APPLE AND NOT IOS)
IF (CMAKE_FIND_FRAMEWORK MATCHES "FIRST"
OR CMAKE_FRAMEWORK_PATH MATCHES "ONLY"
OR NOT CMAKE_FIND_FRAMEWORK)
Expand All @@ -39,7 +39,7 @@ IF (APPLE)
ENDIF (SPATIALITE_INCLUDE_DIR)
SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE)
ENDIF ()
ENDIF (APPLE)
ENDIF (APPLE AND NOT IOS)

FIND_PATH(SPATIALITE_INCLUDE_DIR spatialite.h
/usr/include
Expand Down
2 changes: 2 additions & 0 deletions cmake_templates/qgsconfig.h.in
Expand Up @@ -69,5 +69,7 @@

#cmakedefine HAVE_QUICK

#cmakedefine HAVE_QT5SERIALPORT

#endif

5 changes: 5 additions & 0 deletions images/images.qrc
Expand Up @@ -155,6 +155,7 @@
<file>themes/default/grass_mapset.svg</file>
<file>themes/default/grass_mapset_open.svg</file>
<file>themes/default/grass_mapset_search.svg</file>
<file>themes/default/grid.svg</file>
<file>themes/default/histogram.svg</file>
<file>themes/default/heatmap.svg</file>
<file>themes/default/join_bevel.svg</file>
Expand Down Expand Up @@ -584,6 +585,7 @@
<file>themes/default/symbologyRemove.svg</file>
<file>themes/default/sync_views.svg</file>
<file>themes/default/text.svg</file>
<file>themes/default/title_label.svg</file>
<file>themes/default/tracking.svg</file>
<file>themes/default/transformed.svg</file>
<file>themes/default/transp-background_8x8.png</file>
Expand Down Expand Up @@ -730,6 +732,9 @@
<file>themes/default/mIconInteriorRings.svg</file>
<file>themes/default/mIconFieldBinary.svg</file>
<file>themes/default/mActionTrimExtendFeature.svg</file>
<file>themes/default/mActionTerminal.svg</file>
<file>themes/default/mIconFolder24.svg</file>
<file>themes/default/mActionNewFolder.svg</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
Expand Down
1 change: 1 addition & 0 deletions images/themes/default/grid.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/themes/default/mActionNewFolder.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/themes/default/mActionTerminal.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/themes/default/mIconFolder24.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/themes/default/north_arrow.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/themes/default/title_label.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions python/core/auto_generated/layout/qgslayoutexporter.sip.in
Expand Up @@ -8,6 +8,7 @@




class QgsLayoutExporter
{
%Docstring
Expand Down Expand Up @@ -363,6 +364,7 @@ Subclasses can override this method to customize page file naming.




/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
3 changes: 2 additions & 1 deletion python/core/auto_generated/qgsmaprenderertask.sip.in
Expand Up @@ -27,7 +27,8 @@ task. This can be used to draw maps without blocking the QGIS interface.
enum ErrorType
{
ImageAllocationFail,
ImageSaveFail
ImageSaveFail,
ImageUnsupportedFormat
};

QgsMapRendererTask( const QgsMapSettings &ms,
Expand Down
10 changes: 6 additions & 4 deletions python/core/auto_generated/qgsrunprocess.sip.in
Expand Up @@ -17,6 +17,9 @@ class QgsRunProcess: QObject /NoDefaultCtors/
A class that executes an external program/script.
It can optionally capture the standard output and error from the
process and displays them in a dialog box.

On some platforms (e.g. iOS) , the process execution is skipped
https://lists.qt-project.org/pipermail/development/2015-July/022205.html
%End

%TypeHeaderCode
Expand All @@ -26,16 +29,15 @@ process and displays them in a dialog box.

static QgsRunProcess *create( const QString &action, bool capture ) /Factory/;

private:
QgsRunProcess( const QString &action, bool capture );
~QgsRunProcess();
public slots:
void stdoutAvailable();
void stderrAvailable();
void processError( QProcess::ProcessError );
void processExit( int, QProcess::ExitStatus );
void dialogGone();

private:
QgsRunProcess( const QString &action, bool capture );
~QgsRunProcess();
};

/************************************************************************
Expand Down
4 changes: 4 additions & 0 deletions rpm/qgis.spec.template
Expand Up @@ -107,6 +107,10 @@ BuildRequires: qwt-devel
BuildRequires: qwt-qt5-devel
BuildRequires: qwt-qt5-devel

# GDAL must be explicit. It is required by some raster tools
# like Warp (Reproject) which relies on gdalwarp
Requires: gdal

# Installation of QCA plugins must be explicit
Requires: qca-qt5-ossl
Requires: gpsbabel
Expand Down
2 changes: 2 additions & 0 deletions src/3d/CMakeLists.txt
Expand Up @@ -12,6 +12,7 @@ SET(QGIS_3D_SRCS
qgslayoutitem3dmap.cpp
qgsoffscreen3dengine.cpp
qgsphongmaterialsettings.cpp
qgspointlightsettings.cpp
qgsraycastingutils_p.cpp
qgstessellatedpolygongeometry.cpp
qgstilingscheme.cpp
Expand Down Expand Up @@ -93,6 +94,7 @@ SET(QGIS_3D_HDRS
qgslayoutitem3dmap.h
qgsoffscreen3dengine.h
qgsphongmaterialsettings.h
qgspointlightsettings.h
qgsraycastingutils_p.h
qgstessellatedpolygongeometry.h
qgstilingscheme.h
Expand Down
45 changes: 32 additions & 13 deletions src/3d/qgs3dmapscene.cpp
Expand Up @@ -93,6 +93,7 @@ Qgs3DMapScene::Qgs3DMapScene( const Qgs3DMapSettings &map, QgsAbstract3DEngine *
connect( &map, &Qgs3DMapSettings::maxTerrainScreenErrorChanged, this, &Qgs3DMapScene::createTerrain );
connect( &map, &Qgs3DMapSettings::maxTerrainGroundErrorChanged, this, &Qgs3DMapScene::createTerrain );
connect( &map, &Qgs3DMapSettings::terrainShadingChanged, this, &Qgs3DMapScene::createTerrain );
connect( &map, &Qgs3DMapSettings::pointLightsChanged, this, &Qgs3DMapScene::updateLights );

// create entities of renderers

Expand All @@ -105,19 +106,7 @@ Qgs3DMapScene::Qgs3DMapScene( const Qgs3DMapSettings &map, QgsAbstract3DEngine *
// listen to changes of layers in order to add/remove 3D renderer entities
connect( &map, &Qgs3DMapSettings::layersChanged, this, &Qgs3DMapScene::onLayersChanged );

Qt3DCore::QEntity *lightEntity = new Qt3DCore::QEntity;
Qt3DCore::QTransform *lightTransform = new Qt3DCore::QTransform;
lightTransform->setTranslation( QVector3D( 0, 1000, 0 ) );
// defaults: white, intensity 0.5
// attenuation: constant 1.0, linear 0.0, quadratic 0.0
Qt3DRender::QPointLight *light = new Qt3DRender::QPointLight;
light->setConstantAttenuation( 0 );
//light->setColor(Qt::white);
//light->setIntensity(0.5);
lightEntity->addComponent( light );
lightEntity->addComponent( lightTransform );
lightEntity->setParent( this );

updateLights();

#if 0
ChunkedEntity *testChunkEntity = new ChunkedEntity( AABB( -500, 0, -500, 500, 100, 500 ), 2.f, 3.f, 7, new TestChunkLoaderFactory );
Expand Down Expand Up @@ -465,6 +454,36 @@ void Qgs3DMapScene::onLayerEntityPickEvent( Qt3DRender::QPickEvent *event )

}

void Qgs3DMapScene::updateLights()
{
for ( Qt3DCore::QEntity *entity : qgis::as_const( mLightEntities ) )
entity->deleteLater();
mLightEntities.clear();

const auto newPointLights = mMap.pointLights();
for ( const QgsPointLightSettings &pointLightSettings : newPointLights )
{
Qt3DCore::QEntity *lightEntity = new Qt3DCore::QEntity;
Qt3DCore::QTransform *lightTransform = new Qt3DCore::QTransform;
lightTransform->setTranslation( QVector3D( pointLightSettings.position().x(),
pointLightSettings.position().y(),
pointLightSettings.position().z() ) );

Qt3DRender::QPointLight *light = new Qt3DRender::QPointLight;
light->setColor( pointLightSettings.color() );
light->setIntensity( pointLightSettings.intensity() );

light->setConstantAttenuation( pointLightSettings.constantAttenuation() );
light->setLinearAttenuation( pointLightSettings.linearAttenuation() );
light->setQuadraticAttenuation( pointLightSettings.quadraticAttenuation() );

lightEntity->addComponent( light );
lightEntity->addComponent( lightTransform );
lightEntity->setParent( this );
mLightEntities << lightEntity;
}
}

void Qgs3DMapScene::onLayerRenderer3DChanged()
{
QgsMapLayer *layer = qobject_cast<QgsMapLayer *>( sender() );
Expand Down
3 changes: 3 additions & 0 deletions src/3d/qgs3dmapscene.h
Expand Up @@ -106,6 +106,7 @@ class _3D_EXPORT Qgs3DMapScene : public Qt3DCore::QEntity
void createTerrainDeferred();
void onBackgroundColorChanged();
void onLayerEntityPickEvent( Qt3DRender::QPickEvent *event );
void updateLights();

private:
void addLayerEntity( QgsMapLayer *layer );
Expand All @@ -132,6 +133,8 @@ class _3D_EXPORT Qgs3DMapScene : public Qt3DCore::QEntity
SceneState mSceneState = Ready;
//! List of currently registered pick handlers (used by identify tool)
QList<Qgs3DMapScenePickHandler *> mPickHandlers;
//! List of lights in the scene
QList<Qt3DCore::QEntity *> mLightEntities;
};

#endif // QGS3DMAPSCENE_H
43 changes: 43 additions & 0 deletions src/3d/qgs3dmapsettings.cpp
Expand Up @@ -42,6 +42,8 @@ Qgs3DMapSettings::Qgs3DMapSettings( const Qgs3DMapSettings &other )
, mShowTerrainBoundingBoxes( other.mShowTerrainBoundingBoxes )
, mShowTerrainTileInfo( other.mShowTerrainTileInfo )
, mShowCameraViewCenter( other.mShowCameraViewCenter )
, mShowLabels( other.mShowLabels )
, mPointLights( other.mPointLights )
, mLayers( other.mLayers )
, mSkyboxEnabled( other.mSkyboxEnabled )
, mSkyboxFileBase( other.mSkyboxFileBase )
Expand Down Expand Up @@ -86,6 +88,28 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte
if ( !elemTerrainShadingMaterial.isNull() )
mTerrainShadingMaterial.readXml( elemTerrainShadingMaterial );
mShowLabels = elemTerrain.attribute( QStringLiteral( "show-labels" ), QStringLiteral( "0" ) ).toInt();

mPointLights.clear();
QDomElement elemPointLights = elem.firstChildElement( QStringLiteral( "point-lights" ) );
if ( !elemPointLights.isNull() )
{
QDomElement elemPointLight = elemPointLights.firstChildElement( QStringLiteral( "point-light" ) );
while ( !elemPointLight.isNull() )
{
QgsPointLightSettings pointLight;
pointLight.readXml( elemPointLight );
mPointLights << pointLight;
elemPointLight = elemPointLight.nextSiblingElement( QStringLiteral( "point-light" ) );
}
}
else
{
// QGIS <= 3.4 did not have light configuration
QgsPointLightSettings defaultLight;
defaultLight.setPosition( QgsVector3D( 0, 1000, 0 ) );
mPointLights << defaultLight;
}

QDomElement elemMapLayers = elemTerrain.firstChildElement( QStringLiteral( "layers" ) );
QDomElement elemMapLayer = elemMapLayers.firstChildElement( QStringLiteral( "layer" ) );
QList<QgsMapLayerRef> mapLayers;
Expand All @@ -95,6 +119,7 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte
elemMapLayer = elemMapLayer.nextSiblingElement( QStringLiteral( "layer" ) );
}
mLayers = mapLayers; // needs to resolve refs afterwards

QDomElement elemTerrainGenerator = elemTerrain.firstChildElement( QStringLiteral( "generator" ) );
QString terrainGenType = elemTerrainGenerator.attribute( QStringLiteral( "type" ) );
if ( terrainGenType == QLatin1String( "dem" ) )
Expand Down Expand Up @@ -180,6 +205,15 @@ QDomElement Qgs3DMapSettings::writeXml( QDomDocument &doc, const QgsReadWriteCon
mTerrainShadingMaterial.writeXml( elemTerrainShadingMaterial );
elemTerrain.appendChild( elemTerrainShadingMaterial );
elemTerrain.setAttribute( QStringLiteral( "show-labels" ), mShowLabels ? 1 : 0 );

QDomElement elemPointLights = doc.createElement( QStringLiteral( "point-lights" ) );
for ( const QgsPointLightSettings &pointLight : qgis::as_const( mPointLights ) )
{
QDomElement elemPointLight = pointLight.writeXml( doc );
elemPointLights.appendChild( elemPointLight );
}
elem.appendChild( elemPointLights );

QDomElement elemMapLayers = doc.createElement( QStringLiteral( "layers" ) );
Q_FOREACH ( const QgsMapLayerRef &layerRef, mLayers )
{
Expand Down Expand Up @@ -438,3 +472,12 @@ void Qgs3DMapSettings::setShowLabels( bool enabled )
mShowLabels = enabled;
emit showLabelsChanged();
}

void Qgs3DMapSettings::setPointLights( const QList<QgsPointLightSettings> &pointLights )
{
if ( mPointLights == pointLights )
return;

mPointLights = pointLights;
emit pointLightsChanged();
}

0 comments on commit c292e69

Please sign in to comment.