mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Address some clazy warnings
This commit is contained in:
parent
ca427d3316
commit
230e3b410a
@ -59,6 +59,7 @@ SET(QGIS_3D_MOC_HDRS
|
||||
qgstessellatedpolygongeometry.h
|
||||
qgswindow3dengine.h
|
||||
|
||||
chunks/qgschunkboundsentity_p.h
|
||||
chunks/qgschunkedentity_p.h
|
||||
chunks/qgschunkloader_p.h
|
||||
chunks/qgschunkqueuejob_p.h
|
||||
@ -66,10 +67,12 @@ SET(QGIS_3D_MOC_HDRS
|
||||
processing/qgs3dalgorithms.h
|
||||
|
||||
terrain/qgsdemterraintileloader_p.h
|
||||
terrain/qgsflatterraingenerator.h
|
||||
terrain/qgsterrainentity_p.h
|
||||
terrain/qgsterraintexturegenerator_p.h
|
||||
terrain/qgsterraintextureimage_p.h
|
||||
terrain/qgsterraintileentity_p.h
|
||||
terrain/qgsterraintileloader_p.h
|
||||
)
|
||||
|
||||
QT5_WRAP_CPP(QGIS_3D_MOC_SRCS ${QGIS_3D_MOC_HDRS})
|
||||
@ -96,7 +99,6 @@ SET(QGIS_3D_HDRS
|
||||
qgsvectorlayer3drenderer.h
|
||||
qgswindow3dengine.h
|
||||
|
||||
chunks/qgschunkboundsentity_p.h
|
||||
chunks/qgschunkedentity_p.h
|
||||
chunks/qgschunklist_p.h
|
||||
chunks/qgschunkloader_p.h
|
||||
@ -114,13 +116,11 @@ SET(QGIS_3D_HDRS
|
||||
terrain/qgsdemterraingenerator.h
|
||||
terrain/qgsdemterraintilegeometry_p.h
|
||||
terrain/qgsdemterraintileloader_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
|
||||
)
|
||||
|
@ -15,10 +15,7 @@
|
||||
|
||||
#include "qgschunkboundsentity_p.h"
|
||||
|
||||
#include <Qt3DRender/QAttribute>
|
||||
#include <Qt3DRender/QBuffer>
|
||||
#include <Qt3DRender/QGeometry>
|
||||
#include <Qt3DRender/QGeometryRenderer>
|
||||
#include <Qt3DExtras/QPhongMaterial>
|
||||
|
||||
#include "qgsaabb.h"
|
||||
@ -26,26 +23,6 @@
|
||||
|
||||
///@cond PRIVATE
|
||||
|
||||
class LineMeshGeometry : public Qt3DRender::QGeometry
|
||||
{
|
||||
public:
|
||||
LineMeshGeometry( Qt3DCore::QNode *parent = nullptr );
|
||||
|
||||
int vertexCount()
|
||||
{
|
||||
return mVertices.size();
|
||||
}
|
||||
|
||||
void setVertices( QList<QVector3D> vertices );
|
||||
|
||||
private:
|
||||
Qt3DRender::QAttribute *mPositionAttribute = nullptr;
|
||||
Qt3DRender::QBuffer *mVertexBuffer = nullptr;
|
||||
QList<QVector3D> mVertices;
|
||||
|
||||
};
|
||||
|
||||
|
||||
LineMeshGeometry::LineMeshGeometry( Qt3DCore::QNode *parent )
|
||||
: Qt3DRender::QGeometry( parent )
|
||||
, mPositionAttribute( new Qt3DRender::QAttribute( this ) )
|
||||
@ -60,7 +37,7 @@ LineMeshGeometry::LineMeshGeometry( Qt3DCore::QNode *parent )
|
||||
addAttribute( mPositionAttribute );
|
||||
}
|
||||
|
||||
void LineMeshGeometry::setVertices( QList<QVector3D> vertices )
|
||||
void LineMeshGeometry::setVertices( const QList<QVector3D> &vertices )
|
||||
{
|
||||
QByteArray vertexBufferData;
|
||||
vertexBufferData.resize( vertices.size() * 3 * sizeof( float ) );
|
||||
@ -81,19 +58,6 @@ void LineMeshGeometry::setVertices( QList<QVector3D> vertices )
|
||||
// ----------------
|
||||
|
||||
|
||||
//! Geometry renderer for axis aligned bounding boxes - draws a box edges as lines
|
||||
class AABBMesh : public Qt3DRender::QGeometryRenderer
|
||||
{
|
||||
public:
|
||||
AABBMesh( Qt3DCore::QNode *parent = nullptr );
|
||||
|
||||
void setBoxes( const QList<QgsAABB> &bboxes );
|
||||
|
||||
private:
|
||||
LineMeshGeometry *mLineMeshGeo = nullptr;
|
||||
};
|
||||
|
||||
|
||||
AABBMesh::AABBMesh( Qt3DCore::QNode *parent )
|
||||
: Qt3DRender::QGeometryRenderer( parent )
|
||||
{
|
||||
|
@ -28,6 +28,10 @@
|
||||
//
|
||||
|
||||
#include <Qt3DCore/QEntity>
|
||||
#include <Qt3DRender/QAttribute>
|
||||
#include <Qt3DRender/QGeometry>
|
||||
#include <QVector3D>
|
||||
#include <Qt3DRender/QGeometryRenderer>
|
||||
|
||||
class QgsAABB;
|
||||
class AABBMesh;
|
||||
@ -40,6 +44,8 @@ class AABBMesh;
|
||||
*/
|
||||
class QgsChunkBoundsEntity : public Qt3DCore::QEntity
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructs the entity
|
||||
QgsChunkBoundsEntity( Qt3DCore::QNode *parent = nullptr );
|
||||
@ -51,6 +57,43 @@ class QgsChunkBoundsEntity : public Qt3DCore::QEntity
|
||||
AABBMesh *mAabbMesh = nullptr;
|
||||
};
|
||||
|
||||
|
||||
class LineMeshGeometry : public Qt3DRender::QGeometry
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LineMeshGeometry( Qt3DCore::QNode *parent = nullptr );
|
||||
|
||||
int vertexCount()
|
||||
{
|
||||
return mVertices.size();
|
||||
}
|
||||
|
||||
void setVertices( const QList<QVector3D> &vertices );
|
||||
|
||||
private:
|
||||
Qt3DRender::QAttribute *mPositionAttribute = nullptr;
|
||||
Qt3DRender::QBuffer *mVertexBuffer = nullptr;
|
||||
QList<QVector3D> mVertices;
|
||||
|
||||
};
|
||||
|
||||
|
||||
//! Geometry renderer for axis aligned bounding boxes - draws a box edges as lines
|
||||
class AABBMesh : public Qt3DRender::QGeometryRenderer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AABBMesh( Qt3DCore::QNode *parent = nullptr );
|
||||
|
||||
void setBoxes( const QList<QgsAABB> &bboxes );
|
||||
|
||||
private:
|
||||
LineMeshGeometry *mLineMeshGeo = nullptr;
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
|
||||
#endif // QGSCHUNKBOUNDSENTITY_P_H
|
||||
|
@ -54,7 +54,7 @@ QgsChunkNode::~QgsChunkNode()
|
||||
delete mChildren[i];
|
||||
}
|
||||
|
||||
bool QgsChunkNode::allChildChunksResident( const QTime ¤tTime ) const
|
||||
bool QgsChunkNode::allChildChunksResident( QTime currentTime ) const
|
||||
{
|
||||
for ( int i = 0; i < 4; ++i )
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ class QgsChunkNode
|
||||
QgsChunkQueueJob *updater() const { return mUpdater; }
|
||||
|
||||
//! Returns true if all child chunks are available and thus this node could be swapped to the child nodes
|
||||
bool allChildChunksResident( const QTime ¤tTime ) const;
|
||||
bool allChildChunksResident( QTime currentTime ) const;
|
||||
|
||||
//! make sure that all child nodes are at least skeleton nodes
|
||||
void ensureAllChildrenExist();
|
||||
|
@ -446,7 +446,7 @@ void Qgs3DMapScene::onLayerEntityPickEvent( Qt3DRender::QPickEvent *event )
|
||||
// unfortunately we can't access which sub-entity triggered the pick event
|
||||
// so as a temporary workaround let's just ignore the entity with selection
|
||||
// and hope the event was the main entity (QTBUG-58206)
|
||||
if ( geomRenderer->objectName() != "main" )
|
||||
if ( geomRenderer->objectName() != QLatin1String( "main" ) )
|
||||
continue;
|
||||
|
||||
if ( QgsTessellatedPolygonGeometry *g = qobject_cast<QgsTessellatedPolygonGeometry *>( geomRenderer->geometry() ) )
|
||||
@ -510,7 +510,7 @@ void Qgs3DMapScene::addLayerEntity( QgsMapLayer *layer )
|
||||
// This is a bit of a hack and it should be handled in QgsMapLayer::setRenderer3D() but in qgis_core
|
||||
// the vector layer 3D renderer class is not available. Maybe we need an intermediate map layer 3D renderer
|
||||
// class in qgis_core that can be used to handle this case nicely.
|
||||
if ( layer->type() == QgsMapLayer::VectorLayer && renderer->type() == "vector" )
|
||||
if ( layer->type() == QgsMapLayer::VectorLayer && renderer->type() == QLatin1String( "vector" ) )
|
||||
{
|
||||
static_cast<QgsVectorLayer3DRenderer *>( renderer )->setLayer( static_cast<QgsVectorLayer *>( layer ) );
|
||||
}
|
||||
|
@ -58,46 +58,46 @@ Qgs3DMapSettings::~Qgs3DMapSettings()
|
||||
|
||||
void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteContext &context )
|
||||
{
|
||||
QDomElement elemOrigin = elem.firstChildElement( "origin" );
|
||||
QDomElement elemOrigin = elem.firstChildElement( QStringLiteral( "origin" ) );
|
||||
mOrigin = QgsVector3D(
|
||||
elemOrigin.attribute( "x" ).toDouble(),
|
||||
elemOrigin.attribute( "y" ).toDouble(),
|
||||
elemOrigin.attribute( "z" ).toDouble() );
|
||||
elemOrigin.attribute( QStringLiteral( "x" ) ).toDouble(),
|
||||
elemOrigin.attribute( QStringLiteral( "y" ) ).toDouble(),
|
||||
elemOrigin.attribute( QStringLiteral( "z" ) ).toDouble() );
|
||||
|
||||
QDomElement elemColor = elem.firstChildElement( "color" );
|
||||
QDomElement elemColor = elem.firstChildElement( QStringLiteral( "color" ) );
|
||||
if ( !elemColor.isNull() )
|
||||
{
|
||||
mBackgroundColor = QgsSymbolLayerUtils::decodeColor( elemColor.attribute( "background" ) );
|
||||
mSelectionColor = QgsSymbolLayerUtils::decodeColor( elemColor.attribute( "selection" ) );
|
||||
mBackgroundColor = QgsSymbolLayerUtils::decodeColor( elemColor.attribute( QStringLiteral( "background" ) ) );
|
||||
mSelectionColor = QgsSymbolLayerUtils::decodeColor( elemColor.attribute( QStringLiteral( "selection" ) ) );
|
||||
}
|
||||
|
||||
QDomElement elemCrs = elem.firstChildElement( "crs" );
|
||||
QDomElement elemCrs = elem.firstChildElement( QStringLiteral( "crs" ) );
|
||||
mCrs.readXml( elemCrs );
|
||||
|
||||
QDomElement elemTerrain = elem.firstChildElement( "terrain" );
|
||||
mTerrainVerticalScale = elemTerrain.attribute( "exaggeration", "1" ).toFloat();
|
||||
mMapTileResolution = elemTerrain.attribute( "texture-size", "512" ).toInt();
|
||||
mMaxTerrainScreenError = elemTerrain.attribute( "max-terrain-error", "3" ).toFloat();
|
||||
mMaxTerrainGroundError = elemTerrain.attribute( "max-ground-error", "1" ).toFloat();
|
||||
mShowLabels = elemTerrain.attribute( "show-labels", "0" ).toInt();
|
||||
QDomElement elemMapLayers = elemTerrain.firstChildElement( "layers" );
|
||||
QDomElement elemMapLayer = elemMapLayers.firstChildElement( "layer" );
|
||||
QDomElement elemTerrain = elem.firstChildElement( QStringLiteral( "terrain" ) );
|
||||
mTerrainVerticalScale = elemTerrain.attribute( QStringLiteral( "exaggeration" ), QStringLiteral( "1" ) ).toFloat();
|
||||
mMapTileResolution = elemTerrain.attribute( QStringLiteral( "texture-size" ), QStringLiteral( "512" ) ).toInt();
|
||||
mMaxTerrainScreenError = elemTerrain.attribute( QStringLiteral( "max-terrain-error" ), QStringLiteral( "3" ) ).toFloat();
|
||||
mMaxTerrainGroundError = elemTerrain.attribute( QStringLiteral( "max-ground-error" ), QStringLiteral( "1" ) ).toFloat();
|
||||
mShowLabels = elemTerrain.attribute( QStringLiteral( "show-labels" ), QStringLiteral( "0" ) ).toInt();
|
||||
QDomElement elemMapLayers = elemTerrain.firstChildElement( QStringLiteral( "layers" ) );
|
||||
QDomElement elemMapLayer = elemMapLayers.firstChildElement( QStringLiteral( "layer" ) );
|
||||
QList<QgsMapLayerRef> mapLayers;
|
||||
while ( !elemMapLayer.isNull() )
|
||||
{
|
||||
mapLayers << QgsMapLayerRef( elemMapLayer.attribute( "id" ) );
|
||||
elemMapLayer = elemMapLayer.nextSiblingElement( "layer" );
|
||||
mapLayers << QgsMapLayerRef( elemMapLayer.attribute( QStringLiteral( "id" ) ) );
|
||||
elemMapLayer = elemMapLayer.nextSiblingElement( QStringLiteral( "layer" ) );
|
||||
}
|
||||
mLayers = mapLayers; // needs to resolve refs afterwards
|
||||
QDomElement elemTerrainGenerator = elemTerrain.firstChildElement( "generator" );
|
||||
QString terrainGenType = elemTerrainGenerator.attribute( "type" );
|
||||
if ( terrainGenType == "dem" )
|
||||
QDomElement elemTerrainGenerator = elemTerrain.firstChildElement( QStringLiteral( "generator" ) );
|
||||
QString terrainGenType = elemTerrainGenerator.attribute( QStringLiteral( "type" ) );
|
||||
if ( terrainGenType == QLatin1String( "dem" ) )
|
||||
{
|
||||
QgsDemTerrainGenerator *demTerrainGenerator = new QgsDemTerrainGenerator;
|
||||
demTerrainGenerator->setCrs( mCrs, mTransformContext );
|
||||
mTerrainGenerator.reset( demTerrainGenerator );
|
||||
}
|
||||
else if ( terrainGenType == "quantized-mesh" )
|
||||
else if ( terrainGenType == QLatin1String( "quantized-mesh" ) )
|
||||
{
|
||||
#if 0
|
||||
terrainGenerator.reset( new QuantizedMeshTerrainGenerator );
|
||||
@ -115,13 +115,13 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte
|
||||
qDeleteAll( mRenderers );
|
||||
mRenderers.clear();
|
||||
|
||||
QDomElement elemRenderers = elem.firstChildElement( "renderers" );
|
||||
QDomElement elemRenderer = elemRenderers.firstChildElement( "renderer" );
|
||||
QDomElement elemRenderers = elem.firstChildElement( QStringLiteral( "renderers" ) );
|
||||
QDomElement elemRenderer = elemRenderers.firstChildElement( QStringLiteral( "renderer" ) );
|
||||
while ( !elemRenderer.isNull() )
|
||||
{
|
||||
QgsAbstract3DRenderer *renderer = nullptr;
|
||||
QString type = elemRenderer.attribute( "type" );
|
||||
if ( type == "vector" )
|
||||
QString type = elemRenderer.attribute( QStringLiteral( "type" ) );
|
||||
if ( type == QLatin1String( "vector" ) )
|
||||
{
|
||||
renderer = new QgsVectorLayer3DRenderer;
|
||||
}
|
||||
@ -131,80 +131,80 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte
|
||||
renderer->readXml( elemRenderer, context );
|
||||
mRenderers.append( renderer );
|
||||
}
|
||||
elemRenderer = elemRenderer.nextSiblingElement( "renderer" );
|
||||
elemRenderer = elemRenderer.nextSiblingElement( QStringLiteral( "renderer" ) );
|
||||
}
|
||||
|
||||
QDomElement elemSkybox = elem.firstChildElement( "skybox" );
|
||||
mSkyboxEnabled = elemSkybox.attribute( "enabled", "0" ).toInt();
|
||||
mSkyboxFileBase = elemSkybox.attribute( "file-base" );
|
||||
mSkyboxFileExtension = elemSkybox.attribute( "file-ext" );
|
||||
QDomElement elemSkybox = elem.firstChildElement( QStringLiteral( "skybox" ) );
|
||||
mSkyboxEnabled = elemSkybox.attribute( QStringLiteral( "enabled" ), QStringLiteral( "0" ) ).toInt();
|
||||
mSkyboxFileBase = elemSkybox.attribute( QStringLiteral( "file-base" ) );
|
||||
mSkyboxFileExtension = elemSkybox.attribute( QStringLiteral( "file-ext" ) );
|
||||
|
||||
QDomElement elemDebug = elem.firstChildElement( "debug" );
|
||||
mShowTerrainBoundingBoxes = elemDebug.attribute( "bounding-boxes", "0" ).toInt();
|
||||
mShowTerrainTileInfo = elemDebug.attribute( "terrain-tile-info", "0" ).toInt();
|
||||
mShowCameraViewCenter = elemDebug.attribute( "camera-view-center", "0" ).toInt();
|
||||
QDomElement elemDebug = elem.firstChildElement( QStringLiteral( "debug" ) );
|
||||
mShowTerrainBoundingBoxes = elemDebug.attribute( QStringLiteral( "bounding-boxes" ), QStringLiteral( "0" ) ).toInt();
|
||||
mShowTerrainTileInfo = elemDebug.attribute( QStringLiteral( "terrain-tile-info" ), QStringLiteral( "0" ) ).toInt();
|
||||
mShowCameraViewCenter = elemDebug.attribute( QStringLiteral( "camera-view-center" ), QStringLiteral( "0" ) ).toInt();
|
||||
}
|
||||
|
||||
QDomElement Qgs3DMapSettings::writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const
|
||||
{
|
||||
QDomElement elem = doc.createElement( "qgis3d" );
|
||||
QDomElement elem = doc.createElement( QStringLiteral( "qgis3d" ) );
|
||||
|
||||
QDomElement elemOrigin = doc.createElement( "origin" );
|
||||
elemOrigin.setAttribute( "x", QString::number( mOrigin.x() ) );
|
||||
elemOrigin.setAttribute( "y", QString::number( mOrigin.y() ) );
|
||||
elemOrigin.setAttribute( "z", QString::number( mOrigin.z() ) );
|
||||
QDomElement elemOrigin = doc.createElement( QStringLiteral( "origin" ) );
|
||||
elemOrigin.setAttribute( QStringLiteral( "x" ), QString::number( mOrigin.x() ) );
|
||||
elemOrigin.setAttribute( QStringLiteral( "y" ), QString::number( mOrigin.y() ) );
|
||||
elemOrigin.setAttribute( QStringLiteral( "z" ), QString::number( mOrigin.z() ) );
|
||||
elem.appendChild( elemOrigin );
|
||||
|
||||
QDomElement elemColor = doc.createElement( "color" );
|
||||
elemColor.setAttribute( "background", QgsSymbolLayerUtils::encodeColor( mBackgroundColor ) );
|
||||
elemColor.setAttribute( "selection", QgsSymbolLayerUtils::encodeColor( mSelectionColor ) );
|
||||
QDomElement elemColor = doc.createElement( QStringLiteral( "color" ) );
|
||||
elemColor.setAttribute( QStringLiteral( "background" ), QgsSymbolLayerUtils::encodeColor( mBackgroundColor ) );
|
||||
elemColor.setAttribute( QStringLiteral( "selection" ), QgsSymbolLayerUtils::encodeColor( mSelectionColor ) );
|
||||
elem.appendChild( elemColor );
|
||||
|
||||
QDomElement elemCrs = doc.createElement( "crs" );
|
||||
QDomElement elemCrs = doc.createElement( QStringLiteral( "crs" ) );
|
||||
mCrs.writeXml( elemCrs, doc );
|
||||
elem.appendChild( elemCrs );
|
||||
|
||||
QDomElement elemTerrain = doc.createElement( "terrain" );
|
||||
elemTerrain.setAttribute( "exaggeration", QString::number( mTerrainVerticalScale ) );
|
||||
elemTerrain.setAttribute( "texture-size", mMapTileResolution );
|
||||
elemTerrain.setAttribute( "max-terrain-error", QString::number( mMaxTerrainScreenError ) );
|
||||
elemTerrain.setAttribute( "max-ground-error", QString::number( mMaxTerrainGroundError ) );
|
||||
elemTerrain.setAttribute( "show-labels", mShowLabels ? 1 : 0 );
|
||||
QDomElement elemMapLayers = doc.createElement( "layers" );
|
||||
QDomElement elemTerrain = doc.createElement( QStringLiteral( "terrain" ) );
|
||||
elemTerrain.setAttribute( QStringLiteral( "exaggeration" ), QString::number( mTerrainVerticalScale ) );
|
||||
elemTerrain.setAttribute( QStringLiteral( "texture-size" ), mMapTileResolution );
|
||||
elemTerrain.setAttribute( QStringLiteral( "max-terrain-error" ), QString::number( mMaxTerrainScreenError ) );
|
||||
elemTerrain.setAttribute( QStringLiteral( "max-ground-error" ), QString::number( mMaxTerrainGroundError ) );
|
||||
elemTerrain.setAttribute( QStringLiteral( "show-labels" ), mShowLabels ? 1 : 0 );
|
||||
QDomElement elemMapLayers = doc.createElement( QStringLiteral( "layers" ) );
|
||||
Q_FOREACH ( const QgsMapLayerRef &layerRef, mLayers )
|
||||
{
|
||||
QDomElement elemMapLayer = doc.createElement( "layer" );
|
||||
elemMapLayer.setAttribute( "id", layerRef.layerId );
|
||||
QDomElement elemMapLayer = doc.createElement( QStringLiteral( "layer" ) );
|
||||
elemMapLayer.setAttribute( QStringLiteral( "id" ), layerRef.layerId );
|
||||
elemMapLayers.appendChild( elemMapLayer );
|
||||
}
|
||||
elemTerrain.appendChild( elemMapLayers );
|
||||
QDomElement elemTerrainGenerator = doc.createElement( "generator" );
|
||||
elemTerrainGenerator.setAttribute( "type", QgsTerrainGenerator::typeToString( mTerrainGenerator->type() ) );
|
||||
QDomElement elemTerrainGenerator = doc.createElement( QStringLiteral( "generator" ) );
|
||||
elemTerrainGenerator.setAttribute( QStringLiteral( "type" ), QgsTerrainGenerator::typeToString( mTerrainGenerator->type() ) );
|
||||
mTerrainGenerator->writeXml( elemTerrainGenerator );
|
||||
elemTerrain.appendChild( elemTerrainGenerator );
|
||||
elem.appendChild( elemTerrain );
|
||||
|
||||
QDomElement elemRenderers = doc.createElement( "renderers" );
|
||||
QDomElement elemRenderers = doc.createElement( QStringLiteral( "renderers" ) );
|
||||
Q_FOREACH ( const QgsAbstract3DRenderer *renderer, mRenderers )
|
||||
{
|
||||
QDomElement elemRenderer = doc.createElement( "renderer" );
|
||||
elemRenderer.setAttribute( "type", renderer->type() );
|
||||
QDomElement elemRenderer = doc.createElement( QStringLiteral( "renderer" ) );
|
||||
elemRenderer.setAttribute( QStringLiteral( "type" ), renderer->type() );
|
||||
renderer->writeXml( elemRenderer, context );
|
||||
elemRenderers.appendChild( elemRenderer );
|
||||
}
|
||||
elem.appendChild( elemRenderers );
|
||||
|
||||
QDomElement elemSkybox = doc.createElement( "skybox" );
|
||||
elemSkybox.setAttribute( "enabled", mSkyboxEnabled ? 1 : 0 );
|
||||
QDomElement elemSkybox = doc.createElement( QStringLiteral( "skybox" ) );
|
||||
elemSkybox.setAttribute( QStringLiteral( "enabled" ), mSkyboxEnabled ? 1 : 0 );
|
||||
// TODO: use context for relative paths, maybe explicitly list all files(?)
|
||||
elemSkybox.setAttribute( "file-base", mSkyboxFileBase );
|
||||
elemSkybox.setAttribute( "file-ext", mSkyboxFileExtension );
|
||||
elemSkybox.setAttribute( QStringLiteral( "file-base" ), mSkyboxFileBase );
|
||||
elemSkybox.setAttribute( QStringLiteral( "file-ext" ), mSkyboxFileExtension );
|
||||
elem.appendChild( elemSkybox );
|
||||
|
||||
QDomElement elemDebug = doc.createElement( "debug" );
|
||||
elemDebug.setAttribute( "bounding-boxes", mShowTerrainBoundingBoxes ? 1 : 0 );
|
||||
elemDebug.setAttribute( "terrain-tile-info", mShowTerrainTileInfo ? 1 : 0 );
|
||||
elemDebug.setAttribute( "camera-view-center", mShowCameraViewCenter ? 1 : 0 );
|
||||
QDomElement elemDebug = doc.createElement( QStringLiteral( "debug" ) );
|
||||
elemDebug.setAttribute( QStringLiteral( "bounding-boxes" ), mShowTerrainBoundingBoxes ? 1 : 0 );
|
||||
elemDebug.setAttribute( QStringLiteral( "terrain-tile-info" ), mShowTerrainTileInfo ? 1 : 0 );
|
||||
elemDebug.setAttribute( QStringLiteral( "camera-view-center" ), mShowCameraViewCenter ? 1 : 0 );
|
||||
elem.appendChild( elemDebug );
|
||||
|
||||
return elem;
|
||||
|
@ -97,9 +97,9 @@ QString Qgs3DUtils::altClampingToString( Qgs3DTypes::AltitudeClamping altClamp )
|
||||
|
||||
Qgs3DTypes::AltitudeClamping Qgs3DUtils::altClampingFromString( const QString &str )
|
||||
{
|
||||
if ( str == "absolute" )
|
||||
if ( str == QLatin1String( "absolute" ) )
|
||||
return Qgs3DTypes::AltClampAbsolute;
|
||||
else if ( str == "terrain" )
|
||||
else if ( str == QLatin1String( "terrain" ) )
|
||||
return Qgs3DTypes::AltClampTerrain;
|
||||
else // "relative" (default)
|
||||
return Qgs3DTypes::AltClampRelative;
|
||||
@ -119,7 +119,7 @@ QString Qgs3DUtils::altBindingToString( Qgs3DTypes::AltitudeBinding altBind )
|
||||
|
||||
Qgs3DTypes::AltitudeBinding Qgs3DUtils::altBindingFromString( const QString &str )
|
||||
{
|
||||
if ( str == "vertex" )
|
||||
if ( str == QLatin1String( "vertex" ) )
|
||||
return Qgs3DTypes::AltBindVertex;
|
||||
else // "centroid" (default)
|
||||
return Qgs3DTypes::AltBindCentroid;
|
||||
@ -227,6 +227,7 @@ QString Qgs3DUtils::matrix4x4toString( const QMatrix4x4 &m )
|
||||
{
|
||||
const float *d = m.constData();
|
||||
QStringList elems;
|
||||
elems.reserve( 16 );
|
||||
for ( int i = 0; i < 16; ++i )
|
||||
elems << QString::number( d[i] );
|
||||
return elems.join( ' ' );
|
||||
@ -289,7 +290,7 @@ QList<QVector3D> Qgs3DUtils::positions( const Qgs3DMapSettings &map, QgsVectorLa
|
||||
* qt3d /src/threed/painting/qglpainter.cpp
|
||||
* no changes in the code
|
||||
*/
|
||||
static inline uint outcode( const QVector4D &v )
|
||||
static inline uint outcode( QVector4D v )
|
||||
{
|
||||
// For a discussion of outcodes see pg 388 Dunn & Parberry.
|
||||
// For why you can't just test if the point is in a bounding box
|
||||
|
@ -55,7 +55,7 @@ float QgsAABB::distanceFromPoint( float x, float y, float z ) const
|
||||
return sqrt( dx * dx + dy * dy + dz * dz );
|
||||
}
|
||||
|
||||
float QgsAABB::distanceFromPoint( const QVector3D &v ) const
|
||||
float QgsAABB::distanceFromPoint( QVector3D v ) const
|
||||
{
|
||||
return distanceFromPoint( v.x(), v.y(), v.z() );
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class _3D_EXPORT QgsAABB
|
||||
float distanceFromPoint( float x, float y, float z ) const;
|
||||
|
||||
//! Returns shortest distance from the box to a point
|
||||
float distanceFromPoint( const QVector3D &v ) const;
|
||||
float distanceFromPoint( QVector3D v ) const;
|
||||
|
||||
//! Returns a list of pairs of vertices (useful for display of bounding boxes)
|
||||
QList<QVector3D> verticesForLines() const;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
QDomElement QgsCameraPose::writeXml( QDomDocument &doc ) const
|
||||
{
|
||||
QDomElement elemCamera = doc.createElement( "camera-pose" );
|
||||
QDomElement elemCamera = doc.createElement( QStringLiteral( "camera-pose" ) );
|
||||
elemCamera.setAttribute( QStringLiteral( "x" ), mCenterPoint.x() );
|
||||
elemCamera.setAttribute( QStringLiteral( "y" ), mCenterPoint.y() );
|
||||
elemCamera.setAttribute( QStringLiteral( "z" ), mCenterPoint.z() );
|
||||
|
@ -211,7 +211,7 @@ bool QgsLayoutItem3DMap::writePropertiesToElement( QDomElement &element, QDomDoc
|
||||
bool QgsLayoutItem3DMap::readPropertiesFromElement( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context )
|
||||
{
|
||||
Q_UNUSED( document );
|
||||
QDomElement elemSettings = element.firstChildElement( "qgis3d" );
|
||||
QDomElement elemSettings = element.firstChildElement( QStringLiteral( "qgis3d" ) );
|
||||
if ( !elemSettings.isNull() )
|
||||
{
|
||||
mSettings.reset( new Qgs3DMapSettings );
|
||||
@ -220,7 +220,7 @@ bool QgsLayoutItem3DMap::readPropertiesFromElement( const QDomElement &element,
|
||||
mSettings->resolveReferences( *mLayout->project() );
|
||||
}
|
||||
|
||||
QDomElement elemCameraPose = element.firstChildElement( "camera-pose" );
|
||||
QDomElement elemCameraPose = element.firstChildElement( QStringLiteral( "camera-pose" ) );
|
||||
if ( !elemCameraPose.isNull() )
|
||||
mCameraPose.readXml( elemCameraPose );
|
||||
|
||||
|
@ -87,7 +87,7 @@ QgsOffscreen3DEngine::~QgsOffscreen3DEngine()
|
||||
delete mOffscreenSurface;
|
||||
}
|
||||
|
||||
void QgsOffscreen3DEngine::setSize( const QSize &s )
|
||||
void QgsOffscreen3DEngine::setSize( QSize s )
|
||||
{
|
||||
mSize = s;
|
||||
|
||||
|
@ -66,7 +66,7 @@ class _3D_EXPORT QgsOffscreen3DEngine : public QgsAbstract3DEngine
|
||||
~QgsOffscreen3DEngine() override;
|
||||
|
||||
//! Sets the size of the rendering area (in pixels)
|
||||
void setSize( const QSize &s );
|
||||
void setSize( QSize s );
|
||||
|
||||
void setClearColor( const QColor &color ) override;
|
||||
void setFrustumCullingEnabled( bool enabled ) override;
|
||||
|
@ -20,16 +20,16 @@
|
||||
|
||||
void QgsPhongMaterialSettings::readXml( const QDomElement &elem )
|
||||
{
|
||||
mAmbient = QgsSymbolLayerUtils::decodeColor( elem.attribute( "ambient" ) );
|
||||
mDiffuse = QgsSymbolLayerUtils::decodeColor( elem.attribute( "diffuse" ) );
|
||||
mSpecular = QgsSymbolLayerUtils::decodeColor( elem.attribute( "specular" ) );
|
||||
mShininess = elem.attribute( "shininess" ).toFloat();
|
||||
mAmbient = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "ambient" ) ) );
|
||||
mDiffuse = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "diffuse" ) ) );
|
||||
mSpecular = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "specular" ) ) );
|
||||
mShininess = elem.attribute( QStringLiteral( "shininess" ) ).toFloat();
|
||||
}
|
||||
|
||||
void QgsPhongMaterialSettings::writeXml( QDomElement &elem ) const
|
||||
{
|
||||
elem.setAttribute( "ambient", QgsSymbolLayerUtils::encodeColor( mAmbient ) );
|
||||
elem.setAttribute( "diffuse", QgsSymbolLayerUtils::encodeColor( mDiffuse ) );
|
||||
elem.setAttribute( "specular", QgsSymbolLayerUtils::encodeColor( mSpecular ) );
|
||||
elem.setAttribute( "shininess", mShininess );
|
||||
elem.setAttribute( QStringLiteral( "ambient" ), QgsSymbolLayerUtils::encodeColor( mAmbient ) );
|
||||
elem.setAttribute( QStringLiteral( "diffuse" ), QgsSymbolLayerUtils::encodeColor( mDiffuse ) );
|
||||
elem.setAttribute( QStringLiteral( "specular" ), QgsSymbolLayerUtils::encodeColor( mSpecular ) );
|
||||
elem.setAttribute( QStringLiteral( "shininess" ), mShininess );
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
|
||||
QgsVectorLayer3DRendererMetadata::QgsVectorLayer3DRendererMetadata()
|
||||
: Qgs3DRendererAbstractMetadata( "vector" )
|
||||
: Qgs3DRendererAbstractMetadata( QStringLiteral( "vector" ) )
|
||||
{
|
||||
}
|
||||
|
||||
@ -81,11 +81,11 @@ Qt3DCore::QEntity *QgsVectorLayer3DRenderer::createEntity( const Qgs3DMapSetting
|
||||
if ( !mSymbol || !vl )
|
||||
return nullptr;
|
||||
|
||||
if ( mSymbol->type() == "polygon" )
|
||||
if ( mSymbol->type() == QLatin1String( "polygon" ) )
|
||||
return new QgsPolygon3DSymbolEntity( map, vl, *static_cast<QgsPolygon3DSymbol *>( mSymbol.get() ) );
|
||||
else if ( mSymbol->type() == "point" )
|
||||
else if ( mSymbol->type() == QLatin1String( "point" ) )
|
||||
return new QgsPoint3DSymbolEntity( map, vl, *static_cast<QgsPoint3DSymbol *>( mSymbol.get() ) );
|
||||
else if ( mSymbol->type() == "line" )
|
||||
else if ( mSymbol->type() == QLatin1String( "line" ) )
|
||||
return new QgsLine3DSymbolEntity( map, vl, *static_cast<QgsLine3DSymbol *>( mSymbol.get() ) );
|
||||
else
|
||||
return nullptr;
|
||||
@ -95,12 +95,12 @@ void QgsVectorLayer3DRenderer::writeXml( QDomElement &elem, const QgsReadWriteCo
|
||||
{
|
||||
QDomDocument doc = elem.ownerDocument();
|
||||
|
||||
elem.setAttribute( "layer", mLayerRef.layerId );
|
||||
elem.setAttribute( QStringLiteral( "layer" ), mLayerRef.layerId );
|
||||
|
||||
QDomElement elemSymbol = doc.createElement( "symbol" );
|
||||
QDomElement elemSymbol = doc.createElement( QStringLiteral( "symbol" ) );
|
||||
if ( mSymbol )
|
||||
{
|
||||
elemSymbol.setAttribute( "type", mSymbol->type() );
|
||||
elemSymbol.setAttribute( QStringLiteral( "type" ), mSymbol->type() );
|
||||
mSymbol->writeXml( elemSymbol, context );
|
||||
}
|
||||
elem.appendChild( elemSymbol );
|
||||
@ -108,16 +108,16 @@ void QgsVectorLayer3DRenderer::writeXml( QDomElement &elem, const QgsReadWriteCo
|
||||
|
||||
void QgsVectorLayer3DRenderer::readXml( const QDomElement &elem, const QgsReadWriteContext &context )
|
||||
{
|
||||
mLayerRef = QgsMapLayerRef( elem.attribute( "layer" ) );
|
||||
mLayerRef = QgsMapLayerRef( elem.attribute( QStringLiteral( "layer" ) ) );
|
||||
|
||||
QDomElement elemSymbol = elem.firstChildElement( "symbol" );
|
||||
QString symbolType = elemSymbol.attribute( "type" );
|
||||
QDomElement elemSymbol = elem.firstChildElement( QStringLiteral( "symbol" ) );
|
||||
QString symbolType = elemSymbol.attribute( QStringLiteral( "type" ) );
|
||||
QgsAbstract3DSymbol *symbol = nullptr;
|
||||
if ( symbolType == "polygon" )
|
||||
if ( symbolType == QLatin1String( "polygon" ) )
|
||||
symbol = new QgsPolygon3DSymbol;
|
||||
else if ( symbolType == "point" )
|
||||
else if ( symbolType == QLatin1String( "point" ) )
|
||||
symbol = new QgsPoint3DSymbol;
|
||||
else if ( symbolType == "line" )
|
||||
else if ( symbolType == QLatin1String( "line" ) )
|
||||
symbol = new QgsLine3DSymbol;
|
||||
|
||||
if ( symbol )
|
||||
|
@ -33,7 +33,7 @@ void QgsLine3DSymbol::writeXml( QDomElement &elem, const QgsReadWriteContext &co
|
||||
elemDataProperties.setAttribute( QStringLiteral( "alt-binding" ), Qgs3DUtils::altBindingToString( mAltBinding ) );
|
||||
elemDataProperties.setAttribute( QStringLiteral( "height" ), mHeight );
|
||||
elemDataProperties.setAttribute( QStringLiteral( "extrusion-height" ), mExtrusionHeight );
|
||||
elemDataProperties.setAttribute( QStringLiteral( "simple-lines" ), mRenderAsSimpleLines ? "1" : "0" );
|
||||
elemDataProperties.setAttribute( QStringLiteral( "simple-lines" ), mRenderAsSimpleLines ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
|
||||
elemDataProperties.setAttribute( QStringLiteral( "width" ), mWidth );
|
||||
elem.appendChild( elemDataProperties );
|
||||
|
||||
@ -52,7 +52,7 @@ void QgsLine3DSymbol::readXml( const QDomElement &elem, const QgsReadWriteContex
|
||||
mHeight = elemDataProperties.attribute( QStringLiteral( "height" ) ).toFloat();
|
||||
mExtrusionHeight = elemDataProperties.attribute( QStringLiteral( "extrusion-height" ) ).toFloat();
|
||||
mWidth = elemDataProperties.attribute( QStringLiteral( "width" ) ).toFloat();
|
||||
mRenderAsSimpleLines = elemDataProperties.attribute( QStringLiteral( "simple-lines" ), "0" ).toInt();
|
||||
mRenderAsSimpleLines = elemDataProperties.attribute( QStringLiteral( "simple-lines" ), QStringLiteral( "0" ) ).toInt();
|
||||
|
||||
QDomElement elemMaterial = elem.firstChildElement( QStringLiteral( "material" ) );
|
||||
mMaterial.readXml( elemMaterial );
|
||||
|
@ -85,7 +85,7 @@ void QgsLine3DSymbolEntity::addEntityForNotSelectedLines( const Qgs3DMapSettings
|
||||
|
||||
// build the entity
|
||||
QgsLine3DSymbolEntityNode *entity = new QgsLine3DSymbolEntityNode( map, layer, symbol, req );
|
||||
entity->findChild<Qt3DRender::QGeometryRenderer *>()->setObjectName( "main" ); // temporary measure to distinguish between "selected" and "main"
|
||||
entity->findChild<Qt3DRender::QGeometryRenderer *>()->setObjectName( QStringLiteral( "main" ) ); // temporary measure to distinguish between "selected" and "main"
|
||||
entity->addComponent( mat );
|
||||
entity->setParent( this );
|
||||
}
|
||||
@ -212,7 +212,7 @@ Qt3DRender::QGeometryRenderer *QgsLine3DSymbolEntityNode::rendererSimple( const
|
||||
vertexBufferData.resize( vertices.size() * 3 * sizeof( float ) );
|
||||
float *rawVertexArray = reinterpret_cast<float *>( vertexBufferData.data() );
|
||||
int idx = 0;
|
||||
for ( const auto &v : vertices )
|
||||
for ( const auto &v : qgis::as_const( vertices ) )
|
||||
{
|
||||
rawVertexArray[idx++] = v.x();
|
||||
rawVertexArray[idx++] = v.y();
|
||||
@ -223,7 +223,7 @@ Qt3DRender::QGeometryRenderer *QgsLine3DSymbolEntityNode::rendererSimple( const
|
||||
indexBufferData.resize( indexes.size() * sizeof( int ) );
|
||||
unsigned int *rawIndexArray = reinterpret_cast<unsigned int *>( indexBufferData.data() );
|
||||
idx = 0;
|
||||
for ( unsigned int indexVal : indexes )
|
||||
for ( unsigned int indexVal : qgis::as_const( indexes ) )
|
||||
{
|
||||
rawIndexArray[idx++] = indexVal;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ void QgsPoint3DSymbol::writeXml( QDomElement &elem, const QgsReadWriteContext &c
|
||||
elem.setAttribute( QStringLiteral( "shape" ), shapeToString( mShape ) );
|
||||
|
||||
QVariantMap shapePropertiesCopy( mShapeProperties );
|
||||
shapePropertiesCopy["model"] = QVariant( context.pathResolver().writePath( shapePropertiesCopy["model"].toString() ) );
|
||||
shapePropertiesCopy[QStringLiteral( "model" )] = QVariant( context.pathResolver().writePath( shapePropertiesCopy[QStringLiteral( "model" )].toString() ) );
|
||||
|
||||
QDomElement elemShapeProperties = doc.createElement( QStringLiteral( "shape-properties" ) );
|
||||
elemShapeProperties.appendChild( QgsXmlUtils::writeVariant( shapePropertiesCopy, doc ) );
|
||||
@ -62,7 +62,7 @@ void QgsPoint3DSymbol::readXml( const QDomElement &elem, const QgsReadWriteConte
|
||||
|
||||
QDomElement elemShapeProperties = elem.firstChildElement( QStringLiteral( "shape-properties" ) );
|
||||
mShapeProperties = QgsXmlUtils::readVariant( elemShapeProperties.firstChildElement() ).toMap();
|
||||
mShapeProperties["model"] = QVariant( context.pathResolver().readPath( mShapeProperties["model"].toString() ) );
|
||||
mShapeProperties[QStringLiteral( "model" )] = QVariant( context.pathResolver().readPath( mShapeProperties[QStringLiteral( "model" )].toString() ) );
|
||||
|
||||
QDomElement elemTransform = elem.firstChildElement( QStringLiteral( "transform" ) );
|
||||
mTransform = Qgs3DUtils::stringToMatrix4x4( elemTransform.attribute( QStringLiteral( "matrix" ) ) );
|
||||
|
@ -69,15 +69,15 @@ QgsPoint3DSymbolEntity::QgsPoint3DSymbolEntity( const Qgs3DMapSettings &map, Qgs
|
||||
Qt3DRender::QMaterial *QgsPoint3DSymbolInstancedEntityFactory::material( const QgsPoint3DSymbol &symbol )
|
||||
{
|
||||
Qt3DRender::QFilterKey *filterKey = new Qt3DRender::QFilterKey;
|
||||
filterKey->setName( "renderingStyle" );
|
||||
filterKey->setName( QStringLiteral( "renderingStyle" ) );
|
||||
filterKey->setValue( "forward" );
|
||||
|
||||
// the fragment shader implements a simplified version of phong shading that uses hardcoded light
|
||||
// (instead of whatever light we have defined in the scene)
|
||||
// TODO: use phong shading that respects lights from the scene
|
||||
Qt3DRender::QShaderProgram *shaderProgram = new Qt3DRender::QShaderProgram;
|
||||
shaderProgram->setVertexShaderCode( Qt3DRender::QShaderProgram::loadSource( QUrl( "qrc:/shaders/instanced.vert" ) ) );
|
||||
shaderProgram->setFragmentShaderCode( Qt3DRender::QShaderProgram::loadSource( QUrl( "qrc:/shaders/instanced.frag" ) ) );
|
||||
shaderProgram->setVertexShaderCode( Qt3DRender::QShaderProgram::loadSource( QUrl( QStringLiteral( "qrc:/shaders/instanced.vert" ) ) ) );
|
||||
shaderProgram->setFragmentShaderCode( Qt3DRender::QShaderProgram::loadSource( QUrl( QStringLiteral( "qrc:/shaders/instanced.frag" ) ) ) );
|
||||
|
||||
Qt3DRender::QRenderPass *renderPass = new Qt3DRender::QRenderPass;
|
||||
renderPass->setShaderProgram( shaderProgram );
|
||||
@ -112,11 +112,11 @@ Qt3DRender::QMaterial *QgsPoint3DSymbolInstancedEntityFactory::material( const Q
|
||||
0, 0, 0, 0 );
|
||||
|
||||
Qt3DRender::QParameter *paramInst = new Qt3DRender::QParameter;
|
||||
paramInst->setName( "inst" );
|
||||
paramInst->setName( QStringLiteral( "inst" ) );
|
||||
paramInst->setValue( transformMatrix );
|
||||
|
||||
Qt3DRender::QParameter *paramInstNormal = new Qt3DRender::QParameter;
|
||||
paramInstNormal->setName( "instNormal" );
|
||||
paramInstNormal->setName( QStringLiteral( "instNormal" ) );
|
||||
paramInstNormal->setValue( normalMatrix4 );
|
||||
|
||||
Qt3DRender::QEffect *effect = new Qt3DRender::QEffect;
|
||||
@ -143,9 +143,9 @@ void QgsPoint3DSymbolInstancedEntityFactory::addEntityForSelectedPoints( const Q
|
||||
// update the material with selection colors
|
||||
Q_FOREACH ( Qt3DRender::QParameter *param, mat->effect()->parameters() )
|
||||
{
|
||||
if ( param->name() == "kd" ) // diffuse
|
||||
if ( param->name() == QLatin1String( "kd" ) ) // diffuse
|
||||
param->setValue( map.selectionColor() );
|
||||
else if ( param->name() == "ka" ) // ambient
|
||||
else if ( param->name() == QLatin1String( "ka" ) ) // ambient
|
||||
param->setValue( map.selectionColor().darker() );
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ Qt3DRender::QGeometryRenderer *QgsPoint3DSymbolInstancedEntityNode::renderer( co
|
||||
instanceBuffer->setData( ba );
|
||||
|
||||
Qt3DRender::QAttribute *instanceDataAttribute = new Qt3DRender::QAttribute;
|
||||
instanceDataAttribute->setName( "pos" );
|
||||
instanceDataAttribute->setName( QStringLiteral( "pos" ) );
|
||||
instanceDataAttribute->setAttributeType( Qt3DRender::QAttribute::VertexAttribute );
|
||||
instanceDataAttribute->setVertexBaseType( Qt3DRender::QAttribute::Float );
|
||||
instanceDataAttribute->setVertexSize( 3 );
|
||||
@ -231,8 +231,8 @@ Qt3DRender::QGeometry *QgsPoint3DSymbolInstancedEntityNode::symbolGeometry( QgsP
|
||||
{
|
||||
case QgsPoint3DSymbol::Cylinder:
|
||||
{
|
||||
float radius = shapeProperties["radius"].toFloat();
|
||||
float length = shapeProperties["length"].toFloat();
|
||||
float radius = shapeProperties[QStringLiteral( "radius" )].toFloat();
|
||||
float length = shapeProperties[QStringLiteral( "length" )].toFloat();
|
||||
Qt3DExtras::QCylinderGeometry *g = new Qt3DExtras::QCylinderGeometry;
|
||||
//g->setRings(2); // how many vertices vertically
|
||||
//g->setSlices(8); // how many vertices on circumference
|
||||
@ -243,7 +243,7 @@ Qt3DRender::QGeometry *QgsPoint3DSymbolInstancedEntityNode::symbolGeometry( QgsP
|
||||
|
||||
case QgsPoint3DSymbol::Sphere:
|
||||
{
|
||||
float radius = shapeProperties["radius"].toFloat();
|
||||
float radius = shapeProperties[QStringLiteral( "radius" )].toFloat();
|
||||
Qt3DExtras::QSphereGeometry *g = new Qt3DExtras::QSphereGeometry;
|
||||
g->setRadius( radius ? radius : 10 );
|
||||
return g;
|
||||
@ -251,9 +251,9 @@ Qt3DRender::QGeometry *QgsPoint3DSymbolInstancedEntityNode::symbolGeometry( QgsP
|
||||
|
||||
case QgsPoint3DSymbol::Cone:
|
||||
{
|
||||
float length = shapeProperties["length"].toFloat();
|
||||
float bottomRadius = shapeProperties["bottomRadius"].toFloat();
|
||||
float topRadius = shapeProperties["topRadius"].toFloat();
|
||||
float length = shapeProperties[QStringLiteral( "length" )].toFloat();
|
||||
float bottomRadius = shapeProperties[QStringLiteral( "bottomRadius" )].toFloat();
|
||||
float topRadius = shapeProperties[QStringLiteral( "topRadius" )].toFloat();
|
||||
Qt3DExtras::QConeGeometry *g = new Qt3DExtras::QConeGeometry;
|
||||
g->setLength( length ? length : 10 );
|
||||
g->setBottomRadius( bottomRadius );
|
||||
@ -265,7 +265,7 @@ Qt3DRender::QGeometry *QgsPoint3DSymbolInstancedEntityNode::symbolGeometry( QgsP
|
||||
|
||||
case QgsPoint3DSymbol::Cube:
|
||||
{
|
||||
float size = shapeProperties["size"].toFloat();
|
||||
float size = shapeProperties[QStringLiteral( "size" )].toFloat();
|
||||
Qt3DExtras::QCuboidGeometry *g = new Qt3DExtras::QCuboidGeometry;
|
||||
g->setXExtent( size ? size : 10 );
|
||||
g->setYExtent( size ? size : 10 );
|
||||
@ -275,8 +275,8 @@ Qt3DRender::QGeometry *QgsPoint3DSymbolInstancedEntityNode::symbolGeometry( QgsP
|
||||
|
||||
case QgsPoint3DSymbol::Torus:
|
||||
{
|
||||
float radius = shapeProperties["radius"].toFloat();
|
||||
float minorRadius = shapeProperties["minorRadius"].toFloat();
|
||||
float radius = shapeProperties[QStringLiteral( "radius" )].toFloat();
|
||||
float minorRadius = shapeProperties[QStringLiteral( "minorRadius" )].toFloat();
|
||||
Qt3DExtras::QTorusGeometry *g = new Qt3DExtras::QTorusGeometry;
|
||||
g->setRadius( radius ? radius : 10 );
|
||||
g->setMinorRadius( minorRadius ? minorRadius : 5 );
|
||||
@ -285,7 +285,7 @@ Qt3DRender::QGeometry *QgsPoint3DSymbolInstancedEntityNode::symbolGeometry( QgsP
|
||||
|
||||
case QgsPoint3DSymbol::Plane:
|
||||
{
|
||||
float size = shapeProperties["size"].toFloat();
|
||||
float size = shapeProperties[QStringLiteral( "size" )].toFloat();
|
||||
Qt3DExtras::QPlaneGeometry *g = new Qt3DExtras::QPlaneGeometry;
|
||||
g->setWidth( size ? size : 10 );
|
||||
g->setHeight( size ? size : 10 );
|
||||
@ -295,8 +295,8 @@ Qt3DRender::QGeometry *QgsPoint3DSymbolInstancedEntityNode::symbolGeometry( QgsP
|
||||
#if QT_VERSION >= 0x050900
|
||||
case QgsPoint3DSymbol::ExtrudedText:
|
||||
{
|
||||
float depth = shapeProperties["depth"].toFloat();
|
||||
QString text = shapeProperties["text"].toString();
|
||||
float depth = shapeProperties[QStringLiteral( "depth" )].toFloat();
|
||||
QString text = shapeProperties[QStringLiteral( "text" )].toString();
|
||||
Qt3DExtras::QExtrudedTextGeometry *g = new Qt3DExtras::QExtrudedTextGeometry;
|
||||
g->setDepth( depth ? depth : 1 );
|
||||
g->setText( text );
|
||||
@ -346,7 +346,7 @@ void QgsPoint3DSymbolModelEntityFactory::addEntitiesForNotSelectedPoints( const
|
||||
notSelected.subtract( layer->selectedFeatureIds() );
|
||||
req.setFilterFids( notSelected );
|
||||
|
||||
if ( symbol.shapeProperties()["overwriteMaterial"].toBool() )
|
||||
if ( symbol.shapeProperties()[QStringLiteral( "overwriteMaterial" )].toBool() )
|
||||
{
|
||||
addMeshEntities( map, layer, req, symbol, parent, false );
|
||||
}
|
||||
@ -364,7 +364,7 @@ void QgsPoint3DSymbolModelEntityFactory::addSceneEntities( const Qgs3DMapSetting
|
||||
// build the entity
|
||||
Qt3DCore::QEntity *entity = new Qt3DCore::QEntity;
|
||||
|
||||
QUrl url = QUrl::fromLocalFile( symbol.shapeProperties()["model"].toString() );
|
||||
QUrl url = QUrl::fromLocalFile( symbol.shapeProperties()[QStringLiteral( "model" )].toString() );
|
||||
Qt3DRender::QSceneLoader *modelLoader = new Qt3DRender::QSceneLoader;
|
||||
modelLoader->setSource( url );
|
||||
|
||||
@ -392,7 +392,7 @@ void QgsPoint3DSymbolModelEntityFactory::addMeshEntities( const Qgs3DMapSettings
|
||||
// build the entity
|
||||
Qt3DCore::QEntity *entity = new Qt3DCore::QEntity;
|
||||
|
||||
QUrl url = QUrl::fromLocalFile( symbol.shapeProperties()["model"].toString() );
|
||||
QUrl url = QUrl::fromLocalFile( symbol.shapeProperties()[QStringLiteral( "model" )].toString() );
|
||||
Qt3DRender::QMesh *mesh = new Qt3DRender::QMesh;
|
||||
mesh->setSource( url );
|
||||
|
||||
@ -403,7 +403,7 @@ void QgsPoint3DSymbolModelEntityFactory::addMeshEntities( const Qgs3DMapSettings
|
||||
}
|
||||
}
|
||||
|
||||
Qt3DCore::QTransform *QgsPoint3DSymbolModelEntityFactory::transform( const QVector3D &position, const QgsPoint3DSymbol &symbol )
|
||||
Qt3DCore::QTransform *QgsPoint3DSymbolModelEntityFactory::transform( QVector3D position, const QgsPoint3DSymbol &symbol )
|
||||
{
|
||||
Qt3DCore::QTransform *tr = new Qt3DCore::QTransform;
|
||||
tr->setMatrix( symbol.transform() );
|
||||
|
@ -78,7 +78,7 @@ class QgsPoint3DSymbolModelEntityFactory
|
||||
static void addSceneEntities( const Qgs3DMapSettings &map, QgsVectorLayer *layer, const QgsFeatureRequest &req, const QgsPoint3DSymbol &symbol, QgsPoint3DSymbolEntity *parent );
|
||||
static void addMeshEntities( const Qgs3DMapSettings &map, QgsVectorLayer *layer, const QgsFeatureRequest &req, const QgsPoint3DSymbol &symbol, QgsPoint3DSymbolEntity *parent, bool are_selected );
|
||||
|
||||
static Qt3DCore::QTransform *transform( const QVector3D &position, const QgsPoint3DSymbol &symbol );
|
||||
static Qt3DCore::QTransform *transform( QVector3D position, const QgsPoint3DSymbol &symbol );
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
|
@ -34,8 +34,8 @@ void QgsPolygon3DSymbol::writeXml( QDomElement &elem, const QgsReadWriteContext
|
||||
elemDataProperties.setAttribute( QStringLiteral( "height" ), mHeight );
|
||||
elemDataProperties.setAttribute( QStringLiteral( "extrusion-height" ), mExtrusionHeight );
|
||||
elemDataProperties.setAttribute( QStringLiteral( "culling-mode" ), Qgs3DUtils::cullingModeToString( mCullingMode ) );
|
||||
elemDataProperties.setAttribute( QStringLiteral( "invert-normals" ), mInvertNormals ? "1" : "0" );
|
||||
elemDataProperties.setAttribute( QStringLiteral( "add-back-faces" ), mAddBackFaces ? "1" : "0" );
|
||||
elemDataProperties.setAttribute( QStringLiteral( "invert-normals" ), mInvertNormals ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
|
||||
elemDataProperties.setAttribute( QStringLiteral( "add-back-faces" ), mAddBackFaces ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
|
||||
elem.appendChild( elemDataProperties );
|
||||
|
||||
QDomElement elemMaterial = doc.createElement( QStringLiteral( "material" ) );
|
||||
|
@ -101,7 +101,7 @@ void QgsPolygon3DSymbolEntity::addEntityForNotSelectedPolygons( const Qgs3DMapSe
|
||||
|
||||
// build the entity
|
||||
QgsPolygon3DSymbolEntityNode *entity = new QgsPolygon3DSymbolEntityNode( map, layer, symbol, req );
|
||||
entity->findChild<Qt3DRender::QGeometryRenderer *>()->setObjectName( "main" ); // temporary measure to distinguish between "selected" and "main"
|
||||
entity->findChild<Qt3DRender::QGeometryRenderer *>()->setObjectName( QStringLiteral( "main" ) ); // temporary measure to distinguish between "selected" and "main"
|
||||
entity->addComponent( mat );
|
||||
entity->addComponent( tform );
|
||||
entity->setParent( this );
|
||||
|
@ -71,18 +71,18 @@ float QgsDemTerrainGenerator::heightAt( double x, double y, const Qgs3DMapSettin
|
||||
|
||||
void QgsDemTerrainGenerator::writeXml( QDomElement &elem ) const
|
||||
{
|
||||
elem.setAttribute( "layer", mLayer.layerId );
|
||||
elem.setAttribute( "resolution", mResolution );
|
||||
elem.setAttribute( "skirt-height", mSkirtHeight );
|
||||
elem.setAttribute( QStringLiteral( "layer" ), mLayer.layerId );
|
||||
elem.setAttribute( QStringLiteral( "resolution" ), mResolution );
|
||||
elem.setAttribute( QStringLiteral( "skirt-height" ), mSkirtHeight );
|
||||
|
||||
// crs is not read/written - it should be the same as destination crs of the map
|
||||
}
|
||||
|
||||
void QgsDemTerrainGenerator::readXml( const QDomElement &elem )
|
||||
{
|
||||
mLayer = QgsMapLayerRef( elem.attribute( "layer" ) );
|
||||
mResolution = elem.attribute( "resolution" ).toInt();
|
||||
mSkirtHeight = elem.attribute( "skirt-height" ).toFloat();
|
||||
mLayer = QgsMapLayerRef( elem.attribute( QStringLiteral( "layer" ) ) );
|
||||
mResolution = elem.attribute( QStringLiteral( "resolution" ) ).toInt();
|
||||
mSkirtHeight = elem.attribute( QStringLiteral( "skirt-height" ) ).toFloat();
|
||||
|
||||
// crs is not read/written - it should be the same as destination crs of the map
|
||||
}
|
||||
|
@ -16,29 +16,14 @@
|
||||
#include "qgsflatterraingenerator.h"
|
||||
|
||||
#include <Qt3DRender/QGeometryRenderer>
|
||||
#include <Qt3DExtras/QPlaneGeometry>
|
||||
|
||||
#include "qgs3dmapsettings.h"
|
||||
#include "qgschunknode_p.h"
|
||||
#include "qgsterrainentity_p.h"
|
||||
#include "qgsterraintileloader_p.h"
|
||||
#include "qgsterraintileentity_p.h"
|
||||
|
||||
/// @cond PRIVATE
|
||||
|
||||
//! Chunk loader for flat terrain implementation
|
||||
class FlatTerrainChunkLoader : public QgsTerrainTileLoader
|
||||
{
|
||||
public:
|
||||
//! Construct the loader for a node
|
||||
FlatTerrainChunkLoader( QgsTerrainEntity *terrain, QgsChunkNode *mNode );
|
||||
|
||||
Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
|
||||
|
||||
private:
|
||||
Qt3DExtras::QPlaneGeometry *mTileGeometry = nullptr;
|
||||
};
|
||||
|
||||
|
||||
//---------------
|
||||
|
||||
@ -125,9 +110,9 @@ void QgsFlatTerrainGenerator::rootChunkHeightRange( float &hMin, float &hMax ) c
|
||||
void QgsFlatTerrainGenerator::writeXml( QDomElement &elem ) const
|
||||
{
|
||||
QgsRectangle r = mExtent;
|
||||
QDomElement elemExtent = elem.ownerDocument().createElement( "extent" );
|
||||
elemExtent.setAttribute( "xmin", QString::number( r.xMinimum() ) );
|
||||
elemExtent.setAttribute( "xmax", QString::number( r.xMaximum() ) );
|
||||
QDomElement elemExtent = elem.ownerDocument().createElement( QStringLiteral( "extent" ) );
|
||||
elemExtent.setAttribute( QStringLiteral( "xmin" ), QString::number( r.xMinimum() ) );
|
||||
elemExtent.setAttribute( QStringLiteral( "xmax" ), QString::number( r.xMaximum() ) );
|
||||
elemExtent.setAttribute( "ymin", QString::number( r.yMinimum() ) );
|
||||
elemExtent.setAttribute( "ymax", QString::number( r.yMaximum() ) );
|
||||
|
||||
@ -136,9 +121,9 @@ void QgsFlatTerrainGenerator::writeXml( QDomElement &elem ) const
|
||||
|
||||
void QgsFlatTerrainGenerator::readXml( const QDomElement &elem )
|
||||
{
|
||||
QDomElement elemExtent = elem.firstChildElement( "extent" );
|
||||
double xmin = elemExtent.attribute( "xmin" ).toDouble();
|
||||
double xmax = elemExtent.attribute( "xmax" ).toDouble();
|
||||
QDomElement elemExtent = elem.firstChildElement( QStringLiteral( "extent" ) );
|
||||
double xmin = elemExtent.attribute( QStringLiteral( "xmin" ) ).toDouble();
|
||||
double xmax = elemExtent.attribute( QStringLiteral( "xmax" ) ).toDouble();
|
||||
double ymin = elemExtent.attribute( "ymin" ).toDouble();
|
||||
double ymax = elemExtent.attribute( "ymax" ).toDouble();
|
||||
|
||||
|
@ -19,9 +19,28 @@
|
||||
#include "qgis_3d.h"
|
||||
|
||||
#include "qgsterraingenerator.h"
|
||||
|
||||
#include "qgsterraintileloader_p.h"
|
||||
#include "qgsrectangle.h"
|
||||
#include <Qt3DExtras/QPlaneGeometry>
|
||||
|
||||
///@cond PRIVATE
|
||||
|
||||
//! Chunk loader for flat terrain implementation
|
||||
class FlatTerrainChunkLoader : public QgsTerrainTileLoader
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Construct the loader for a node
|
||||
FlatTerrainChunkLoader( QgsTerrainEntity *terrain, QgsChunkNode *mNode );
|
||||
|
||||
Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
|
||||
|
||||
private:
|
||||
Qt3DExtras::QPlaneGeometry *mTileGeometry = nullptr;
|
||||
};
|
||||
|
||||
///@endcond
|
||||
|
||||
/**
|
||||
* \ingroup 3d
|
||||
|
@ -61,11 +61,11 @@ QString QgsTerrainGenerator::typeToString( QgsTerrainGenerator::Type type )
|
||||
switch ( type )
|
||||
{
|
||||
case QgsTerrainGenerator::Flat:
|
||||
return "flat";
|
||||
return QStringLiteral( "flat" );
|
||||
case QgsTerrainGenerator::Dem:
|
||||
return "dem";
|
||||
return QStringLiteral( "dem" );
|
||||
case QgsTerrainGenerator::QuantizedMesh:
|
||||
return "quantized-mesh";
|
||||
return QStringLiteral( "quantized-mesh" );
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ QgsTerrainTileLoader::QgsTerrainTileLoader( QgsTerrainEntity *terrain, QgsChunkN
|
||||
|
||||
QgsRectangle extentTerrainCrs = map.terrainGenerator()->tilingScheme().tileToExtent( tx, ty, tz );
|
||||
mExtentMapCrs = terrain->terrainToMapTransform().transformBoundingBox( extentTerrainCrs );
|
||||
mTileDebugText = QString( "%1 | %2 | %3" ).arg( tx ).arg( ty ).arg( tz );
|
||||
mTileDebugText = QStringLiteral( "%1 | %2 | %3" ).arg( tx ).arg( ty ).arg( tz );
|
||||
}
|
||||
|
||||
void QgsTerrainTileLoader::loadTexture()
|
||||
|
@ -44,6 +44,8 @@ class QgsTerrainTileEntity;
|
||||
*/
|
||||
class QgsTerrainTileLoader : public QgsChunkLoader
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructs loader for a chunk node
|
||||
QgsTerrainTileLoader( QgsTerrainEntity *terrain, QgsChunkNode *mNode );
|
||||
|
@ -94,7 +94,7 @@ bool QgsImportPhotosAlgorithm::extractGeoTagFromMetadata( const QVariantMap &met
|
||||
if ( !ok )
|
||||
return false;
|
||||
|
||||
if ( metadata.value( QStringLiteral( "EXIF_GPSLongitudeRef" ) ).toString().right( 1 ).compare( "W", Qt::CaseInsensitive ) == 0
|
||||
if ( metadata.value( QStringLiteral( "EXIF_GPSLongitudeRef" ) ).toString().right( 1 ).compare( QLatin1String( "W" ), Qt::CaseInsensitive ) == 0
|
||||
|| metadata.value( QStringLiteral( "EXIF_GPSLongitudeRef" ) ).toDouble() < 0 )
|
||||
x = -x;
|
||||
}
|
||||
@ -111,7 +111,7 @@ bool QgsImportPhotosAlgorithm::extractGeoTagFromMetadata( const QVariantMap &met
|
||||
if ( !ok )
|
||||
return false;
|
||||
|
||||
if ( metadata.value( QStringLiteral( "EXIF_GPSLatitudeRef" ) ).toString().right( 1 ).compare( "S", Qt::CaseInsensitive ) == 0
|
||||
if ( metadata.value( QStringLiteral( "EXIF_GPSLatitudeRef" ) ).toString().right( 1 ).compare( QLatin1String( "S" ), Qt::CaseInsensitive ) == 0
|
||||
|| metadata.value( QStringLiteral( "EXIF_GPSLatitudeRef" ) ).toDouble() < 0 )
|
||||
y = -y;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ bool QgsRotateFeaturesAlgorithm::prepareAlgorithm( const QVariantMap ¶meters
|
||||
if ( mDynamicAngle )
|
||||
mAngleProperty = parameters.value( QStringLiteral( "ANGLE" ) ).value< QgsProperty >();
|
||||
|
||||
mUseAnchor = parameters.value( "ANCHOR" ).isValid();
|
||||
mUseAnchor = parameters.value( QStringLiteral( "ANCHOR" ) ).isValid();
|
||||
if ( mUseAnchor )
|
||||
{
|
||||
mAnchor = parameterAsPoint( parameters, QStringLiteral( "ANCHOR" ), context );
|
||||
|
@ -116,8 +116,8 @@ QVariantMap QgsShortestPathLayerToPointAlgorithm::processAlgorithm( const QVaria
|
||||
if ( tree.at( idxEnd ) == -1 )
|
||||
{
|
||||
feedback->reportError( QObject::tr( "There is no route from start point (%1) to end point (%2)." )
|
||||
.arg( points[i].toString() )
|
||||
.arg( endPoint.toString() ) );
|
||||
.arg( points[i].toString(),
|
||||
endPoint.toString() ) );
|
||||
feat.clearGeometry();
|
||||
attributes = sourceAttributes.value( i );
|
||||
attributes.append( points[i].toString() );
|
||||
|
@ -114,8 +114,8 @@ QVariantMap QgsShortestPathPointToLayerAlgorithm::processAlgorithm( const QVaria
|
||||
if ( tree.at( idxEnd ) == -1 )
|
||||
{
|
||||
feedback->reportError( QObject::tr( "There is no route from start point (%1) to end point (%2)." )
|
||||
.arg( startPoint.toString() )
|
||||
.arg( points[i].toString() ) );
|
||||
.arg( startPoint.toString(),
|
||||
points[i].toString() ) );
|
||||
feat.clearGeometry();
|
||||
attributes = sourceAttributes.value( i );
|
||||
attributes.append( QVariant() );
|
||||
|
@ -59,7 +59,7 @@ int QgsNineCellFilter::processRaster( QgsFeedback *feedback )
|
||||
}
|
||||
catch ( cl::Error &e )
|
||||
{
|
||||
QString err = QObject::tr( "Error running OpenCL program: %1 - %2" ).arg( e.what( ) ).arg( QgsOpenClUtils::errorText( e.err( ) ) );
|
||||
QString err = QObject::tr( "Error running OpenCL program: %1 - %2" ).arg( e.what( ), QgsOpenClUtils::errorText( e.err( ) ) );
|
||||
QgsMessageLog::logMessage( err, QgsOpenClUtils::LOGMESSAGE_TAG, Qgis::Critical );
|
||||
throw QgsProcessingException( err );
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ void QgsGeometryCheck::deleteFeatureGeometryRing( const QMap<QString, QgsFeature
|
||||
}
|
||||
}
|
||||
|
||||
double QgsGeometryCheck::scaleFactor( QPointer<QgsVectorLayer> layer ) const
|
||||
double QgsGeometryCheck::scaleFactor( const QPointer<QgsVectorLayer> &layer ) const
|
||||
{
|
||||
double scaleFactor = 1.0;
|
||||
|
||||
|
@ -253,7 +253,7 @@ class ANALYSIS_EXPORT QgsGeometryCheck
|
||||
const QgsGeometryCheckContext *mContext;
|
||||
QVariantMap mConfiguration;
|
||||
|
||||
double scaleFactor( QPointer<QgsVectorLayer> layer ) const SIP_SKIP;
|
||||
double scaleFactor( const QPointer<QgsVectorLayer> &layer ) const SIP_SKIP;
|
||||
};
|
||||
|
||||
#endif // QGS_GEOMETRY_CHECK_H
|
||||
|
@ -74,7 +74,7 @@ const QgsGeometry &QgsGeometryCheckerUtils::LayerFeature::geometry() const
|
||||
|
||||
QString QgsGeometryCheckerUtils::LayerFeature::id() const
|
||||
{
|
||||
return QString( "%1:%2" ).arg( layer()->name() ).arg( mFeature.id() );
|
||||
return QStringLiteral( "%1:%2" ).arg( layer()->name() ).arg( mFeature.id() );
|
||||
}
|
||||
|
||||
bool QgsGeometryCheckerUtils::LayerFeature::operator==( const LayerFeature &other ) const
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
QgsGeometryCheckRegistry::~QgsGeometryCheckRegistry()
|
||||
{
|
||||
qDeleteAll( mGeometryCheckFactories.values() );
|
||||
qDeleteAll( mGeometryCheckFactories );
|
||||
}
|
||||
|
||||
QgsGeometryCheck *QgsGeometryCheckRegistry::geometryCheck( const QString &checkId, QgsGeometryCheckContext *context, const QVariantMap &geometryCheckConfig )
|
||||
|
@ -28,11 +28,12 @@ QString QgsGeometryDuplicateCheckError::duplicatesString( const QMap<QString, Qg
|
||||
{
|
||||
str.append( featurePools[it.key()]->layer()->name() + ":" );
|
||||
QStringList ids;
|
||||
ids.reserve( it.value().length() );
|
||||
for ( QgsFeatureId id : it.value() )
|
||||
{
|
||||
ids.append( QString::number( id ) );
|
||||
}
|
||||
str.back() += ids.join( "," );
|
||||
str.back() += ids.join( ',' );
|
||||
}
|
||||
return str.join( QStringLiteral( "; " ) );
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
QgsGeometryGapCheck::QgsGeometryGapCheck( const QgsGeometryCheckContext *context, const QVariantMap &configuration )
|
||||
: QgsGeometryCheck( context, configuration )
|
||||
, mGapThresholdMapUnits( configuration.value( "gapThreshold" ).toDouble() )
|
||||
, mGapThresholdMapUnits( configuration.value( QStringLiteral( "gapThreshold" ) ).toDouble() )
|
||||
|
||||
{
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
QgsGeometryOverlapCheck::QgsGeometryOverlapCheck( const QgsGeometryCheckContext *context, const QVariantMap &configuration )
|
||||
: QgsGeometryCheck( context, configuration )
|
||||
, mOverlapThresholdMapUnits( configurationValue<double>( "maxOverlapArea" ) )
|
||||
, mOverlapThresholdMapUnits( configurationValue<double>( QStringLiteral( "maxOverlapArea" ) ) )
|
||||
|
||||
{
|
||||
|
||||
|
@ -244,7 +244,7 @@ static bool snapLineString( QgsLineString *linestring, QgsSpatialIndex &index, Q
|
||||
if ( !newVerticesAlongSegment.isEmpty() )
|
||||
{
|
||||
// sort by distance along the segment
|
||||
std::sort( newVerticesAlongSegment.begin(), newVerticesAlongSegment.end(), []( const AnchorAlongSegment & p1, const AnchorAlongSegment & p2 )
|
||||
std::sort( newVerticesAlongSegment.begin(), newVerticesAlongSegment.end(), []( AnchorAlongSegment p1, AnchorAlongSegment p2 )
|
||||
{
|
||||
return ( p1.along < p2.along ? -1 : ( p1.along > p2.along ) );
|
||||
} );
|
||||
|
@ -81,44 +81,44 @@ Qgs3DAnimationSettings::Keyframe Qgs3DAnimationSettings::interpolate( float time
|
||||
|
||||
void Qgs3DAnimationSettings::readXml( const QDomElement &elem )
|
||||
{
|
||||
mEasingCurve = QEasingCurve( ( QEasingCurve::Type ) elem.attribute( "interpolation", "0" ).toInt() );
|
||||
mEasingCurve = QEasingCurve( ( QEasingCurve::Type ) elem.attribute( QStringLiteral( "interpolation" ), QStringLiteral( "0" ) ).toInt() );
|
||||
|
||||
mKeyframes.clear();
|
||||
|
||||
QDomElement elemKeyframes = elem.firstChildElement( "keyframes" );
|
||||
QDomElement elemKeyframe = elemKeyframes.firstChildElement( "keyframe" );
|
||||
QDomElement elemKeyframes = elem.firstChildElement( QStringLiteral( "keyframes" ) );
|
||||
QDomElement elemKeyframe = elemKeyframes.firstChildElement( QStringLiteral( "keyframe" ) );
|
||||
while ( !elemKeyframe.isNull() )
|
||||
{
|
||||
Keyframe kf;
|
||||
kf.time = elemKeyframe.attribute( "time" ).toFloat();
|
||||
kf.point.set( elemKeyframe.attribute( "x" ).toDouble(),
|
||||
elemKeyframe.attribute( "y" ).toDouble(),
|
||||
elemKeyframe.attribute( "z" ).toDouble() );
|
||||
kf.dist = elemKeyframe.attribute( "dist" ).toFloat();
|
||||
kf.pitch = elemKeyframe.attribute( "pitch" ).toFloat();
|
||||
kf.yaw = elemKeyframe.attribute( "yaw" ).toFloat();
|
||||
kf.time = elemKeyframe.attribute( QStringLiteral( "time" ) ).toFloat();
|
||||
kf.point.set( elemKeyframe.attribute( QStringLiteral( "x" ) ).toDouble(),
|
||||
elemKeyframe.attribute( QStringLiteral( "y" ) ).toDouble(),
|
||||
elemKeyframe.attribute( QStringLiteral( "z" ) ).toDouble() );
|
||||
kf.dist = elemKeyframe.attribute( QStringLiteral( "dist" ) ).toFloat();
|
||||
kf.pitch = elemKeyframe.attribute( QStringLiteral( "pitch" ) ).toFloat();
|
||||
kf.yaw = elemKeyframe.attribute( QStringLiteral( "yaw" ) ).toFloat();
|
||||
mKeyframes.append( kf );
|
||||
elemKeyframe = elemKeyframe.nextSiblingElement( "keyframe" );
|
||||
elemKeyframe = elemKeyframe.nextSiblingElement( QStringLiteral( "keyframe" ) );
|
||||
}
|
||||
}
|
||||
|
||||
QDomElement Qgs3DAnimationSettings::writeXml( QDomDocument &doc ) const
|
||||
{
|
||||
QDomElement elem = doc.createElement( "animation3d" );
|
||||
elem.setAttribute( "interpolation", mEasingCurve.type() );
|
||||
QDomElement elem = doc.createElement( QStringLiteral( "animation3d" ) );
|
||||
elem.setAttribute( QStringLiteral( "interpolation" ), mEasingCurve.type() );
|
||||
|
||||
QDomElement elemKeyframes = doc.createElement( "keyframes" );
|
||||
QDomElement elemKeyframes = doc.createElement( QStringLiteral( "keyframes" ) );
|
||||
|
||||
for ( const Keyframe &keyframe : mKeyframes )
|
||||
{
|
||||
QDomElement elemKeyframe = doc.createElement( "keyframe" );
|
||||
elemKeyframe.setAttribute( "time", keyframe.time );
|
||||
elemKeyframe.setAttribute( "x", keyframe.point.x() );
|
||||
elemKeyframe.setAttribute( "y", keyframe.point.y() );
|
||||
elemKeyframe.setAttribute( "z", keyframe.point.z() );
|
||||
elemKeyframe.setAttribute( "dist", keyframe.dist );
|
||||
elemKeyframe.setAttribute( "pitch", keyframe.pitch );
|
||||
elemKeyframe.setAttribute( "yaw", keyframe.yaw );
|
||||
QDomElement elemKeyframe = doc.createElement( QStringLiteral( "keyframe" ) );
|
||||
elemKeyframe.setAttribute( QStringLiteral( "time" ), keyframe.time );
|
||||
elemKeyframe.setAttribute( QStringLiteral( "x" ), keyframe.point.x() );
|
||||
elemKeyframe.setAttribute( QStringLiteral( "y" ), keyframe.point.y() );
|
||||
elemKeyframe.setAttribute( QStringLiteral( "z" ), keyframe.point.z() );
|
||||
elemKeyframe.setAttribute( QStringLiteral( "dist" ), keyframe.dist );
|
||||
elemKeyframe.setAttribute( QStringLiteral( "pitch" ), keyframe.pitch );
|
||||
elemKeyframe.setAttribute( QStringLiteral( "yaw" ), keyframe.yaw );
|
||||
elemKeyframes.appendChild( elemKeyframe );
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ void Qgs3DAnimationWidget::setAnimation( const Qgs3DAnimationSettings &animSetti
|
||||
cboKeyframe->addItem( tr( "<none>" ) );
|
||||
for ( const Qgs3DAnimationSettings::Keyframe &keyframe : animSettings.keyFrames() )
|
||||
{
|
||||
cboKeyframe->addItem( QString( "%1 s" ).arg( keyframe.time ) );
|
||||
cboKeyframe->addItem( QStringLiteral( "%1 s" ).arg( keyframe.time ) );
|
||||
int lastIndex = cboKeyframe->count() - 1;
|
||||
cboKeyframe->setItemData( lastIndex, QVariant::fromValue<Qgs3DAnimationSettings::Keyframe>( keyframe ), Qt::UserRole + 1 );
|
||||
}
|
||||
@ -269,7 +269,7 @@ void Qgs3DAnimationWidget::onAddKeyframe()
|
||||
kf.pitch = mCameraController->pitch();
|
||||
kf.yaw = mCameraController->yaw();
|
||||
|
||||
cboKeyframe->insertItem( index + 1, QString( "%1 s" ).arg( kf.time ) );
|
||||
cboKeyframe->insertItem( index + 1, QStringLiteral( "%1 s" ).arg( kf.time ) );
|
||||
cboKeyframe->setItemData( index + 1, QVariant::fromValue<Qgs3DAnimationSettings::Keyframe>( kf ), Qt::UserRole + 1 );
|
||||
|
||||
initializeController( animation() );
|
||||
@ -312,7 +312,7 @@ void Qgs3DAnimationWidget::onEditKeyframe()
|
||||
|
||||
kf.time = t;
|
||||
|
||||
cboKeyframe->insertItem( newIndex + 1, QString( "%1 s" ).arg( kf.time ) );
|
||||
cboKeyframe->insertItem( newIndex + 1, QStringLiteral( "%1 s" ).arg( kf.time ) );
|
||||
cboKeyframe->setItemData( newIndex + 1, QVariant::fromValue<Qgs3DAnimationSettings::Keyframe>( kf ), Qt::UserRole + 1 );
|
||||
|
||||
initializeController( animation() );
|
||||
@ -338,7 +338,7 @@ void Qgs3DAnimationWidget::onDuplicateKeyframe()
|
||||
|
||||
kf.time = t;
|
||||
|
||||
cboKeyframe->insertItem( newIndex + 1, QString( "%1 s" ).arg( kf.time ) );
|
||||
cboKeyframe->insertItem( newIndex + 1, QStringLiteral( "%1 s" ).arg( kf.time ) );
|
||||
cboKeyframe->setItemData( newIndex + 1, QVariant::fromValue<Qgs3DAnimationSettings::Keyframe>( kf ), Qt::UserRole + 1 );
|
||||
|
||||
initializeController( animation() );
|
||||
|
@ -164,5 +164,5 @@ void Qgs3DMapConfigWidget::updateMaxZoomLevel()
|
||||
|
||||
double tile0width = tGen->extent().width();
|
||||
int zoomLevel = Qgs3DUtils::maxZoomLevel( tile0width, spinMapResolution->value(), spinGroundError->value() );
|
||||
labelZoomLevels->setText( QString( "0 - %1" ).arg( zoomLevel ) );
|
||||
labelZoomLevels->setText( QStringLiteral( "0 - %1" ).arg( zoomLevel ) );
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "qgs3dmapscene.h"
|
||||
#include "qgs3dutils.h"
|
||||
#include "qgsterrainentity_p.h"
|
||||
#include "qgsvector3d.h"
|
||||
|
||||
#include "qgisapp.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
@ -42,7 +43,9 @@ class Qgs3DMapToolIdentifyPickHandler : public Qgs3DMapScenePickHandler
|
||||
|
||||
void Qgs3DMapToolIdentifyPickHandler::handlePickOnVectorLayer( QgsVectorLayer *vlayer, QgsFeatureId id, const QVector3D &worldIntersection )
|
||||
{
|
||||
QgsVector3D mapCoords = Qgs3DUtils::worldToMapCoordinates( worldIntersection, mIdentifyTool->mCanvas->map()->origin() );
|
||||
QgsVector3D mapCoords = Qgs3DUtils::worldToMapCoordinates( QgsVector3D( worldIntersection.x(),
|
||||
worldIntersection.y(),
|
||||
worldIntersection.z() ), mIdentifyTool->mCanvas->map()->origin() );
|
||||
QgsPoint pt( mapCoords.x(), mapCoords.y(), mapCoords.z() );
|
||||
|
||||
QgsMapToolIdentifyAction *identifyTool2D = QgisApp::instance()->identifyMapTool();
|
||||
@ -93,7 +96,10 @@ void Qgs3DMapToolIdentify::onTerrainPicked( Qt3DRender::QPickEvent *event )
|
||||
if ( event->button() != Qt3DRender::QPickEvent::LeftButton )
|
||||
return;
|
||||
|
||||
QgsVector3D mapCoords = Qgs3DUtils::worldToMapCoordinates( event->worldIntersection(), mCanvas->map()->origin() );
|
||||
const QVector3D worldIntersection = event->worldIntersection();
|
||||
QgsVector3D mapCoords = Qgs3DUtils::worldToMapCoordinates( QgsVector3D( worldIntersection.x(),
|
||||
worldIntersection.y(),
|
||||
worldIntersection.z() ), mCanvas->map()->origin() );
|
||||
QgsPointXY mapPoint( mapCoords.x(), mapCoords.y() );
|
||||
|
||||
// estimate search radius
|
||||
|
@ -107,30 +107,30 @@ void QgsPoint3DSymbolWidget::setSymbol( const QgsPoint3DSymbol &symbol )
|
||||
switch ( cboShape->currentIndex() )
|
||||
{
|
||||
case 0: // sphere
|
||||
spinRadius->setValue( vm["radius"].toDouble() );
|
||||
spinRadius->setValue( vm[QStringLiteral( "radius" )].toDouble() );
|
||||
break;
|
||||
case 1: // cylinder
|
||||
spinRadius->setValue( vm["radius"].toDouble() );
|
||||
spinLength->setValue( vm["length"].toDouble() );
|
||||
spinRadius->setValue( vm[QStringLiteral( "radius" )].toDouble() );
|
||||
spinLength->setValue( vm[QStringLiteral( "length" )].toDouble() );
|
||||
break;
|
||||
case 2: // cube
|
||||
spinSize->setValue( vm["size"].toDouble() );
|
||||
spinSize->setValue( vm[QStringLiteral( "size" )].toDouble() );
|
||||
break;
|
||||
case 3: // cone
|
||||
spinTopRadius->setValue( vm["topRadius"].toDouble() );
|
||||
spinBottomRadius->setValue( vm["bottomRadius"].toDouble() );
|
||||
spinLength->setValue( vm["length"].toDouble() );
|
||||
spinTopRadius->setValue( vm[QStringLiteral( "topRadius" )].toDouble() );
|
||||
spinBottomRadius->setValue( vm[QStringLiteral( "bottomRadius" )].toDouble() );
|
||||
spinLength->setValue( vm[QStringLiteral( "length" )].toDouble() );
|
||||
break;
|
||||
case 4: // plane
|
||||
spinSize->setValue( vm["size"].toDouble() );
|
||||
spinSize->setValue( vm[QStringLiteral( "size" )].toDouble() );
|
||||
break;
|
||||
case 5: // torus
|
||||
spinRadius->setValue( vm["radius"].toDouble() );
|
||||
spinMinorRadius->setValue( vm["minorRadius"].toDouble() );
|
||||
spinRadius->setValue( vm[QStringLiteral( "radius" )].toDouble() );
|
||||
spinMinorRadius->setValue( vm[QStringLiteral( "minorRadius" )].toDouble() );
|
||||
break;
|
||||
case 6: // 3d model
|
||||
lineEditModel->setText( vm["model"].toString() );
|
||||
bool overwriteMaterial = vm["overwriteMaterial"].toBool();
|
||||
lineEditModel->setText( vm[QStringLiteral( "model" )].toString() );
|
||||
bool overwriteMaterial = vm[QStringLiteral( "overwriteMaterial" )].toBool();
|
||||
widgetMaterial->setEnabled( overwriteMaterial );
|
||||
cbOverwriteMaterial->setChecked( overwriteMaterial );
|
||||
break;
|
||||
@ -172,30 +172,30 @@ QgsPoint3DSymbol QgsPoint3DSymbolWidget::symbol() const
|
||||
switch ( cboShape->currentIndex() )
|
||||
{
|
||||
case 0: // sphere
|
||||
vm["radius"] = spinRadius->value();
|
||||
vm[QStringLiteral( "radius" )] = spinRadius->value();
|
||||
break;
|
||||
case 1: // cylinder
|
||||
vm["radius"] = spinRadius->value();
|
||||
vm["length"] = spinLength->value();
|
||||
vm[QStringLiteral( "radius" )] = spinRadius->value();
|
||||
vm[QStringLiteral( "length" )] = spinLength->value();
|
||||
break;
|
||||
case 2: // cube
|
||||
vm["size"] = spinSize->value();
|
||||
vm[QStringLiteral( "size" )] = spinSize->value();
|
||||
break;
|
||||
case 3: // cone
|
||||
vm["topRadius"] = spinTopRadius->value();
|
||||
vm["bottomRadius"] = spinBottomRadius->value();
|
||||
vm["length"] = spinLength->value();
|
||||
vm[QStringLiteral( "topRadius" )] = spinTopRadius->value();
|
||||
vm[QStringLiteral( "bottomRadius" )] = spinBottomRadius->value();
|
||||
vm[QStringLiteral( "length" )] = spinLength->value();
|
||||
break;
|
||||
case 4: // plane
|
||||
vm["size"] = spinSize->value();
|
||||
vm[QStringLiteral( "size" )] = spinSize->value();
|
||||
break;
|
||||
case 5: // torus
|
||||
vm["radius"] = spinRadius->value();
|
||||
vm["minorRadius"] = spinMinorRadius->value();
|
||||
vm[QStringLiteral( "radius" )] = spinRadius->value();
|
||||
vm[QStringLiteral( "minorRadius" )] = spinMinorRadius->value();
|
||||
break;
|
||||
case 6: // model
|
||||
vm["model"] = lineEditModel->text();
|
||||
vm["overwriteMaterial"] = cbOverwriteMaterial->isChecked();
|
||||
vm[QStringLiteral( "model" )] = lineEditModel->text();
|
||||
vm[QStringLiteral( "overwriteMaterial" )] = cbOverwriteMaterial->isChecked();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ void QgsVectorLayer3DRendererWidget::setLayer( QgsVectorLayer *layer )
|
||||
mLayer = layer;
|
||||
|
||||
QgsAbstract3DRenderer *r = layer->renderer3D();
|
||||
if ( r && r->type() == "vector" )
|
||||
if ( r && r->type() == QLatin1String( "vector" ) )
|
||||
{
|
||||
QgsVectorLayer3DRenderer *vectorRenderer = static_cast<QgsVectorLayer3DRenderer *>( r );
|
||||
setRenderer( vectorRenderer );
|
||||
@ -88,7 +88,7 @@ void QgsVectorLayer3DRendererWidget::setRenderer( const QgsVectorLayer3DRenderer
|
||||
{
|
||||
case QgsWkbTypes::PointGeometry:
|
||||
pageIndex = 2;
|
||||
if ( mRenderer && mRenderer->symbol() && mRenderer->symbol()->type() == "point" )
|
||||
if ( mRenderer && mRenderer->symbol() && mRenderer->symbol()->type() == QLatin1String( "point" ) )
|
||||
{
|
||||
whileBlocking( widgetPoint )->setSymbol( *static_cast<const QgsPoint3DSymbol *>( mRenderer->symbol() ) );
|
||||
}
|
||||
@ -100,7 +100,7 @@ void QgsVectorLayer3DRendererWidget::setRenderer( const QgsVectorLayer3DRenderer
|
||||
|
||||
case QgsWkbTypes::LineGeometry:
|
||||
pageIndex = 1;
|
||||
if ( mRenderer && mRenderer->symbol() && mRenderer->symbol()->type() == "line" )
|
||||
if ( mRenderer && mRenderer->symbol() && mRenderer->symbol()->type() == QLatin1String( "line" ) )
|
||||
{
|
||||
whileBlocking( widgetLine )->setSymbol( *static_cast<const QgsLine3DSymbol *>( mRenderer->symbol() ) );
|
||||
}
|
||||
@ -112,7 +112,7 @@ void QgsVectorLayer3DRendererWidget::setRenderer( const QgsVectorLayer3DRenderer
|
||||
|
||||
case QgsWkbTypes::PolygonGeometry:
|
||||
pageIndex = 3;
|
||||
if ( mRenderer && mRenderer->symbol() && mRenderer->symbol()->type() == "polygon" )
|
||||
if ( mRenderer && mRenderer->symbol() && mRenderer->symbol()->type() == QLatin1String( "polygon" ) )
|
||||
{
|
||||
whileBlocking( widgetPolygon )->setSymbol( *static_cast<const QgsPolygon3DSymbol *>( mRenderer->symbol() ), vlayer );
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ void QgsLayoutAtlasWidget::updateGuiElements()
|
||||
mAtlasFilenamePatternEdit->setText( mAtlas->filenameExpression() );
|
||||
mAtlasHideCoverageCheckBox->setCheckState( mAtlas->hideCoverage() ? Qt::Checked : Qt::Unchecked );
|
||||
|
||||
bool singleFile = mLayout->customProperty( "singleFile", true ).toBool();
|
||||
bool singleFile = mLayout->customProperty( QStringLiteral( "singleFile" ), true ).toBool();
|
||||
mAtlasSingleFileCheckBox->setCheckState( singleFile ? Qt::Checked : Qt::Unchecked );
|
||||
mAtlasFilenamePatternEdit->setEnabled( !singleFile );
|
||||
mAtlasFilenameExpressionButton->setEnabled( !singleFile );
|
||||
|
@ -231,7 +231,7 @@ void QgsLayoutManagerDialog::mAddButton_clicked()
|
||||
{
|
||||
QDomElement layoutElem = templateDoc.documentElement();
|
||||
if ( !layoutElem.isNull() )
|
||||
storedTitle = layoutElem.attribute( "name" );
|
||||
storedTitle = layoutElem.attribute( QStringLiteral( "name" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1425,7 +1425,7 @@ void QgsLayoutMapWidget::mOverviewListWidget_itemChanged( QListWidgetItem *item
|
||||
return;
|
||||
}
|
||||
|
||||
mMapItem->beginCommand( "Rename Overview" );
|
||||
mMapItem->beginCommand( QStringLiteral( "Rename Overview" ) );
|
||||
overview->setName( item->text() );
|
||||
mMapItem->endCommand();
|
||||
if ( item->isSelected() )
|
||||
|
@ -70,7 +70,7 @@ QVariant QgsReportSectionModel::data( const QModelIndex &index, int role ) const
|
||||
QPixmap pixmap( icon.pixmap( 16, 16 ) );
|
||||
|
||||
QPainter painter( &pixmap );
|
||||
painter.drawPixmap( 0, 0, 16, 16, QgsApplication::getThemePixmap( "/mActionToggleEditing.svg" ) );
|
||||
painter.drawPixmap( 0, 0, 16, 16, QgsApplication::getThemePixmap( QStringLiteral( "/mActionToggleEditing.svg" ) ) );
|
||||
painter.end();
|
||||
|
||||
return QIcon( pixmap );
|
||||
|
@ -278,7 +278,7 @@ void QgsActiveLayerFeaturesLocatorFilter::fetchResults( const QString &string, c
|
||||
if ( attrString.contains( string, Qt::CaseInsensitive ) )
|
||||
{
|
||||
if ( idx < mAttributeAliases.count() )
|
||||
result.displayString = QString( "%1 (%2)" ).arg( attrString, mAttributeAliases[idx] );
|
||||
result.displayString = QStringLiteral( "%1 (%2)" ).arg( attrString, mAttributeAliases[idx] );
|
||||
else
|
||||
result.displayString = attrString;
|
||||
break;
|
||||
@ -518,8 +518,8 @@ void QgsSettingsLocatorFilter::fetchResults( const QString &string, const QgsLoc
|
||||
QMap<QString, QString> QgsSettingsLocatorFilter::settingsPage( const QString &type, const QString &page )
|
||||
{
|
||||
QMap<QString, QString> returnPage;
|
||||
returnPage.insert( "type", type );
|
||||
returnPage.insert( "page", page );
|
||||
returnPage.insert( QStringLiteral( "type" ), type );
|
||||
returnPage.insert( QStringLiteral( "page" ), page );
|
||||
return returnPage;
|
||||
}
|
||||
|
||||
@ -527,18 +527,18 @@ void QgsSettingsLocatorFilter::triggerResult( const QgsLocatorResult &result )
|
||||
{
|
||||
|
||||
QMap<QString, QString> settingsPage = qvariant_cast<QMap<QString, QString>>( result.userData );
|
||||
QString type = settingsPage.value( "type" );
|
||||
QString page = settingsPage.value( "page" );
|
||||
QString type = settingsPage.value( QStringLiteral( "type" ) );
|
||||
QString page = settingsPage.value( QStringLiteral( "page" ) );
|
||||
|
||||
if ( type == "optionpage" )
|
||||
if ( type == QLatin1String( "optionpage" ) )
|
||||
{
|
||||
QgisApp::instance()->showOptionsDialog( QgisApp::instance(), page );
|
||||
}
|
||||
else if ( type == "projectpropertypage" )
|
||||
else if ( type == QLatin1String( "projectpropertypage" ) )
|
||||
{
|
||||
QgisApp::instance()->showProjectProperties( page );
|
||||
}
|
||||
else if ( type == "settingspage" )
|
||||
else if ( type == QLatin1String( "settingspage" ) )
|
||||
{
|
||||
QgisApp::instance()->showSettings( page );
|
||||
}
|
||||
|
@ -973,7 +973,7 @@ int main( int argc, char *argv[] )
|
||||
QgsApplication myApp( argc, argv, myUseGuiFlag );
|
||||
|
||||
// Settings migration is only supported on the default profile for now.
|
||||
if ( profileName == "default" )
|
||||
if ( profileName == QLatin1String( "default" ) )
|
||||
{
|
||||
// Note: this flag is ka version number so that we can reset it once we change the version.
|
||||
// Note2: Is this a good idea can we do it better.
|
||||
|
@ -1401,7 +1401,7 @@ void QgsPluginManager::buttonInstallFromZip_clicked()
|
||||
if ( !showInstallFromZipWarning || msgbox.result() == QMessageBox::Yes )
|
||||
{
|
||||
QgsPythonRunner::run( QStringLiteral( "pyplugin_installer.instance().installFromZipFile(r'%1')" ).arg( mZipFileWidget->filePath() ) );
|
||||
mZipFileWidget->setFilePath( "" );
|
||||
mZipFileWidget->setFilePath( QLatin1String( "" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,7 +481,7 @@ static void setTitleBarText_( QWidget &qgisApp )
|
||||
}
|
||||
if ( !caption.isEmpty() )
|
||||
{
|
||||
caption += " - ";
|
||||
caption += QLatin1String( " - " );
|
||||
}
|
||||
if ( QgsProject::instance()->isDirty() )
|
||||
caption.prepend( '*' );
|
||||
@ -3198,7 +3198,7 @@ void QgisApp::setTheme( const QString &themeName )
|
||||
mActionAddMssqlLayer->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddMssqlLayer.svg" ) ) );
|
||||
mActionAddDb2Layer->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddDb2Layer.svg" ) ) );
|
||||
#ifdef HAVE_ORACLE
|
||||
mActionAddOracleLayer->setIcon( QgsApplication::getThemeIcon( "/mActionAddOracleLayer.svg" ) );
|
||||
mActionAddOracleLayer->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddOracleLayer.svg" ) ) );
|
||||
#endif
|
||||
mActionRemoveLayer->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionRemoveLayer.svg" ) ) );
|
||||
mActionDuplicateLayer->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDuplicateLayer.svg" ) ) );
|
||||
@ -3743,7 +3743,7 @@ QgsMapCanvasDockWidget *QgisApp::createNewMapCanvasDock( const QString &name )
|
||||
}
|
||||
|
||||
|
||||
void QgisApp::setupDockWidget( QDockWidget *dockWidget, bool isFloating, const QRect &dockGeometry, Qt::DockWidgetArea area )
|
||||
void QgisApp::setupDockWidget( QDockWidget *dockWidget, bool isFloating, QRect dockGeometry, Qt::DockWidgetArea area )
|
||||
{
|
||||
dockWidget->setFloating( isFloating );
|
||||
if ( dockGeometry.isEmpty() )
|
||||
@ -4034,7 +4034,7 @@ void QgisApp::createMapTips()
|
||||
// set the delay to 0.850 seconds or time defined in the Settings
|
||||
// timer will be started next time the mouse moves
|
||||
QgsSettings settings;
|
||||
int timerInterval = settings.value( "qgis/mapTipsDelay", 850 ).toInt();
|
||||
int timerInterval = settings.value( QStringLiteral( "qgis/mapTipsDelay" ), 850 ).toInt();
|
||||
mpMapTipsTimer->setInterval( timerInterval );
|
||||
mpMapTipsTimer->setSingleShot( true );
|
||||
|
||||
@ -4458,7 +4458,7 @@ static void setupVectorLayer( const QString &vectorLayerPath,
|
||||
const QStringList &sublayers,
|
||||
QgsVectorLayer *&layer,
|
||||
const QString &providerKey,
|
||||
const QgsVectorLayer::LayerOptions &options )
|
||||
QgsVectorLayer::LayerOptions options )
|
||||
{
|
||||
//set friendly name for datasources with only one layer
|
||||
QgsSettings settings;
|
||||
@ -4492,7 +4492,7 @@ static void setupVectorLayer( const QString &vectorLayerPath,
|
||||
{
|
||||
auto uriParts = QgsProviderRegistry::instance()->decodeUri(
|
||||
layer->providerType(), layer->dataProvider()->dataSourceUri() );
|
||||
QString composedURI( uriParts.value( QLatin1String( "path" ) ).toString() );
|
||||
QString composedURI( uriParts.value( QStringLiteral( "path" ) ).toString() );
|
||||
composedURI += "|layername=" + rawLayerName;
|
||||
|
||||
auto newLayer = qgis::make_unique<QgsVectorLayer>( composedURI, layer->name(), QStringLiteral( "ogr" ), options );
|
||||
@ -5027,7 +5027,7 @@ void QgisApp::askUserForOGRSublayers( QgsVectorLayer *layer )
|
||||
|
||||
auto uriParts = QgsProviderRegistry::instance()->decodeUri(
|
||||
layer->providerType(), layer->dataProvider()->dataSourceUri() );
|
||||
QString uri( uriParts.value( QLatin1String( "path" ) ).toString() );
|
||||
QString uri( uriParts.value( QStringLiteral( "path" ) ).toString() );
|
||||
|
||||
// The uri must contain the actual uri of the vectorLayer from which we are
|
||||
// going to load the sublayers.
|
||||
@ -10249,29 +10249,29 @@ QMap< QString, QString > QgisApp::settingPagesMap()
|
||||
{
|
||||
if ( mSettingPagesMap.isEmpty() )
|
||||
{
|
||||
mSettingPagesMap.insert( tr( "Style Manager" ), "stylemanager" );
|
||||
mSettingPagesMap.insert( tr( "Keyboard Shortcuts" ), "shortcuts" );
|
||||
mSettingPagesMap.insert( tr( "Custom Projections" ), "customprojection" );
|
||||
mSettingPagesMap.insert( tr( "Interface Customization" ), "customize" );
|
||||
mSettingPagesMap.insert( tr( "Style Manager" ), QStringLiteral( "stylemanager" ) );
|
||||
mSettingPagesMap.insert( tr( "Keyboard Shortcuts" ), QStringLiteral( "shortcuts" ) );
|
||||
mSettingPagesMap.insert( tr( "Custom Projections" ), QStringLiteral( "customprojection" ) );
|
||||
mSettingPagesMap.insert( tr( "Interface Customization" ), QStringLiteral( "customize" ) );
|
||||
}
|
||||
return mSettingPagesMap;
|
||||
}
|
||||
|
||||
void QgisApp::showSettings( const QString &page )
|
||||
{
|
||||
if ( page == "stylemanager" )
|
||||
if ( page == QLatin1String( "stylemanager" ) )
|
||||
{
|
||||
showStyleManager();
|
||||
}
|
||||
else if ( page == "shortcuts" )
|
||||
else if ( page == QLatin1String( "shortcuts" ) )
|
||||
{
|
||||
configureShortcuts();
|
||||
}
|
||||
else if ( page == "customprojection" )
|
||||
else if ( page == QLatin1String( "customprojection" ) )
|
||||
{
|
||||
customProjection();
|
||||
}
|
||||
else if ( page == "customize" )
|
||||
else if ( page == QLatin1String( "customize" ) )
|
||||
{
|
||||
customize();
|
||||
}
|
||||
|
@ -1937,7 +1937,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
|
||||
* The \a isFloating and \a dockGeometry arguments can be used to specify an initial floating state
|
||||
* and widget geometry rect for the dock.
|
||||
*/
|
||||
void setupDockWidget( QDockWidget *dockWidget, bool isFloating = false, const QRect &dockGeometry = QRect(),
|
||||
void setupDockWidget( QDockWidget *dockWidget, bool isFloating = false, QRect dockGeometry = QRect(),
|
||||
Qt::DockWidgetArea area = Qt::RightDockWidgetArea );
|
||||
|
||||
/**
|
||||
|
@ -52,9 +52,9 @@ QgsAppScreenShots::QgsAppScreenShots( const QString &saveDirectory )
|
||||
|
||||
// add join
|
||||
QgsVectorLayerJoinInfo join;
|
||||
join.setTargetFieldName( "fk_polygon" );
|
||||
join.setTargetFieldName( QStringLiteral( "fk_polygon" ) );
|
||||
join.setJoinLayer( mPolygonLayer );
|
||||
join.setJoinFieldName( "pk" );
|
||||
join.setJoinFieldName( QStringLiteral( "pk" ) );
|
||||
join.setUsingMemoryCache( true );
|
||||
join.setEditable( true );
|
||||
join.setCascadedDelete( true );
|
||||
@ -148,7 +148,7 @@ void QgsAppScreenShots::saveScreenshot( QPixmap &pixmap, const QString &name, co
|
||||
const QDir topDirectory( mSaveDirectory );
|
||||
if ( !topDirectory.exists() )
|
||||
{
|
||||
QgsMessageLog::logMessage( QString( "Directory does not exist: %1" ).arg( mSaveDirectory ), QString(), Qgis::Critical );
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Directory does not exist: %1" ).arg( mSaveDirectory ), QString(), Qgis::Critical );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -158,14 +158,14 @@ void QgsAppScreenShots::saveScreenshot( QPixmap &pixmap, const QString &name, co
|
||||
{
|
||||
if ( !topDirectory.mkpath( folder ) )
|
||||
{
|
||||
QgsMessageLog::logMessage( QString( "Could not create directory %1 in %2" ).arg( folder, mSaveDirectory ), QString(), Qgis::Critical );
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Could not create directory %1 in %2" ).arg( folder, mSaveDirectory ), QString(), Qgis::Critical );
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ( pixmap.save( fileName ) )
|
||||
QgsMessageLog::logMessage( QString( "Screenshot saved: %1" ).arg( fileName ) );
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Screenshot saved: %1" ).arg( fileName ) );
|
||||
else
|
||||
QgsMessageLog::logMessage( QString( "Failed to save screenshot: %1" ).arg( fileName ), QString(), Qgis::Critical );
|
||||
QgsMessageLog::logMessage( QStringLiteral( "Failed to save screenshot: %1" ).arg( fileName ), QString(), Qgis::Critical );
|
||||
}
|
||||
|
||||
void QgsAppScreenShots::moveWidgetTo( QWidget *widget, Qt::Corner corner, Reference reference )
|
||||
@ -235,7 +235,7 @@ void QgsAppScreenShots::setGradientSize( int size )
|
||||
|
||||
void QgsAppScreenShots::takeVectorLayerProperties()
|
||||
{
|
||||
QString folder = QLatin1String( "working_with_vector/img/auto_generated/vector_layer_properties" );
|
||||
QString folder = QStringLiteral( "working_with_vector/img/auto_generated/vector_layer_properties" );
|
||||
QgsVectorLayerProperties *dlg = new QgsVectorLayerProperties( mLineLayer, QgisApp::instance() );
|
||||
dlg->show();
|
||||
dlg->mJoinTreeWidget->expandAll(); // expand join tree
|
||||
@ -247,7 +247,7 @@ void QgsAppScreenShots::takeVectorLayerProperties()
|
||||
dlg->adjustSize();
|
||||
QCoreApplication::processEvents();
|
||||
QString name = dlg->mOptionsListWidget->item( row )[0].text().toLower();
|
||||
name.replace( " ", "_" ).replace( "&", "and" );
|
||||
name.replace( QLatin1String( " " ), QLatin1String( "_" ) ).replace( QLatin1String( "&" ), QLatin1String( "and" ) );
|
||||
takeScreenshot( name, folder, dlg );
|
||||
}
|
||||
// ------------------
|
||||
@ -258,7 +258,7 @@ void QgsAppScreenShots::takeVectorLayerProperties()
|
||||
QCoreApplication::processEvents();
|
||||
dlg->mBtnStyle->click();
|
||||
QCoreApplication::processEvents();
|
||||
takeScreenshot( "style_menu", folder, dlg );
|
||||
takeScreenshot( QStringLiteral( "style_menu" ), folder, dlg );
|
||||
QCoreApplication::processEvents();
|
||||
dlg->mBtnStyle->menu()->hide();
|
||||
QCoreApplication::processEvents();
|
||||
@ -272,7 +272,7 @@ void QgsAppScreenShots::takeVectorLayerProperties()
|
||||
|
||||
void QgsAppScreenShots::takeVectorLayerProperties25DSymbol()
|
||||
{
|
||||
QString folder = QLatin1String( "working_with_vector/img/auto_generated/vector_layer_properties/" );
|
||||
QString folder = QStringLiteral( "working_with_vector/img/auto_generated/vector_layer_properties/" );
|
||||
QgsVectorLayerProperties *dlg = new QgsVectorLayerProperties( mPolygonLayer, QgisApp::instance() );
|
||||
dlg->show();
|
||||
dlg->mOptionsListWidget->setCurrentRow( 2 );
|
||||
@ -283,14 +283,14 @@ void QgsAppScreenShots::takeVectorLayerProperties25DSymbol()
|
||||
dlg->mRendererDialog->cboRenderers->setCurrentIndex( idx );
|
||||
QCoreApplication::processEvents();
|
||||
Qgs25DRendererWidget *w = dynamic_cast<Qgs25DRendererWidget *>( dlg->mRendererDialog->mActiveWidget );
|
||||
w->mHeightWidget->setField( QLatin1String( "height" ) );
|
||||
w->mHeightWidget->setField( QStringLiteral( "height" ) );
|
||||
Q_ASSERT( w->mHeightWidget->expression() == QLatin1String( "\"height\"" ) );
|
||||
QCoreApplication::processEvents();
|
||||
dlg->adjustSize();
|
||||
QCoreApplication::processEvents();
|
||||
int cropHeight = w->mAdvancedConfigurationBox->mapTo( dlg, w->mAdvancedConfigurationBox->frameGeometry().bottomLeft() ).y();
|
||||
QPixmap pixmap = takeScreenshot( dlg, GrabWidgetAndFrame, QRect( 0, 0, 0, cropHeight ), true );
|
||||
saveScreenshot( pixmap, QLatin1String( "25dsymbol" ), folder );
|
||||
saveScreenshot( pixmap, QStringLiteral( "25dsymbol" ), folder );
|
||||
|
||||
// exit properly
|
||||
dlg->close();
|
||||
@ -301,7 +301,7 @@ void QgsAppScreenShots::takeVectorLayerProperties25DSymbol()
|
||||
|
||||
void QgsAppScreenShots::takeGlobalOptions()
|
||||
{
|
||||
QString folder = QLatin1String( "introduction/img/auto_generated/global_options/" );
|
||||
QString folder = QStringLiteral( "introduction/img/auto_generated/global_options/" );
|
||||
QgsOptions *dlg = QgisApp::instance()->createOptionsDialog();
|
||||
dlg->setMinimumHeight( 600 );
|
||||
dlg->show();
|
||||
@ -312,7 +312,7 @@ void QgsAppScreenShots::takeGlobalOptions()
|
||||
dlg->adjustSize();
|
||||
QCoreApplication::processEvents();
|
||||
QString name = dlg->mOptionsListWidget->item( row )[0].text().toLower();
|
||||
name.replace( " ", "_" ).replace( "&", "and" );
|
||||
name.replace( QLatin1String( " " ), QLatin1String( "_" ) ).replace( QLatin1String( "&" ), QLatin1String( "and" ) );
|
||||
takeScreenshot( name, folder, dlg );
|
||||
}
|
||||
// -----------------
|
||||
@ -335,7 +335,7 @@ void QgsAppScreenShots::takeGlobalOptions()
|
||||
|
||||
void QgsAppScreenShots::takeRasterLayerProperties()
|
||||
{
|
||||
QString folder = QLatin1String( "working_with_raster/img/auto_generated/raster_layer_properties" );
|
||||
QString folder = QStringLiteral( "working_with_raster/img/auto_generated/raster_layer_properties" );
|
||||
QgsRasterLayerProperties *dlg = new QgsRasterLayerProperties( mRasterLayer, QgisApp::instance()->mapCanvas() );
|
||||
dlg->show();
|
||||
// ----------------
|
||||
@ -346,7 +346,7 @@ void QgsAppScreenShots::takeRasterLayerProperties()
|
||||
dlg->adjustSize();
|
||||
QCoreApplication::processEvents();
|
||||
QString name = dlg->mOptionsListWidget->item( row )[0].text().toLower();
|
||||
name.replace( " ", "_" ).replace( "&", "and" );
|
||||
name.replace( QLatin1String( " " ), QLatin1String( "_" ) ).replace( QLatin1String( "&" ), QLatin1String( "and" ) );
|
||||
takeScreenshot( name, folder, dlg );
|
||||
}
|
||||
// exit properly
|
||||
|
@ -91,7 +91,7 @@ void QgsAttributesFormProperties::initAvailableWidgetsTree()
|
||||
|
||||
//load Fields
|
||||
|
||||
DnDTreeItemData catItemData = DnDTreeItemData( DnDTreeItemData::Container, "Fields", "Fields" );
|
||||
DnDTreeItemData catItemData = DnDTreeItemData( DnDTreeItemData::Container, QStringLiteral( "Fields" ), QStringLiteral( "Fields" ) );
|
||||
QTreeWidgetItem *catitem = mAvailableWidgetsTree->addItem( mAvailableWidgetsTree->invisibleRootItem(), catItemData );
|
||||
|
||||
const QgsFields fields = mLayer->fields();
|
||||
@ -845,15 +845,15 @@ QTreeWidgetItem *DnDTree::addItem( QTreeWidgetItem *parent, QgsAttributesFormPro
|
||||
switch ( data.type() )
|
||||
{
|
||||
case QgsAttributesFormProperties::DnDTreeItemData::Field:
|
||||
newItem->setIcon( 0, QgsApplication::getThemeIcon( "/mFieldIcon.svg" ) );
|
||||
newItem->setIcon( 0, QgsApplication::getThemeIcon( QStringLiteral( "/mFieldIcon.svg" ) ) );
|
||||
break;
|
||||
|
||||
case QgsAttributesFormProperties::DnDTreeItemData::Relation:
|
||||
newItem->setIcon( 0, QgsApplication::getThemeIcon( "/mRelationIcon.svg" ) );
|
||||
newItem->setIcon( 0, QgsApplication::getThemeIcon( QStringLiteral( "/mRelationIcon.svg" ) ) );
|
||||
break;
|
||||
|
||||
case QgsAttributesFormProperties::DnDTreeItemData::Container:
|
||||
newItem->setIcon( 0, QgsApplication::getThemeIcon( "/mContainerIcon.svg" ) );
|
||||
newItem->setIcon( 0, QgsApplication::getThemeIcon( QStringLiteral( "/mContainerIcon.svg" ) ) );
|
||||
break;
|
||||
|
||||
case QgsAttributesFormProperties::DnDTreeItemData::QmlWidget:
|
||||
@ -1213,11 +1213,11 @@ void DnDTree::onItemDoubleClicked( QTreeWidgetItem *item, int column )
|
||||
QgsFieldExpressionWidget *expressionWidget = new QgsFieldExpressionWidget;
|
||||
expressionWidget->setLayer( mLayer );
|
||||
QToolButton *addExpressionButton = new QToolButton();
|
||||
addExpressionButton->setIcon( QgsApplication::getThemeIcon( "/symbologyAdd.svg" ) );
|
||||
addExpressionButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/symbologyAdd.svg" ) ) );
|
||||
|
||||
connect( addExpressionButton, &QAbstractButton::clicked, this, [ = ]
|
||||
{
|
||||
qmlCode->insertPlainText( QStringLiteral( "expression.evaluate(\"%1\")" ).arg( expressionWidget->expression().replace( '"', "\\\"" ) ) );
|
||||
qmlCode->insertPlainText( QStringLiteral( "expression.evaluate(\"%1\")" ).arg( expressionWidget->expression().replace( '"', QLatin1String( "\\\"" ) ) ) );
|
||||
} );
|
||||
|
||||
layout->addRow( tr( "Title" ), title );
|
||||
@ -1291,7 +1291,7 @@ DnDTree::Type DnDTree::type() const
|
||||
return mType;
|
||||
}
|
||||
|
||||
void DnDTree::setType( const Type &value )
|
||||
void DnDTree::setType( DnDTree::Type value )
|
||||
{
|
||||
mType = value;
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ class DnDTree : public QTreeWidget
|
||||
|
||||
|
||||
Type type() const;
|
||||
void setType( const Type &value );
|
||||
void setType( DnDTree::Type value );
|
||||
|
||||
protected:
|
||||
void dragMoveEvent( QDragMoveEvent *event ) override;
|
||||
|
@ -118,7 +118,7 @@ void QgsDecorationCopyright::render( const QgsMapSettings &mapSettings, QgsRende
|
||||
context.painter()->setRenderHint( QPainter::Antialiasing, true );
|
||||
|
||||
QString displayString = QgsExpression::replaceExpressionText( mLabelText, &context.expressionContext() );
|
||||
QStringList displayStringList = displayString.split( "\n" );
|
||||
QStringList displayStringList = displayString.split( QStringLiteral( "\n" ) );
|
||||
|
||||
QFontMetricsF fm( mTextFormat.scaledFont( context ) );
|
||||
double textWidth = QgsTextRenderer::textWidth( context, mTextFormat, displayStringList, &fm );
|
||||
|
@ -51,7 +51,7 @@ QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyrig
|
||||
if ( !mDeco.enabled() && mDeco.mLabelText.isEmpty() )
|
||||
{
|
||||
QDate now = QDate::currentDate();
|
||||
QString defaultString = QString( "%1 %2 %3" ).arg( QChar( 0x00A9 ), QgsProject::instance()->metadata().author(), now.toString( QStringLiteral( "yyyy" ) ) );
|
||||
QString defaultString = QStringLiteral( "%1 %2 %3" ).arg( QChar( 0x00A9 ), QgsProject::instance()->metadata().author(), now.toString( QStringLiteral( "yyyy" ) ) );
|
||||
txtCopyrightText->setPlainText( defaultString );
|
||||
}
|
||||
else
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
QgsFeatureAction::QgsFeatureAction( const QString &name, QgsFeature &f, QgsVectorLayer *layer, const QUuid &actionId, int defaultAttr, QObject *parent )
|
||||
QgsFeatureAction::QgsFeatureAction( const QString &name, QgsFeature &f, QgsVectorLayer *layer, QUuid actionId, int defaultAttr, QObject *parent )
|
||||
: QAction( name, parent )
|
||||
, mLayer( layer )
|
||||
, mFeature( &f )
|
||||
|
@ -36,7 +36,7 @@ class APP_EXPORT QgsFeatureAction : public QAction
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QgsFeatureAction( const QString &name, QgsFeature &f, QgsVectorLayer *vl, const QUuid &actionId = QString(), int defaultAttr = -1, QObject *parent = nullptr );
|
||||
QgsFeatureAction( const QString &name, QgsFeature &f, QgsVectorLayer *vl, QUuid actionId = QString(), int defaultAttr = -1, QObject *parent = nullptr );
|
||||
|
||||
public slots:
|
||||
void execute();
|
||||
|
@ -178,7 +178,7 @@ QString QgsHandleBadLayers::filename( int row )
|
||||
{
|
||||
const QVariantMap parts = QgsProviderRegistry::instance()->decodeUri( provider, datasource );
|
||||
// if parts is empty then provider doesn't handle this method!
|
||||
return parts.empty() ? datasource : parts.value( QLatin1String( "path" ) ).toString();
|
||||
return parts.empty() ? datasource : parts.value( QStringLiteral( "path" ) ).toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -256,8 +256,8 @@ void QgsMapToolIdentifyAction::handleCopyToClipboard( QgsFeatureStore &featureSt
|
||||
void QgsMapToolIdentifyAction::setClickContextScope( const QgsPointXY &point )
|
||||
{
|
||||
QgsExpressionContextScope clickScope;
|
||||
clickScope.addVariable( QgsExpressionContextScope::StaticVariable( QString( "click_x" ), point.x(), true ) );
|
||||
clickScope.addVariable( QgsExpressionContextScope::StaticVariable( QString( "click_y" ), point.y(), true ) );
|
||||
clickScope.addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "click_x" ), point.x(), true ) );
|
||||
clickScope.addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "click_y" ), point.y(), true ) );
|
||||
|
||||
resultsDialog()->setExpressionContextScope( clickScope );
|
||||
|
||||
|
@ -94,7 +94,7 @@ void QgsMapToolOffsetCurve::canvasReleaseEvent( QgsMapMouseEvent *e )
|
||||
bool hasM = QgsWkbTypes::hasZ( mLayer->wkbType() );
|
||||
if ( hasZ || hasM )
|
||||
{
|
||||
emit messageEmitted( QString( "layer %1 has %2%3%4 geometry. %2%3%4 values be set to 0 when using offset tool." )
|
||||
emit messageEmitted( QStringLiteral( "layer %1 has %2%3%4 geometry. %2%3%4 values be set to 0 when using offset tool." )
|
||||
.arg( mLayer->name() )
|
||||
.arg( hasZ ? "Z" : "" )
|
||||
.arg( hasZ && hasM ? "/" : "" )
|
||||
@ -119,7 +119,7 @@ void QgsMapToolOffsetCurve::canvasReleaseEvent( QgsMapMouseEvent *e )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsMapToolOffsetCurve::applyOffset( const double &offset, const Qt::KeyboardModifiers &modifiers )
|
||||
void QgsMapToolOffsetCurve::applyOffset( double offset, Qt::KeyboardModifiers modifiers )
|
||||
{
|
||||
if ( !mLayer || offset == 0.0 )
|
||||
{
|
||||
@ -350,7 +350,7 @@ void QgsMapToolOffsetCurve::applyOffset( const double &offset, const Qt::Keyboar
|
||||
else
|
||||
{
|
||||
mLayer->destroyEditCommand();
|
||||
emit messageEmitted( "Could not apply offset", Qgis::Critical );
|
||||
emit messageEmitted( QStringLiteral( "Could not apply offset" ), Qgis::Critical );
|
||||
}
|
||||
|
||||
deleteRubberBandAndGeometry();
|
||||
@ -646,7 +646,7 @@ QgsOffsetUserWidget::QgsOffsetUserWidget( QWidget *parent )
|
||||
|
||||
connect( mJoinStyleComboBox, static_cast < void ( QComboBox::* )( int ) > ( &QComboBox::currentIndexChanged ), this, [ = ] { QgsSettings().setEnumValue( QStringLiteral( "/qgis/digitizing/offset_join_style" ), ( QgsGeometry::JoinStyle )mJoinStyleComboBox->currentData().toInt() ); emit offsetConfigChanged(); } );
|
||||
connect( mQuadrantSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, [ = ]( const int quadSegments ) { QgsSettings().setValue( QStringLiteral( "/qgis/digitizing/offset_quad_seg" ), quadSegments ); emit offsetConfigChanged(); } );
|
||||
connect( mMiterLimitSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, [ = ]( const double & miterLimit ) { QgsSettings().setValue( QStringLiteral( "/qgis/digitizing/offset_miter_limit" ), miterLimit ); emit offsetConfigChanged(); } );
|
||||
connect( mMiterLimitSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, [ = ]( double miterLimit ) { QgsSettings().setValue( QStringLiteral( "/qgis/digitizing/offset_miter_limit" ), miterLimit ); emit offsetConfigChanged(); } );
|
||||
connect( mCapStyleComboBox, static_cast < void ( QComboBox::* )( int ) > ( &QComboBox::currentIndexChanged ), this, [ = ] { QgsSettings().setEnumValue( QStringLiteral( "/qgis/digitizing/offset_cap_style" ), ( QgsGeometry::EndCapStyle ) mCapStyleComboBox->currentData().toInt() ); emit offsetConfigChanged(); } );
|
||||
|
||||
bool showAdvanced = s.value( QStringLiteral( "/qgis/digitizing/offset_show_advanced" ), false ).toBool();
|
||||
|
@ -69,7 +69,7 @@ class APP_EXPORT QgsMapToolOffsetCurve: public QgsMapToolEdit
|
||||
void updateGeometryAndRubberBand( double offset );
|
||||
|
||||
//! Apply the offset either from the spin box or from the mouse event
|
||||
void applyOffset( const double &offset, const Qt::KeyboardModifiers &modifiers );
|
||||
void applyOffset( double offset, Qt::KeyboardModifiers modifiers );
|
||||
|
||||
void cancel();
|
||||
|
||||
|
@ -421,7 +421,7 @@ void QgsMapToolSelectionHandler::deleteDistanceWidget()
|
||||
mDistanceWidget = nullptr;
|
||||
}
|
||||
|
||||
void QgsMapToolSelectionHandler::radiusValueEntered( const double &radius, const Qt::KeyboardModifiers &modifiers )
|
||||
void QgsMapToolSelectionHandler::radiusValueEntered( double radius, Qt::KeyboardModifiers modifiers )
|
||||
{
|
||||
if ( !mSelectionRubberBand )
|
||||
return;
|
||||
@ -439,7 +439,7 @@ void QgsMapToolSelectionHandler::cancel()
|
||||
mSelectionActive = false;
|
||||
}
|
||||
|
||||
void QgsMapToolSelectionHandler::updateRadiusRubberband( const double &radius )
|
||||
void QgsMapToolSelectionHandler::updateRadiusRubberband( double radius )
|
||||
{
|
||||
if ( !mSelectionRubberBand )
|
||||
initRubberBand();
|
||||
|
@ -133,13 +133,13 @@ class QgsMapToolSelectionHandler : public QObject
|
||||
|
||||
private slots:
|
||||
//! update the rubber band from the input widget
|
||||
void updateRadiusRubberband( const double &radius );
|
||||
void updateRadiusRubberband( double radius );
|
||||
|
||||
/**
|
||||
* triggered when the user input widget has a new value
|
||||
* either programmatically (from the mouse event) or entered by the user
|
||||
*/
|
||||
void radiusValueEntered( const double &radius, const Qt::KeyboardModifiers &modifiers );
|
||||
void radiusValueEntered( double radius, Qt::KeyboardModifiers modifiers );
|
||||
|
||||
//! cancel selecting (between two click events)
|
||||
void cancel();
|
||||
|
@ -87,7 +87,7 @@ QgsRectangle QgsMapToolSelectUtils::expandSelectRectangle( QgsPointXY mapPoint,
|
||||
return QgsRectangle( ll, ur );
|
||||
}
|
||||
|
||||
void QgsMapToolSelectUtils::selectMultipleFeatures( QgsMapCanvas *canvas, const QgsGeometry &selectGeometry, const Qt::KeyboardModifiers &modifiers )
|
||||
void QgsMapToolSelectUtils::selectMultipleFeatures( QgsMapCanvas *canvas, const QgsGeometry &selectGeometry, Qt::KeyboardModifiers modifiers )
|
||||
{
|
||||
QgsVectorLayer::SelectBehavior behavior = QgsVectorLayer::SetSelection;
|
||||
if ( modifiers & Qt::ShiftModifier && modifiers & Qt::ControlModifier )
|
||||
@ -101,7 +101,7 @@ void QgsMapToolSelectUtils::selectMultipleFeatures( QgsMapCanvas *canvas, const
|
||||
setSelectedFeatures( canvas, selectGeometry, behavior, doContains );
|
||||
}
|
||||
|
||||
void QgsMapToolSelectUtils::selectSingleFeature( QgsMapCanvas *canvas, const QgsGeometry &selectGeometry, const Qt::KeyboardModifiers &modifiers )
|
||||
void QgsMapToolSelectUtils::selectSingleFeature( QgsMapCanvas *canvas, const QgsGeometry &selectGeometry, Qt::KeyboardModifiers modifiers )
|
||||
{
|
||||
QgsVectorLayer *vlayer = QgsMapToolSelectUtils::getCurrentVectorLayer( canvas );
|
||||
if ( !vlayer )
|
||||
|
@ -77,7 +77,7 @@ namespace QgsMapToolSelectUtils
|
||||
\since QGIS 2.16
|
||||
\see selectSingleFeature()
|
||||
*/
|
||||
void selectMultipleFeatures( QgsMapCanvas *canvas, const QgsGeometry &selectGeometry, const Qt::KeyboardModifiers &modifiers );
|
||||
void selectMultipleFeatures( QgsMapCanvas *canvas, const QgsGeometry &selectGeometry, Qt::KeyboardModifiers modifiers );
|
||||
|
||||
/**
|
||||
Selects a single feature from within currently selected layer.
|
||||
@ -89,7 +89,7 @@ namespace QgsMapToolSelectUtils
|
||||
operations (add, subtract, contains)
|
||||
\see selectMultipleFeatures()
|
||||
*/
|
||||
void selectSingleFeature( QgsMapCanvas *canvas, const QgsGeometry &selectGeometry, const Qt::KeyboardModifiers &modifiers );
|
||||
void selectSingleFeature( QgsMapCanvas *canvas, const QgsGeometry &selectGeometry, Qt::KeyboardModifiers modifiers );
|
||||
|
||||
/**
|
||||
Get the current selected canvas map layer. Returns nullptr if it is not a vector layer
|
||||
|
@ -79,11 +79,11 @@ QgsSimplifyUserInputWidget::QgsSimplifyUserInputWidget( QWidget *parent )
|
||||
setFocusProxy( mButtonBox );
|
||||
}
|
||||
|
||||
void QgsSimplifyUserInputWidget::setConfig( const QgsMapToolSimplify::Method &method,
|
||||
const double &tolerance,
|
||||
const QgsTolerance::UnitType &units,
|
||||
const double &smoothOffset,
|
||||
const int &smoothIterations )
|
||||
void QgsSimplifyUserInputWidget::setConfig( QgsMapToolSimplify::Method method,
|
||||
double tolerance,
|
||||
QgsTolerance::UnitType units,
|
||||
double smoothOffset,
|
||||
int smoothIterations )
|
||||
{
|
||||
mMethodComboBox->setCurrentIndex( mMethodComboBox->findData( method ) );
|
||||
|
||||
|
@ -141,9 +141,9 @@ class APP_EXPORT QgsSimplifyUserInputWidget : public QWidget, private Ui::Simpli
|
||||
void updateStatusText( const QString &text );
|
||||
void enableOkButton( bool enabled );
|
||||
|
||||
void setConfig( const QgsMapToolSimplify::Method &method, const double &tolerance,
|
||||
const QgsTolerance::UnitType &units, const double &smoothOffset,
|
||||
const int &smoothIterations );
|
||||
void setConfig( QgsMapToolSimplify::Method method, double tolerance,
|
||||
QgsTolerance::UnitType units, double smoothOffset,
|
||||
int smoothIterations );
|
||||
|
||||
signals:
|
||||
void accepted();
|
||||
|
@ -68,7 +68,7 @@ QgsNewSpatialiteLayerDialog::QgsNewSpatialiteLayerDialog( QWidget *parent, Qt::W
|
||||
mGeometryWithZCheckBox->setEnabled( false );
|
||||
mGeometryWithMCheckBox->setEnabled( false );
|
||||
leGeometryColumn->setEnabled( false );
|
||||
leGeometryColumn->setText( "geometry" );
|
||||
leGeometryColumn->setText( QStringLiteral( "geometry" ) );
|
||||
|
||||
mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionNewAttribute.svg" ) ) );
|
||||
mRemoveAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDeleteAttribute.svg" ) ) );
|
||||
|
@ -1888,7 +1888,7 @@ void QgsVertexTool::highlightAdjacentVertex( double offset )
|
||||
zoomToVertex( vertex ); // make sure the vertex is visible
|
||||
}
|
||||
|
||||
void QgsVertexTool::startSelectionRect( const QPoint &point0 )
|
||||
void QgsVertexTool::startSelectionRect( QPoint point0 )
|
||||
{
|
||||
Q_ASSERT( !mSelectionRect );
|
||||
mSelectionRect.reset( new QRect() );
|
||||
@ -1896,7 +1896,7 @@ void QgsVertexTool::startSelectionRect( const QPoint &point0 )
|
||||
mSelectionRectItem = new QRubberBand( QRubberBand::Rectangle, canvas() );
|
||||
}
|
||||
|
||||
void QgsVertexTool::updateSelectionRect( const QPoint &point1 )
|
||||
void QgsVertexTool::updateSelectionRect( QPoint point1 )
|
||||
{
|
||||
Q_ASSERT( mSelectionRect );
|
||||
mSelectionRect->setBottomRight( point1 );
|
||||
|
@ -198,13 +198,13 @@ class APP_EXPORT QgsVertexTool : public QgsMapToolAdvancedDigitizing
|
||||
* Initialize rectangle that is being dragged to select vertices.
|
||||
* Argument point0 is in screen coordinates.
|
||||
*/
|
||||
void startSelectionRect( const QPoint &point0 );
|
||||
void startSelectionRect( QPoint point0 );
|
||||
|
||||
/**
|
||||
* Update bottom-right corner of the existing selection rectangle.
|
||||
* Argument point1 is in screen coordinates.
|
||||
*/
|
||||
void updateSelectionRect( const QPoint &point1 );
|
||||
void updateSelectionRect( QPoint point1 );
|
||||
|
||||
void stopSelectionRect();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user