mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-22 00:06:12 -05:00
Upgrade std::unique_ptr xx( new XX ) to auto/std::make_unique
This commit is contained in:
parent
2db0254c9e
commit
0ac9936b62
@ -99,6 +99,9 @@ make_unique = re.compile(
|
||||
make_unique2 = re.compile(
|
||||
r"""^(\s*)std::unique_ptr<\s*(.*?)\s*>(?:\s*(.*?)\s*\()\s*(std::make_unique<\s*(.*?)\s*>.*?)\s*\)\s*;$"""
|
||||
)
|
||||
make_unique3 = re.compile(
|
||||
r"""^(\s*)std::unique_ptr<\s*(.*?)\s*>(?:\s*(.*?)\s*\()\s*new\s*(.*?)\s*(\(.*\s*\))\s*\)\s*;"""
|
||||
)
|
||||
|
||||
|
||||
def qlatin1char_or_string(x):
|
||||
@ -240,5 +243,18 @@ while i < len(lines):
|
||||
if m and m.group(2) == m.group(5):
|
||||
line = m.group(1) + "auto " + m.group(3) + " = " + m.group(4) + ";"
|
||||
|
||||
m = make_unique3.match(line)
|
||||
if m and m.group(2) == m.group(4):
|
||||
line = (
|
||||
m.group(1)
|
||||
+ "auto "
|
||||
+ m.group(3)
|
||||
+ " = std::make_unique<"
|
||||
+ m.group(4)
|
||||
+ ">"
|
||||
+ m.group(5)
|
||||
+ ";"
|
||||
)
|
||||
|
||||
print(line)
|
||||
i += 1
|
||||
|
@ -268,7 +268,7 @@ QgsGeometry QgsMeshContours::exportLines( const QgsMeshDatasetIndex &index, doub
|
||||
|
||||
QgsGeometry QgsMeshContours::exportLines( double value, QgsFeedback *feedback )
|
||||
{
|
||||
std::unique_ptr<QgsMultiLineString> multiLineString( new QgsMultiLineString() );
|
||||
auto multiLineString = std::make_unique<QgsMultiLineString>();
|
||||
QSet<QPair<int, int>> exactEdges;
|
||||
|
||||
// STEP 1: Get Data
|
||||
@ -337,7 +337,7 @@ QgsGeometry QgsMeshContours::exportLines( double value, QgsFeedback *feedback )
|
||||
else
|
||||
{
|
||||
exactEdges.insert( { indices[i], indices[j] } );
|
||||
std::unique_ptr<QgsLineString> line( new QgsLineString( coords[i], coords[j] ) );
|
||||
auto line = std::make_unique<QgsLineString>( coords[i], coords[j] );
|
||||
multiLineString->addGeometry( line.release() );
|
||||
break;
|
||||
}
|
||||
@ -361,7 +361,7 @@ QgsGeometry QgsMeshContours::exportLines( double value, QgsFeedback *feedback )
|
||||
else
|
||||
{
|
||||
// we have found the end point of the contour line, we are done
|
||||
std::unique_ptr<QgsLineString> line( new QgsLineString( tmp, xy ) );
|
||||
auto line = std::make_unique<QgsLineString>( tmp, xy );
|
||||
multiLineString->addGeometry( line.release() );
|
||||
break;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
void QgsDistanceWithinAlgorithm::addDistanceParameter()
|
||||
{
|
||||
std::unique_ptr<QgsProcessingParameterDistance> distanceParam( new QgsProcessingParameterDistance( QStringLiteral( "DISTANCE" ), QObject::tr( "Where the features are within" ), 100, QStringLiteral( "INPUT" ), false, 0 ) );
|
||||
auto distanceParam = std::make_unique<QgsProcessingParameterDistance>( QStringLiteral( "DISTANCE" ), QObject::tr( "Where the features are within" ), 100, QStringLiteral( "INPUT" ), false, 0 );
|
||||
distanceParam->setIsDynamic( true );
|
||||
distanceParam->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "Distance" ), QObject::tr( "Distance within" ), QgsPropertyDefinition::DoublePositive ) );
|
||||
distanceParam->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) );
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
void QgsLocationBasedAlgorithm::addPredicateParameter()
|
||||
{
|
||||
std::unique_ptr<QgsProcessingParameterEnum> predicateParam( new QgsProcessingParameterEnum( QStringLiteral( "PREDICATE" ), QObject::tr( "Where the features (geometric predicate)" ), predicateOptionsList(), true, QVariant::fromValue( QList<int>() << 0 ) ) );
|
||||
auto predicateParam = std::make_unique<QgsProcessingParameterEnum>( QStringLiteral( "PREDICATE" ), QObject::tr( "Where the features (geometric predicate)" ), predicateOptionsList(), true, QVariant::fromValue( QList<int>() << 0 ) );
|
||||
|
||||
QVariantMap predicateMetadata;
|
||||
QVariantMap widgetMetadata;
|
||||
@ -423,7 +423,7 @@ QVariantMap QgsSelectByLocationAlgorithm::processAlgorithm( const QVariantMap &p
|
||||
case Qgis::SelectBehavior::RemoveFromSelection:
|
||||
{
|
||||
// When subsetting or removing we only need to check already selected features
|
||||
std::unique_ptr<QgsVectorLayerSelectedFeatureSource> selectLayerSelected( new QgsVectorLayerSelectedFeatureSource( selectLayer ) );
|
||||
auto selectLayerSelected = std::make_unique<QgsVectorLayerSelectedFeatureSource>( selectLayer );
|
||||
mTargetCrs = selectLayerSelected->sourceCrs();
|
||||
mTargetFeatureCount = selectLayerSelected->featureCount();
|
||||
process( context, selectLayerSelected.get(), intersectSource.get(), selectedPredicates, addToSelection, true, feedback );
|
||||
|
@ -173,7 +173,7 @@ QVariantMap QgsMeshSurfaceToPolygonAlgorithm::processAlgorithm( const QVariantMa
|
||||
feedback->setProgressText( QObject::tr( "Parsing mesh edges." ) );
|
||||
}
|
||||
|
||||
std::unique_ptr<QgsMultiLineString> multiLineString( new QgsMultiLineString() );
|
||||
auto multiLineString = std::make_unique<QgsMultiLineString>();
|
||||
|
||||
int i = 0;
|
||||
for ( auto it = edges.begin(); it != edges.end(); it++ )
|
||||
@ -187,7 +187,7 @@ QVariantMap QgsMeshSurfaceToPolygonAlgorithm::processAlgorithm( const QVariantMa
|
||||
// only consider edges with count 1 which are on the edge of mesh surface
|
||||
if ( it.value() == 1 )
|
||||
{
|
||||
std::unique_ptr<QgsLineString> line( new QgsLineString( mNativeMesh.vertex( it.key().first ), mNativeMesh.vertex( it.key().second ) ) );
|
||||
auto line = std::make_unique<QgsLineString>( mNativeMesh.vertex( it.key().first ), mNativeMesh.vertex( it.key().second ) );
|
||||
multiLineString->addGeometry( line.release() );
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ QVariantMap QgsRescaleRasterAlgorithm::processAlgorithm( const QVariantMap ¶
|
||||
std::unique_ptr<QgsRasterBlock> inputBlock;
|
||||
while ( iter.readNextRasterPart( mBand, iterCols, iterRows, inputBlock, iterLeft, iterTop ) )
|
||||
{
|
||||
std::unique_ptr<QgsRasterBlock> outputBlock( new QgsRasterBlock( destProvider->dataType( 1 ), iterCols, iterRows ) );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>( destProvider->dataType( 1 ), iterCols, iterRows );
|
||||
feedback->setProgress( 100 * ( ( iterTop / blockHeight * numBlocksX ) + iterLeft / blockWidth ) / numBlocks );
|
||||
|
||||
for ( int row = 0; row < iterRows; row++ )
|
||||
|
@ -474,11 +474,11 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl
|
||||
return result;
|
||||
}
|
||||
|
||||
std::unique_ptr<QgsSnapIndex> subjSnapIndex( new QgsSnapIndex() );
|
||||
auto subjSnapIndex = std::make_unique<QgsSnapIndex>();
|
||||
subjSnapIndex->addGeometry( subjGeom );
|
||||
|
||||
std::unique_ptr<QgsAbstractGeometry> origSubjGeom( subjGeom->clone() );
|
||||
std::unique_ptr<QgsSnapIndex> origSubjSnapIndex( new QgsSnapIndex() );
|
||||
auto origSubjSnapIndex = std::make_unique<QgsSnapIndex>();
|
||||
origSubjSnapIndex->addGeometry( origSubjGeom.get() );
|
||||
|
||||
// Pass 2: add missing vertices to subject geometry
|
||||
|
@ -1021,7 +1021,7 @@ void QgsLayerItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu *men
|
||||
case Qgis::LayerType::Vector:
|
||||
{
|
||||
const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
|
||||
std::unique_ptr<QgsVectorLayer> layer( new QgsVectorLayer( layerItem->uri(), layerItem->name(), layerItem->providerKey(), options ) );
|
||||
auto layer = std::make_unique<QgsVectorLayer>( layerItem->uri(), layerItem->name(), layerItem->providerKey(), options );
|
||||
if ( layer && layer->isValid() )
|
||||
{
|
||||
QgisApp::instance()->saveAsFile( layer.get(), false, false );
|
||||
@ -1031,7 +1031,7 @@ void QgsLayerItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu *men
|
||||
|
||||
case Qgis::LayerType::Raster:
|
||||
{
|
||||
std::unique_ptr<QgsRasterLayer> layer( new QgsRasterLayer( layerItem->uri(), layerItem->name(), layerItem->providerKey() ) );
|
||||
auto layer = std::make_unique<QgsRasterLayer>( layerItem->uri(), layerItem->name(), layerItem->providerKey() );
|
||||
if ( layer && layer->isValid() )
|
||||
{
|
||||
QgisApp::instance()->saveAsFile( layer.get(), false, false );
|
||||
@ -1900,7 +1900,7 @@ bool QgsDatabaseItemGuiProvider::handleDrop( QgsDataItem *item, QgsDataItemGuiCo
|
||||
bool hasError = false;
|
||||
|
||||
// Main task
|
||||
std::unique_ptr<QgsTaskWithSerialSubTasks> mainTask( new QgsTaskWithSerialSubTasks( tr( "Layer import" ) ) );
|
||||
auto mainTask = std::make_unique<QgsTaskWithSerialSubTasks>( tr( "Layer import" ) );
|
||||
bool hasSubTasks = false;
|
||||
|
||||
const QgsMimeDataUtils::UriList lst = QgsMimeDataUtils::decodeUriList( data );
|
||||
|
@ -186,7 +186,7 @@ void QgsDwgImportDialog::pbLoadDatabase_clicked()
|
||||
|
||||
QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
|
||||
options.loadDefaultStyle = false;
|
||||
std::unique_ptr<QgsVectorLayer> d( new QgsVectorLayer( QStringLiteral( "%1|layername=drawing" ).arg( mDatabaseFileWidget->filePath() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ), options ) );
|
||||
auto d = std::make_unique<QgsVectorLayer>( QStringLiteral( "%1|layername=drawing" ).arg( mDatabaseFileWidget->filePath() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ), options );
|
||||
if ( d && d->isValid() )
|
||||
{
|
||||
const int idxPath = d->fields().lookupField( QStringLiteral( "path" ) );
|
||||
@ -227,7 +227,7 @@ void QgsDwgImportDialog::pbLoadDatabase_clicked()
|
||||
|
||||
lblMessage->setVisible( lblVisible );
|
||||
|
||||
std::unique_ptr<QgsVectorLayer> l( new QgsVectorLayer( QStringLiteral( "%1|layername=layers" ).arg( mDatabaseFileWidget->filePath() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ), options ) );
|
||||
auto l = std::make_unique<QgsVectorLayer>( QStringLiteral( "%1|layername=layers" ).arg( mDatabaseFileWidget->filePath() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ), options );
|
||||
if ( l && l->isValid() )
|
||||
{
|
||||
const int idxName = l->fields().lookupField( QStringLiteral( "name" ) );
|
||||
|
@ -631,7 +631,7 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa
|
||||
if ( fi.suffix().compare( QLatin1String( "dxf" ), Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
//loads dxf
|
||||
std::unique_ptr<dxfRW> dxf( new dxfRW( drawing.toLocal8Bit() ) );
|
||||
auto dxf = std::make_unique<dxfRW>( drawing.toLocal8Bit() );
|
||||
if ( !dxf->read( this, true ) )
|
||||
{
|
||||
result = DRW::BAD_UNKNOWN;
|
||||
@ -640,7 +640,7 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa
|
||||
else if ( fi.suffix().compare( QLatin1String( "dwg" ), Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
//loads dwg
|
||||
std::unique_ptr<dwgR> dwg( new dwgR( drawing.toLocal8Bit() ) );
|
||||
auto dwg = std::make_unique<dwgR>( drawing.toLocal8Bit() );
|
||||
if ( !dwg->read( this, true ) )
|
||||
{
|
||||
result = dwg->getError();
|
||||
|
@ -76,7 +76,7 @@ bool QgsGeorefTransform::parametersInitialized() const
|
||||
|
||||
QgsGcpTransformerInterface *QgsGeorefTransform::clone() const
|
||||
{
|
||||
std::unique_ptr<QgsGeorefTransform> res( new QgsGeorefTransform( *this ) );
|
||||
auto res = std::make_unique<QgsGeorefTransform>( *this );
|
||||
res->updateParametersFromGcps( mSourceCoordinates, mDestinationCoordinates, mInvertYAxis );
|
||||
return res.release();
|
||||
}
|
||||
|
@ -40,6 +40,9 @@ class APP_EXPORT QgsGeorefTransform : public QgsGcpTransformerInterface
|
||||
QgsGeorefTransform();
|
||||
~QgsGeorefTransform() override;
|
||||
|
||||
//! shallow copy constructor
|
||||
QgsGeorefTransform( const QgsGeorefTransform &other );
|
||||
|
||||
/**
|
||||
* Switches the used transform type to the given parametrisation.
|
||||
*/
|
||||
@ -116,8 +119,6 @@ class APP_EXPORT QgsGeorefTransform : public QgsGcpTransformerInterface
|
||||
bool getOriginScaleRotation( QgsPointXY &origin, double &scaleX, double &scaleY, double &rotation ) const;
|
||||
|
||||
private:
|
||||
// shallow copy constructor
|
||||
QgsGeorefTransform( const QgsGeorefTransform &other );
|
||||
QgsGeorefTransform &operator=( const QgsGeorefTransform & ) = delete;
|
||||
|
||||
bool transformPrivate( const QgsPointXY &src, QgsPointXY &dst, bool inverseTransform ) const;
|
||||
|
@ -327,7 +327,7 @@ void QgsActiveLayerFeaturesLocatorFilter::openConfigWidget( QWidget *parent )
|
||||
{
|
||||
QString key = "locator_filters/active_layer_features";
|
||||
QgsSettings settings;
|
||||
std::unique_ptr<QDialog> dlg( new QDialog( parent ) );
|
||||
auto dlg = std::make_unique<QDialog>( parent );
|
||||
dlg->restoreGeometry( settings.value( QStringLiteral( "Windows/%1/geometry" ).arg( key ) ).toByteArray() );
|
||||
dlg->setWindowTitle( "All layers features locator filter" );
|
||||
QFormLayout *formLayout = new QFormLayout;
|
||||
|
@ -217,7 +217,7 @@ void QgsAllLayersFeaturesLocatorFilter::openConfigWidget( QWidget *parent )
|
||||
{
|
||||
QString key = "locator_filters/all_layers_features";
|
||||
QgsSettings settings;
|
||||
std::unique_ptr<QDialog> dlg( new QDialog( parent ) );
|
||||
auto dlg = std::make_unique<QDialog>( parent );
|
||||
dlg->restoreGeometry( settings.value( QStringLiteral( "Windows/%1/geometry" ).arg( key ) ).toByteArray() );
|
||||
dlg->setWindowTitle( "All layers features locator filter" );
|
||||
QFormLayout *formLayout = new QFormLayout;
|
||||
|
@ -129,7 +129,7 @@ void QgsMapToolShapeCircle2TangentsPoint::cadCanvasMoveEvent( QgsMapMouseEvent *
|
||||
{
|
||||
QgsPointXY p1, p2;
|
||||
match.edgePoints( p1, p2 );
|
||||
std::unique_ptr<QgsLineString> line( new QgsLineString() );
|
||||
auto line = std::make_unique<QgsLineString>();
|
||||
|
||||
line->addVertex( QgsPoint( p1 ) );
|
||||
line->addVertex( QgsPoint( p2 ) );
|
||||
@ -161,11 +161,11 @@ void QgsMapToolShapeCircle2TangentsPoint::getPossibleCenter()
|
||||
|
||||
if ( mPoints.size() == 4 )
|
||||
{
|
||||
std::unique_ptr<QgsLineString> l1( new QgsLineString() );
|
||||
auto l1 = std::make_unique<QgsLineString>();
|
||||
l1->addVertex( mPoints.at( 0 ) );
|
||||
l1->addVertex( mPoints.at( 1 ) );
|
||||
|
||||
std::unique_ptr<QgsLineString> l2( new QgsLineString() );
|
||||
auto l2 = std::make_unique<QgsLineString>();
|
||||
l2->addVertex( mPoints.at( 2 ) );
|
||||
l2->addVertex( mPoints.at( 3 ) );
|
||||
|
||||
@ -227,7 +227,7 @@ void QgsMapToolShapeCircle2TangentsPoint::radiusSpinBoxChanged( double radius )
|
||||
for ( int i = 0; i < mCenters.size(); ++i )
|
||||
{
|
||||
std::unique_ptr<QgsGeometryRubberBand> tempRB( mParentTool->createGeometryRubberBand( Qgis::GeometryType::Point, true ) );
|
||||
std::unique_ptr<QgsPoint> tempCenter( new QgsPoint( mCenters.at( i ) ) );
|
||||
auto tempCenter = std::make_unique<QgsPoint>( mCenters.at( i ) );
|
||||
tempRB->setGeometry( tempCenter.release() );
|
||||
tempRB->show();
|
||||
mRubberBands.append( tempRB.release() );
|
||||
|
@ -84,7 +84,7 @@ void QgsMapToolShapeCircle3Points::cadCanvasMoveEvent( QgsMapMouseEvent *e, QgsM
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
std::unique_ptr<QgsLineString> line( new QgsLineString() );
|
||||
auto line = std::make_unique<QgsLineString>();
|
||||
line->addVertex( mPoints.at( 0 ) );
|
||||
line->addVertex( mParentTool->mapPoint( *e ) );
|
||||
mTempRubberBand->setGeometry( line.release() );
|
||||
|
@ -145,7 +145,7 @@ void QgsMapToolShapeCircle3Tangents::cadCanvasMoveEvent( QgsMapMouseEvent *e, Qg
|
||||
}
|
||||
else
|
||||
{
|
||||
std::unique_ptr<QgsLineString> line( new QgsLineString() );
|
||||
auto line = std::make_unique<QgsLineString>();
|
||||
|
||||
line->addVertex( mParentTool->mapPoint( p1 ) );
|
||||
line->addVertex( mParentTool->mapPoint( p2 ) );
|
||||
|
@ -61,8 +61,8 @@ void QgsMapToolShapeCircularStringAbstract::undo()
|
||||
if ( mPoints.size() > 1 )
|
||||
{
|
||||
mPoints.removeLast();
|
||||
std::unique_ptr<QgsCircularString> geomRubberBand( new QgsCircularString() );
|
||||
std::unique_ptr<QgsLineString> geomTempRubberBand( new QgsLineString() );
|
||||
auto geomRubberBand = std::make_unique<QgsCircularString>();
|
||||
auto geomTempRubberBand = std::make_unique<QgsLineString>();
|
||||
const int lastPositionCompleteCircularString = mPoints.size() - 1 - ( mPoints.size() + 1 ) % 2;
|
||||
|
||||
geomTempRubberBand->setPoints( mPoints.mid( lastPositionCompleteCircularString ) );
|
||||
|
@ -87,7 +87,7 @@ void QgsMapToolShapeEllipseCenter2Points::cadCanvasMoveEvent( QgsMapMouseEvent *
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
std::unique_ptr<QgsLineString> line( new QgsLineString() );
|
||||
auto line = std::make_unique<QgsLineString>();
|
||||
line->addVertex( mPoints.at( 0 ) );
|
||||
line->addVertex( point );
|
||||
mTempRubberBand->setGeometry( line.release() );
|
||||
|
@ -93,7 +93,7 @@ void QgsMapToolShapeEllipseFoci::cadCanvasMoveEvent( QgsMapMouseEvent *e, QgsMap
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
std::unique_ptr<QgsLineString> line( new QgsLineString() );
|
||||
auto line = std::make_unique<QgsLineString>();
|
||||
line->addVertex( mPoints.at( 0 ) );
|
||||
line->addVertex( point );
|
||||
mTempRubberBand->setGeometry( line.release() );
|
||||
|
@ -134,7 +134,7 @@ void QgsMapToolShapeRectangle3Points::cadCanvasMoveEvent( QgsMapMouseEvent *e, Q
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
std::unique_ptr<QgsLineString> line( new QgsLineString() );
|
||||
auto line = std::make_unique<QgsLineString>();
|
||||
line->addVertex( mPoints.at( 0 ) );
|
||||
line->addVertex( point );
|
||||
mTempRubberBand->setGeometry( line.release() );
|
||||
|
@ -2064,7 +2064,7 @@ void QgsMapToolEditMeshFrame::selectTouchedByGeometry( const QgsGeometry &geomet
|
||||
for ( const int faceIndex : nativeFaceIndexes )
|
||||
{
|
||||
const QgsMeshFace &face = nativeFace( faceIndex );
|
||||
std::unique_ptr<QgsPolygon> faceGeom( new QgsPolygon( new QgsLineString( nativeFaceGeometry( faceIndex ) ) ) );
|
||||
auto faceGeom = std::make_unique<QgsPolygon>( new QgsLineString( nativeFaceGeometry( faceIndex ) ) );
|
||||
if ( engine->intersects( faceGeom.get() ) )
|
||||
{
|
||||
QSet<int> faceToAdd = qgis::listToSet( face.toList() );
|
||||
|
@ -603,7 +603,7 @@ QgsO2 *QgsAuthOAuth2Method::getOAuth2Bundle( const QString &authcfg, bool fullco
|
||||
|
||||
// do loading of method config into oauth2 config
|
||||
|
||||
std::unique_ptr<QgsAuthOAuth2Config> config( new QgsAuthOAuth2Config() );
|
||||
auto config = std::make_unique<QgsAuthOAuth2Config>();
|
||||
if ( configmap.contains( QStringLiteral( "oauth2config" ) ) )
|
||||
{
|
||||
const QByteArray configtxt = configmap.value( QStringLiteral( "oauth2config" ) ).toUtf8();
|
||||
|
@ -57,7 +57,7 @@ QgsHtmlAnnotation::QgsHtmlAnnotation( QObject *parent )
|
||||
|
||||
QgsHtmlAnnotation *QgsHtmlAnnotation::clone() const
|
||||
{
|
||||
std::unique_ptr< QgsHtmlAnnotation > c( new QgsHtmlAnnotation() );
|
||||
auto c = std::make_unique<QgsHtmlAnnotation>();
|
||||
copyCommonProperties( c.get() );
|
||||
c->setSourceFile( mHtmlFile );
|
||||
return c.release();
|
||||
|
@ -34,7 +34,7 @@ QgsSvgAnnotation::QgsSvgAnnotation( QObject *parent )
|
||||
|
||||
QgsSvgAnnotation *QgsSvgAnnotation::clone() const
|
||||
{
|
||||
std::unique_ptr< QgsSvgAnnotation > c( new QgsSvgAnnotation() );
|
||||
auto c = std::make_unique<QgsSvgAnnotation>();
|
||||
copyCommonProperties( c.get() );
|
||||
c->setFilePath( mFilePath );
|
||||
return c.release();
|
||||
|
@ -30,7 +30,7 @@ QgsTextAnnotation::QgsTextAnnotation( QObject *parent )
|
||||
|
||||
QgsTextAnnotation *QgsTextAnnotation::clone() const
|
||||
{
|
||||
std::unique_ptr< QgsTextAnnotation > c( new QgsTextAnnotation() );
|
||||
auto c = std::make_unique<QgsTextAnnotation>();
|
||||
copyCommonProperties( c.get() );
|
||||
c->setDocument( mDocument.get() );
|
||||
return c.release();
|
||||
|
@ -604,7 +604,7 @@ QgsExpressionContextScope *QgsExpressionContextUtils::updateSymbolScope( const Q
|
||||
|
||||
QgsExpressionContextScope *QgsExpressionContextUtils::layoutScope( const QgsLayout *layout )
|
||||
{
|
||||
std::unique_ptr< QgsExpressionContextScope > scope( new QgsExpressionContextScope( QObject::tr( "Layout" ) ) );
|
||||
auto scope = std::make_unique<QgsExpressionContextScope>( QObject::tr( "Layout" ) );
|
||||
if ( !layout )
|
||||
return scope.release();
|
||||
|
||||
@ -901,7 +901,7 @@ QgsExpressionContextScope *QgsExpressionContextUtils::processingAlgorithmScope(
|
||||
// set aside for future use
|
||||
Q_UNUSED( context )
|
||||
|
||||
std::unique_ptr< QgsExpressionContextScope > scope( new QgsExpressionContextScope( QObject::tr( "Algorithm" ) ) );
|
||||
auto scope = std::make_unique<QgsExpressionContextScope>( QObject::tr( "Algorithm" ) );
|
||||
scope->addFunction( QStringLiteral( "parameter" ), new GetProcessingParameterValue( parameters ) );
|
||||
|
||||
if ( !algorithm )
|
||||
@ -915,7 +915,7 @@ QgsExpressionContextScope *QgsExpressionContextUtils::processingAlgorithmScope(
|
||||
|
||||
QgsExpressionContextScope *QgsExpressionContextUtils::processingModelAlgorithmScope( const QgsProcessingModelAlgorithm *model, const QVariantMap &, QgsProcessingContext &context )
|
||||
{
|
||||
std::unique_ptr< QgsExpressionContextScope > modelScope( new QgsExpressionContextScope( QObject::tr( "Model" ) ) );
|
||||
auto modelScope = std::make_unique<QgsExpressionContextScope>( QObject::tr( "Model" ) );
|
||||
QString modelPath;
|
||||
if ( !model->sourceFilePath().isEmpty() )
|
||||
{
|
||||
@ -946,7 +946,7 @@ QgsExpressionContextScope *QgsExpressionContextUtils::processingModelAlgorithmSc
|
||||
|
||||
QgsExpressionContextScope *QgsExpressionContextUtils::notificationScope( const QString &message )
|
||||
{
|
||||
std::unique_ptr< QgsExpressionContextScope > scope( new QgsExpressionContextScope() );
|
||||
auto scope = std::make_unique<QgsExpressionContextScope>();
|
||||
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "notification_message" ), message, true ) );
|
||||
return scope.release();
|
||||
}
|
||||
|
@ -3871,8 +3871,8 @@ static QVariant fcnMakePolygon( const QVariantList &values, const QgsExpressionC
|
||||
|
||||
static QVariant fcnMakeTriangle( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
|
||||
{
|
||||
std::unique_ptr<QgsTriangle> tr( new QgsTriangle() );
|
||||
std::unique_ptr<QgsLineString> lineString( new QgsLineString() );
|
||||
auto tr = std::make_unique<QgsTriangle>();
|
||||
auto lineString = std::make_unique<QgsLineString>();
|
||||
lineString->clear();
|
||||
|
||||
for ( const QVariant &value : values )
|
||||
|
@ -429,7 +429,7 @@ QVector<QgsPoint> QgsCircle::northQuadrant() const
|
||||
|
||||
QgsCircularString *QgsCircle::toCircularString( bool oriented ) const
|
||||
{
|
||||
std::unique_ptr<QgsCircularString> circString( new QgsCircularString() );
|
||||
auto circString = std::make_unique<QgsCircularString>();
|
||||
QgsPointSequence points;
|
||||
QVector<QgsPoint> quad;
|
||||
if ( oriented )
|
||||
|
@ -515,7 +515,7 @@ double QgsCurvePolygon::roundness() const
|
||||
|
||||
QgsPolygon *QgsCurvePolygon::surfaceToPolygon() const
|
||||
{
|
||||
std::unique_ptr< QgsPolygon > polygon( new QgsPolygon() );
|
||||
auto polygon = std::make_unique<QgsPolygon>();
|
||||
if ( !mExteriorRing )
|
||||
return polygon.release();
|
||||
|
||||
@ -685,7 +685,7 @@ bool QgsCurvePolygon::boundingBoxIntersects( const QgsBox3D &box3d ) const
|
||||
|
||||
QgsPolygon *QgsCurvePolygon::toPolygon( double tolerance, SegmentationToleranceType toleranceType ) const
|
||||
{
|
||||
std::unique_ptr< QgsPolygon > poly( new QgsPolygon() );
|
||||
auto poly = std::make_unique<QgsPolygon>();
|
||||
if ( !mExteriorRing )
|
||||
{
|
||||
return poly.release();
|
||||
|
@ -259,7 +259,7 @@ void QgsEllipse::pointsInternal( unsigned int segments, QVector<double> &x, QVec
|
||||
|
||||
QgsPolygon *QgsEllipse::toPolygon( unsigned int segments ) const
|
||||
{
|
||||
std::unique_ptr<QgsPolygon> polygon( new QgsPolygon() );
|
||||
auto polygon = std::make_unique<QgsPolygon>();
|
||||
if ( segments < 3 )
|
||||
{
|
||||
return polygon.release();
|
||||
@ -337,7 +337,7 @@ QString QgsEllipse::toString( int pointPrecision, int axisPrecision, int azimuth
|
||||
|
||||
QgsPolygon *QgsEllipse::orientedBoundingBox() const
|
||||
{
|
||||
std::unique_ptr<QgsPolygon> ombb( new QgsPolygon() );
|
||||
auto ombb = std::make_unique<QgsPolygon>();
|
||||
if ( isEmpty() )
|
||||
{
|
||||
return ombb.release();
|
||||
|
@ -1057,7 +1057,7 @@ void QgsGeometryCollection::swapXy()
|
||||
|
||||
QgsGeometryCollection *QgsGeometryCollection::toCurveType() const
|
||||
{
|
||||
std::unique_ptr< QgsGeometryCollection > newCollection( new QgsGeometryCollection() );
|
||||
auto newCollection = std::make_unique<QgsGeometryCollection>();
|
||||
newCollection->reserve( mGeometries.size() );
|
||||
for ( QgsAbstractGeometry *geom : mGeometries )
|
||||
{
|
||||
|
@ -1600,7 +1600,7 @@ std::unique_ptr<QgsAbstractGeometry> QgsGeos::fromGeos( const GEOSGeometry *geos
|
||||
}
|
||||
case GEOS_MULTIPOINT:
|
||||
{
|
||||
std::unique_ptr< QgsMultiPoint > multiPoint( new QgsMultiPoint() );
|
||||
auto multiPoint = std::make_unique<QgsMultiPoint>();
|
||||
int nParts = GEOSGetNumGeometries_r( context, geos );
|
||||
multiPoint->reserve( nParts );
|
||||
for ( int i = 0; i < nParts; ++i )
|
||||
@ -1618,7 +1618,7 @@ std::unique_ptr<QgsAbstractGeometry> QgsGeos::fromGeos( const GEOSGeometry *geos
|
||||
}
|
||||
case GEOS_MULTILINESTRING:
|
||||
{
|
||||
std::unique_ptr< QgsMultiLineString > multiLineString( new QgsMultiLineString() );
|
||||
auto multiLineString = std::make_unique<QgsMultiLineString>();
|
||||
int nParts = GEOSGetNumGeometries_r( context, geos );
|
||||
multiLineString->reserve( nParts );
|
||||
for ( int i = 0; i < nParts; ++i )
|
||||
@ -1633,7 +1633,7 @@ std::unique_ptr<QgsAbstractGeometry> QgsGeos::fromGeos( const GEOSGeometry *geos
|
||||
}
|
||||
case GEOS_MULTIPOLYGON:
|
||||
{
|
||||
std::unique_ptr< QgsMultiPolygon > multiPolygon( new QgsMultiPolygon() );
|
||||
auto multiPolygon = std::make_unique<QgsMultiPolygon>();
|
||||
|
||||
int nParts = GEOSGetNumGeometries_r( context, geos );
|
||||
multiPolygon->reserve( nParts );
|
||||
@ -1649,7 +1649,7 @@ std::unique_ptr<QgsAbstractGeometry> QgsGeos::fromGeos( const GEOSGeometry *geos
|
||||
}
|
||||
case GEOS_GEOMETRYCOLLECTION:
|
||||
{
|
||||
std::unique_ptr< QgsGeometryCollection > geomCollection( new QgsGeometryCollection() );
|
||||
auto geomCollection = std::make_unique<QgsGeometryCollection>();
|
||||
int nParts = GEOSGetNumGeometries_r( context, geos );
|
||||
geomCollection->reserve( nParts );
|
||||
for ( int i = 0; i < nParts; ++i )
|
||||
@ -1679,7 +1679,7 @@ std::unique_ptr<QgsPolygon> QgsGeos::fromGeosPolygon( const GEOSGeometry *geos )
|
||||
bool hasZ = ( nCoordDims == 3 );
|
||||
bool hasM = ( ( nDims - nCoordDims ) == 1 );
|
||||
|
||||
std::unique_ptr< QgsPolygon > polygon( new QgsPolygon() );
|
||||
auto polygon = std::make_unique<QgsPolygon>();
|
||||
|
||||
const GEOSGeometry *ring = GEOSGetExteriorRing_r( context, geos );
|
||||
if ( ring )
|
||||
@ -1740,7 +1740,7 @@ std::unique_ptr<QgsLineString> QgsGeos::sequenceToLinestring( const GEOSGeometry
|
||||
}
|
||||
}
|
||||
#endif
|
||||
std::unique_ptr< QgsLineString > line( new QgsLineString( xOut, yOut, zOut, mOut ) );
|
||||
auto line = std::make_unique<QgsLineString>( xOut, yOut, zOut, mOut );
|
||||
return line;
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ QgsMultiCurve *QgsMultiCurve::reversed() const
|
||||
|
||||
QgsAbstractGeometry *QgsMultiCurve::boundary() const
|
||||
{
|
||||
std::unique_ptr< QgsMultiPoint > multiPoint( new QgsMultiPoint() );
|
||||
auto multiPoint = std::make_unique<QgsMultiPoint>();
|
||||
multiPoint->reserve( mGeometries.size() * 2 );
|
||||
for ( int i = 0; i < mGeometries.size(); ++i )
|
||||
{
|
||||
|
@ -260,7 +260,7 @@ QgsMultiSurface *QgsMultiPolygon::toCurveType() const
|
||||
|
||||
QgsAbstractGeometry *QgsMultiPolygon::boundary() const
|
||||
{
|
||||
std::unique_ptr< QgsMultiLineString > multiLine( new QgsMultiLineString() );
|
||||
auto multiLine = std::make_unique<QgsMultiLineString>();
|
||||
multiLine->reserve( mGeometries.size() );
|
||||
for ( int i = 0; i < mGeometries.size(); ++i )
|
||||
{
|
||||
|
@ -221,7 +221,7 @@ bool QgsMultiSurface::insertGeometry( QgsAbstractGeometry *g, int index )
|
||||
|
||||
QgsAbstractGeometry *QgsMultiSurface::boundary() const
|
||||
{
|
||||
std::unique_ptr< QgsMultiCurve > multiCurve( new QgsMultiCurve() );
|
||||
auto multiCurve = std::make_unique<QgsMultiCurve>();
|
||||
multiCurve->reserve( mGeometries.size() );
|
||||
for ( int i = 0; i < mGeometries.size(); ++i )
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ bool QgsPolygon::fromWkb( QgsConstWkbPtr &wkbPtr )
|
||||
wkbPtr >> nRings;
|
||||
for ( int i = 0; i < nRings; ++i )
|
||||
{
|
||||
std::unique_ptr< QgsLineString > line( new QgsLineString() );
|
||||
auto line = std::make_unique<QgsLineString>();
|
||||
line->fromWkbPoints( ringType, wkbPtr );
|
||||
/*if ( !line->isRing() )
|
||||
{
|
||||
|
@ -375,7 +375,7 @@ double QgsPolyhedralSurface::perimeter() const
|
||||
|
||||
QgsAbstractGeometry *QgsPolyhedralSurface::boundary() const
|
||||
{
|
||||
std::unique_ptr< QgsMultiLineString > multiLine( new QgsMultiLineString() );
|
||||
auto multiLine = std::make_unique<QgsMultiLineString>();
|
||||
multiLine->reserve( mPatches.size() );
|
||||
for ( QgsPolygon *polygon : mPatches )
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ QgsPointSequence QgsRegularPolygon::points() const
|
||||
|
||||
QgsPolygon *QgsRegularPolygon::toPolygon() const
|
||||
{
|
||||
std::unique_ptr<QgsPolygon> polygon( new QgsPolygon() );
|
||||
auto polygon = std::make_unique<QgsPolygon>();
|
||||
if ( isEmpty() )
|
||||
{
|
||||
return polygon.release();
|
||||
@ -195,7 +195,7 @@ QgsPolygon *QgsRegularPolygon::toPolygon() const
|
||||
|
||||
QgsLineString *QgsRegularPolygon::toLineString() const
|
||||
{
|
||||
std::unique_ptr<QgsLineString> ext( new QgsLineString() );
|
||||
auto ext = std::make_unique<QgsLineString>();
|
||||
if ( isEmpty() )
|
||||
{
|
||||
return ext.release();
|
||||
|
@ -251,7 +251,7 @@ QgsPolygon *QgsTriangle::surfaceToPolygon() const
|
||||
|
||||
QgsCurvePolygon *QgsTriangle::toCurveType() const
|
||||
{
|
||||
std::unique_ptr<QgsCurvePolygon> curvePolygon( new QgsCurvePolygon() );
|
||||
auto curvePolygon = std::make_unique<QgsCurvePolygon>();
|
||||
curvePolygon->setExteriorRing( mExteriorRing->clone() );
|
||||
|
||||
return curvePolygon.release();
|
||||
|
@ -153,7 +153,7 @@ QgsGeometry QgsGpsLogger::currentGeometry( Qgis::WkbType type, QString &error )
|
||||
{
|
||||
QgsGeometry g;
|
||||
|
||||
std::unique_ptr<QgsLineString> ringWgs84( new QgsLineString( captureListWgs84 ) );
|
||||
auto ringWgs84 = std::make_unique<QgsLineString>( captureListWgs84 );
|
||||
if ( !is3D )
|
||||
ringWgs84->dropZValue();
|
||||
if ( !isMeasure )
|
||||
@ -168,7 +168,7 @@ QgsGeometry QgsGpsLogger::currentGeometry( Qgis::WkbType type, QString &error )
|
||||
else if ( geometryType == Qgis::GeometryType::Polygon )
|
||||
{
|
||||
ringWgs84->close();
|
||||
std::unique_ptr<QgsPolygon> polygon( new QgsPolygon() );
|
||||
auto polygon = std::make_unique<QgsPolygon>();
|
||||
polygon->setExteriorRing( ringWgs84.release() );
|
||||
|
||||
g = QgsGeometry( polygon.release() );
|
||||
|
@ -936,7 +936,7 @@ bool QgsCompositionConverter::readMapXml( QgsLayoutItemMap *layoutItem, const QD
|
||||
for ( int i = 0; i < mapOverviewNodeList.size(); ++i )
|
||||
{
|
||||
const QDomElement mapOverviewElem = mapOverviewNodeList.at( i ).toElement();
|
||||
std::unique_ptr<QgsLayoutItemMapOverview> mapOverview( new QgsLayoutItemMapOverview( mapOverviewElem.attribute( QStringLiteral( "name" ) ), layoutItem ) );
|
||||
auto mapOverview = std::make_unique<QgsLayoutItemMapOverview>( mapOverviewElem.attribute( QStringLiteral( "name" ) ), layoutItem );
|
||||
mapOverview->readXml( mapOverviewElem, doc, context );
|
||||
const QString frameMapId = mapOverviewElem.attribute( QStringLiteral( "frameMap" ), QStringLiteral( "-1" ) );
|
||||
if ( frameMapId != QLatin1String( "-1" ) && mapId2Uuid.contains( frameMapId ) )
|
||||
|
@ -768,7 +768,7 @@ QgsLayoutItemGroup *QgsLayout::groupItems( const QList<QgsLayoutItem *> &items )
|
||||
}
|
||||
|
||||
mUndoStack->beginMacro( tr( "Group Items" ) );
|
||||
std::unique_ptr< QgsLayoutItemGroup > itemGroup( new QgsLayoutItemGroup( this ) );
|
||||
auto itemGroup = std::make_unique<QgsLayoutItemGroup>( this );
|
||||
for ( QgsLayoutItem *item : items )
|
||||
{
|
||||
itemGroup->addItem( item );
|
||||
@ -776,7 +776,7 @@ QgsLayoutItemGroup *QgsLayout::groupItems( const QList<QgsLayoutItem *> &items )
|
||||
QgsLayoutItemGroup *returnGroup = itemGroup.get();
|
||||
addLayoutItem( itemGroup.release() );
|
||||
|
||||
std::unique_ptr< QgsLayoutItemGroupUndoCommand > c( new QgsLayoutItemGroupUndoCommand( QgsLayoutItemGroupUndoCommand::Grouped, returnGroup, this, tr( "Group Items" ) ) );
|
||||
auto c = std::make_unique<QgsLayoutItemGroupUndoCommand>( QgsLayoutItemGroupUndoCommand::Grouped, returnGroup, this, tr( "Group Items" ) );
|
||||
mUndoStack->push( c.release() );
|
||||
mProject->setDirty( true );
|
||||
|
||||
@ -797,7 +797,7 @@ QList<QgsLayoutItem *> QgsLayout::ungroupItems( QgsLayoutItemGroup *group )
|
||||
mUndoStack->beginMacro( tr( "Ungroup Items" ) );
|
||||
// Call this before removing group items so it can keep note
|
||||
// of contents
|
||||
std::unique_ptr< QgsLayoutItemGroupUndoCommand > c( new QgsLayoutItemGroupUndoCommand( QgsLayoutItemGroupUndoCommand::Ungrouped, group, this, tr( "Ungroup Items" ) ) );
|
||||
auto c = std::make_unique<QgsLayoutItemGroupUndoCommand>( QgsLayoutItemGroupUndoCommand::Ungrouped, group, this, tr( "Ungroup Items" ) );
|
||||
mUndoStack->push( c.release() );
|
||||
|
||||
mProject->setDirty( true );
|
||||
|
@ -457,7 +457,7 @@ void QgsLayoutGuideCollection::applyGuidesToAllOtherPages( int sourcePage )
|
||||
if ( p == sourcePage )
|
||||
continue;
|
||||
|
||||
std::unique_ptr< QgsLayoutGuide> newGuide( new QgsLayoutGuide( guide->orientation(), guide->position(), mPageCollection->page( p ) ) );
|
||||
auto newGuide = std::make_unique<QgsLayoutGuide>( guide->orientation(), guide->position(), mPageCollection->page( p ) );
|
||||
newGuide->setLayout( mLayout );
|
||||
if ( newGuide->item()->isVisible() )
|
||||
{
|
||||
@ -579,7 +579,7 @@ bool QgsLayoutGuideCollection::readXml( const QDomElement &e, const QDomDocument
|
||||
double pos = element.attribute( QStringLiteral( "position" ), QStringLiteral( "0" ) ).toDouble();
|
||||
Qgis::LayoutUnit unit = QgsUnitTypes::decodeLayoutUnit( element.attribute( QStringLiteral( "units" ) ) );
|
||||
int page = element.attribute( QStringLiteral( "page" ), QStringLiteral( "0" ) ).toInt();
|
||||
std::unique_ptr< QgsLayoutGuide > guide( new QgsLayoutGuide( orientation, QgsLayoutMeasurement( pos, unit ), mPageCollection->page( page ) ) );
|
||||
auto guide = std::make_unique<QgsLayoutGuide>( orientation, QgsLayoutMeasurement( pos, unit ), mPageCollection->page( page ) );
|
||||
guide->update();
|
||||
addGuide( guide.release() );
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ bool QgsLayoutPageCollection::readXml( const QDomElement &e, const QDomDocument
|
||||
for ( int i = 0; i < pageList.size(); ++i )
|
||||
{
|
||||
QDomElement pageElement = pageList.at( i ).toElement();
|
||||
std::unique_ptr< QgsLayoutItemPage > page( new QgsLayoutItemPage( mLayout ) );
|
||||
auto page = std::make_unique<QgsLayoutItemPage>( mLayout );
|
||||
if ( mPageStyleSymbol )
|
||||
page->setPageStyleSymbol( mPageStyleSymbol->clone() );
|
||||
page->readXml( pageElement, document, context );
|
||||
|
@ -433,7 +433,7 @@ bool QgsMeshEditRefineFaces::createNewBorderFaces( QgsMeshEditor *meshEditor,
|
||||
|
||||
try
|
||||
{
|
||||
std::unique_ptr<p2t::CDT> cdt( new p2t::CDT( points ) );
|
||||
auto cdt = std::make_unique<p2t::CDT>( points );
|
||||
cdt->Triangulate();
|
||||
std::vector<p2t::Triangle *> triangles = cdt->GetTriangles();
|
||||
QVector<QgsMeshFace> faces( triangles.size() );
|
||||
|
@ -906,7 +906,7 @@ bool QgsMeshEditForceByLine::triangulateHoles(
|
||||
mapPoly2TriPointToVertex.insert( holeToFill[i + hole.count()], vertexLocalIndex + mesh->vertexCount() );
|
||||
}
|
||||
|
||||
std::unique_ptr<p2t::CDT> cdt( new p2t::CDT( holeToFill ) );
|
||||
auto cdt = std::make_unique<p2t::CDT>( holeToFill );
|
||||
cdt->Triangulate();
|
||||
std::vector<p2t::Triangle *> triangles = cdt->GetTriangles();
|
||||
QVector<QgsMeshFace> newFaces( triangles.size() );
|
||||
|
@ -72,7 +72,7 @@ int QgsMeshLayerInterpolator::bandCount() const
|
||||
|
||||
QgsRasterBlock *QgsMeshLayerInterpolator::block( int, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback )
|
||||
{
|
||||
std::unique_ptr<QgsRasterBlock> outputBlock( new QgsRasterBlock( Qgis::DataType::Float64, width, height ) );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>( Qgis::DataType::Float64, width, height );
|
||||
const double noDataValue = std::numeric_limits<double>::quiet_NaN();
|
||||
outputBlock->setNoDataValue( noDataValue );
|
||||
outputBlock->setIsNoData(); // assume initially that all values are unset
|
||||
|
@ -1361,7 +1361,7 @@ QgsTopologicalMesh::Changes QgsTopologicalMesh::removeVertexFillHole( int vertex
|
||||
mapPoly2TriPointToVertex.insert( holeToFill[i], holeVertices.at( i ) );
|
||||
}
|
||||
|
||||
std::unique_ptr<p2t::CDT> cdt( new p2t::CDT( holeToFill ) );
|
||||
auto cdt = std::make_unique<p2t::CDT>( holeToFill );
|
||||
|
||||
cdt->Triangulate();
|
||||
std::vector<p2t::Triangle *> triangles = cdt->GetTriangles();
|
||||
@ -2398,7 +2398,7 @@ QgsTopologicalMesh::Changes QgsTopologicalMesh::insertVertexInFacesEdge( int fac
|
||||
mapPoly2TriPointToVertex.insert( faceToFill[i], newBoundary.at( i ) );
|
||||
}
|
||||
|
||||
std::unique_ptr<p2t::CDT> cdt( new p2t::CDT( faceToFill ) );
|
||||
auto cdt = std::make_unique<p2t::CDT>( faceToFill );
|
||||
cdt->Triangulate();
|
||||
std::vector<p2t::Triangle *> triangles = cdt->GetTriangles();
|
||||
QVector<QgsMeshFace> newFaces( triangles.size() );
|
||||
|
@ -1312,7 +1312,7 @@ QMap<QString, QgsProcessingModelAlgorithm::VariableDefinition> QgsProcessingMode
|
||||
|
||||
QgsExpressionContextScope *QgsProcessingModelAlgorithm::createExpressionContextScopeForChildAlgorithm( const QString &childId, QgsProcessingContext &context, const QVariantMap &modelParameters, const QVariantMap &results ) const
|
||||
{
|
||||
std::unique_ptr< QgsExpressionContextScope > scope( new QgsExpressionContextScope( QStringLiteral( "algorithm_inputs" ) ) );
|
||||
auto scope = std::make_unique<QgsExpressionContextScope>( QStringLiteral( "algorithm_inputs" ) );
|
||||
QMap< QString, QgsProcessingModelAlgorithm::VariableDefinition> variables = variablesForChildAlgorithm( childId, &context, modelParameters, results );
|
||||
QMap< QString, QgsProcessingModelAlgorithm::VariableDefinition>::const_iterator varIt = variables.constBegin();
|
||||
for ( ; varIt != variables.constEnd(); ++varIt )
|
||||
|
@ -1011,7 +1011,7 @@ QgsFeatureSink *QgsProcessingUtils::createFeatureSink( QString &destination, Qgs
|
||||
destination = layer->id();
|
||||
|
||||
// this is a factory, so we need to return a proxy
|
||||
std::unique_ptr< QgsProcessingFeatureSink > sink( new QgsProcessingFeatureSink( layer->dataProvider(), destination, context ) );
|
||||
auto sink = std::make_unique<QgsProcessingFeatureSink>( layer->dataProvider(), destination, context );
|
||||
context.temporaryLayerStore()->addMapLayer( layer.release() );
|
||||
|
||||
return sink.release();
|
||||
|
@ -1991,7 +1991,7 @@ bool QgsProject::read( Qgis::ProjectReadFlags flags )
|
||||
const QString attachmentsZip = finfo.absoluteDir().absoluteFilePath( QStringLiteral( "%1_attachments.zip" ).arg( finfo.completeBaseName() ) );
|
||||
if ( QFile( attachmentsZip ).exists() )
|
||||
{
|
||||
std::unique_ptr<QgsArchive> archive( new QgsArchive() );
|
||||
auto archive = std::make_unique<QgsArchive>();
|
||||
if ( archive->unzip( attachmentsZip ) )
|
||||
{
|
||||
releaseHandlesToProjectArchive();
|
||||
@ -2040,7 +2040,7 @@ bool QgsProject::readProjectFile( const QString &filename, Qgis::ProjectReadFlag
|
||||
}
|
||||
|
||||
profile.switchTask( tr( "Reading project file" ) );
|
||||
std::unique_ptr<QDomDocument> doc( new QDomDocument( QStringLiteral( "qgis" ) ) );
|
||||
auto doc = std::make_unique<QDomDocument>( QStringLiteral( "qgis" ) );
|
||||
|
||||
if ( !projectFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||
{
|
||||
@ -3248,7 +3248,7 @@ bool QgsProject::writeProjectFile( const QString &filename )
|
||||
const QDomDocumentType documentType =
|
||||
QDomImplementation().createDocumentType( QStringLiteral( "qgis" ), QStringLiteral( "http://mrcc.com/qgis.dtd" ),
|
||||
QStringLiteral( "SYSTEM" ) );
|
||||
std::unique_ptr<QDomDocument> doc( new QDomDocument( documentType ) );
|
||||
auto doc = std::make_unique<QDomDocument>( documentType );
|
||||
|
||||
QDomElement qgisNode = doc->createElement( QStringLiteral( "qgis" ) );
|
||||
qgisNode.setAttribute( QStringLiteral( "projectname" ), title() );
|
||||
@ -4596,7 +4596,7 @@ bool QgsProject::unzip( const QString &filename, Qgis::ProjectReadFlags flags )
|
||||
QGIS_PROTECT_QOBJECT_THREAD_ACCESS
|
||||
|
||||
clearError();
|
||||
std::unique_ptr<QgsProjectArchive> archive( new QgsProjectArchive() );
|
||||
auto archive = std::make_unique<QgsProjectArchive>();
|
||||
|
||||
// unzip the archive
|
||||
if ( !archive->unzip( filename ) )
|
||||
@ -4648,7 +4648,7 @@ bool QgsProject::zip( const QString &filename )
|
||||
clearError();
|
||||
|
||||
// save the current project in a temporary .qgs file
|
||||
std::unique_ptr<QgsProjectArchive> archive( new QgsProjectArchive() );
|
||||
auto archive = std::make_unique<QgsProjectArchive>();
|
||||
const QString baseName = QFileInfo( filename ).baseName();
|
||||
const QString qgsFileName = QStringLiteral( "%1.qgs" ).arg( baseName );
|
||||
QFile qgsFile( QDir( archive->dir() ).filePath( qgsFileName ) );
|
||||
|
@ -913,7 +913,7 @@ QLibrary *QgsProviderRegistry::createProviderLibrary( QString const &providerKey
|
||||
if ( lib.isEmpty() )
|
||||
return nullptr;
|
||||
|
||||
std::unique_ptr< QLibrary > myLib( new QLibrary( lib ) );
|
||||
auto myLib = std::make_unique<QLibrary>( lib );
|
||||
|
||||
QgsDebugMsgLevel( "Library name is " + myLib->fileName(), 2 );
|
||||
|
||||
|
@ -58,7 +58,7 @@ float QgsElevationMap::decodeElevation( QRgb colorRaw )
|
||||
|
||||
std::unique_ptr<QgsElevationMap> QgsElevationMap::fromRasterBlock( QgsRasterBlock *block )
|
||||
{
|
||||
std::unique_ptr<QgsElevationMap> elevMap( new QgsElevationMap( QSize( block->width(), block->height() ) ) );
|
||||
auto elevMap = std::make_unique<QgsElevationMap>( QSize( block->width(), block->height() ) );
|
||||
QRgb *dataPtr = reinterpret_cast<QRgb *>( elevMap->mElevationImage.bits() );
|
||||
for ( int row = 0; row < block->height(); ++row )
|
||||
{
|
||||
|
@ -376,7 +376,7 @@ std::unique_ptr< QgsAbstractGeometry > QgsMapToPixelSimplifier::simplifyGeometry
|
||||
else if ( flatType == Qgis::WkbType::Polygon )
|
||||
{
|
||||
const QgsPolygon &srcPolygon = dynamic_cast<const QgsPolygon &>( geometry );
|
||||
std::unique_ptr<QgsPolygon> polygon( new QgsPolygon() );
|
||||
auto polygon = std::make_unique<QgsPolygon>();
|
||||
std::unique_ptr<QgsAbstractGeometry> extRing = simplifyGeometry( simplifyFlags, simplifyAlgorithm, *srcPolygon.exteriorRing(), map2pixelTol, true );
|
||||
polygon->setExteriorRing( qgsgeometry_cast<QgsCurve *>( extRing.release() ) );
|
||||
for ( int i = 0; i < srcPolygon.numInteriorRings(); ++i )
|
||||
|
@ -3526,7 +3526,7 @@ QgsExpressionNodeFunction *QgsOgcUtilsExpressionFromFilter::nodeSpatialOperatorF
|
||||
// we are exploiting the fact that our function names are the same as the XML tag names
|
||||
const int opIdx = QgsExpression::functionIndex( element.tagName().toLower() );
|
||||
|
||||
std::unique_ptr<QgsExpressionNode::NodeList> gml2Args( new QgsExpressionNode::NodeList() );
|
||||
auto gml2Args = std::make_unique<QgsExpressionNode::NodeList>();
|
||||
QDomElement childElem = element.firstChildElement();
|
||||
QString gml2Str;
|
||||
while ( !childElem.isNull() && gml2Str.isEmpty() )
|
||||
@ -3548,7 +3548,7 @@ QgsExpressionNodeFunction *QgsOgcUtilsExpressionFromFilter::nodeSpatialOperatorF
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<QgsExpressionNode::NodeList> opArgs( new QgsExpressionNode::NodeList() );
|
||||
auto opArgs = std::make_unique<QgsExpressionNode::NodeList>();
|
||||
opArgs->append( new QgsExpressionNodeFunction( QgsExpression::functionIndex( QStringLiteral( "$geometry" ) ), new QgsExpressionNode::NodeList() ) );
|
||||
opArgs->append( new QgsExpressionNodeFunction( QgsExpression::functionIndex( QStringLiteral( "geomFromGML" ) ), gml2Args.release() ) );
|
||||
|
||||
@ -3706,7 +3706,7 @@ QgsExpressionNodeFunction *QgsOgcUtilsExpressionFromFilter::nodeFunctionFromOgcF
|
||||
if ( element.attribute( QStringLiteral( "name" ) ) != funcDef->name() )
|
||||
continue;
|
||||
|
||||
std::unique_ptr<QgsExpressionNode::NodeList> args( new QgsExpressionNode::NodeList() );
|
||||
auto args = std::make_unique<QgsExpressionNode::NodeList>();
|
||||
|
||||
QDomElement operandElem = element.firstChildElement();
|
||||
while ( !operandElem.isNull() )
|
||||
|
@ -680,7 +680,7 @@ void QgsTessellator::addPolygon( const QgsPolygon &polygon, float extrusionHeigh
|
||||
_ringToPoly2tri( qgsgeometry_cast< const QgsLineString * >( polygonNew->exteriorRing() ), polyline, mNoZ ? nullptr : &z );
|
||||
polylinesToDelete << polyline;
|
||||
|
||||
std::unique_ptr<p2t::CDT> cdt( new p2t::CDT( polyline ) );
|
||||
auto cdt = std::make_unique<p2t::CDT>( polyline );
|
||||
|
||||
// polygon holes
|
||||
for ( int i = 0; i < polygonNew->numInteriorRings(); ++i )
|
||||
|
@ -108,7 +108,7 @@ QgsRasterBlock *QgsBrightnessContrastFilter::block( int bandNo, QgsRectangle co
|
||||
Q_UNUSED( bandNo )
|
||||
QgsDebugMsgLevel( QStringLiteral( "width = %1 height = %2 extent = %3" ).arg( width ).arg( height ).arg( extent.toString() ), 4 );
|
||||
|
||||
std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>();
|
||||
if ( !mInput )
|
||||
{
|
||||
return outputBlock.release();
|
||||
|
@ -99,7 +99,7 @@ void QgsHillshadeRenderer::writeXml( QDomDocument &doc, QDomElement &parentElem
|
||||
QgsRasterBlock *QgsHillshadeRenderer::block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback )
|
||||
{
|
||||
Q_UNUSED( bandNo )
|
||||
std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>();
|
||||
if ( !mInput )
|
||||
{
|
||||
QgsDebugError( QStringLiteral( "No input raster!" ) );
|
||||
|
@ -113,7 +113,7 @@ QgsRasterBlock *QgsHueSaturationFilter::block( int bandNo, QgsRectangle const &
|
||||
Q_UNUSED( bandNo )
|
||||
QgsDebugMsgLevel( QStringLiteral( "width = %1 height = %2 extent = %3" ).arg( width ).arg( height ).arg( extent.toString() ), 4 );
|
||||
|
||||
std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>();
|
||||
if ( !mInput )
|
||||
{
|
||||
return outputBlock.release();
|
||||
|
@ -139,7 +139,7 @@ QgsRasterRenderer *QgsMultiBandColorRenderer::create( const QDomElement &elem, Q
|
||||
QgsRasterBlock *QgsMultiBandColorRenderer::block( int bandNo, QgsRectangle const &extent, int width, int height, QgsRasterBlockFeedback *feedback )
|
||||
{
|
||||
Q_UNUSED( bandNo )
|
||||
std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>();
|
||||
if ( !mInput )
|
||||
{
|
||||
return outputBlock.release();
|
||||
|
@ -208,7 +208,7 @@ bool QgsPalettedRasterRenderer::setInputBand( int band )
|
||||
|
||||
QgsRasterBlock *QgsPalettedRasterRenderer::block( int, QgsRectangle const &extent, int width, int height, QgsRasterBlockFeedback *feedback )
|
||||
{
|
||||
std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>();
|
||||
if ( !mInput || mMultiValueClassData.isEmpty() )
|
||||
{
|
||||
return outputBlock.release();
|
||||
|
@ -145,7 +145,7 @@ QgsRasterBlock *QgsRasterContourRenderer::block( int bandNo, const QgsRectangle
|
||||
{
|
||||
Q_UNUSED( bandNo )
|
||||
|
||||
std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>();
|
||||
if ( !mInput || !mContourSymbol )
|
||||
{
|
||||
return outputBlock.release();
|
||||
|
@ -1419,7 +1419,7 @@ void QgsRasterLayer::setContrastEnhancement( QgsContrastEnhancement::ContrastEnh
|
||||
if ( myBand != -1 )
|
||||
{
|
||||
const Qgis::DataType myType = static_cast< Qgis::DataType >( mDataProvider->dataType( myBand ) );
|
||||
std::unique_ptr<QgsContrastEnhancement> myEnhancement( new QgsContrastEnhancement( static_cast< Qgis::DataType >( myType ) ) );
|
||||
auto myEnhancement = std::make_unique<QgsContrastEnhancement>( static_cast< Qgis::DataType >( myType ) );
|
||||
myEnhancement->setContrastEnhancementAlgorithm( algorithm, generateLookupTableFlag );
|
||||
|
||||
double min;
|
||||
|
@ -85,7 +85,7 @@ QgsRasterBlock *QgsRasterNuller::block( int bandNo, QgsRectangle const &extent,
|
||||
return inputBlock.release();
|
||||
}
|
||||
|
||||
std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock( inputBlock->dataType(), width, height ) );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>( inputBlock->dataType(), width, height );
|
||||
if ( mHasOutputNoData.value( bandNo - 1 ) || inputBlock->hasNoDataValue() )
|
||||
{
|
||||
double noDataValue;
|
||||
|
@ -123,7 +123,7 @@ QgsRasterBlock *QgsRasterResampleFilter::block( int bandNo, QgsRectangle const
|
||||
const int bandNumber = 1;
|
||||
|
||||
QgsDebugMsgLevel( QStringLiteral( "width = %1 height = %2 extent = %3" ).arg( width ).arg( height ).arg( extent.toString() ), 4 );
|
||||
std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>();
|
||||
if ( !mInput )
|
||||
return outputBlock.release();
|
||||
|
||||
|
@ -60,7 +60,7 @@ QgsRasterBlock *QgsRasterSingleColorRenderer::block( int, const QgsRectangle &ex
|
||||
{
|
||||
QgsDebugMsgLevel( QStringLiteral( "width = %1 height = %2" ).arg( width ).arg( height ), 4 );
|
||||
|
||||
std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>();
|
||||
if ( !mInput || mInputBand == -1 )
|
||||
{
|
||||
return outputBlock.release();
|
||||
|
@ -59,7 +59,7 @@ QgsRasterBlock *QgsSingleBandColorDataRenderer::block( int bandNo, QgsRectangle
|
||||
{
|
||||
Q_UNUSED( bandNo )
|
||||
|
||||
std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>();
|
||||
if ( !mInput )
|
||||
{
|
||||
return outputBlock.release();
|
||||
|
@ -99,7 +99,7 @@ QgsRasterBlock *QgsSingleBandGrayRenderer::block( int bandNo, const QgsRectangle
|
||||
Q_UNUSED( bandNo )
|
||||
QgsDebugMsgLevel( QStringLiteral( "width = %1 height = %2" ).arg( width ).arg( height ), 4 );
|
||||
|
||||
std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>();
|
||||
if ( !mInput )
|
||||
{
|
||||
return outputBlock.release();
|
||||
|
@ -210,7 +210,7 @@ QgsRasterBlock *QgsSingleBandPseudoColorRenderer::block( int bandNo, QgsRectangl
|
||||
{
|
||||
Q_UNUSED( bandNo )
|
||||
|
||||
std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() );
|
||||
auto outputBlock = std::make_unique<QgsRasterBlock>();
|
||||
if ( !mInput || !mShader || !mShader->rasterShaderFunction() )
|
||||
{
|
||||
return outputBlock.release();
|
||||
|
@ -5006,7 +5006,7 @@ QgsSymbolLayer *QgsCentroidFillSymbolLayer::createFromSld( QDomElement &element
|
||||
|
||||
QgsSymbolLayerList layers;
|
||||
layers.append( l );
|
||||
std::unique_ptr< QgsMarkerSymbol > marker( new QgsMarkerSymbol( layers ) );
|
||||
auto marker = std::make_unique<QgsMarkerSymbol>( layers );
|
||||
|
||||
auto sl = std::make_unique< QgsCentroidFillSymbolLayer >();
|
||||
sl->setSubSymbol( marker.release() );
|
||||
|
@ -537,7 +537,7 @@ QgsVectorLayerExporterTask::QgsVectorLayerExporterTask( QgsVectorLayer *layer, c
|
||||
|
||||
QgsVectorLayerExporterTask *QgsVectorLayerExporterTask::withLayerOwnership( QgsVectorLayer *layer, const QString &uri, const QString &providerKey, const QgsCoordinateReferenceSystem &destinationCrs, const QMap<QString, QVariant> &options )
|
||||
{
|
||||
std::unique_ptr< QgsVectorLayerExporterTask > newTask( new QgsVectorLayerExporterTask( layer, uri, providerKey, destinationCrs, options ) );
|
||||
auto newTask = std::make_unique<QgsVectorLayerExporterTask>( layer, uri, providerKey, destinationCrs, options );
|
||||
newTask->mOwnsLayer = true;
|
||||
return newTask.release();
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ QgsVectorTileFeatures QgsVectorTileMVTDecoder::layerFeatures( const QMap<QString
|
||||
{
|
||||
tmpPoints.append( tmpPoints.first() ); // close the ring
|
||||
|
||||
std::unique_ptr<QgsLineString> ring( new QgsLineString( tmpPoints ) );
|
||||
auto ring = std::make_unique<QgsLineString>( tmpPoints );
|
||||
tmpPoints.clear();
|
||||
|
||||
if ( QgsVectorTileMVTUtils::isExteriorRing( ring.get() ) )
|
||||
|
@ -68,13 +68,13 @@ QgsLayoutGuideWidget::QgsLayoutGuideWidget( QWidget *parent, QgsLayout *layout,
|
||||
|
||||
void QgsLayoutGuideWidget::addHorizontalGuide()
|
||||
{
|
||||
std::unique_ptr<QgsLayoutGuide> newGuide( new QgsLayoutGuide( Qt::Horizontal, QgsLayoutMeasurement( 0 ), mLayout->pageCollection()->page( mPage ) ) );
|
||||
auto newGuide = std::make_unique<QgsLayoutGuide>( Qt::Horizontal, QgsLayoutMeasurement( 0 ), mLayout->pageCollection()->page( mPage ) );
|
||||
mLayout->guides().addGuide( newGuide.release() );
|
||||
}
|
||||
|
||||
void QgsLayoutGuideWidget::addVerticalGuide()
|
||||
{
|
||||
std::unique_ptr<QgsLayoutGuide> newGuide( new QgsLayoutGuide( Qt::Vertical, QgsLayoutMeasurement( 0 ), mLayout->pageCollection()->page( mPage ) ) );
|
||||
auto newGuide = std::make_unique<QgsLayoutGuide>( Qt::Vertical, QgsLayoutMeasurement( 0 ), mLayout->pageCollection()->page( mPage ) );
|
||||
mLayout->guides().addGuide( newGuide.release() );
|
||||
}
|
||||
|
||||
|
@ -930,7 +930,7 @@ void QgsLayoutView::mousePressEvent( QMouseEvent *event )
|
||||
|
||||
if ( mTool )
|
||||
{
|
||||
std::unique_ptr<QgsLayoutViewMouseEvent> me( new QgsLayoutViewMouseEvent( this, event, mTool->flags() & QgsLayoutViewTool::FlagSnaps ) );
|
||||
auto me = std::make_unique<QgsLayoutViewMouseEvent>( this, event, mTool->flags() & QgsLayoutViewTool::FlagSnaps );
|
||||
mTool->layoutPressEvent( me.get() );
|
||||
event->setAccepted( me->isAccepted() );
|
||||
}
|
||||
@ -966,7 +966,7 @@ void QgsLayoutView::mouseReleaseEvent( QMouseEvent *event )
|
||||
|
||||
if ( mTool )
|
||||
{
|
||||
std::unique_ptr<QgsLayoutViewMouseEvent> me( new QgsLayoutViewMouseEvent( this, event, mTool->flags() & QgsLayoutViewTool::FlagSnaps ) );
|
||||
auto me = std::make_unique<QgsLayoutViewMouseEvent>( this, event, mTool->flags() & QgsLayoutViewTool::FlagSnaps );
|
||||
mTool->layoutReleaseEvent( me.get() );
|
||||
event->setAccepted( me->isAccepted() );
|
||||
}
|
||||
@ -985,7 +985,7 @@ void QgsLayoutView::mouseMoveEvent( QMouseEvent *event )
|
||||
QPointF cursorPos = mapToScene( mMouseCurrentXY );
|
||||
if ( mTool )
|
||||
{
|
||||
std::unique_ptr<QgsLayoutViewMouseEvent> me( new QgsLayoutViewMouseEvent( this, event, false ) );
|
||||
auto me = std::make_unique<QgsLayoutViewMouseEvent>( this, event, false );
|
||||
if ( mTool->flags() & QgsLayoutViewTool::FlagSnaps )
|
||||
{
|
||||
me->snapPoint( mHorizontalSnapLine, mVerticalSnapLine, mTool->ignoredSnapItems() );
|
||||
@ -1025,7 +1025,7 @@ void QgsLayoutView::mouseDoubleClickEvent( QMouseEvent *event )
|
||||
|
||||
if ( mTool )
|
||||
{
|
||||
std::unique_ptr<QgsLayoutViewMouseEvent> me( new QgsLayoutViewMouseEvent( this, event, mTool->flags() & QgsLayoutViewTool::FlagSnaps ) );
|
||||
auto me = std::make_unique<QgsLayoutViewMouseEvent>( this, event, mTool->flags() & QgsLayoutViewTool::FlagSnaps );
|
||||
mTool->layoutDoubleClickEvent( me.get() );
|
||||
event->setAccepted( me->isAccepted() );
|
||||
}
|
||||
@ -1244,7 +1244,7 @@ void QgsLayoutView::wheelZoom( QWheelEvent *event )
|
||||
|
||||
QGraphicsLineItem *QgsLayoutView::createSnapLine() const
|
||||
{
|
||||
std::unique_ptr<QGraphicsLineItem> item( new QGraphicsLineItem( nullptr ) );
|
||||
auto item = std::make_unique<QGraphicsLineItem>( nullptr );
|
||||
QPen pen = QPen( QColor( Qt::blue ) );
|
||||
pen.setStyle( Qt::DotLine );
|
||||
pen.setWidthF( 0.0 );
|
||||
|
@ -140,7 +140,7 @@ void QgsPlotCanvas::mouseDoubleClickEvent( QMouseEvent *event )
|
||||
{
|
||||
if ( mTool )
|
||||
{
|
||||
std::unique_ptr<QgsPlotMouseEvent> me( new QgsPlotMouseEvent( this, event ) );
|
||||
auto me = std::make_unique<QgsPlotMouseEvent>( this, event );
|
||||
mTool->plotDoubleClickEvent( me.get() );
|
||||
event->setAccepted( me->isAccepted() );
|
||||
}
|
||||
@ -153,7 +153,7 @@ void QgsPlotCanvas::mousePressEvent( QMouseEvent *event )
|
||||
{
|
||||
if ( mTool )
|
||||
{
|
||||
std::unique_ptr<QgsPlotMouseEvent> me( new QgsPlotMouseEvent( this, event ) );
|
||||
auto me = std::make_unique<QgsPlotMouseEvent>( this, event );
|
||||
mTool->plotPressEvent( me.get() );
|
||||
event->setAccepted( me->isAccepted() );
|
||||
}
|
||||
@ -168,7 +168,7 @@ void QgsPlotCanvas::mousePressEvent( QMouseEvent *event )
|
||||
}
|
||||
else if ( event->button() == Qt::RightButton && mTool->flags() & Qgis::PlotToolFlag::ShowContextMenu )
|
||||
{
|
||||
std::unique_ptr<QgsPlotMouseEvent> me( new QgsPlotMouseEvent( this, event ) );
|
||||
auto me = std::make_unique<QgsPlotMouseEvent>( this, event );
|
||||
showContextMenu( me.get() );
|
||||
event->accept();
|
||||
return;
|
||||
@ -184,7 +184,7 @@ void QgsPlotCanvas::mouseReleaseEvent( QMouseEvent *event )
|
||||
{
|
||||
if ( mTool )
|
||||
{
|
||||
std::unique_ptr<QgsPlotMouseEvent> me( new QgsPlotMouseEvent( this, event ) );
|
||||
auto me = std::make_unique<QgsPlotMouseEvent>( this, event );
|
||||
mTool->plotReleaseEvent( me.get() );
|
||||
event->setAccepted( me->isAccepted() );
|
||||
}
|
||||
@ -216,7 +216,7 @@ void QgsPlotCanvas::mouseMoveEvent( QMouseEvent *event )
|
||||
{
|
||||
if ( mTool )
|
||||
{
|
||||
std::unique_ptr<QgsPlotMouseEvent> me( new QgsPlotMouseEvent( this, event ) );
|
||||
auto me = std::make_unique<QgsPlotMouseEvent>( this, event );
|
||||
mTool->plotMoveEvent( me.get() );
|
||||
event->setAccepted( me->isAccepted() );
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ void QgsModelGraphicsView::mousePressEvent( QMouseEvent *event )
|
||||
|
||||
if ( mTool )
|
||||
{
|
||||
std::unique_ptr<QgsModelViewMouseEvent> me( new QgsModelViewMouseEvent( this, event, mTool->flags() & QgsModelViewTool::FlagSnaps ) );
|
||||
auto me = std::make_unique<QgsModelViewMouseEvent>( this, event, mTool->flags() & QgsModelViewTool::FlagSnaps );
|
||||
mTool->modelPressEvent( me.get() );
|
||||
event->setAccepted( me->isAccepted() );
|
||||
}
|
||||
@ -249,7 +249,7 @@ void QgsModelGraphicsView::mouseReleaseEvent( QMouseEvent *event )
|
||||
|
||||
if ( mTool )
|
||||
{
|
||||
std::unique_ptr<QgsModelViewMouseEvent> me( new QgsModelViewMouseEvent( this, event, mTool->flags() & QgsModelViewTool::FlagSnaps ) );
|
||||
auto me = std::make_unique<QgsModelViewMouseEvent>( this, event, mTool->flags() & QgsModelViewTool::FlagSnaps );
|
||||
mTool->modelReleaseEvent( me.get() );
|
||||
event->setAccepted( me->isAccepted() );
|
||||
}
|
||||
@ -268,7 +268,7 @@ void QgsModelGraphicsView::mouseMoveEvent( QMouseEvent *event )
|
||||
QPointF cursorPos = mapToScene( mMouseCurrentXY );
|
||||
if ( mTool )
|
||||
{
|
||||
std::unique_ptr<QgsModelViewMouseEvent> me( new QgsModelViewMouseEvent( this, event, false ) );
|
||||
auto me = std::make_unique<QgsModelViewMouseEvent>( this, event, false );
|
||||
if ( mTool->flags() & QgsModelViewTool::FlagSnaps )
|
||||
{
|
||||
me->snapPoint();
|
||||
@ -305,7 +305,7 @@ void QgsModelGraphicsView::mouseDoubleClickEvent( QMouseEvent *event )
|
||||
|
||||
if ( mTool )
|
||||
{
|
||||
std::unique_ptr<QgsModelViewMouseEvent> me( new QgsModelViewMouseEvent( this, event, mTool->flags() & QgsModelViewTool::FlagSnaps ) );
|
||||
auto me = std::make_unique<QgsModelViewMouseEvent>( this, event, mTool->flags() & QgsModelViewTool::FlagSnaps );
|
||||
mTool->modelDoubleClickEvent( me.get() );
|
||||
event->setAccepted( me->isAccepted() );
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ bool QgsGeoPackageItemGuiProvider::handleDropGeopackage( QgsGeoPackageCollection
|
||||
bool hasError = false;
|
||||
|
||||
// Main task
|
||||
std::unique_ptr<QgsTaskWithSerialSubTasks> mainTask( new QgsTaskWithSerialSubTasks( tr( "GeoPackage import" ) ) );
|
||||
auto mainTask = std::make_unique<QgsTaskWithSerialSubTasks>( tr( "GeoPackage import" ) );
|
||||
bool hasSubTasks = false;
|
||||
|
||||
const auto lst = QgsMimeDataUtils::decodeUriList( data );
|
||||
|
@ -321,7 +321,7 @@ void QgsOgrDbSourceSelect::setSql( const QModelIndex &index )
|
||||
}
|
||||
|
||||
// create a query builder object
|
||||
std::unique_ptr<QgsQueryBuilder> gb( new QgsQueryBuilder( vlayer.get(), this ) );
|
||||
auto gb = std::make_unique<QgsQueryBuilder>( vlayer.get(), this );
|
||||
|
||||
if ( gb->exec() )
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ QgsFormAnnotation::QgsFormAnnotation( QObject *parent )
|
||||
|
||||
QgsFormAnnotation *QgsFormAnnotation::clone() const
|
||||
{
|
||||
std::unique_ptr<QgsFormAnnotation> c( new QgsFormAnnotation() );
|
||||
auto c = std::make_unique<QgsFormAnnotation>();
|
||||
copyCommonProperties( c.get() );
|
||||
c->setDesignerForm( mDesignerForm );
|
||||
return c.release();
|
||||
|
@ -147,7 +147,7 @@ namespace QgsGuiUtils
|
||||
outputFileName = QFileDialog::getSaveFileName( parent, message, initialPath, formatByExtension + QStringLiteral( ";;" ) + qgsMapJoinKeys( filterMap, QStringLiteral( ";;" ) ), &selectedFilter );
|
||||
#else
|
||||
//create a file dialog using the filter list generated above
|
||||
std::unique_ptr<QFileDialog> fileDialog( new QFileDialog( parent, message, initialPath, formatByExtension + QStringLiteral( ";;" ) + qgsMapJoinKeys( filterMap, QStringLiteral( ";;" ) ) ) );
|
||||
auto fileDialog = std::make_unique<QFileDialog>( parent, message, initialPath, formatByExtension + QStringLiteral( ";;" ) + qgsMapJoinKeys( filterMap, QStringLiteral( ";;" ) ) );
|
||||
|
||||
// allow for selection of more than one file
|
||||
fileDialog->setFileMode( QFileDialog::AnyFile );
|
||||
|
@ -2419,7 +2419,7 @@ void QgsMapCanvas::mouseDoubleClickEvent( QMouseEvent *e )
|
||||
// call handler of current map tool
|
||||
if ( mMapTool )
|
||||
{
|
||||
std::unique_ptr<QgsMapMouseEvent> me( new QgsMapMouseEvent( this, e ) );
|
||||
auto me = std::make_unique<QgsMapMouseEvent>( this, e );
|
||||
mMapTool->canvasDoubleClickEvent( me.get() );
|
||||
}
|
||||
} // mouseDoubleClickEvent
|
||||
@ -2528,13 +2528,13 @@ void QgsMapCanvas::mousePressEvent( QMouseEvent *e )
|
||||
}
|
||||
else if ( mMapTool->flags() & QgsMapTool::ShowContextMenu && e->button() == Qt::RightButton )
|
||||
{
|
||||
std::unique_ptr<QgsMapMouseEvent> me( new QgsMapMouseEvent( this, e ) );
|
||||
auto me = std::make_unique<QgsMapMouseEvent>( this, e );
|
||||
showContextMenu( me.get() );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::unique_ptr<QgsMapMouseEvent> me( new QgsMapMouseEvent( this, e ) );
|
||||
auto me = std::make_unique<QgsMapMouseEvent>( this, e );
|
||||
mMapTool->canvasPressEvent( me.get() );
|
||||
}
|
||||
}
|
||||
@ -2583,7 +2583,7 @@ void QgsMapCanvas::mouseReleaseEvent( QMouseEvent *e )
|
||||
// call handler of current map tool
|
||||
if ( mMapTool )
|
||||
{
|
||||
std::unique_ptr<QgsMapMouseEvent> me( new QgsMapMouseEvent( this, e ) );
|
||||
auto me = std::make_unique<QgsMapMouseEvent>( this, e );
|
||||
mMapTool->canvasReleaseEvent( me.get() );
|
||||
}
|
||||
}
|
||||
@ -2762,7 +2762,7 @@ void QgsMapCanvas::mouseMoveEvent( QMouseEvent *e )
|
||||
// call handler of current map tool
|
||||
if ( mMapTool )
|
||||
{
|
||||
std::unique_ptr<QgsMapMouseEvent> me( new QgsMapMouseEvent( this, e ) );
|
||||
auto me = std::make_unique<QgsMapMouseEvent>( this, e );
|
||||
mMapTool->canvasMoveEvent( me.get() );
|
||||
}
|
||||
}
|
||||
|
@ -1094,7 +1094,7 @@ void QgsRasterLayerProperties::buttonBuildPyramids_clicked()
|
||||
{
|
||||
QgsRasterDataProvider *provider = mRasterLayer->dataProvider();
|
||||
|
||||
std::unique_ptr<QgsRasterBlockFeedback> feedback( new QgsRasterBlockFeedback() );
|
||||
auto feedback = std::make_unique<QgsRasterBlockFeedback>();
|
||||
|
||||
connect( feedback.get(), &QgsRasterBlockFeedback::progressChanged, mPyramidProgress, &QProgressBar::setValue );
|
||||
//
|
||||
|
@ -3255,7 +3255,7 @@ Qgis::VectorExportResult QgsOracleProvider::createEmptyLayer( const QString &uri
|
||||
dsUri.setWkbType( wkbType );
|
||||
|
||||
QgsDataProvider::ProviderOptions providerOptions;
|
||||
std::unique_ptr<QgsOracleProvider> provider( new QgsOracleProvider( dsUri.uri( false ), providerOptions ) );
|
||||
auto provider = std::make_unique<QgsOracleProvider>( dsUri.uri( false ), providerOptions );
|
||||
if ( !provider->isValid() )
|
||||
{
|
||||
errorMessage = QObject::tr( "Loading of the layer %1 failed" ).arg( ownerTableName );
|
||||
|
@ -149,7 +149,7 @@ bool QgsPGConnectionItem::handleDrop( const QMimeData *data, const QString &toSc
|
||||
uri.setSchema( toSchema );
|
||||
}
|
||||
|
||||
std::unique_ptr<QgsVectorLayerExporterTask> exportTask( new QgsVectorLayerExporterTask( srcLayer, uri.uri( false ), QStringLiteral( "postgres" ), srcLayer->crs(), QVariantMap(), owner ) );
|
||||
auto exportTask = std::make_unique<QgsVectorLayerExporterTask>( srcLayer, uri.uri( false ), QStringLiteral( "postgres" ), srcLayer->crs(), QVariantMap(), owner );
|
||||
|
||||
// when export is successful:
|
||||
connect( exportTask.get(), &QgsVectorLayerExporterTask::exportComplete, this, [=]() {
|
||||
|
@ -35,7 +35,7 @@ extern "C"
|
||||
|
||||
std::unique_ptr<QgsPostgresListener> QgsPostgresListener::create( const QString &connString )
|
||||
{
|
||||
std::unique_ptr<QgsPostgresListener> res( new QgsPostgresListener( connString ) );
|
||||
auto res = std::make_unique<QgsPostgresListener>( connString );
|
||||
QgsDebugMsgLevel( QStringLiteral( "starting notification listener" ), 2 );
|
||||
|
||||
res->start();
|
||||
|
@ -44,6 +44,7 @@ class QgsPostgresListener : public QThread
|
||||
*/
|
||||
static std::unique_ptr<QgsPostgresListener> create( const QString &connString );
|
||||
|
||||
QgsPostgresListener( const QString &connString );
|
||||
~QgsPostgresListener() override;
|
||||
|
||||
void run() override;
|
||||
@ -56,8 +57,6 @@ class QgsPostgresListener : public QThread
|
||||
|
||||
QgsPostgresConn *mConn = nullptr;
|
||||
|
||||
QgsPostgresListener( const QString &connString );
|
||||
|
||||
Q_DISABLE_COPY( QgsPostgresListener )
|
||||
};
|
||||
|
||||
|
@ -173,7 +173,7 @@ bool QgsSpatiaLiteDataItemGuiProvider::handleDropConnectionItem( QgsSLConnection
|
||||
destUri.setDataSource( QString(), u.name, srcLayer->geometryType() != Qgis::GeometryType::Null ? QStringLiteral( "geom" ) : QString() );
|
||||
QgsDebugMsgLevel( "URI " + destUri.uri(), 2 );
|
||||
|
||||
std::unique_ptr<QgsVectorLayerExporterTask> exportTask( new QgsVectorLayerExporterTask( srcLayer, destUri.uri(), QStringLiteral( "spatialite" ), srcLayer->crs(), QVariantMap(), owner ) );
|
||||
auto exportTask = std::make_unique<QgsVectorLayerExporterTask>( srcLayer, destUri.uri(), QStringLiteral( "spatialite" ), srcLayer->crs(), QVariantMap(), owner );
|
||||
|
||||
// when export is successful:
|
||||
connect( exportTask.get(), &QgsVectorLayerExporterTask::exportComplete, connItem, [=]() {
|
||||
|
@ -257,7 +257,7 @@ bool QgsVirtualLayerSourceSelect::preFlight()
|
||||
if ( !def.toString().isEmpty() )
|
||||
{
|
||||
const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
|
||||
std::unique_ptr<QgsVectorLayer> vl( new QgsVectorLayer( def.toString(), QStringLiteral( "test" ), QStringLiteral( "virtual" ), options ) );
|
||||
auto vl = std::make_unique<QgsVectorLayer>( def.toString(), QStringLiteral( "test" ), QStringLiteral( "virtual" ), options );
|
||||
if ( vl->isValid() )
|
||||
{
|
||||
const QStringList fieldNames = vl->fields().names();
|
||||
|
@ -165,7 +165,7 @@ QgsRasterBlock *QgsVirtualRasterProvider::block( int bandNo, const QgsRectangle
|
||||
proj.setInput( it->raster->dataProvider() );
|
||||
proj.setPrecision( QgsRasterProjector::Exact );
|
||||
|
||||
std::unique_ptr<QgsRasterBlockFeedback> rasterBlockFeedback( new QgsRasterBlockFeedback() );
|
||||
auto rasterBlockFeedback = std::make_unique<QgsRasterBlockFeedback>();
|
||||
QObject::connect( feedback, &QgsFeedback::canceled, rasterBlockFeedback.get(), &QgsRasterBlockFeedback::cancel );
|
||||
block.reset( proj.block( it->bandNumber, extent, width, height, rasterBlockFeedback.get() ) );
|
||||
if ( rasterBlockFeedback->isCanceled() )
|
||||
|
@ -103,7 +103,7 @@ const QgsProject *QgsConfigCache::project( const QString &path, const QgsServerS
|
||||
if ( !mProjectCache[path] )
|
||||
{
|
||||
// disable the project style database -- this incurs unwanted cost and is not required
|
||||
std::unique_ptr<QgsProject> prj( new QgsProject( nullptr, Qgis::ProjectCapabilities() ) );
|
||||
auto prj = std::make_unique<QgsProject>( nullptr, Qgis::ProjectCapabilities() );
|
||||
|
||||
// This is required by virtual layers that call QgsProject::instance() inside the constructor :(
|
||||
QgsProject::setInstance( prj.get() );
|
||||
|
@ -196,7 +196,7 @@ namespace QgsWfs
|
||||
QgsAccessControl *accessControl = serverIface->accessControls();
|
||||
//scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope
|
||||
//there's LOTS of potential exit paths here, so we avoid having to restore the filters manually
|
||||
std::unique_ptr<QgsOWSServerFilterRestorer> filterRestorer( new QgsOWSServerFilterRestorer() );
|
||||
auto filterRestorer = std::make_unique<QgsOWSServerFilterRestorer>();
|
||||
#else
|
||||
( void ) serverIface;
|
||||
#endif
|
||||
|
@ -249,7 +249,7 @@ namespace QgsWfs
|
||||
|
||||
//scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope
|
||||
//there's LOTS of potential exit paths here, so we avoid having to restore the filters manually
|
||||
std::unique_ptr<QgsOWSServerFilterRestorer> filterRestorer( new QgsOWSServerFilterRestorer() );
|
||||
auto filterRestorer = std::make_unique<QgsOWSServerFilterRestorer>();
|
||||
|
||||
// get layers
|
||||
QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project );
|
||||
|
@ -233,7 +233,7 @@ namespace QgsWfs
|
||||
|
||||
//scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope
|
||||
//there's LOTS of potential exit paths here, so we avoid having to restore the filters manually
|
||||
std::unique_ptr<QgsOWSServerFilterRestorer> filterRestorer( new QgsOWSServerFilterRestorer() );
|
||||
auto filterRestorer = std::make_unique<QgsOWSServerFilterRestorer>();
|
||||
|
||||
// get layers
|
||||
QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project );
|
||||
|
@ -1241,7 +1241,7 @@ void QgsWfs3CollectionsItemsHandler::handleRequest( const QgsServerApiContext &c
|
||||
|
||||
//scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope
|
||||
//there's LOTS of potential exit paths here, so we avoid having to restore the filters manually
|
||||
std::unique_ptr<QgsOWSServerFilterRestorer> filterRestorer( new QgsOWSServerFilterRestorer() );
|
||||
auto filterRestorer = std::make_unique<QgsOWSServerFilterRestorer>();
|
||||
if ( accessControl )
|
||||
{
|
||||
QgsOWSServerFilterRestorer::applyAccessControlLayerFilters( accessControl, mapLayer, filterRestorer->originalFilters() );
|
||||
@ -1434,7 +1434,7 @@ void QgsWfs3CollectionsFeatureHandler::handleRequest( const QgsServerApiContext
|
||||
QgsAccessControl *accessControl = context.serverInterface()->accessControls();
|
||||
//scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope
|
||||
//there's LOTS of potential exit paths here, so we avoid having to restore the filters manually
|
||||
std::unique_ptr<QgsOWSServerFilterRestorer> filterRestorer( new QgsOWSServerFilterRestorer() );
|
||||
auto filterRestorer = std::make_unique<QgsOWSServerFilterRestorer>();
|
||||
if ( accessControl )
|
||||
{
|
||||
QgsOWSServerFilterRestorer::applyAccessControlLayerFilters( accessControl, mapLayer, filterRestorer->originalFilters() );
|
||||
@ -1498,7 +1498,7 @@ void QgsWfs3CollectionsFeatureHandler::handleRequest( const QgsServerApiContext
|
||||
|
||||
//scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope
|
||||
//there's LOTS of potential exit paths here, so we avoid having to restore the filters manually
|
||||
std::unique_ptr<QgsOWSServerFilterRestorer> filterRestorer( new QgsOWSServerFilterRestorer() );
|
||||
auto filterRestorer = std::make_unique<QgsOWSServerFilterRestorer>();
|
||||
if ( accessControl )
|
||||
{
|
||||
QgsOWSServerFilterRestorer::applyAccessControlLayerFilters( accessControl, mapLayer, filterRestorer->originalFilters() );
|
||||
@ -1629,7 +1629,7 @@ void QgsWfs3CollectionsFeatureHandler::handleRequest( const QgsServerApiContext
|
||||
|
||||
//scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope
|
||||
//there's LOTS of potential exit paths here, so we avoid having to restore the filters manually
|
||||
std::unique_ptr<QgsOWSServerFilterRestorer> filterRestorer( new QgsOWSServerFilterRestorer() );
|
||||
auto filterRestorer = std::make_unique<QgsOWSServerFilterRestorer>();
|
||||
if ( accessControl )
|
||||
{
|
||||
QgsOWSServerFilterRestorer::applyAccessControlLayerFilters( accessControl, mapLayer, filterRestorer->originalFilters() );
|
||||
@ -1748,7 +1748,7 @@ void QgsWfs3CollectionsFeatureHandler::handleRequest( const QgsServerApiContext
|
||||
|
||||
//scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope
|
||||
//there's LOTS of potential exit paths here, so we avoid having to restore the filters manually
|
||||
std::unique_ptr<QgsOWSServerFilterRestorer> filterRestorer( new QgsOWSServerFilterRestorer() );
|
||||
auto filterRestorer = std::make_unique<QgsOWSServerFilterRestorer>();
|
||||
if ( accessControl )
|
||||
{
|
||||
QgsOWSServerFilterRestorer::applyAccessControlLayerFilters( accessControl, mapLayer, filterRestorer->originalFilters() );
|
||||
|
@ -243,7 +243,7 @@ namespace QgsWms
|
||||
QgsLayerTreeModel *legendModel( const QgsWmsRenderContext &context, QgsLayerTree &tree )
|
||||
{
|
||||
const QgsWmsParameters parameters = context.parameters();
|
||||
std::unique_ptr<QgsLayerTreeModel> model( new QgsLayerTreeModel( &tree ) );
|
||||
auto model = std::make_unique<QgsLayerTreeModel>( &tree );
|
||||
std::unique_ptr<QgsMapSettings> mapSettings;
|
||||
|
||||
if ( context.scaleDenominator() > 0 )
|
||||
@ -320,7 +320,7 @@ namespace QgsWms
|
||||
|
||||
QgsLayerTree *layerTree( const QgsWmsRenderContext &context )
|
||||
{
|
||||
std::unique_ptr<QgsLayerTree> tree( new QgsLayerTree() );
|
||||
auto tree = std::make_unique<QgsLayerTree>();
|
||||
|
||||
QList<QgsVectorLayerFeatureCounter *> counters;
|
||||
for ( QgsMapLayer *ml : context.layersToRender() )
|
||||
@ -363,7 +363,7 @@ namespace QgsWms
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::unique_ptr<QgsLayerTree> tree( new QgsLayerTree() );
|
||||
auto tree = std::make_unique<QgsLayerTree>();
|
||||
|
||||
QgsWmsParameters wmsParams = context.parameters();
|
||||
QStringList layerNicknames = wmsParams.allLayersNickname();
|
||||
|
@ -528,7 +528,7 @@ namespace QgsWms
|
||||
configureLayers( layers, &mapSettings );
|
||||
|
||||
// configure map settings (background, DPI, ...)
|
||||
std::unique_ptr<QImage> image( new QImage() );
|
||||
auto image = std::make_unique<QImage>();
|
||||
configureMapSettings( image.get(), mapSettings );
|
||||
|
||||
// add layers to map settings
|
||||
@ -3606,7 +3606,7 @@ namespace QgsWms
|
||||
}
|
||||
if ( !exp.isEmpty() )
|
||||
{
|
||||
std::unique_ptr<QgsExpression> expression( new QgsExpression( exp ) );
|
||||
auto expression = std::make_unique<QgsExpression>( exp );
|
||||
if ( expression )
|
||||
{
|
||||
mFeatureFilter.setFilter( filteredLayer, *expression );
|
||||
|
@ -207,9 +207,9 @@ void TestQgs3DRendering::initTestCase()
|
||||
QColor cMin = Qt::red, cMax = Qt::yellow;
|
||||
|
||||
// change renderer for the new style
|
||||
std::unique_ptr<QgsColorRampShader> colorRampShader( new QgsColorRampShader( vMin, vMax ) );
|
||||
auto colorRampShader = std::make_unique<QgsColorRampShader>( vMin, vMax );
|
||||
colorRampShader->setColorRampItemList( QList<QgsColorRampShader::ColorRampItem>() << QgsColorRampShader::ColorRampItem( vMin, cMin ) << QgsColorRampShader::ColorRampItem( vMax, cMax ) );
|
||||
std::unique_ptr<QgsRasterShader> shader( new QgsRasterShader( vMin, vMax ) );
|
||||
auto shader = std::make_unique<QgsRasterShader>( vMin, vMax );
|
||||
shader->setRasterShaderFunction( colorRampShader.release() );
|
||||
QgsSingleBandPseudoColorRenderer *r = new QgsSingleBandPseudoColorRenderer( mLayerDtm->renderer()->input(), 1, shader.release() );
|
||||
mLayerDtm->setRenderer( r );
|
||||
@ -1545,7 +1545,7 @@ void TestQgs3DRendering::testInstancedRendering()
|
||||
{
|
||||
const QgsRectangle fullExtent( 1000, 1000, 2000, 2000 );
|
||||
|
||||
std::unique_ptr<QgsVectorLayer> layerPointsZ( new QgsVectorLayer( "PointZ?crs=EPSG:27700", "points Z", "memory" ) );
|
||||
auto layerPointsZ = std::make_unique<QgsVectorLayer>( "PointZ?crs=EPSG:27700", "points Z", "memory" );
|
||||
|
||||
QgsPoint *p1 = new QgsPoint( 1000, 1000, 50 );
|
||||
QgsPoint *p2 = new QgsPoint( 1000, 2000, 100 );
|
||||
@ -1620,7 +1620,7 @@ void TestQgs3DRendering::testInstancedRenderingClipping()
|
||||
{
|
||||
const QgsRectangle fullExtent( 1000, 1000, 2000, 2000 );
|
||||
|
||||
std::unique_ptr<QgsVectorLayer> layerPointsZ( new QgsVectorLayer( "PointZ?crs=EPSG:27700", "points Z", "memory" ) );
|
||||
auto layerPointsZ = std::make_unique<QgsVectorLayer>( "PointZ?crs=EPSG:27700", "points Z", "memory" );
|
||||
|
||||
QgsPoint *p1 = new QgsPoint( 1000, 1000, 50 );
|
||||
QgsPoint *p2 = new QgsPoint( 1000, 2000, 100 );
|
||||
@ -1720,7 +1720,7 @@ void TestQgs3DRendering::testBillboardRendering()
|
||||
{
|
||||
const QgsRectangle fullExtent( 1000, 1000, 2000, 2000 );
|
||||
|
||||
std::unique_ptr<QgsVectorLayer> layerPointsZ( new QgsVectorLayer( "PointZ?crs=EPSG:27700", "points Z", "memory" ) );
|
||||
auto layerPointsZ = std::make_unique<QgsVectorLayer>( "PointZ?crs=EPSG:27700", "points Z", "memory" );
|
||||
|
||||
QgsPoint *p1 = new QgsPoint( 1000, 1000, 50 );
|
||||
QgsPoint *p2 = new QgsPoint( 1000, 2000, 100 );
|
||||
|
@ -2141,7 +2141,7 @@ void TestQgsProcessing::generateTemporaryDestination()
|
||||
context.setProject( &p );
|
||||
|
||||
// destination vector with "." in it's name
|
||||
std::unique_ptr<QgsProcessingParameterVectorDestination> def( new QgsProcessingParameterVectorDestination( "with.inside", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QString(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterVectorDestination>( "with.inside", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QString(), false );
|
||||
|
||||
// check that temporary destination does not have dot at the end when there is no extension
|
||||
QVERIFY( !def->generateTemporaryDestination().endsWith( QLatin1Char( '.' ) ) );
|
||||
@ -2152,7 +2152,7 @@ void TestQgsProcessing::generateTemporaryDestination()
|
||||
QCOMPARE( f.completeSuffix(), QString( "gpkg" ) );
|
||||
|
||||
// destination raster with "." in it's name
|
||||
std::unique_ptr<QgsProcessingParameterRasterDestination> def2( new QgsProcessingParameterRasterDestination( "with.inside", QString(), QString(), false ) );
|
||||
auto def2 = std::make_unique<QgsProcessingParameterRasterDestination>( "with.inside", QString(), QString(), false );
|
||||
|
||||
// check that temporary destination does not have dot at the end when there is no extension
|
||||
QVERIFY( !def2->generateTemporaryDestination().endsWith( QLatin1Char( '.' ) ) );
|
||||
@ -2163,7 +2163,7 @@ void TestQgsProcessing::generateTemporaryDestination()
|
||||
QCOMPARE( f.completeSuffix(), QString( "tif" ) );
|
||||
|
||||
// destination vector without "." in it's name
|
||||
std::unique_ptr<QgsProcessingParameterVectorDestination> def3( new QgsProcessingParameterVectorDestination( "without_inside", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QString(), false ) );
|
||||
auto def3 = std::make_unique<QgsProcessingParameterVectorDestination>( "without_inside", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QString(), false );
|
||||
|
||||
// check that temporary destination does not have dot at the end when there is no extension
|
||||
QVERIFY( !def3->generateTemporaryDestination().endsWith( QLatin1Char( '.' ) ) );
|
||||
@ -3186,7 +3186,7 @@ void TestQgsProcessing::parameterCrs()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, with default value
|
||||
std::unique_ptr<QgsProcessingParameterCrs> def( new QgsProcessingParameterCrs( "non_optional", QString(), QString( "EPSG:3113" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterCrs>( "non_optional", QString(), QString( "EPSG:3113" ), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -3376,7 +3376,7 @@ void TestQgsProcessing::parameterMapLayer()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, no default value
|
||||
std::unique_ptr<QgsProcessingParameterMapLayer> def( new QgsProcessingParameterMapLayer( "non_optional", QString(), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterMapLayer>( "non_optional", QString(), QVariant(), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -3591,7 +3591,7 @@ void TestQgsProcessing::parameterExtent()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, with default value
|
||||
std::unique_ptr<QgsProcessingParameterExtent> def( new QgsProcessingParameterExtent( "non_optional", QString(), QString( "1,2,3,4" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterExtent>( "non_optional", QString(), QString( "1,2,3,4" ), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -3962,7 +3962,7 @@ void TestQgsProcessing::parameterPoint()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional, with default value
|
||||
std::unique_ptr<QgsProcessingParameterPoint> def( new QgsProcessingParameterPoint( "non_optional", QString(), QString( "1,2" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterPoint>( "non_optional", QString(), QString( "1,2" ), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -4199,7 +4199,7 @@ void TestQgsProcessing::parameterGeometry()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional, default value
|
||||
std::unique_ptr<QgsProcessingParameterGeometry> def( new QgsProcessingParameterGeometry( "non_optional", QString(), QString( "Point(1 2)" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterGeometry>( "non_optional", QString(), QString( "Point(1 2)" ), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -4447,7 +4447,7 @@ void TestQgsProcessing::parameterFile()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional, with default value
|
||||
std::unique_ptr<QgsProcessingParameterFile> def( new QgsProcessingParameterFile( "non_optional", QString(), Qgis::ProcessingFileParameterBehavior::File, QString(), QString( "abc.bmp" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterFile>( "non_optional", QString(), Qgis::ProcessingFileParameterBehavior::File, QString(), QString( "abc.bmp" ), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -4673,7 +4673,7 @@ void TestQgsProcessing::parameterMatrix()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional, no default value
|
||||
std::unique_ptr<QgsProcessingParameterMatrix> def( new QgsProcessingParameterMatrix( "non_optional", QString(), 3, false, QStringList(), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterMatrix>( "non_optional", QString(), 3, false, QStringList(), QVariant(), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( 5 ) );
|
||||
@ -4837,7 +4837,7 @@ void TestQgsProcessing::parameterLayerList()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, no default value
|
||||
std::unique_ptr<QgsProcessingParameterMultipleLayers> def( new QgsProcessingParameterMultipleLayers( "non_optional", QString(), Qgis::ProcessingSourceType::MapLayer, QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterMultipleLayers>( "non_optional", QString(), Qgis::ProcessingSourceType::MapLayer, QVariant(), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -5190,7 +5190,7 @@ void TestQgsProcessing::parameterDistance()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterDistance> def( new QgsProcessingParameterDistance( "non_optional", QString(), 5, QStringLiteral( "parent" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterDistance>( "non_optional", QString(), 5, QStringLiteral( "parent" ), false );
|
||||
QCOMPARE( def->parentParameterName(), QStringLiteral( "parent" ) );
|
||||
def->setParentParameterName( QStringLiteral( "parent2" ) );
|
||||
QCOMPARE( def->defaultUnit(), Qgis::DistanceUnit::Unknown );
|
||||
@ -5306,7 +5306,7 @@ void TestQgsProcessing::parameterArea()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterArea> def( new QgsProcessingParameterArea( "non_optional", QString(), 5, QStringLiteral( "parent" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterArea>( "non_optional", QString(), 5, QStringLiteral( "parent" ), false );
|
||||
QCOMPARE( def->parentParameterName(), QStringLiteral( "parent" ) );
|
||||
def->setParentParameterName( QStringLiteral( "parent2" ) );
|
||||
QCOMPARE( def->defaultUnit(), Qgis::AreaUnit::Unknown );
|
||||
@ -5422,7 +5422,7 @@ void TestQgsProcessing::parameterVolume()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterVolume> def( new QgsProcessingParameterVolume( "non_optional", QString(), 5, QStringLiteral( "parent" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterVolume>( "non_optional", QString(), 5, QStringLiteral( "parent" ), false );
|
||||
QCOMPARE( def->parentParameterName(), QStringLiteral( "parent" ) );
|
||||
def->setParentParameterName( QStringLiteral( "parent2" ) );
|
||||
QCOMPARE( def->defaultUnit(), Qgis::VolumeUnit::Unknown );
|
||||
@ -5538,7 +5538,7 @@ void TestQgsProcessing::parameterDuration()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterDuration> def( new QgsProcessingParameterDuration( "non_optional", QString(), 5, false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterDuration>( "non_optional", QString(), 5, false );
|
||||
QCOMPARE( def->defaultUnit(), Qgis::TemporalUnit::Milliseconds );
|
||||
def->setDefaultUnit( Qgis::TemporalUnit::Days );
|
||||
QCOMPARE( def->defaultUnit(), Qgis::TemporalUnit::Days );
|
||||
@ -5646,7 +5646,7 @@ void TestQgsProcessing::parameterScale()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterScale> def( new QgsProcessingParameterScale( "non_optional", QString(), 5, false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterScale>( "non_optional", QString(), 5, false );
|
||||
|
||||
QVERIFY( def->checkValueIsAcceptable( 5 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "1.1" ) );
|
||||
@ -5757,7 +5757,7 @@ void TestQgsProcessing::parameterNumber()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterNumber> def( new QgsProcessingParameterNumber( "non_optional", QString(), Qgis::ProcessingNumberParameterType::Double, 5, false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterNumber>( "non_optional", QString(), Qgis::ProcessingNumberParameterType::Double, 5, false );
|
||||
QVERIFY( def->checkValueIsAcceptable( 5 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "1.1" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "1.1,2" ) );
|
||||
@ -5903,7 +5903,7 @@ void TestQgsProcessing::parameterRange()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional, with default value
|
||||
std::unique_ptr<QgsProcessingParameterRange> def( new QgsProcessingParameterRange( "non_optional", QString(), Qgis::ProcessingNumberParameterType::Double, QString( "5,6" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterRange>( "non_optional", QString(), Qgis::ProcessingNumberParameterType::Double, QString( "5,6" ), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "1.1" ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "1.1,2" ) );
|
||||
@ -6089,7 +6089,7 @@ void TestQgsProcessing::parameterRasterLayer()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, no default value
|
||||
std::unique_ptr<QgsProcessingParameterRasterLayer> def( new QgsProcessingParameterRasterLayer( "non_optional", QString(), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterRasterLayer>( "non_optional", QString(), QVariant(), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -6242,7 +6242,7 @@ void TestQgsProcessing::parameterEnum()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterEnum> def( new QgsProcessingParameterEnum( "non_optional", QString(), QStringList() << "A" << "B" << "C", false, 2, false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterEnum>( "non_optional", QString(), QStringList() << "A" << "B" << "C", false, 2, false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( 1 ) );
|
||||
@ -6617,7 +6617,7 @@ void TestQgsProcessing::parameterString()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterString> def( new QgsProcessingParameterString( "non_optional", QString(), QString(), false, false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterString>( "non_optional", QString(), QString(), false, false );
|
||||
QVERIFY( def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -6797,7 +6797,7 @@ void TestQgsProcessing::parameterAuthConfig()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterAuthConfig> def( new QgsProcessingParameterAuthConfig( "non_optional", QString(), QString(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterAuthConfig>( "non_optional", QString(), QString(), false );
|
||||
QVERIFY( def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -6934,7 +6934,7 @@ void TestQgsProcessing::parameterExpression()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterExpression> def( new QgsProcessingParameterExpression( "non_optional", QString(), QString( "1+1" ), QString(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterExpression>( "non_optional", QString(), QString( "1+1" ), QString(), false );
|
||||
QVERIFY( def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -7044,7 +7044,7 @@ void TestQgsProcessing::parameterField()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional, no default value
|
||||
std::unique_ptr<QgsProcessingParameterField> def( new QgsProcessingParameterField( "non_optional", QString(), QVariant(), QString(), Qgis::ProcessingFieldParameterDataType::Any, false, false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterField>( "non_optional", QString(), QVariant(), QString(), Qgis::ProcessingFieldParameterDataType::Any, false, false );
|
||||
QVERIFY( def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( QStringList() << "a" << "b" ) );
|
||||
@ -7352,7 +7352,7 @@ void TestQgsProcessing::parameterVectorLayer()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, with default value
|
||||
std::unique_ptr<QgsProcessingParameterVectorLayer> def( new QgsProcessingParameterVectorLayer( "non_optional", QString(), QList<int>(), QString( "somelayer" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterVectorLayer>( "non_optional", QString(), QList<int>(), QString( "somelayer" ), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -7514,7 +7514,7 @@ void TestQgsProcessing::parameterMeshLayer()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, with default value
|
||||
std::unique_ptr<QgsProcessingParameterMeshLayer> def( new QgsProcessingParameterMeshLayer( "non_optional", QString(), QString( "somelayer" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterMeshLayer>( "non_optional", QString(), QString( "somelayer" ), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -7674,7 +7674,7 @@ void TestQgsProcessing::parameterFeatureSource()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterFeatureSource> def( new QgsProcessingParameterFeatureSource( "non_optional", QString(), QList<int>() << static_cast<int>( Qgis::ProcessingSourceType::VectorAnyGeometry ), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterFeatureSource>( "non_optional", QString(), QList<int>() << static_cast<int>( Qgis::ProcessingSourceType::VectorAnyGeometry ), QVariant(), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -7929,7 +7929,7 @@ void TestQgsProcessing::parameterFeatureSink()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, no default value
|
||||
std::unique_ptr<QgsProcessingParameterFeatureSink> def( new QgsProcessingParameterFeatureSink( "non_optional", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterFeatureSink>( "non_optional", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -8135,7 +8135,7 @@ void TestQgsProcessing::parameterVectorOut()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, no default
|
||||
std::unique_ptr<QgsProcessingParameterVectorDestination> def( new QgsProcessingParameterVectorDestination( "non_optional", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterVectorDestination>( "non_optional", QString(), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -8373,7 +8373,7 @@ void TestQgsProcessing::parameterRasterOut()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, no default
|
||||
std::unique_ptr<QgsProcessingParameterRasterDestination> def( new QgsProcessingParameterRasterDestination( "non_optional", QString(), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterRasterDestination>( "non_optional", QString(), QVariant(), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -8540,7 +8540,7 @@ void TestQgsProcessing::parameterPointCloudOut()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, no default
|
||||
std::unique_ptr<QgsProcessingParameterPointCloudDestination> def( new QgsProcessingParameterPointCloudDestination( "non_optional", QString(), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterPointCloudDestination>( "non_optional", QString(), QVariant(), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -8709,7 +8709,7 @@ void TestQgsProcessing::parameterFileOut()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterFileDestination> def( new QgsProcessingParameterFileDestination( "non_optional", QString(), QStringLiteral( "BMP files (*.bmp)" ), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterFileDestination>( "non_optional", QString(), QStringLiteral( "BMP files (*.bmp)" ), QVariant(), false );
|
||||
QCOMPARE( def->fileFilter(), QStringLiteral( "BMP files (*.bmp)" ) );
|
||||
QCOMPARE( def->defaultFileExtension(), QStringLiteral( "bmp" ) );
|
||||
QVERIFY( def->generateTemporaryDestination().endsWith( QLatin1String( ".bmp" ) ) );
|
||||
@ -8874,7 +8874,7 @@ void TestQgsProcessing::parameterFolderOut()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterFolderDestination> def( new QgsProcessingParameterFolderDestination( "non_optional", QString(), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterFolderDestination>( "non_optional", QString(), QVariant(), false );
|
||||
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
@ -8990,7 +8990,7 @@ void TestQgsProcessing::parameterVectorTileOut()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, no default
|
||||
std::unique_ptr<QgsProcessingParameterVectorTileDestination> def( new QgsProcessingParameterVectorTileDestination( "non_optional", QString(), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterVectorTileDestination>( "non_optional", QString(), QVariant(), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -9155,7 +9155,7 @@ void TestQgsProcessing::parameterBand()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterBand> def( new QgsProcessingParameterBand( "non_optional", QString(), QVariant(), QString(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterBand>( "non_optional", QString(), QVariant(), QString(), false );
|
||||
QVERIFY( def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "1" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -9315,7 +9315,7 @@ void TestQgsProcessing::parameterLayout()
|
||||
p.layoutManager()->addLayout( l2 );
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterLayout> def( new QgsProcessingParameterLayout( "non_optional", QString(), QString(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterLayout>( "non_optional", QString(), QString(), false );
|
||||
QVERIFY( def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -9474,7 +9474,7 @@ void TestQgsProcessing::parameterLayoutItem()
|
||||
QgsPrintLayout *l2 = new QgsPrintLayout( &p );
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterLayoutItem> def( new QgsProcessingParameterLayoutItem( "non_optional", QString(), QVariant(), QString(), -1, false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterLayoutItem>( "non_optional", QString(), QVariant(), QString(), -1, false );
|
||||
QVERIFY( def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -9621,7 +9621,7 @@ void TestQgsProcessing::parameterColor()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterColor> def( new QgsProcessingParameterColor( "non_optional", QString(), QVariant(), true, false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterColor>( "non_optional", QString(), QVariant(), true, false );
|
||||
QVERIFY( def->opacityEnabled() );
|
||||
def->setOpacityEnabled( false );
|
||||
QVERIFY( !def->opacityEnabled() );
|
||||
@ -9798,7 +9798,7 @@ void TestQgsProcessing::parameterCoordinateOperation()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterCoordinateOperation> def( new QgsProcessingParameterCoordinateOperation( "non_optional", QString(), QString(), QString(), QString(), QVariant(), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterCoordinateOperation>( "non_optional", QString(), QString(), QString(), QString(), QVariant(), QVariant(), false );
|
||||
QVERIFY( def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -9949,7 +9949,7 @@ void TestQgsProcessing::parameterMapTheme()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterMapTheme> def( new QgsProcessingParameterMapTheme( "non_optional", QString(), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterMapTheme>( "non_optional", QString(), QVariant(), false );
|
||||
QVERIFY( def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -10093,7 +10093,7 @@ void TestQgsProcessing::parameterProviderConnection()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional, no default
|
||||
std::unique_ptr<QgsProcessingParameterProviderConnection> def( new QgsProcessingParameterProviderConnection( "non_optional", QString(), QStringLiteral( "ogr" ), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterProviderConnection>( "non_optional", QString(), QStringLiteral( "ogr" ), QVariant(), false );
|
||||
QCOMPARE( def->providerId(), QStringLiteral( "ogr" ) );
|
||||
def->setProviderId( QStringLiteral( "postgres" ) );
|
||||
QCOMPARE( def->providerId(), QStringLiteral( "postgres" ) );
|
||||
@ -10251,7 +10251,7 @@ void TestQgsProcessing::parameterDatabaseSchema()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional, no default
|
||||
std::unique_ptr<QgsProcessingParameterDatabaseSchema> def( new QgsProcessingParameterDatabaseSchema( "non_optional", QString(), QString(), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterDatabaseSchema>( "non_optional", QString(), QString(), QVariant(), false );
|
||||
QVERIFY( def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -10349,7 +10349,7 @@ void TestQgsProcessing::parameterDatabaseTable()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional, no default
|
||||
std::unique_ptr<QgsProcessingParameterDatabaseTable> def( new QgsProcessingParameterDatabaseTable( "non_optional", QString(), QString(), QString(), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterDatabaseTable>( "non_optional", QString(), QString(), QString(), QVariant(), false );
|
||||
QVERIFY( def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -10463,7 +10463,7 @@ void TestQgsProcessing::parameterFieldMapping()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterFieldMapping> def( new QgsProcessingParameterFieldMapping( "non_optional", QString(), QStringLiteral( "parent" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterFieldMapping>( "non_optional", QString(), QStringLiteral( "parent" ), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -10530,7 +10530,7 @@ void TestQgsProcessing::parameterAggregate()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional!
|
||||
std::unique_ptr<QgsProcessingParameterAggregate> def( new QgsProcessingParameterAggregate( "non_optional", QString(), QStringLiteral( "parent" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterAggregate>( "non_optional", QString(), QStringLiteral( "parent" ), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -10624,7 +10624,7 @@ void TestQgsProcessing::parameterTinInputLayers()
|
||||
QgsVectorLayer *vectorLayer = new QgsVectorLayer( QStringLiteral( "Point" ), QStringLiteral( "PointLayerForTin" ), QStringLiteral( "memory" ) );
|
||||
project.addMapLayer( vectorLayer );
|
||||
|
||||
std::unique_ptr<QgsProcessingParameterTinInputLayers> def( new QgsProcessingParameterTinInputLayers( "tin input layer" ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterTinInputLayers>( "tin input layer" );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -10778,7 +10778,7 @@ void TestQgsProcessing::parameterMeshDatasetTime()
|
||||
QgsProject project;
|
||||
context.setProject( &project );
|
||||
|
||||
std::unique_ptr<QgsProcessingParameterMeshDatasetTime> def( new QgsProcessingParameterMeshDatasetTime( QStringLiteral( "dataset groups" ), QStringLiteral( "groups" ) ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterMeshDatasetTime>( QStringLiteral( "dataset groups" ), QStringLiteral( "groups" ) );
|
||||
QVERIFY( def->type() == QLatin1String( "meshdatasettime" ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( QDateTime( QDate( 2020, 01, 01 ), QTime( 10, 0, 0 ) ) ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( QVariant::fromValue( QDateTime( QDate( 2020, 01, 01 ), QTime( 10, 0, 0 ) ) ).toString() ) );
|
||||
@ -10890,7 +10890,7 @@ void TestQgsProcessing::parameterDateTime()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional, with default
|
||||
std::unique_ptr<QgsProcessingParameterDateTime> def( new QgsProcessingParameterDateTime( "non_optional", QString(), Qgis::ProcessingDateTimeParameterDataType::DateTime, QDateTime( QDate( 2010, 4, 3 ), QTime( 12, 11, 10 ) ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterDateTime>( "non_optional", QString(), Qgis::ProcessingDateTimeParameterDataType::DateTime, QDateTime( QDate( 2010, 4, 3 ), QTime( 12, 11, 10 ) ), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "1.1" ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( QDateTime( QDate( 2020, 2, 2 ), QTime( 0, 0, 0 ) ) ) );
|
||||
@ -11280,7 +11280,7 @@ void TestQgsProcessing::parameterDxfLayers()
|
||||
QgsVectorLayer *vectorLayer = new QgsVectorLayer( QStringLiteral( "Point" ), QStringLiteral( "PointLayer" ), QStringLiteral( "memory" ) );
|
||||
project.addMapLayer( vectorLayer );
|
||||
|
||||
std::unique_ptr<QgsProcessingParameterDxfLayers> def( new QgsProcessingParameterDxfLayers( "dxf input layer" ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterDxfLayers>( "dxf input layer" );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -11418,7 +11418,7 @@ void TestQgsProcessing::parameterAnnotationLayer()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, no default
|
||||
std::unique_ptr<QgsProcessingParameterAnnotationLayer> def( new QgsProcessingParameterAnnotationLayer( "non_optional", QString(), QVariant(), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterAnnotationLayer>( "non_optional", QString(), QVariant(), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -11598,7 +11598,7 @@ void TestQgsProcessing::parameterPointCloudLayer()
|
||||
context.setProject( &p );
|
||||
|
||||
// not optional, with default
|
||||
std::unique_ptr<QgsProcessingParameterPointCloudLayer> def( new QgsProcessingParameterPointCloudLayer( "non_optional", QString(), QString( "somelayer" ), false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterPointCloudLayer>( "non_optional", QString(), QString( "somelayer" ), false );
|
||||
QVERIFY( !def->checkValueIsAcceptable( false ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( true ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
|
||||
@ -11748,7 +11748,7 @@ void TestQgsProcessing::parameterPointCloudAttribute()
|
||||
QgsProcessingContext context;
|
||||
|
||||
// not optional, no default
|
||||
std::unique_ptr<QgsProcessingParameterPointCloudAttribute> def( new QgsProcessingParameterPointCloudAttribute( "non_optional", QString(), QVariant(), QString(), false, false ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterPointCloudAttribute>( "non_optional", QString(), QVariant(), QString(), false, false );
|
||||
QVERIFY( def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( QStringList() << "a" << "b" ) );
|
||||
@ -11982,7 +11982,7 @@ void TestQgsProcessing::parameterAlignRasterLayers()
|
||||
QgsRasterLayer *rasterLayer = new QgsRasterLayer( fi.filePath(), "R1" );
|
||||
project.addMapLayer( rasterLayer );
|
||||
|
||||
std::unique_ptr<QgsProcessingParameterAlignRasterLayers> def( new QgsProcessingParameterAlignRasterLayers( "align raster layer" ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterAlignRasterLayers>( "align raster layer" );
|
||||
QVERIFY( !def->checkValueIsAcceptable( 1 ) );
|
||||
QVERIFY( def->checkValueIsAcceptable( "test" ) );
|
||||
QVERIFY( !def->checkValueIsAcceptable( "" ) );
|
||||
@ -12257,7 +12257,7 @@ void TestQgsProcessing::processingFeatureSink()
|
||||
context.setProject( &p );
|
||||
|
||||
// first using static string definition
|
||||
std::unique_ptr<QgsProcessingParameterFeatureSink> def( new QgsProcessingParameterFeatureSink( QStringLiteral( "layer" ) ) );
|
||||
auto def = std::make_unique<QgsProcessingParameterFeatureSink>( QStringLiteral( "layer" ) );
|
||||
QVariantMap params;
|
||||
params.insert( QStringLiteral( "layer" ), QgsProcessingOutputLayerDefinition( "memory:test", nullptr ) );
|
||||
QString dest;
|
||||
|
@ -201,7 +201,7 @@ void TestQgsZonalStatistics::testReprojection()
|
||||
const QString myTestDataPath = myDataPath + "/zonalstatistics/";
|
||||
|
||||
// create a reprojected version of the layer
|
||||
std::unique_ptr<QgsVectorLayer> vectorLayer( new QgsVectorLayer( myTestDataPath + "polys.shp", QStringLiteral( "poly" ), QStringLiteral( "ogr" ) ) );
|
||||
auto vectorLayer = std::make_unique<QgsVectorLayer>( myTestDataPath + "polys.shp", QStringLiteral( "poly" ), QStringLiteral( "ogr" ) );
|
||||
std::unique_ptr<QgsVectorLayer> reprojected( vectorLayer->materialize( QgsFeatureRequest().setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3785" ) ), QgsProject::instance()->transformContext() ) ) );
|
||||
|
||||
QCOMPARE( reprojected->featureCount(), vectorLayer->featureCount() );
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user