mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
Swap QScopedPointer to std::unique_ptr
Why? - no benefits to QScopedPointer over std::unique_ptr - unlike QScopedPointer, std::unique_ptr has no overhead over regular pointers - using standard language features makes it more likely that compilers can optimise this use and static analysers can correctly handle code using unique_ptrs - QScopedPointer has an (IMO) uncertain future (given that Qt is dropping features which have become part of the c++ standard). Better to port now before wider use of QScopedPointer in the codebase!
This commit is contained in:
parent
9475850f39
commit
aed6c735a6
@ -913,7 +913,7 @@ void QgsComposer::setTitle( const QString& title )
|
|||||||
bool QgsComposer::loadFromTemplate( const QDomDocument& templateDoc, bool clearExisting )
|
bool QgsComposer::loadFromTemplate( const QDomDocument& templateDoc, bool clearExisting )
|
||||||
{
|
{
|
||||||
// provide feedback, since composer will be hidden when loading template (much faster)
|
// provide feedback, since composer will be hidden when loading template (much faster)
|
||||||
QScopedPointer< QDialog > dlg( new QgsBusyIndicatorDialog( tr( "Loading template into composer..." ), this ) );
|
std::unique_ptr< QDialog > dlg( new QgsBusyIndicatorDialog( tr( "Loading template into composer..." ), this ) );
|
||||||
dlg->setStyleSheet( mQgis->styleSheet() );
|
dlg->setStyleSheet( mQgis->styleSheet() );
|
||||||
dlg->show();
|
dlg->show();
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ void QgsDwgImportDialog::on_pbLoadDatabase_clicked()
|
|||||||
|
|
||||||
bool lblVisible = false;
|
bool lblVisible = false;
|
||||||
|
|
||||||
QScopedPointer<QgsVectorLayer> d( new QgsVectorLayer( QString( "%1|layername=drawing" ).arg( leDatabase->text() ), "layers", "ogr", false ) );
|
std::unique_ptr<QgsVectorLayer> d( new QgsVectorLayer( QString( "%1|layername=drawing" ).arg( leDatabase->text() ), "layers", "ogr", false ) );
|
||||||
if ( d && d->isValid() )
|
if ( d && d->isValid() )
|
||||||
{
|
{
|
||||||
int idxPath = d->fields().lookupField( "path" );
|
int idxPath = d->fields().lookupField( "path" );
|
||||||
@ -190,7 +190,7 @@ void QgsDwgImportDialog::on_pbLoadDatabase_clicked()
|
|||||||
|
|
||||||
lblMessage->setVisible( lblVisible );
|
lblMessage->setVisible( lblVisible );
|
||||||
|
|
||||||
QScopedPointer<QgsVectorLayer> l( new QgsVectorLayer( QString( "%1|layername=layers" ).arg( leDatabase->text() ), "layers", "ogr", false ) );
|
std::unique_ptr<QgsVectorLayer> l( new QgsVectorLayer( QString( "%1|layername=layers" ).arg( leDatabase->text() ), "layers", "ogr", false ) );
|
||||||
if ( l && l->isValid() )
|
if ( l && l->isValid() )
|
||||||
{
|
{
|
||||||
int idxName = l->fields().lookupField( "name" );
|
int idxName = l->fields().lookupField( "name" );
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include <cpl_string.h>
|
#include <cpl_string.h>
|
||||||
#include <gdal.h>
|
#include <gdal.h>
|
||||||
#include <ogr_srs_api.h>
|
#include <ogr_srs_api.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#define LOG( x ) { QgsDebugMsg( x ); QgsMessageLog::logMessage( x, QObject::tr( "DWG/DXF import" ) ); }
|
#define LOG( x ) { QgsDebugMsg( x ); QgsMessageLog::logMessage( x, QObject::tr( "DWG/DXF import" ) ); }
|
||||||
#define ONCE( x ) { static bool show=true; if( show ) LOG( x ); show=false; }
|
#define ONCE( x ) { static bool show=true; if( show ) LOG( x ); show=false; }
|
||||||
@ -614,7 +615,7 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa
|
|||||||
if ( fi.suffix().toLower() == "dxf" )
|
if ( fi.suffix().toLower() == "dxf" )
|
||||||
{
|
{
|
||||||
//loads dxf
|
//loads dxf
|
||||||
QScopedPointer<dxfRW> dxf( new dxfRW( drawing.toUtf8() ) );
|
std::unique_ptr<dxfRW> dxf( new dxfRW( drawing.toUtf8() ) );
|
||||||
if ( !dxf->read( this, false ) )
|
if ( !dxf->read( this, false ) )
|
||||||
{
|
{
|
||||||
result = DRW::BAD_UNKNOWN;
|
result = DRW::BAD_UNKNOWN;
|
||||||
@ -623,7 +624,7 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa
|
|||||||
else if ( fi.suffix().toLower() == "dwg" )
|
else if ( fi.suffix().toLower() == "dwg" )
|
||||||
{
|
{
|
||||||
//loads dwg
|
//loads dwg
|
||||||
QScopedPointer<dwgR> dwg( new dwgR( drawing.toUtf8() ) );
|
std::unique_ptr<dwgR> dwg( new dwgR( drawing.toUtf8() ) );
|
||||||
if ( !dwg->read( this, false ) )
|
if ( !dwg->read( this, false ) )
|
||||||
{
|
{
|
||||||
result = dwg->getError();
|
result = dwg->getError();
|
||||||
@ -1185,12 +1186,12 @@ void QgsDwgImporter::addAppId( const DRW_AppId &data )
|
|||||||
bool QgsDwgImporter::createFeature( OGRLayerH layer, OGRFeatureH f, const QgsAbstractGeometry &g0 ) const
|
bool QgsDwgImporter::createFeature( OGRLayerH layer, OGRFeatureH f, const QgsAbstractGeometry &g0 ) const
|
||||||
{
|
{
|
||||||
const QgsAbstractGeometry *g;
|
const QgsAbstractGeometry *g;
|
||||||
QScopedPointer<QgsAbstractGeometry> sg( nullptr );
|
std::unique_ptr<QgsAbstractGeometry> sg( nullptr );
|
||||||
|
|
||||||
if ( !mUseCurves && g0.hasCurvedSegments() )
|
if ( !mUseCurves && g0.hasCurvedSegments() )
|
||||||
{
|
{
|
||||||
sg.reset( g0.segmentize() );
|
sg.reset( g0.segmentize() );
|
||||||
g = sg.data();
|
g = sg.get();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -449,15 +449,15 @@ void QgisApp::layerTreeViewDoubleClicked( const QModelIndex& index )
|
|||||||
if ( !originalSymbol )
|
if ( !originalSymbol )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QScopedPointer< QgsSymbol > symbol( originalSymbol->clone() );
|
std::unique_ptr< QgsSymbol > symbol( originalSymbol->clone() );
|
||||||
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer*>( node->layerNode()->layer() );
|
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer*>( node->layerNode()->layer() );
|
||||||
QgsSymbolSelectorDialog dlg( symbol.data(), QgsStyle::defaultStyle(), vlayer, this );
|
QgsSymbolSelectorDialog dlg( symbol.get(), QgsStyle::defaultStyle(), vlayer, this );
|
||||||
QgsSymbolWidgetContext context;
|
QgsSymbolWidgetContext context;
|
||||||
context.setMapCanvas( mMapCanvas );
|
context.setMapCanvas( mMapCanvas );
|
||||||
dlg.setContext( context );
|
dlg.setContext( context );
|
||||||
if ( dlg.exec() )
|
if ( dlg.exec() )
|
||||||
{
|
{
|
||||||
node->setSymbol( symbol.take() );
|
node->setSymbol( symbol.release() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -6241,7 +6241,7 @@ void QgisApp::saveAsRasterFile()
|
|||||||
// TODO: show error dialogs
|
// TODO: show error dialogs
|
||||||
// TODO: this code should go somewhere else, but probably not into QgsRasterFileWriter
|
// TODO: this code should go somewhere else, but probably not into QgsRasterFileWriter
|
||||||
// clone pipe/provider is not really necessary, ready for threads
|
// clone pipe/provider is not really necessary, ready for threads
|
||||||
QScopedPointer<QgsRasterPipe> pipe( nullptr );
|
std::unique_ptr<QgsRasterPipe> pipe( nullptr );
|
||||||
|
|
||||||
if ( d.mode() == QgsRasterLayerSaveAsDialog::RawDataMode )
|
if ( d.mode() == QgsRasterLayerSaveAsDialog::RawDataMode )
|
||||||
{
|
{
|
||||||
@ -6303,7 +6303,7 @@ void QgisApp::saveAsRasterFile()
|
|||||||
fileWriter.setPyramidsFormat( d.pyramidsFormat() );
|
fileWriter.setPyramidsFormat( d.pyramidsFormat() );
|
||||||
fileWriter.setPyramidsConfigOptions( d.pyramidsConfigOptions() );
|
fileWriter.setPyramidsConfigOptions( d.pyramidsConfigOptions() );
|
||||||
|
|
||||||
QgsRasterFileWriter::WriterError err = fileWriter.writeRaster( pipe.data(), d.nColumns(), d.nRows(), d.outputRectangle(), d.outputCrs(), &pd );
|
QgsRasterFileWriter::WriterError err = fileWriter.writeRaster( pipe.get(), d.nColumns(), d.nRows(), d.outputRectangle(), d.outputCrs(), &pd );
|
||||||
if ( err != QgsRasterFileWriter::NoError )
|
if ( err != QgsRasterFileWriter::NoError )
|
||||||
{
|
{
|
||||||
QMessageBox::warning( this, tr( "Error" ),
|
QMessageBox::warning( this, tr( "Error" ),
|
||||||
|
@ -147,7 +147,7 @@ void QgsAnnotationWidget::updateCenterIcon()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( mMarkerSymbol.data(), mMapMarkerButton->iconSize() );
|
QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( mMarkerSymbol.get(), mMapMarkerButton->iconSize() );
|
||||||
mMapMarkerButton->setIcon( icon );
|
mMapMarkerButton->setIcon( icon );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ void QgsAnnotationWidget::updateFillIcon()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( mFillSymbol.data(), mFrameStyleButton->iconSize() );
|
QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( mFillSymbol.get(), mFrameStyleButton->iconSize() );
|
||||||
mFrameStyleButton->setIcon( icon );
|
mFrameStyleButton->setIcon( icon );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "ui_qgsannotationwidgetbase.h"
|
#include "ui_qgsannotationwidgetbase.h"
|
||||||
#include "qgis_app.h"
|
#include "qgis_app.h"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class QgsMapCanvasAnnotationItem;
|
class QgsMapCanvasAnnotationItem;
|
||||||
class QgsMarkerSymbol;
|
class QgsMarkerSymbol;
|
||||||
@ -47,8 +48,8 @@ class APP_EXPORT QgsAnnotationWidget: public QWidget, private Ui::QgsAnnotationW
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QgsMapCanvasAnnotationItem* mItem = nullptr;
|
QgsMapCanvasAnnotationItem* mItem = nullptr;
|
||||||
QScopedPointer< QgsMarkerSymbol > mMarkerSymbol;
|
std::unique_ptr< QgsMarkerSymbol > mMarkerSymbol;
|
||||||
QScopedPointer< QgsFillSymbol > mFillSymbol;
|
std::unique_ptr< QgsFillSymbol > mFillSymbol;
|
||||||
|
|
||||||
void blockAllSignals( bool block );
|
void blockAllSignals( bool block );
|
||||||
void updateCenterIcon();
|
void updateCenterIcon();
|
||||||
|
@ -500,15 +500,15 @@ void QgsAppLayerTreeViewMenuProvider::editVectorSymbol()
|
|||||||
if ( !singleRenderer )
|
if ( !singleRenderer )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QScopedPointer< QgsSymbol > symbol( singleRenderer->symbol() ? singleRenderer->symbol()->clone() : nullptr );
|
std::unique_ptr< QgsSymbol > symbol( singleRenderer->symbol() ? singleRenderer->symbol()->clone() : nullptr );
|
||||||
QgsSymbolSelectorDialog dlg( symbol.data(), QgsStyle::defaultStyle(), layer, mView->window() );
|
QgsSymbolSelectorDialog dlg( symbol.get(), QgsStyle::defaultStyle(), layer, mView->window() );
|
||||||
dlg.setWindowTitle( tr( "Symbol selector" ) );
|
dlg.setWindowTitle( tr( "Symbol selector" ) );
|
||||||
QgsSymbolWidgetContext context;
|
QgsSymbolWidgetContext context;
|
||||||
context.setMapCanvas( mCanvas );
|
context.setMapCanvas( mCanvas );
|
||||||
dlg.setContext( context );
|
dlg.setContext( context );
|
||||||
if ( dlg.exec() )
|
if ( dlg.exec() )
|
||||||
{
|
{
|
||||||
singleRenderer->setSymbol( symbol.take() );
|
singleRenderer->setSymbol( symbol.release() );
|
||||||
layer->triggerRepaint();
|
layer->triggerRepaint();
|
||||||
mView->refreshLayerSymbology( layer->id() );
|
mView->refreshLayerSymbology( layer->id() );
|
||||||
}
|
}
|
||||||
@ -576,16 +576,16 @@ void QgsAppLayerTreeViewMenuProvider::editSymbolLegendNodeSymbol()
|
|||||||
if ( !originalSymbol )
|
if ( !originalSymbol )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QScopedPointer< QgsSymbol > symbol( originalSymbol->clone() );
|
std::unique_ptr< QgsSymbol > symbol( originalSymbol->clone() );
|
||||||
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer*>( node->layerNode()->layer() );
|
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer*>( node->layerNode()->layer() );
|
||||||
QgsSymbolSelectorDialog dlg( symbol.data(), QgsStyle::defaultStyle(), vlayer, mView->window() );
|
QgsSymbolSelectorDialog dlg( symbol.get(), QgsStyle::defaultStyle(), vlayer, mView->window() );
|
||||||
dlg.setWindowTitle( tr( "Symbol selector" ) );
|
dlg.setWindowTitle( tr( "Symbol selector" ) );
|
||||||
QgsSymbolWidgetContext context;
|
QgsSymbolWidgetContext context;
|
||||||
context.setMapCanvas( mCanvas );
|
context.setMapCanvas( mCanvas );
|
||||||
dlg.setContext( context );
|
dlg.setContext( context );
|
||||||
if ( dlg.exec() )
|
if ( dlg.exec() )
|
||||||
{
|
{
|
||||||
node->setSymbol( symbol.take() );
|
node->setSymbol( symbol.release() );
|
||||||
if ( vlayer )
|
if ( vlayer )
|
||||||
{
|
{
|
||||||
vlayer->emitStyleChanged();
|
vlayer->emitStyleChanged();
|
||||||
|
@ -101,7 +101,7 @@ QgsBookmarks::QgsBookmarks( QWidget *parent )
|
|||||||
mProjectModel = new QgsProjectBookmarksTableModel();
|
mProjectModel = new QgsProjectBookmarksTableModel();
|
||||||
mModel.reset( new QgsMergedBookmarksTableModel( *mQgisModel, *mProjectModel, lstBookmarks ) );
|
mModel.reset( new QgsMergedBookmarksTableModel( *mQgisModel, *mProjectModel, lstBookmarks ) );
|
||||||
|
|
||||||
lstBookmarks->setModel( mModel.data() );
|
lstBookmarks->setModel( mModel.get() );
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
lstBookmarks->header()->restoreState( settings.value( QStringLiteral( "/Windows/Bookmarks/headerstate" ) ).toByteArray() );
|
lstBookmarks->header()->restoreState( settings.value( QStringLiteral( "/Windows/Bookmarks/headerstate" ) ).toByteArray() );
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#define QGSBOOKMARKS_H
|
#define QGSBOOKMARKS_H
|
||||||
|
|
||||||
#include <QSqlTableModel>
|
#include <QSqlTableModel>
|
||||||
#include <QScopedPointer>
|
#include <memory>
|
||||||
|
|
||||||
#include "ui_qgsbookmarksbase.h"
|
#include "ui_qgsbookmarksbase.h"
|
||||||
#include "qgsdockwidget.h"
|
#include "qgsdockwidget.h"
|
||||||
@ -121,7 +121,7 @@ class APP_EXPORT QgsBookmarks : public QgsDockWidget, private Ui::QgsBookmarksBa
|
|||||||
private:
|
private:
|
||||||
QSqlTableModel* mQgisModel;
|
QSqlTableModel* mQgisModel;
|
||||||
QgsProjectBookmarksTableModel* mProjectModel;
|
QgsProjectBookmarksTableModel* mProjectModel;
|
||||||
QScopedPointer<QgsMergedBookmarksTableModel> mModel;
|
std::unique_ptr<QgsMergedBookmarksTableModel> mModel;
|
||||||
|
|
||||||
void saveWindowLocation();
|
void saveWindowLocation();
|
||||||
void restorePosition();
|
void restorePosition();
|
||||||
|
@ -251,7 +251,7 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
|
|||||||
mCheckBoxAttributeLegend->setChecked( dr->attributeLegend() );
|
mCheckBoxAttributeLegend->setChecked( dr->attributeLegend() );
|
||||||
mCheckBoxSizeLegend->setChecked( dr->sizeLegend() );
|
mCheckBoxSizeLegend->setChecked( dr->sizeLegend() );
|
||||||
mSizeLegendSymbol.reset( dr->sizeLegendSymbol() ? dr->sizeLegendSymbol()->clone() : QgsMarkerSymbol::createSimple( QgsStringMap() ) );
|
mSizeLegendSymbol.reset( dr->sizeLegendSymbol() ? dr->sizeLegendSymbol()->clone() : QgsMarkerSymbol::createSimple( QgsStringMap() ) );
|
||||||
QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( mSizeLegendSymbol.data(), mButtonSizeLegendSymbol->iconSize() );
|
QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( mSizeLegendSymbol.get(), mButtonSizeLegendSymbol->iconSize() );
|
||||||
mButtonSizeLegendSymbol->setIcon( icon );
|
mButtonSizeLegendSymbol->setIcon( icon );
|
||||||
|
|
||||||
//assume single category or linearly interpolated diagram renderer for now
|
//assume single category or linearly interpolated diagram renderer for now
|
||||||
@ -943,7 +943,7 @@ void QgsDiagramProperties::on_mButtonSizeLegendSymbol_clicked()
|
|||||||
if ( d.exec() == QDialog::Accepted )
|
if ( d.exec() == QDialog::Accepted )
|
||||||
{
|
{
|
||||||
mSizeLegendSymbol.reset( newSymbol );
|
mSizeLegendSymbol.reset( newSymbol );
|
||||||
QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( mSizeLegendSymbol.data(), mButtonSizeLegendSymbol->iconSize() );
|
QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( mSizeLegendSymbol.get(), mButtonSizeLegendSymbol->iconSize() );
|
||||||
mButtonSizeLegendSymbol->setIcon( icon );
|
mButtonSizeLegendSymbol->setIcon( icon );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -80,7 +80,7 @@ class APP_EXPORT QgsDiagramProperties : public QWidget, private Ui::QgsDiagramPr
|
|||||||
|
|
||||||
// Keeps track of the diagram type to properly save / restore settings when the diagram type combo box is set to no diagram.
|
// Keeps track of the diagram type to properly save / restore settings when the diagram type combo box is set to no diagram.
|
||||||
QString mDiagramType;
|
QString mDiagramType;
|
||||||
QScopedPointer< QgsMarkerSymbol > mSizeLegendSymbol;
|
std::unique_ptr< QgsMarkerSymbol > mSizeLegendSymbol;
|
||||||
|
|
||||||
QString guessLegendText( const QString &expression );
|
QString guessLegendText( const QString &expression );
|
||||||
QgsMapCanvas *mMapCanvas;
|
QgsMapCanvas *mMapCanvas;
|
||||||
|
@ -116,7 +116,7 @@ bool QgsFeatureAction::editFeature( bool showModal )
|
|||||||
|
|
||||||
if ( showModal )
|
if ( showModal )
|
||||||
{
|
{
|
||||||
QScopedPointer<QgsAttributeDialog> dialog( newDialog( false ) );
|
std::unique_ptr<QgsAttributeDialog> dialog( newDialog( false ) );
|
||||||
|
|
||||||
if ( !mFeature->isValid() )
|
if ( !mFeature->isValid() )
|
||||||
dialog->setMode( QgsAttributeForm::AddFeatureMode );
|
dialog->setMode( QgsAttributeForm::AddFeatureMode );
|
||||||
|
@ -46,13 +46,13 @@ QgsLabelingWidget::QgsLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canva
|
|||||||
|
|
||||||
void QgsLabelingWidget::resetSettings()
|
void QgsLabelingWidget::resetSettings()
|
||||||
{
|
{
|
||||||
if ( mOldSettings.data() )
|
if ( mOldSettings )
|
||||||
{
|
{
|
||||||
if ( mOldSettings->type() == QLatin1String( "simple" ) )
|
if ( mOldSettings->type() == QLatin1String( "simple" ) )
|
||||||
{
|
{
|
||||||
mOldPalSettings.writeToLayer( mLayer );
|
mOldPalSettings.writeToLayer( mLayer );
|
||||||
}
|
}
|
||||||
mLayer->setLabeling( mOldSettings.take() );
|
mLayer->setLabeling( mOldSettings.release() );
|
||||||
}
|
}
|
||||||
setLayer( mLayer );
|
setLayer( mLayer );
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ class QgsLabelingWidget : public QgsMapLayerConfigWidget, private Ui::QgsLabelin
|
|||||||
|
|
||||||
QWidget* mWidget;
|
QWidget* mWidget;
|
||||||
QgsLabelingGui* mLabelGui;
|
QgsLabelingGui* mLabelGui;
|
||||||
QScopedPointer< QgsAbstractVectorLayerLabeling > mOldSettings;
|
std::unique_ptr< QgsAbstractVectorLayerLabeling > mOldSettings;
|
||||||
QgsPalLayerSettings mOldPalSettings;
|
QgsPalLayerSettings mOldPalSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
|
|||||||
}
|
}
|
||||||
|
|
||||||
//create QgsFeature with wkb representation
|
//create QgsFeature with wkb representation
|
||||||
QScopedPointer< QgsFeature > f( new QgsFeature( vlayer->fields(), 0 ) );
|
std::unique_ptr< QgsFeature > f( new QgsFeature( vlayer->fields(), 0 ) );
|
||||||
|
|
||||||
//does compoundcurve contain circular strings?
|
//does compoundcurve contain circular strings?
|
||||||
//does provider support circular strings?
|
//does provider support circular strings?
|
||||||
@ -288,7 +288,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
|
|||||||
}
|
}
|
||||||
f->setValid( true );
|
f->setValid( true );
|
||||||
|
|
||||||
if ( addFeature( vlayer, f.data(), false ) )
|
if ( addFeature( vlayer, f.get(), false ) )
|
||||||
{
|
{
|
||||||
//add points to other features to keep topology up-to-date
|
//add points to other features to keep topology up-to-date
|
||||||
bool topologicalEditing = QgsProject::instance()->topologicalEditing();
|
bool topologicalEditing = QgsProject::instance()->topologicalEditing();
|
||||||
|
@ -77,7 +77,7 @@ void QgsMapToolOffsetPointSymbol::canvasPressOnFeature( QgsMapMouseEvent *e, con
|
|||||||
{
|
{
|
||||||
Q_UNUSED( e );
|
Q_UNUSED( e );
|
||||||
mClickedFeature = feature;
|
mClickedFeature = feature;
|
||||||
createPreviewItem( mMarkerSymbol.data() );
|
createPreviewItem( mMarkerSymbol.get() );
|
||||||
mOffsetItem->setPointLocation( snappedPoint );
|
mOffsetItem->setPointLocation( snappedPoint );
|
||||||
updateOffsetPreviewItem( mClickedPoint, mClickedPoint );
|
updateOffsetPreviewItem( mClickedPoint, mClickedPoint );
|
||||||
mOffsetting = true;
|
mOffsetting = true;
|
||||||
@ -97,7 +97,7 @@ bool QgsMapToolOffsetPointSymbol::checkSymbolCompatibility( QgsMarkerSymbol* mar
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
ok = true;
|
ok = true;
|
||||||
if ( mMarkerSymbol.isNull() )
|
if ( !mMarkerSymbol )
|
||||||
{
|
{
|
||||||
double symbolRotation = markerSymbol->angle();
|
double symbolRotation = markerSymbol->angle();
|
||||||
if ( layer->dataDefinedProperties().isActive( QgsSymbolLayer::PropertyAngle ) )
|
if ( layer->dataDefinedProperties().isActive( QgsSymbolLayer::PropertyAngle ) )
|
||||||
|
@ -60,7 +60,7 @@ class APP_EXPORT QgsMapToolOffsetPointSymbol: public QgsMapToolPointSymbol
|
|||||||
QgsPointMarkerItem* mOffsetItem;
|
QgsPointMarkerItem* mOffsetItem;
|
||||||
|
|
||||||
//! Clone of first found marker symbol for feature with offset attribute set
|
//! Clone of first found marker symbol for feature with offset attribute set
|
||||||
QScopedPointer< QgsMarkerSymbol > mMarkerSymbol;
|
std::unique_ptr< QgsMarkerSymbol > mMarkerSymbol;
|
||||||
|
|
||||||
//! Feature which was clicked on
|
//! Feature which was clicked on
|
||||||
QgsFeature mClickedFeature;
|
QgsFeature mClickedFeature;
|
||||||
|
@ -83,7 +83,7 @@ void QgsMapToolRotatePointSymbols::canvasPressOnFeature( QgsMapMouseEvent *e, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
mCurrentRotationFeature = attrVal.toDouble();
|
mCurrentRotationFeature = attrVal.toDouble();
|
||||||
createPixmapItem( mMarkerSymbol.data() );
|
createPixmapItem( mMarkerSymbol.get() );
|
||||||
if ( mRotationItem )
|
if ( mRotationItem )
|
||||||
{
|
{
|
||||||
mRotationItem->setPointLocation( snappedPoint );
|
mRotationItem->setPointLocation( snappedPoint );
|
||||||
@ -101,7 +101,7 @@ bool QgsMapToolRotatePointSymbols::checkSymbolCompatibility( QgsMarkerSymbol* ma
|
|||||||
{
|
{
|
||||||
mCurrentRotationAttributes << mActiveLayer->fields().indexFromName( ddAngle.field() );
|
mCurrentRotationAttributes << mActiveLayer->fields().indexFromName( ddAngle.field() );
|
||||||
ok = true;
|
ok = true;
|
||||||
if ( mMarkerSymbol.isNull() )
|
if ( !mMarkerSymbol )
|
||||||
{
|
{
|
||||||
mMarkerSymbol.reset( markerSymbol->clone() );
|
mMarkerSymbol.reset( markerSymbol->clone() );
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "qgsmaptoolpointsymbol.h"
|
#include "qgsmaptoolpointsymbol.h"
|
||||||
#include "qgis_app.h"
|
#include "qgis_app.h"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class QgsPointRotationItem;
|
class QgsPointRotationItem;
|
||||||
class QgsMarkerSymbol;
|
class QgsMarkerSymbol;
|
||||||
@ -62,7 +63,7 @@ class APP_EXPORT QgsMapToolRotatePointSymbols: public QgsMapToolPointSymbol
|
|||||||
//! True if ctrl was pressed during the last mouse move event
|
//! True if ctrl was pressed during the last mouse move event
|
||||||
bool mCtrlPressed;
|
bool mCtrlPressed;
|
||||||
//! Clone of first found marker symbol for feature with rotation attribute set
|
//! Clone of first found marker symbol for feature with rotation attribute set
|
||||||
QScopedPointer< QgsMarkerSymbol > mMarkerSymbol;
|
std::unique_ptr< QgsMarkerSymbol > mMarkerSymbol;
|
||||||
|
|
||||||
void drawArrow( double azimut ) const;
|
void drawArrow( double azimut ) const;
|
||||||
//! Calculates the azimut between mousePos and mSnappedPoint
|
//! Calculates the azimut between mousePos and mSnappedPoint
|
||||||
|
@ -94,7 +94,7 @@ void QgsPointMarkerItem::setSymbol( QgsMarkerSymbol *symbol )
|
|||||||
|
|
||||||
QgsMarkerSymbol*QgsPointMarkerItem::symbol()
|
QgsMarkerSymbol*QgsPointMarkerItem::symbol()
|
||||||
{
|
{
|
||||||
return mMarkerSymbol.data();
|
return mMarkerSymbol.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsPointMarkerItem::setFeature( const QgsFeature& feature )
|
void QgsPointMarkerItem::setFeature( const QgsFeature& feature )
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <QFontMetricsF>
|
#include <QFontMetricsF>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include "qgis_app.h"
|
#include "qgis_app.h"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class QgsMarkerSymbol;
|
class QgsMarkerSymbol;
|
||||||
|
|
||||||
@ -91,9 +92,9 @@ class APP_EXPORT QgsPointMarkerItem: public QgsMapCanvasItem
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
QgsFeature mFeature;
|
QgsFeature mFeature;
|
||||||
QScopedPointer< QgsMarkerSymbol > mMarkerSymbol;
|
std::unique_ptr< QgsMarkerSymbol > mMarkerSymbol;
|
||||||
QPointF mLocation;
|
QPointF mLocation;
|
||||||
QScopedPointer< QgsDrawSourceEffect > mOpacityEffect;
|
std::unique_ptr< QgsDrawSourceEffect > mOpacityEffect;
|
||||||
|
|
||||||
QgsRenderContext renderContext( QPainter* painter );
|
QgsRenderContext renderContext( QPainter* painter );
|
||||||
};
|
};
|
||||||
|
@ -1718,8 +1718,8 @@ void QgsProjectProperties::populateStyles()
|
|||||||
for ( int i = 0; i < colorRamps.count(); ++i )
|
for ( int i = 0; i < colorRamps.count(); ++i )
|
||||||
{
|
{
|
||||||
QString name = colorRamps[i];
|
QString name = colorRamps[i];
|
||||||
QScopedPointer< QgsColorRamp > ramp( mStyle->colorRamp( name ) );
|
std::unique_ptr< QgsColorRamp > ramp( mStyle->colorRamp( name ) );
|
||||||
QIcon icon = QgsSymbolLayerUtils::colorRampPreviewIcon( ramp.data(), cboStyleColorRamp->iconSize() );
|
QIcon icon = QgsSymbolLayerUtils::colorRampPreviewIcon( ramp.get(), cboStyleColorRamp->iconSize() );
|
||||||
cboStyleColorRamp->addItem( icon, name );
|
cboStyleColorRamp->addItem( icon, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ QgsTextAnnotationDialog::QgsTextAnnotationDialog( QgsMapCanvasAnnotationItem* it
|
|||||||
{
|
{
|
||||||
QgsTextAnnotation* annotation = static_cast< QgsTextAnnotation* >( mItem->annotation() );
|
QgsTextAnnotation* annotation = static_cast< QgsTextAnnotation* >( mItem->annotation() );
|
||||||
mTextDocument.reset( annotation->document() ? annotation->document()->clone() : nullptr );
|
mTextDocument.reset( annotation->document() ? annotation->document()->clone() : nullptr );
|
||||||
mTextEdit->setDocument( mTextDocument.data() );
|
mTextEdit->setDocument( mTextDocument.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
mFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
|
mFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
|
||||||
@ -91,7 +91,7 @@ void QgsTextAnnotationDialog::applyTextToItem()
|
|||||||
{
|
{
|
||||||
mEmbeddedWidget->apply();
|
mEmbeddedWidget->apply();
|
||||||
}
|
}
|
||||||
annotation->setDocument( mTextDocument.data() );
|
annotation->setDocument( mTextDocument.get() );
|
||||||
mItem->update();
|
mItem->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "ui_qgstextannotationdialogbase.h"
|
#include "ui_qgstextannotationdialogbase.h"
|
||||||
#include "qgis_app.h"
|
#include "qgis_app.h"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class QgsAnnotationWidget;
|
class QgsAnnotationWidget;
|
||||||
class QgsMapCanvasAnnotationItem;
|
class QgsMapCanvasAnnotationItem;
|
||||||
@ -37,7 +38,7 @@ class APP_EXPORT QgsTextAnnotationDialog: public QDialog, private Ui::QgsTextAnn
|
|||||||
private:
|
private:
|
||||||
QgsMapCanvasAnnotationItem* mItem = nullptr;
|
QgsMapCanvasAnnotationItem* mItem = nullptr;
|
||||||
//! Text document (a clone of the annotation items document)
|
//! Text document (a clone of the annotation items document)
|
||||||
QScopedPointer< QTextDocument > mTextDocument;
|
std::unique_ptr< QTextDocument > mTextDocument;
|
||||||
QgsAnnotationWidget* mEmbeddedWidget = nullptr;
|
QgsAnnotationWidget* mEmbeddedWidget = nullptr;
|
||||||
|
|
||||||
void blockAllSignals( bool block );
|
void blockAllSignals( bool block );
|
||||||
|
@ -305,7 +305,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
|
|||||||
{
|
{
|
||||||
layer->parent()->takeChild( layer );
|
layer->parent()->takeChild( layer );
|
||||||
}
|
}
|
||||||
mLayersDependenciesTreeModel.reset( new QgsLayerTreeModel( mLayersDependenciesTreeGroup.data() ) );
|
mLayersDependenciesTreeModel.reset( new QgsLayerTreeModel( mLayersDependenciesTreeGroup.get() ) );
|
||||||
// use visibility as selection
|
// use visibility as selection
|
||||||
mLayersDependenciesTreeModel->setFlag( QgsLayerTreeModel::AllowNodeChangeVisibility );
|
mLayersDependenciesTreeModel->setFlag( QgsLayerTreeModel::AllowNodeChangeVisibility );
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
|
|||||||
layer->setItemVisibilityChecked( dependencySources.contains( layer->layerId() ) );
|
layer->setItemVisibilityChecked( dependencySources.contains( layer->layerId() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
mLayersDependenciesTreeView->setModel( mLayersDependenciesTreeModel.data() );
|
mLayersDependenciesTreeView->setModel( mLayersDependenciesTreeModel.get() );
|
||||||
} // QgsVectorLayerProperties ctor
|
} // QgsVectorLayerProperties ctor
|
||||||
|
|
||||||
|
|
||||||
|
@ -196,8 +196,8 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private
|
|||||||
|
|
||||||
QgsExpressionContext createExpressionContext() const override;
|
QgsExpressionContext createExpressionContext() const override;
|
||||||
|
|
||||||
QScopedPointer<QgsLayerTreeGroup> mLayersDependenciesTreeGroup;
|
std::unique_ptr<QgsLayerTreeGroup> mLayersDependenciesTreeGroup;
|
||||||
QScopedPointer<QgsLayerTreeModel> mLayersDependenciesTreeModel;
|
std::unique_ptr<QgsLayerTreeModel> mLayersDependenciesTreeModel;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void openPanel( QgsPanelWidget* panel );
|
void openPanel( QgsPanelWidget* panel );
|
||||||
|
@ -326,7 +326,7 @@ void QgsAnnotation::_writeXml( QDomElement& itemElem, QDomDocument& doc ) const
|
|||||||
}
|
}
|
||||||
if ( mMarkerSymbol )
|
if ( mMarkerSymbol )
|
||||||
{
|
{
|
||||||
QDomElement symbolElem = QgsSymbolLayerUtils::saveSymbol( QStringLiteral( "marker symbol" ), mMarkerSymbol.data(), doc );
|
QDomElement symbolElem = QgsSymbolLayerUtils::saveSymbol( QStringLiteral( "marker symbol" ), mMarkerSymbol.get(), doc );
|
||||||
if ( !symbolElem.isNull() )
|
if ( !symbolElem.isNull() )
|
||||||
{
|
{
|
||||||
annotationElem.appendChild( symbolElem );
|
annotationElem.appendChild( symbolElem );
|
||||||
@ -335,7 +335,7 @@ void QgsAnnotation::_writeXml( QDomElement& itemElem, QDomDocument& doc ) const
|
|||||||
if ( mFillSymbol )
|
if ( mFillSymbol )
|
||||||
{
|
{
|
||||||
QDomElement fillElem = doc.createElement( QStringLiteral( "fillSymbol" ) );
|
QDomElement fillElem = doc.createElement( QStringLiteral( "fillSymbol" ) );
|
||||||
QDomElement symbolElem = QgsSymbolLayerUtils::saveSymbol( QStringLiteral( "fill symbol" ), mFillSymbol.data(), doc );
|
QDomElement symbolElem = QgsSymbolLayerUtils::saveSymbol( QStringLiteral( "fill symbol" ), mFillSymbol.get(), doc );
|
||||||
if ( !symbolElem.isNull() )
|
if ( !symbolElem.isNull() )
|
||||||
{
|
{
|
||||||
fillElem.appendChild( symbolElem );
|
fillElem.appendChild( symbolElem );
|
||||||
|
@ -182,7 +182,7 @@ class CORE_EXPORT QgsAnnotation : public QObject
|
|||||||
* Returns the symbol that is used for rendering the annotation frame.
|
* Returns the symbol that is used for rendering the annotation frame.
|
||||||
* @see setFillSymbol()
|
* @see setFillSymbol()
|
||||||
*/
|
*/
|
||||||
QgsFillSymbol* fillSymbol() const { return mFillSymbol.data(); }
|
QgsFillSymbol* fillSymbol() const { return mFillSymbol.get(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the annotation to a target render context.
|
* Renders the annotation to a target render context.
|
||||||
@ -216,7 +216,7 @@ class CORE_EXPORT QgsAnnotation : public QObject
|
|||||||
* Returns the symbol that is drawn at the annotation's map position.
|
* Returns the symbol that is drawn at the annotation's map position.
|
||||||
* @see setMarkerSymbol()
|
* @see setMarkerSymbol()
|
||||||
*/
|
*/
|
||||||
QgsMarkerSymbol* markerSymbol() const { return mMarkerSymbol.data(); }
|
QgsMarkerSymbol* markerSymbol() const { return mMarkerSymbol.get(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the map layer associated with the annotation. Annotations can be
|
* Returns the map layer associated with the annotation. Annotations can be
|
||||||
@ -331,12 +331,12 @@ class CORE_EXPORT QgsAnnotation : public QObject
|
|||||||
QSizeF mFrameSize;
|
QSizeF mFrameSize;
|
||||||
|
|
||||||
//! Point symbol that is to be drawn at the map reference location
|
//! Point symbol that is to be drawn at the map reference location
|
||||||
QScopedPointer<QgsMarkerSymbol> mMarkerSymbol;
|
std::unique_ptr<QgsMarkerSymbol> mMarkerSymbol;
|
||||||
|
|
||||||
QgsMargins mContentsMargins;
|
QgsMargins mContentsMargins;
|
||||||
|
|
||||||
//! Fill symbol used for drawing annotation
|
//! Fill symbol used for drawing annotation
|
||||||
QScopedPointer<QgsFillSymbol> mFillSymbol;
|
std::unique_ptr<QgsFillSymbol> mFillSymbol;
|
||||||
|
|
||||||
//! Segment number where the connection to the map point is attached. -1 if no balloon needed (e.g. if point is contained in frame)
|
//! Segment number where the connection to the map point is attached. -1 if no balloon needed (e.g. if point is contained in frame)
|
||||||
int mBalloonSegment = -1;
|
int mBalloonSegment = -1;
|
||||||
|
@ -28,7 +28,7 @@ QgsTextAnnotation::QgsTextAnnotation( QObject* parent )
|
|||||||
|
|
||||||
const QTextDocument* QgsTextAnnotation::document() const
|
const QTextDocument* QgsTextAnnotation::document() const
|
||||||
{
|
{
|
||||||
return mDocument.data();
|
return mDocument.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsTextAnnotation::setDocument( const QTextDocument* doc )
|
void QgsTextAnnotation::setDocument( const QTextDocument* doc )
|
||||||
|
@ -66,7 +66,7 @@ class CORE_EXPORT QgsTextAnnotation: public QgsAnnotation
|
|||||||
void renderAnnotation( QgsRenderContext& context, QSizeF size ) const override;
|
void renderAnnotation( QgsRenderContext& context, QSizeF size ) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer< QTextDocument > mDocument;
|
std::unique_ptr< QTextDocument > mDocument;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QGSTEXTANNOTATION_H
|
#endif // QGSTEXTANNOTATION_H
|
||||||
|
@ -137,7 +137,7 @@ int QgsAtlasComposition::updateFeatures()
|
|||||||
// select all features with all attributes
|
// select all features with all attributes
|
||||||
QgsFeatureRequest req;
|
QgsFeatureRequest req;
|
||||||
|
|
||||||
QScopedPointer<QgsExpression> filterExpression;
|
std::unique_ptr<QgsExpression> filterExpression;
|
||||||
if ( mFilterFeatures && !mFeatureFilter.isEmpty() )
|
if ( mFilterFeatures && !mFeatureFilter.isEmpty() )
|
||||||
{
|
{
|
||||||
filterExpression.reset( new QgsExpression( mFeatureFilter ) );
|
filterExpression.reset( new QgsExpression( mFeatureFilter ) );
|
||||||
@ -154,7 +154,7 @@ int QgsAtlasComposition::updateFeatures()
|
|||||||
|
|
||||||
QgsFeatureIterator fit = mCoverageLayer->getFeatures( req );
|
QgsFeatureIterator fit = mCoverageLayer->getFeatures( req );
|
||||||
|
|
||||||
QScopedPointer<QgsExpression> nameExpression;
|
std::unique_ptr<QgsExpression> nameExpression;
|
||||||
if ( !mPageNameExpression.isEmpty() )
|
if ( !mPageNameExpression.isEmpty() )
|
||||||
{
|
{
|
||||||
nameExpression.reset( new QgsExpression( mPageNameExpression ) );
|
nameExpression.reset( new QgsExpression( mPageNameExpression ) );
|
||||||
@ -180,7 +180,7 @@ int QgsAtlasComposition::updateFeatures()
|
|||||||
expressionContext.setFeature( feat );
|
expressionContext.setFeature( feat );
|
||||||
|
|
||||||
QString pageName;
|
QString pageName;
|
||||||
if ( !nameExpression.isNull() )
|
if ( nameExpression )
|
||||||
{
|
{
|
||||||
QVariant result = nameExpression->evaluate( &expressionContext );
|
QVariant result = nameExpression->evaluate( &expressionContext );
|
||||||
if ( nameExpression->hasEvalError() )
|
if ( nameExpression->hasEvalError() )
|
||||||
@ -732,7 +732,7 @@ bool QgsAtlasComposition::updateFilenameExpression()
|
|||||||
bool QgsAtlasComposition::evalFeatureFilename( const QgsExpressionContext &context )
|
bool QgsAtlasComposition::evalFeatureFilename( const QgsExpressionContext &context )
|
||||||
{
|
{
|
||||||
//generate filename for current atlas feature
|
//generate filename for current atlas feature
|
||||||
if ( !mFilenamePattern.isEmpty() && !mFilenameExpr.isNull() )
|
if ( !mFilenamePattern.isEmpty() && mFilenameExpr )
|
||||||
{
|
{
|
||||||
QVariant filenameRes = mFilenameExpr->evaluate( &context );
|
QVariant filenameRes = mFilenameExpr->evaluate( &context );
|
||||||
if ( mFilenameExpr->hasEvalError() )
|
if ( mFilenameExpr->hasEvalError() )
|
||||||
|
@ -340,7 +340,7 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
|
|||||||
|
|
||||||
QgsFeature mCurrentFeature;
|
QgsFeature mCurrentFeature;
|
||||||
|
|
||||||
QScopedPointer<QgsExpression> mFilenameExpr;
|
std::unique_ptr<QgsExpression> mFilenameExpr;
|
||||||
|
|
||||||
// bounding box of the current feature transformed into map crs
|
// bounding box of the current feature transformed into map crs
|
||||||
QgsRectangle mTransformedFeatureBounds;
|
QgsRectangle mTransformedFeatureBounds;
|
||||||
|
@ -404,7 +404,7 @@ bool QgsComposerAttributeTableV2::getTableContents( QgsComposerTableContents &co
|
|||||||
context.setFields( layer->fields() );
|
context.setFields( layer->fields() );
|
||||||
|
|
||||||
//prepare filter expression
|
//prepare filter expression
|
||||||
QScopedPointer<QgsExpression> filterExpression;
|
std::unique_ptr<QgsExpression> filterExpression;
|
||||||
bool activeFilter = false;
|
bool activeFilter = false;
|
||||||
if ( mFilterFeatures && !mFeatureFilter.isEmpty() )
|
if ( mFilterFeatures && !mFeatureFilter.isEmpty() )
|
||||||
{
|
{
|
||||||
@ -465,7 +465,7 @@ bool QgsComposerAttributeTableV2::getTableContents( QgsComposerTableContents &co
|
|||||||
{
|
{
|
||||||
context.setFeature( f );
|
context.setFeature( f );
|
||||||
//check feature against filter
|
//check feature against filter
|
||||||
if ( activeFilter && !filterExpression.isNull() )
|
if ( activeFilter && filterExpression )
|
||||||
{
|
{
|
||||||
QVariant result = filterExpression->evaluate( &context );
|
QVariant result = filterExpression->evaluate( &context );
|
||||||
// skip this feature if the filter evaluation is false
|
// skip this feature if the filter evaluation is false
|
||||||
|
@ -282,8 +282,8 @@ QString QgsComposerLabel::displayText() const
|
|||||||
QgsExpressionContext context = createExpressionContext();
|
QgsExpressionContext context = createExpressionContext();
|
||||||
//overwrite layer/feature if they have been set via setExpressionContext
|
//overwrite layer/feature if they have been set via setExpressionContext
|
||||||
//TODO remove when setExpressionContext is removed
|
//TODO remove when setExpressionContext is removed
|
||||||
if ( mExpressionFeature.data() )
|
if ( mExpressionFeature.get() )
|
||||||
context.setFeature( *mExpressionFeature.data() );
|
context.setFeature( *mExpressionFeature.get() );
|
||||||
if ( mExpressionLayer )
|
if ( mExpressionLayer )
|
||||||
context.setFields( mExpressionLayer->fields() );
|
context.setFields( mExpressionLayer->fields() );
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ class CORE_EXPORT QgsComposerLabel: public QgsComposerItem
|
|||||||
//! Creates an encoded stylesheet url using the current font and label appearance settings
|
//! Creates an encoded stylesheet url using the current font and label appearance settings
|
||||||
QUrl createStylesheetUrl() const;
|
QUrl createStylesheetUrl() const;
|
||||||
|
|
||||||
QScopedPointer<QgsFeature> mExpressionFeature;
|
std::unique_ptr<QgsFeature> mExpressionFeature;
|
||||||
QgsVectorLayer* mExpressionLayer;
|
QgsVectorLayer* mExpressionLayer;
|
||||||
QgsDistanceArea* mDistanceArea;
|
QgsDistanceArea* mDistanceArea;
|
||||||
|
|
||||||
|
@ -1467,7 +1467,7 @@ QString QgsComposerMapGrid::gridAnnotationString( double value, QgsComposerMapGr
|
|||||||
{
|
{
|
||||||
expressionContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "grid_number" ), value, true ) );
|
expressionContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "grid_number" ), value, true ) );
|
||||||
expressionContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "grid_axis" ), coord == QgsComposerMapGrid::Longitude ? "x" : "y", true ) );
|
expressionContext.lastScope()->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "grid_axis" ), coord == QgsComposerMapGrid::Longitude ? "x" : "y", true ) );
|
||||||
if ( !mGridAnnotationExpression.data() )
|
if ( !mGridAnnotationExpression )
|
||||||
{
|
{
|
||||||
mGridAnnotationExpression.reset( new QgsExpression( mGridAnnotationExpressionString ) );
|
mGridAnnotationExpression.reset( new QgsExpression( mGridAnnotationExpressionString ) );
|
||||||
mGridAnnotationExpression->prepare( &expressionContext );
|
mGridAnnotationExpression->prepare( &expressionContext );
|
||||||
|
@ -898,7 +898,7 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem
|
|||||||
AnnotationFormat mGridAnnotationFormat;
|
AnnotationFormat mGridAnnotationFormat;
|
||||||
|
|
||||||
QString mGridAnnotationExpressionString;
|
QString mGridAnnotationExpressionString;
|
||||||
mutable QScopedPointer< QgsExpression > mGridAnnotationExpression;
|
mutable std::unique_ptr< QgsExpression > mGridAnnotationExpression;
|
||||||
|
|
||||||
FrameStyle mGridFrameStyle;
|
FrameStyle mGridFrameStyle;
|
||||||
FrameSideFlags mGridFrameSides;
|
FrameSideFlags mGridFrameSides;
|
||||||
|
@ -132,10 +132,10 @@ void QgsComposerNodesItem::drawNodes( QPainter *painter ) const
|
|||||||
properties.insert( QStringLiteral( "name" ), QStringLiteral( "cross" ) );
|
properties.insert( QStringLiteral( "name" ), QStringLiteral( "cross" ) );
|
||||||
properties.insert( QStringLiteral( "color_border" ), QStringLiteral( "red" ) );
|
properties.insert( QStringLiteral( "color_border" ), QStringLiteral( "red" ) );
|
||||||
|
|
||||||
QScopedPointer<QgsMarkerSymbol> symbol;
|
std::unique_ptr<QgsMarkerSymbol> symbol;
|
||||||
symbol.reset( QgsMarkerSymbol::createSimple( properties ) );
|
symbol.reset( QgsMarkerSymbol::createSimple( properties ) );
|
||||||
symbol.data()->setSize( rectSize );
|
symbol->setSize( rectSize );
|
||||||
symbol.data()->setAngle( 45 );
|
symbol->setAngle( 45 );
|
||||||
|
|
||||||
QgsRenderContext context = QgsComposerUtils::createRenderContextForComposition( mComposition, painter );
|
QgsRenderContext context = QgsComposerUtils::createRenderContextForComposition( mComposition, painter );
|
||||||
context.setForceVectorOutput( true );
|
context.setForceVectorOutput( true );
|
||||||
@ -143,12 +143,12 @@ void QgsComposerNodesItem::drawNodes( QPainter *painter ) const
|
|||||||
QgsExpressionContext expressionContext = createExpressionContext();
|
QgsExpressionContext expressionContext = createExpressionContext();
|
||||||
context.setExpressionContext( expressionContext );
|
context.setExpressionContext( expressionContext );
|
||||||
|
|
||||||
symbol.data()->startRender( context );
|
symbol->startRender( context );
|
||||||
|
|
||||||
Q_FOREACH ( QPointF pt, mPolygon )
|
Q_FOREACH ( QPointF pt, mPolygon )
|
||||||
symbol.data()->renderPoint( pt, nullptr, context );
|
symbol->renderPoint( pt, nullptr, context );
|
||||||
|
|
||||||
symbol.data()->stopRender( context );
|
symbol->stopRender( context );
|
||||||
|
|
||||||
if ( mSelectedNode >= 0 && mSelectedNode < mPolygon.size() )
|
if ( mSelectedNode >= 0 && mSelectedNode < mPolygon.size() )
|
||||||
drawSelectedNode( painter );
|
drawSelectedNode( painter );
|
||||||
@ -164,9 +164,9 @@ void QgsComposerNodesItem::drawSelectedNode( QPainter *painter ) const
|
|||||||
properties.insert( QStringLiteral( "color_border" ), QStringLiteral( "blue" ) );
|
properties.insert( QStringLiteral( "color_border" ), QStringLiteral( "blue" ) );
|
||||||
properties.insert( QStringLiteral( "width_border" ), QStringLiteral( "4" ) );
|
properties.insert( QStringLiteral( "width_border" ), QStringLiteral( "4" ) );
|
||||||
|
|
||||||
QScopedPointer<QgsMarkerSymbol> symbol;
|
std::unique_ptr<QgsMarkerSymbol> symbol;
|
||||||
symbol.reset( QgsMarkerSymbol::createSimple( properties ) );
|
symbol.reset( QgsMarkerSymbol::createSimple( properties ) );
|
||||||
symbol.data()->setSize( rectSize );
|
symbol->setSize( rectSize );
|
||||||
|
|
||||||
QgsRenderContext context = QgsComposerUtils::createRenderContextForComposition( mComposition, painter );
|
QgsRenderContext context = QgsComposerUtils::createRenderContextForComposition( mComposition, painter );
|
||||||
context.setForceVectorOutput( true );
|
context.setForceVectorOutput( true );
|
||||||
@ -174,9 +174,9 @@ void QgsComposerNodesItem::drawSelectedNode( QPainter *painter ) const
|
|||||||
QgsExpressionContext expressionContext = createExpressionContext();
|
QgsExpressionContext expressionContext = createExpressionContext();
|
||||||
context.setExpressionContext( expressionContext );
|
context.setExpressionContext( expressionContext );
|
||||||
|
|
||||||
symbol.data()->startRender( context );
|
symbol->startRender( context );
|
||||||
symbol.data()->renderPoint( mPolygon.at( mSelectedNode ), nullptr, context );
|
symbol->renderPoint( mPolygon.at( mSelectedNode ), nullptr, context );
|
||||||
symbol.data()->stopRender( context );
|
symbol->stopRender( context );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsComposerNodesItem::paint( QPainter* painter,
|
void QgsComposerNodesItem::paint( QPainter* painter,
|
||||||
|
@ -106,7 +106,7 @@ void QgsComposerPolygon::setPolygonStyleSymbol( QgsFillSymbol* symbol )
|
|||||||
void QgsComposerPolygon::_writeXmlStyle( QDomDocument &doc, QDomElement &elmt ) const
|
void QgsComposerPolygon::_writeXmlStyle( QDomDocument &doc, QDomElement &elmt ) const
|
||||||
{
|
{
|
||||||
const QDomElement pe = QgsSymbolLayerUtils::saveSymbol( QString(),
|
const QDomElement pe = QgsSymbolLayerUtils::saveSymbol( QString(),
|
||||||
mPolygonStyleSymbol.data(),
|
mPolygonStyleSymbol.get(),
|
||||||
doc );
|
doc );
|
||||||
elmt.appendChild( pe );
|
elmt.appendChild( pe );
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class CORE_EXPORT QgsComposerPolygon: public QgsComposerNodesItem
|
|||||||
virtual QString displayName() const override;
|
virtual QString displayName() const override;
|
||||||
|
|
||||||
//! Returns the QgsSymbol used to draw the shape.
|
//! Returns the QgsSymbol used to draw the shape.
|
||||||
QgsFillSymbol* polygonStyleSymbol() { return mPolygonStyleSymbol.data(); }
|
QgsFillSymbol* polygonStyleSymbol() { return mPolygonStyleSymbol.get(); }
|
||||||
|
|
||||||
//! Set the QgsSymbol used to draw the shape.
|
//! Set the QgsSymbol used to draw the shape.
|
||||||
void setPolygonStyleSymbol( QgsFillSymbol* symbol );
|
void setPolygonStyleSymbol( QgsFillSymbol* symbol );
|
||||||
@ -62,7 +62,7 @@ class CORE_EXPORT QgsComposerPolygon: public QgsComposerNodesItem
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! QgsSymbol use to draw the shape.
|
//! QgsSymbol use to draw the shape.
|
||||||
QScopedPointer<QgsFillSymbol> mPolygonStyleSymbol;
|
std::unique_ptr<QgsFillSymbol> mPolygonStyleSymbol;
|
||||||
|
|
||||||
/** Add the node newPoint at the given position according to some
|
/** Add the node newPoint at the given position according to some
|
||||||
* criteres. */
|
* criteres. */
|
||||||
|
@ -130,7 +130,7 @@ void QgsComposerPolyline::setPolylineStyleSymbol( QgsLineSymbol* symbol )
|
|||||||
void QgsComposerPolyline::_writeXmlStyle( QDomDocument &doc, QDomElement &elmt ) const
|
void QgsComposerPolyline::_writeXmlStyle( QDomDocument &doc, QDomElement &elmt ) const
|
||||||
{
|
{
|
||||||
const QDomElement pe = QgsSymbolLayerUtils::saveSymbol( QString(),
|
const QDomElement pe = QgsSymbolLayerUtils::saveSymbol( QString(),
|
||||||
mPolylineStyleSymbol.data(),
|
mPolylineStyleSymbol.get(),
|
||||||
doc );
|
doc );
|
||||||
elmt.appendChild( pe );
|
elmt.appendChild( pe );
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ class CORE_EXPORT QgsComposerPolyline: public QgsComposerNodesItem
|
|||||||
virtual QString displayName() const override;
|
virtual QString displayName() const override;
|
||||||
|
|
||||||
//! Returns the QgsSymbol used to draw the shape.
|
//! Returns the QgsSymbol used to draw the shape.
|
||||||
QgsLineSymbol* polylineStyleSymbol() { return mPolylineStyleSymbol.data(); }
|
QgsLineSymbol* polylineStyleSymbol() { return mPolylineStyleSymbol.get(); }
|
||||||
|
|
||||||
//! Set the QgsSymbol used to draw the shape.
|
//! Set the QgsSymbol used to draw the shape.
|
||||||
void setPolylineStyleSymbol( QgsLineSymbol* symbol );
|
void setPolylineStyleSymbol( QgsLineSymbol* symbol );
|
||||||
@ -61,7 +61,7 @@ class CORE_EXPORT QgsComposerPolyline: public QgsComposerNodesItem
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! QgsSymbol use to draw the shape.
|
//! QgsSymbol use to draw the shape.
|
||||||
QScopedPointer<QgsLineSymbol> mPolylineStyleSymbol;
|
std::unique_ptr<QgsLineSymbol> mPolylineStyleSymbol;
|
||||||
|
|
||||||
/** Add the node newPoint at the given position according to some
|
/** Add the node newPoint at the given position according to some
|
||||||
* criteres. */
|
* criteres. */
|
||||||
|
@ -3644,7 +3644,7 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext& ctx, const QgsCoordinateT
|
|||||||
if ( !fet->hasGeometry() )
|
if ( !fet->hasGeometry() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QScopedPointer<QgsAbstractGeometry> geom( fet->geometry().geometry()->clone() );
|
std::unique_ptr<QgsAbstractGeometry> geom( fet->geometry().geometry()->clone() );
|
||||||
if ( ct.isValid() )
|
if ( ct.isValid() )
|
||||||
{
|
{
|
||||||
geom->transform( ct );
|
geom->transform( ct );
|
||||||
@ -3702,7 +3702,7 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext& ctx, const QgsCoordinateT
|
|||||||
|
|
||||||
if ( penStyle != Qt::NoPen )
|
if ( penStyle != Qt::NoPen )
|
||||||
{
|
{
|
||||||
const QgsAbstractGeometry *tempGeom = geom.data();
|
const QgsAbstractGeometry *tempGeom = geom.get();
|
||||||
|
|
||||||
switch ( QgsWkbTypes::flatType( geometryType ) )
|
switch ( QgsWkbTypes::flatType( geometryType ) )
|
||||||
{
|
{
|
||||||
@ -3716,11 +3716,11 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext& ctx, const QgsCoordinateT
|
|||||||
if ( !qgsDoubleNear( offset, 0.0 ) )
|
if ( !qgsDoubleNear( offset, 0.0 ) )
|
||||||
{
|
{
|
||||||
QgsGeos geos( tempGeom );
|
QgsGeos geos( tempGeom );
|
||||||
if ( tempGeom != geom.data() )
|
if ( tempGeom != geom.get() )
|
||||||
delete tempGeom;
|
delete tempGeom;
|
||||||
tempGeom = geos.offsetCurve( offset, 0, GEOSBUF_JOIN_MITRE, 2.0 );
|
tempGeom = geos.offsetCurve( offset, 0, GEOSBUF_JOIN_MITRE, 2.0 );
|
||||||
if ( !tempGeom )
|
if ( !tempGeom )
|
||||||
tempGeom = geom.data();
|
tempGeom = geom.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
writePolyline( tempGeom->coordinateSequence().at( 0 ).at( 0 ), layer, lineStyleName, penColor, width );
|
writePolyline( tempGeom->coordinateSequence().at( 0 ).at( 0 ), layer, lineStyleName, penColor, width );
|
||||||
@ -3737,11 +3737,11 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext& ctx, const QgsCoordinateT
|
|||||||
if ( !qgsDoubleNear( offset, 0.0 ) )
|
if ( !qgsDoubleNear( offset, 0.0 ) )
|
||||||
{
|
{
|
||||||
QgsGeos geos( tempGeom );
|
QgsGeos geos( tempGeom );
|
||||||
if ( tempGeom != geom.data() )
|
if ( tempGeom != geom.get() )
|
||||||
delete tempGeom;
|
delete tempGeom;
|
||||||
tempGeom = geos.offsetCurve( offset, 0, GEOSBUF_JOIN_MITRE, 2.0 );
|
tempGeom = geos.offsetCurve( offset, 0, GEOSBUF_JOIN_MITRE, 2.0 );
|
||||||
if ( !tempGeom )
|
if ( !tempGeom )
|
||||||
tempGeom = geom.data();
|
tempGeom = geom.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QgsCoordinateSequence &cs = tempGeom->coordinateSequence();
|
const QgsCoordinateSequence &cs = tempGeom->coordinateSequence();
|
||||||
@ -3763,11 +3763,11 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext& ctx, const QgsCoordinateT
|
|||||||
if ( !qgsDoubleNear( offset, 0.0 ) )
|
if ( !qgsDoubleNear( offset, 0.0 ) )
|
||||||
{
|
{
|
||||||
QgsGeos geos( tempGeom );
|
QgsGeos geos( tempGeom );
|
||||||
if ( tempGeom != geom.data() )
|
if ( tempGeom != geom.get() )
|
||||||
delete tempGeom;
|
delete tempGeom;
|
||||||
tempGeom = geos.buffer( offset, 0, GEOSBUF_CAP_FLAT, GEOSBUF_JOIN_MITRE, 2.0 );
|
tempGeom = geos.buffer( offset, 0, GEOSBUF_CAP_FLAT, GEOSBUF_JOIN_MITRE, 2.0 );
|
||||||
if ( !tempGeom )
|
if ( !tempGeom )
|
||||||
tempGeom = geom.data();
|
tempGeom = geom.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QgsCoordinateSequence &cs = tempGeom->coordinateSequence();
|
const QgsCoordinateSequence &cs = tempGeom->coordinateSequence();
|
||||||
@ -3784,11 +3784,11 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext& ctx, const QgsCoordinateT
|
|||||||
if ( !qgsDoubleNear( offset, 0.0 ) )
|
if ( !qgsDoubleNear( offset, 0.0 ) )
|
||||||
{
|
{
|
||||||
QgsGeos geos( tempGeom );
|
QgsGeos geos( tempGeom );
|
||||||
if ( tempGeom != geom.data() )
|
if ( tempGeom != geom.get() )
|
||||||
delete tempGeom;
|
delete tempGeom;
|
||||||
tempGeom = geos.buffer( offset, 0, GEOSBUF_CAP_FLAT, GEOSBUF_JOIN_MITRE, 2.0 );
|
tempGeom = geos.buffer( offset, 0, GEOSBUF_CAP_FLAT, GEOSBUF_JOIN_MITRE, 2.0 );
|
||||||
if ( !tempGeom )
|
if ( !tempGeom )
|
||||||
tempGeom = geom.data();
|
tempGeom = geom.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QgsCoordinateSequence &cs = tempGeom->coordinateSequence();
|
const QgsCoordinateSequence &cs = tempGeom->coordinateSequence();
|
||||||
@ -3803,13 +3803,13 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext& ctx, const QgsCoordinateT
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( tempGeom != geom.data() )
|
if ( tempGeom != geom.get() )
|
||||||
delete tempGeom;
|
delete tempGeom;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( brushStyle != Qt::NoBrush )
|
if ( brushStyle != Qt::NoBrush )
|
||||||
{
|
{
|
||||||
const QgsAbstractGeometry *tempGeom = geom.data();
|
const QgsAbstractGeometry *tempGeom = geom.get();
|
||||||
|
|
||||||
switch ( QgsWkbTypes::flatType( geometryType ) )
|
switch ( QgsWkbTypes::flatType( geometryType ) )
|
||||||
{
|
{
|
||||||
@ -3837,7 +3837,7 @@ void QgsDxfExport::addFeature( QgsSymbolRenderContext& ctx, const QgsCoordinateT
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( tempGeom != geom.data() )
|
if ( tempGeom != geom.get() )
|
||||||
delete tempGeom;
|
delete tempGeom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2337,7 +2337,7 @@ QgsLineString* smoothCurve( const QgsLineString& line, const unsigned int iterat
|
|||||||
const double offset, double squareDistThreshold, double maxAngleRads,
|
const double offset, double squareDistThreshold, double maxAngleRads,
|
||||||
bool isRing )
|
bool isRing )
|
||||||
{
|
{
|
||||||
QScopedPointer< QgsLineString > result( new QgsLineString( line ) );
|
std::unique_ptr< QgsLineString > result( new QgsLineString( line ) );
|
||||||
for ( unsigned int iteration = 0; iteration < iterations; ++iteration )
|
for ( unsigned int iteration = 0; iteration < iterations; ++iteration )
|
||||||
{
|
{
|
||||||
QgsPointSequence outputLine;
|
QgsPointSequence outputLine;
|
||||||
@ -2415,7 +2415,7 @@ QgsLineString* smoothCurve( const QgsLineString& line, const unsigned int iterat
|
|||||||
|
|
||||||
result->setPoints( outputLine );
|
result->setPoints( outputLine );
|
||||||
}
|
}
|
||||||
return result.take();
|
return result.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsLineString* QgsGeometry::smoothLine( const QgsLineString& line, const unsigned int iterations, const double offset, double minimumDistance, double maxAngle ) const
|
QgsLineString* QgsGeometry::smoothLine( const QgsLineString& line, const unsigned int iterations, const double offset, double minimumDistance, double maxAngle ) const
|
||||||
@ -2429,7 +2429,7 @@ QgsPolygonV2* QgsGeometry::smoothPolygon( const QgsPolygonV2& polygon, const uns
|
|||||||
{
|
{
|
||||||
double maxAngleRads = maxAngle * M_PI / 180.0;
|
double maxAngleRads = maxAngle * M_PI / 180.0;
|
||||||
double squareDistThreshold = minimumDistance > 0 ? minimumDistance * minimumDistance : -1;
|
double squareDistThreshold = minimumDistance > 0 ? minimumDistance * minimumDistance : -1;
|
||||||
QScopedPointer< QgsPolygonV2 > resultPoly( new QgsPolygonV2 );
|
std::unique_ptr< QgsPolygonV2 > resultPoly( new QgsPolygonV2 );
|
||||||
|
|
||||||
resultPoly->setExteriorRing( smoothCurve( *( static_cast< const QgsLineString*>( polygon.exteriorRing() ) ), iterations, offset,
|
resultPoly->setExteriorRing( smoothCurve( *( static_cast< const QgsLineString*>( polygon.exteriorRing() ) ), iterations, offset,
|
||||||
squareDistThreshold, maxAngleRads, true ) );
|
squareDistThreshold, maxAngleRads, true ) );
|
||||||
@ -2439,7 +2439,7 @@ QgsPolygonV2* QgsGeometry::smoothPolygon( const QgsPolygonV2& polygon, const uns
|
|||||||
resultPoly->addInteriorRing( smoothCurve( *( static_cast< const QgsLineString*>( polygon.interiorRing( i ) ) ), iterations, offset,
|
resultPoly->addInteriorRing( smoothCurve( *( static_cast< const QgsLineString*>( polygon.interiorRing( i ) ) ), iterations, offset,
|
||||||
squareDistThreshold, maxAngleRads, true ) );
|
squareDistThreshold, maxAngleRads, true ) );
|
||||||
}
|
}
|
||||||
return resultPoly.take();
|
return resultPoly.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsGeometry QgsGeometry::convertToPoint( bool destMultipart ) const
|
QgsGeometry QgsGeometry::convertToPoint( bool destMultipart ) const
|
||||||
|
@ -66,7 +66,7 @@ int QgsGeometryEditUtils::addRing( QgsAbstractGeometry* geom, QgsCurve* ring )
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
QScopedPointer<QgsGeometryEngine> ringGeom( QgsGeometry::createGeometryEngine( ring ) );
|
std::unique_ptr<QgsGeometryEngine> ringGeom( QgsGeometry::createGeometryEngine( ring ) );
|
||||||
ringGeom->prepareGeometry();
|
ringGeom->prepareGeometry();
|
||||||
|
|
||||||
//for each polygon, test if inside outer ring and no intersection with other interior ring
|
//for each polygon, test if inside outer ring and no intersection with other interior ring
|
||||||
@ -228,8 +228,8 @@ QgsAbstractGeometry* QgsGeometryEditUtils::avoidIntersections( const QgsAbstract
|
|||||||
const QList<QgsVectorLayer*>& avoidIntersectionsLayers,
|
const QList<QgsVectorLayer*>& avoidIntersectionsLayers,
|
||||||
QHash<QgsVectorLayer *, QSet<QgsFeatureId> > ignoreFeatures )
|
QHash<QgsVectorLayer *, QSet<QgsFeatureId> > ignoreFeatures )
|
||||||
{
|
{
|
||||||
QScopedPointer<QgsGeometryEngine> geomEngine( QgsGeometry::createGeometryEngine( &geom ) );
|
std::unique_ptr<QgsGeometryEngine> geomEngine( QgsGeometry::createGeometryEngine( &geom ) );
|
||||||
if ( geomEngine.isNull() )
|
if ( !geomEngine )
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -277,14 +277,14 @@ QgsAbstractGeometry* QgsGeometryEditUtils::avoidIntersections( const QgsAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QgsAbstractGeometry* combinedGeometries = geomEngine.data()->combine( nearGeometries );
|
QgsAbstractGeometry* combinedGeometries = geomEngine->combine( nearGeometries );
|
||||||
qDeleteAll( nearGeometries );
|
qDeleteAll( nearGeometries );
|
||||||
if ( !combinedGeometries )
|
if ( !combinedGeometries )
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsAbstractGeometry* diffGeom = geomEngine.data()->difference( *combinedGeometries );
|
QgsAbstractGeometry* diffGeom = geomEngine->difference( *combinedGeometries );
|
||||||
|
|
||||||
delete combinedGeometries;
|
delete combinedGeometries;
|
||||||
return diffGeom;
|
return diffGeom;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <QTransform>
|
#include <QTransform>
|
||||||
|
#include <memory>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
QgsInternalGeometryEngine::QgsInternalGeometryEngine( const QgsGeometry& geometry )
|
QgsInternalGeometryEngine::QgsInternalGeometryEngine( const QgsGeometry& geometry )
|
||||||
@ -58,7 +59,7 @@ QgsGeometry QgsInternalGeometryEngine::extrude( double x, double y ) const
|
|||||||
linesToProcess << static_cast<QgsLineString*>( curve->segmentize() );
|
linesToProcess << static_cast<QgsLineString*>( curve->segmentize() );
|
||||||
}
|
}
|
||||||
|
|
||||||
QScopedPointer<QgsMultiPolygonV2> multipolygon( linesToProcess.size() > 1 ? new QgsMultiPolygonV2() : nullptr );
|
std::unique_ptr<QgsMultiPolygonV2> multipolygon( linesToProcess.size() > 1 ? new QgsMultiPolygonV2() : nullptr );
|
||||||
QgsPolygonV2 *polygon = nullptr;
|
QgsPolygonV2 *polygon = nullptr;
|
||||||
|
|
||||||
if ( !linesToProcess.empty() )
|
if ( !linesToProcess.empty() )
|
||||||
@ -83,7 +84,7 @@ QgsGeometry QgsInternalGeometryEngine::extrude( double x, double y ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( multipolygon )
|
if ( multipolygon )
|
||||||
return QgsGeometry( multipolygon.take() );
|
return QgsGeometry( multipolygon.release() );
|
||||||
else
|
else
|
||||||
return QgsGeometry( polygon );
|
return QgsGeometry( polygon );
|
||||||
}
|
}
|
||||||
@ -171,12 +172,12 @@ QgsGeometry QgsInternalGeometryEngine::poleOfInaccessibility( double precision ,
|
|||||||
if ( !surface )
|
if ( !surface )
|
||||||
return QgsGeometry();
|
return QgsGeometry();
|
||||||
|
|
||||||
QScopedPointer< QgsPolygonV2 > segmentizedPoly;
|
std::unique_ptr< QgsPolygonV2 > segmentizedPoly;
|
||||||
const QgsPolygonV2* polygon = dynamic_cast< const QgsPolygonV2* >( mGeometry );
|
const QgsPolygonV2* polygon = dynamic_cast< const QgsPolygonV2* >( mGeometry );
|
||||||
if ( !polygon )
|
if ( !polygon )
|
||||||
{
|
{
|
||||||
segmentizedPoly.reset( static_cast< QgsPolygonV2*>( surface->segmentize() ) );
|
segmentizedPoly.reset( static_cast< QgsPolygonV2*>( surface->segmentize() ) );
|
||||||
polygon = segmentizedPoly.data();
|
polygon = segmentizedPoly.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
// start with the bounding box
|
// start with the bounding box
|
||||||
@ -201,28 +202,28 @@ QgsGeometry QgsInternalGeometryEngine::poleOfInaccessibility( double precision ,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// take centroid as the first best guess
|
// take centroid as the first best guess
|
||||||
QScopedPointer< Cell > bestCell( getCentroidCell( polygon ) );
|
std::unique_ptr< Cell > bestCell( getCentroidCell( polygon ) );
|
||||||
|
|
||||||
// special case for rectangular polygons
|
// special case for rectangular polygons
|
||||||
QScopedPointer< Cell > bboxCell( new Cell( bounds.xMinimum() + bounds.width() / 2.0,
|
std::unique_ptr< Cell > bboxCell( new Cell( bounds.xMinimum() + bounds.width() / 2.0,
|
||||||
bounds.yMinimum() + bounds.height() / 2.0,
|
bounds.yMinimum() + bounds.height() / 2.0,
|
||||||
0, polygon ) );
|
0, polygon ) );
|
||||||
if ( bboxCell->d > bestCell->d )
|
if ( bboxCell->d > bestCell->d )
|
||||||
{
|
{
|
||||||
bestCell.reset( bboxCell.take() );
|
bestCell.reset( bboxCell.release() );
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( cellQueue.size() > 0 )
|
while ( cellQueue.size() > 0 )
|
||||||
{
|
{
|
||||||
// pick the most promising cell from the queue
|
// pick the most promising cell from the queue
|
||||||
QScopedPointer< Cell > cell( cellQueue.top() );
|
std::unique_ptr< Cell > cell( cellQueue.top() );
|
||||||
cellQueue.pop();
|
cellQueue.pop();
|
||||||
Cell* currentCell = cell.data();
|
Cell* currentCell = cell.get();
|
||||||
|
|
||||||
// update the best cell if we found a better one
|
// update the best cell if we found a better one
|
||||||
if ( currentCell->d > bestCell->d )
|
if ( currentCell->d > bestCell->d )
|
||||||
{
|
{
|
||||||
bestCell.reset( cell.take() );
|
bestCell.reset( cell.release() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// do not drill down further if there's no chance of a better solution
|
// do not drill down further if there's no chance of a better solution
|
||||||
@ -347,7 +348,7 @@ QgsLineString* doOrthogonalize( QgsLineString* ring, int iterations, double tole
|
|||||||
bool isClosed = ring->isClosed();
|
bool isClosed = ring->isClosed();
|
||||||
int numPoints = ring->numPoints();
|
int numPoints = ring->numPoints();
|
||||||
|
|
||||||
QScopedPointer< QgsLineString > best( ring->clone() );
|
std::unique_ptr< QgsLineString > best( ring->clone() );
|
||||||
|
|
||||||
for ( int it = 0; it < iterations; ++it )
|
for ( int it = 0; it < iterations; ++it )
|
||||||
{
|
{
|
||||||
@ -406,17 +407,17 @@ QgsLineString* doOrthogonalize( QgsLineString* ring, int iterations, double tole
|
|||||||
|
|
||||||
delete ring;
|
delete ring;
|
||||||
|
|
||||||
return best.take();
|
return best.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QgsAbstractGeometry* orthogonalizeGeom( const QgsAbstractGeometry* geom, int maxIterations, double tolerance, double lowerThreshold, double upperThreshold )
|
QgsAbstractGeometry* orthogonalizeGeom( const QgsAbstractGeometry* geom, int maxIterations, double tolerance, double lowerThreshold, double upperThreshold )
|
||||||
{
|
{
|
||||||
QScopedPointer< QgsAbstractGeometry > segmentizedCopy;
|
std::unique_ptr< QgsAbstractGeometry > segmentizedCopy;
|
||||||
if ( QgsWkbTypes::isCurvedType( geom->wkbType() ) )
|
if ( QgsWkbTypes::isCurvedType( geom->wkbType() ) )
|
||||||
{
|
{
|
||||||
segmentizedCopy.reset( geom->segmentize() );
|
segmentizedCopy.reset( geom->segmentize() );
|
||||||
geom = segmentizedCopy.data();
|
geom = segmentizedCopy.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( QgsWkbTypes::geometryType( geom->wkbType() ) == QgsWkbTypes::LineGeometry )
|
if ( QgsWkbTypes::geometryType( geom->wkbType() ) == QgsWkbTypes::LineGeometry )
|
||||||
|
@ -1314,11 +1314,11 @@ QgsRenderContext* QgsLayerTreeModel::createTemporaryRenderContext() const
|
|||||||
bool validData = !qgsDoubleNear( mupp, 0.0 ) && dpi != 0 && !qgsDoubleNear( scale, 0.0 );
|
bool validData = !qgsDoubleNear( mupp, 0.0 ) && dpi != 0 && !qgsDoubleNear( scale, 0.0 );
|
||||||
|
|
||||||
// setup temporary render context
|
// setup temporary render context
|
||||||
QScopedPointer<QgsRenderContext> context( new QgsRenderContext );
|
std::unique_ptr<QgsRenderContext> context( new QgsRenderContext );
|
||||||
context->setScaleFactor( dpi / 25.4 );
|
context->setScaleFactor( dpi / 25.4 );
|
||||||
context->setRendererScale( scale );
|
context->setRendererScale( scale );
|
||||||
context->setMapToPixel( QgsMapToPixel( mupp ) );
|
context->setMapToPixel( QgsMapToPixel( mupp ) );
|
||||||
return validData ? context.take() : nullptr;
|
return validData ? context.release() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1518,7 +1518,7 @@ void QgsLayerTreeModel::invalidateLegendMapBasedData()
|
|||||||
// we do that here because for symbols with size defined in map units
|
// we do that here because for symbols with size defined in map units
|
||||||
// the symbol sizes changes depends on the zoom level
|
// the symbol sizes changes depends on the zoom level
|
||||||
|
|
||||||
QScopedPointer<QgsRenderContext> context( createTemporaryRenderContext() );
|
std::unique_ptr<QgsRenderContext> context( createTemporaryRenderContext() );
|
||||||
|
|
||||||
Q_FOREACH ( const LayerLegendData& data, mLegend )
|
Q_FOREACH ( const LayerLegendData& data, mLegend )
|
||||||
{
|
{
|
||||||
@ -1529,7 +1529,7 @@ void QgsLayerTreeModel::invalidateLegendMapBasedData()
|
|||||||
QgsSymbolLegendNode* n = dynamic_cast<QgsSymbolLegendNode*>( legendNode );
|
QgsSymbolLegendNode* n = dynamic_cast<QgsSymbolLegendNode*>( legendNode );
|
||||||
if ( n )
|
if ( n )
|
||||||
{
|
{
|
||||||
const QSize sz( n->minimumIconSize( context.data() ) );
|
const QSize sz( n->minimumIconSize( context.get() ) );
|
||||||
const QString parentKey( n->data( QgsLayerTreeModelLegendNode::ParentRuleKeyRole ).toString() );
|
const QString parentKey( n->data( QgsLayerTreeModelLegendNode::ParentRuleKeyRole ).toString() );
|
||||||
widthMax[parentKey] = qMax( sz.width(), widthMax.contains( parentKey ) ? widthMax[parentKey] : 0 );
|
widthMax[parentKey] = qMax( sz.width(), widthMax.contains( parentKey ) ? widthMax[parentKey] : 0 );
|
||||||
n->setIconSize( sz );
|
n->setIconSize( sz );
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "qgsgeometry.h"
|
#include "qgsgeometry.h"
|
||||||
|
|
||||||
@ -191,7 +192,7 @@ class CORE_EXPORT QgsLayerTreeModel : public QAbstractItemModel
|
|||||||
|
|
||||||
//! Returns the current map settings used for the current legend filter (or null if none is enabled)
|
//! Returns the current map settings used for the current legend filter (or null if none is enabled)
|
||||||
//! @note added in 2.14
|
//! @note added in 2.14
|
||||||
const QgsMapSettings* legendFilterMapSettings() const { return mLegendFilterMapSettings.data(); }
|
const QgsMapSettings* legendFilterMapSettings() const { return mLegendFilterMapSettings.get(); }
|
||||||
|
|
||||||
//! Give the layer tree model hints about the currently associated map view
|
//! Give the layer tree model hints about the currently associated map view
|
||||||
//! so that legend nodes that use map units can be scaled currectly
|
//! so that legend nodes that use map units can be scaled currectly
|
||||||
@ -338,8 +339,8 @@ class CORE_EXPORT QgsLayerTreeModel : public QAbstractItemModel
|
|||||||
//! scale denominator for filtering of legend nodes (<= 0 means no filtering)
|
//! scale denominator for filtering of legend nodes (<= 0 means no filtering)
|
||||||
double mLegendFilterByScale;
|
double mLegendFilterByScale;
|
||||||
|
|
||||||
QScopedPointer<QgsMapSettings> mLegendFilterMapSettings;
|
std::unique_ptr<QgsMapSettings> mLegendFilterMapSettings;
|
||||||
QScopedPointer<QgsMapHitTest> mLegendFilterHitTest;
|
std::unique_ptr<QgsMapHitTest> mLegendFilterHitTest;
|
||||||
|
|
||||||
//! whether to use map filtering
|
//! whether to use map filtering
|
||||||
bool mLegendFilterUsesExtent;
|
bool mLegendFilterUsesExtent;
|
||||||
|
@ -151,8 +151,8 @@ Qt::ItemFlags QgsSymbolLegendNode::flags() const
|
|||||||
|
|
||||||
QSize QgsSymbolLegendNode::minimumIconSize() const
|
QSize QgsSymbolLegendNode::minimumIconSize() const
|
||||||
{
|
{
|
||||||
QScopedPointer<QgsRenderContext> context( createTemporaryRenderContext() );
|
std::unique_ptr<QgsRenderContext> context( createTemporaryRenderContext() );
|
||||||
return minimumIconSize( context.data() );
|
return minimumIconSize( context.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize QgsSymbolLegendNode::minimumIconSize( QgsRenderContext* context ) const
|
QSize QgsSymbolLegendNode::minimumIconSize( QgsRenderContext* context ) const
|
||||||
@ -225,11 +225,11 @@ QgsRenderContext * QgsSymbolLegendNode::createTemporaryRenderContext() const
|
|||||||
bool validData = !qgsDoubleNear( mupp, 0.0 ) && dpi != 0 && !qgsDoubleNear( scale, 0.0 );
|
bool validData = !qgsDoubleNear( mupp, 0.0 ) && dpi != 0 && !qgsDoubleNear( scale, 0.0 );
|
||||||
|
|
||||||
// setup temporary render context
|
// setup temporary render context
|
||||||
QScopedPointer<QgsRenderContext> context( new QgsRenderContext );
|
std::unique_ptr<QgsRenderContext> context( new QgsRenderContext );
|
||||||
context->setScaleFactor( dpi / 25.4 );
|
context->setScaleFactor( dpi / 25.4 );
|
||||||
context->setRendererScale( scale );
|
context->setRendererScale( scale );
|
||||||
context->setMapToPixel( QgsMapToPixel( mupp ) );
|
context->setMapToPixel( QgsMapToPixel( mupp ) );
|
||||||
return validData ? context.take() : nullptr;
|
return validData ? context.release() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsSymbolLegendNode::checkAll( bool state )
|
void QgsSymbolLegendNode::checkAll( bool state )
|
||||||
@ -265,8 +265,8 @@ QVariant QgsSymbolLegendNode::data( int role ) const
|
|||||||
QPixmap pix;
|
QPixmap pix;
|
||||||
if ( mItem.symbol() )
|
if ( mItem.symbol() )
|
||||||
{
|
{
|
||||||
QScopedPointer<QgsRenderContext> context( createTemporaryRenderContext() );
|
std::unique_ptr<QgsRenderContext> context( createTemporaryRenderContext() );
|
||||||
pix = QgsSymbolLayerUtils::symbolPreviewPixmap( mItem.symbol(), mIconSize, 0, context.data() );
|
pix = QgsSymbolLayerUtils::symbolPreviewPixmap( mItem.symbol(), mIconSize, 0, context.get() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -603,9 +603,9 @@ QImage QgsWmsLegendNode::getLegendGraphic() const
|
|||||||
mFetcher.reset( prov->getLegendGraphicFetcher( ms ) );
|
mFetcher.reset( prov->getLegendGraphicFetcher( ms ) );
|
||||||
if ( mFetcher )
|
if ( mFetcher )
|
||||||
{
|
{
|
||||||
connect( mFetcher.data(), SIGNAL( finish( const QImage& ) ), this, SLOT( getLegendGraphicFinished( const QImage& ) ) );
|
connect( mFetcher.get(), SIGNAL( finish( const QImage& ) ), this, SLOT( getLegendGraphicFinished( const QImage& ) ) );
|
||||||
connect( mFetcher.data(), SIGNAL( error( const QString& ) ), this, SLOT( getLegendGraphicErrored( const QString& ) ) );
|
connect( mFetcher.get(), SIGNAL( error( const QString& ) ), this, SLOT( getLegendGraphicErrored( const QString& ) ) );
|
||||||
connect( mFetcher.data(), SIGNAL( progress( qint64, qint64 ) ), this, SLOT( getLegendGraphicProgress( qint64, qint64 ) ) );
|
connect( mFetcher.get(), SIGNAL( progress( qint64, qint64 ) ), this, SLOT( getLegendGraphicProgress( qint64, qint64 ) ) );
|
||||||
mFetcher->start();
|
mFetcher->start();
|
||||||
} // else QgsDebugMsg("XXX No legend supported?");
|
} // else QgsDebugMsg("XXX No legend supported?");
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ class CORE_EXPORT QgsWmsLegendNode : public QgsLayerTreeModelLegendNode
|
|||||||
|
|
||||||
bool mValid;
|
bool mValid;
|
||||||
|
|
||||||
mutable QScopedPointer<QgsImageFetcher> mFetcher;
|
mutable std::unique_ptr<QgsImageFetcher> mFetcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QGSLAYERTREEMODELLEGENDNODE_H
|
#endif // QGSLAYERTREEMODELLEGENDNODE_H
|
||||||
|
@ -54,7 +54,7 @@ QVariant QgsAggregateCalculator::calculate( QgsAggregateCalculator::Aggregate ag
|
|||||||
QgsExpressionContext defaultContext = mLayer->createExpressionContext();
|
QgsExpressionContext defaultContext = mLayer->createExpressionContext();
|
||||||
context = context ? context : &defaultContext;
|
context = context ? context : &defaultContext;
|
||||||
|
|
||||||
QScopedPointer<QgsExpression> expression;
|
std::unique_ptr<QgsExpression> expression;
|
||||||
|
|
||||||
int attrNum = mLayer->fields().lookupField( fieldOrExpression );
|
int attrNum = mLayer->fields().lookupField( fieldOrExpression );
|
||||||
|
|
||||||
@ -72,13 +72,13 @@ QVariant QgsAggregateCalculator::calculate( QgsAggregateCalculator::Aggregate ag
|
|||||||
}
|
}
|
||||||
|
|
||||||
QSet<QString> lst;
|
QSet<QString> lst;
|
||||||
if ( expression.isNull() )
|
if ( !expression )
|
||||||
lst.insert( fieldOrExpression );
|
lst.insert( fieldOrExpression );
|
||||||
else
|
else
|
||||||
lst = expression->referencedColumns();
|
lst = expression->referencedColumns();
|
||||||
|
|
||||||
QgsFeatureRequest request = QgsFeatureRequest()
|
QgsFeatureRequest request = QgsFeatureRequest()
|
||||||
.setFlags(( expression.data() && expression->needsGeometry() ) ?
|
.setFlags(( expression && expression->needsGeometry() ) ?
|
||||||
QgsFeatureRequest::NoFlags :
|
QgsFeatureRequest::NoFlags :
|
||||||
QgsFeatureRequest::NoGeometry )
|
QgsFeatureRequest::NoGeometry )
|
||||||
.setSubsetOfAttributes( lst, mLayer->fields() );
|
.setSubsetOfAttributes( lst, mLayer->fields() );
|
||||||
@ -115,7 +115,7 @@ QVariant QgsAggregateCalculator::calculate( QgsAggregateCalculator::Aggregate ag
|
|||||||
}
|
}
|
||||||
|
|
||||||
QgsFeatureIterator fit = mLayer->getFeatures( request );
|
QgsFeatureIterator fit = mLayer->getFeatures( request );
|
||||||
return calculate( aggregate, fit, resultType, attrNum, expression.data(), mDelimiter, context, ok );
|
return calculate( aggregate, fit, resultType, attrNum, expression.get(), mDelimiter, context, ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsAggregateCalculator::Aggregate QgsAggregateCalculator::stringToAggregate( const QString& string, bool* ok )
|
QgsAggregateCalculator::Aggregate QgsAggregateCalculator::stringToAggregate( const QString& string, bool* ok )
|
||||||
|
@ -142,7 +142,7 @@ QgsConditionalStyle::QgsConditionalStyle( const QgsConditionalStyle &other )
|
|||||||
, mTextColor( other.mTextColor )
|
, mTextColor( other.mTextColor )
|
||||||
, mIcon( other.mIcon )
|
, mIcon( other.mIcon )
|
||||||
{
|
{
|
||||||
if ( other.mSymbol.data() )
|
if ( other.mSymbol )
|
||||||
mSymbol.reset( other.mSymbol->clone() );
|
mSymbol.reset( other.mSymbol->clone() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ QgsConditionalStyle& QgsConditionalStyle::operator=( const QgsConditionalStyle &
|
|||||||
mTextColor = other.mTextColor;
|
mTextColor = other.mTextColor;
|
||||||
mIcon = other.mIcon;
|
mIcon = other.mIcon;
|
||||||
mName = other.mName;
|
mName = other.mName;
|
||||||
if ( other.mSymbol.data() )
|
if ( other.mSymbol )
|
||||||
{
|
{
|
||||||
mSymbol.reset( other.mSymbol->clone() );
|
mSymbol.reset( other.mSymbol->clone() );
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ void QgsConditionalStyle::setSymbol( QgsSymbol* value )
|
|||||||
if ( value )
|
if ( value )
|
||||||
{
|
{
|
||||||
mSymbol.reset( value->clone() );
|
mSymbol.reset( value->clone() );
|
||||||
mIcon = QgsSymbolLayerUtils::symbolPreviewPixmap( mSymbol.data(), QSize( 16, 16 ) );
|
mIcon = QgsSymbolLayerUtils::symbolPreviewPixmap( mSymbol.get(), QSize( 16, 16 ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -280,9 +280,9 @@ bool QgsConditionalStyle::writeXml( QDomNode &node, QDomDocument &doc ) const
|
|||||||
stylesel.setAttribute( QStringLiteral( "text_color" ), mTextColor.name() );
|
stylesel.setAttribute( QStringLiteral( "text_color" ), mTextColor.name() );
|
||||||
QDomElement labelFontElem = QgsFontUtils::toXmlElement( mFont, doc, QStringLiteral( "font" ) );
|
QDomElement labelFontElem = QgsFontUtils::toXmlElement( mFont, doc, QStringLiteral( "font" ) );
|
||||||
stylesel.appendChild( labelFontElem );
|
stylesel.appendChild( labelFontElem );
|
||||||
if ( ! mSymbol.isNull() )
|
if ( mSymbol )
|
||||||
{
|
{
|
||||||
QDomElement symbolElm = QgsSymbolLayerUtils::saveSymbol( QStringLiteral( "icon" ), mSymbol.data(), doc );
|
QDomElement symbolElm = QgsSymbolLayerUtils::saveSymbol( QStringLiteral( "icon" ), mSymbol.get(), doc );
|
||||||
stylesel.appendChild( symbolElm );
|
stylesel.appendChild( symbolElm );
|
||||||
}
|
}
|
||||||
node.appendChild( stylesel );
|
node.appendChild( stylesel );
|
||||||
|
@ -146,7 +146,7 @@ class CORE_EXPORT QgsConditionalStyle
|
|||||||
* @brief The symbol used to generate the icon for the style
|
* @brief The symbol used to generate the icon for the style
|
||||||
* @return The QgsSymbol used for the icon
|
* @return The QgsSymbol used for the icon
|
||||||
*/
|
*/
|
||||||
QgsSymbol* symbol() const { return mSymbol.data(); }
|
QgsSymbol* symbol() const { return mSymbol.get(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The text color set for style
|
* @brief The text color set for style
|
||||||
@ -234,7 +234,7 @@ class CORE_EXPORT QgsConditionalStyle
|
|||||||
bool mValid;
|
bool mValid;
|
||||||
QString mName;
|
QString mName;
|
||||||
QString mRule;
|
QString mRule;
|
||||||
QScopedPointer<QgsSymbol> mSymbol;
|
std::unique_ptr<QgsSymbol> mSymbol;
|
||||||
QFont mFont;
|
QFont mFont;
|
||||||
QColor mBackColor;
|
QColor mBackColor;
|
||||||
QColor mTextColor;
|
QColor mTextColor;
|
||||||
|
@ -1175,7 +1175,7 @@ void QgsZipItem::init()
|
|||||||
QgsDebugMsgLevel( "provider " + k, 3 );
|
QgsDebugMsgLevel( "provider " + k, 3 );
|
||||||
// some providers hangs with empty uri (Postgis) etc...
|
// some providers hangs with empty uri (Postgis) etc...
|
||||||
// -> using libraries directly
|
// -> using libraries directly
|
||||||
QScopedPointer< QLibrary > library( QgsProviderRegistry::instance()->providerLibrary( k ) );
|
std::unique_ptr< QLibrary > library( QgsProviderRegistry::instance()->providerLibrary( k ) );
|
||||||
if ( library )
|
if ( library )
|
||||||
{
|
{
|
||||||
dataCapabilities_t * dataCapabilities = reinterpret_cast< dataCapabilities_t * >( cast_to_fptr( library->resolve( "dataCapabilities" ) ) );
|
dataCapabilities_t * dataCapabilities = reinterpret_cast< dataCapabilities_t * >( cast_to_fptr( library->resolve( "dataCapabilities" ) ) );
|
||||||
|
@ -62,7 +62,7 @@ QgsDataItemProviderRegistry::QgsDataItemProviderRegistry()
|
|||||||
|
|
||||||
Q_FOREACH ( const QString& key, providersList )
|
Q_FOREACH ( const QString& key, providersList )
|
||||||
{
|
{
|
||||||
QScopedPointer< QLibrary > library( QgsProviderRegistry::instance()->providerLibrary( key ) );
|
std::unique_ptr< QLibrary > library( QgsProviderRegistry::instance()->providerLibrary( key ) );
|
||||||
if ( !library )
|
if ( !library )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -429,7 +429,7 @@ QgsDiagramRenderer::QgsDiagramRenderer( const QgsDiagramRenderer& other )
|
|||||||
: mDiagram( other.mDiagram ? other.mDiagram->clone() : nullptr )
|
: mDiagram( other.mDiagram ? other.mDiagram->clone() : nullptr )
|
||||||
, mShowAttributeLegend( other.mShowAttributeLegend )
|
, mShowAttributeLegend( other.mShowAttributeLegend )
|
||||||
, mShowSizeLegend( other.mShowSizeLegend )
|
, mShowSizeLegend( other.mShowSizeLegend )
|
||||||
, mSizeLegendSymbol( other.mSizeLegendSymbol.data() ? other.mSizeLegendSymbol->clone() : nullptr )
|
, mSizeLegendSymbol( other.mSizeLegendSymbol ? other.mSizeLegendSymbol->clone() : nullptr )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,7 +438,7 @@ QgsDiagramRenderer &QgsDiagramRenderer::operator=( const QgsDiagramRenderer & ot
|
|||||||
mDiagram = other.mDiagram ? other.mDiagram->clone() : nullptr;
|
mDiagram = other.mDiagram ? other.mDiagram->clone() : nullptr;
|
||||||
mShowAttributeLegend = other.mShowAttributeLegend;
|
mShowAttributeLegend = other.mShowAttributeLegend;
|
||||||
mShowSizeLegend = other.mShowSizeLegend;
|
mShowSizeLegend = other.mShowSizeLegend;
|
||||||
mSizeLegendSymbol.reset( other.mSizeLegendSymbol.data() ? other.mSizeLegendSymbol->clone() : nullptr );
|
mSizeLegendSymbol.reset( other.mSizeLegendSymbol ? other.mSizeLegendSymbol->clone() : nullptr );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,7 +573,7 @@ void QgsDiagramRenderer::_writeXml( QDomElement& rendererElem, QDomDocument& doc
|
|||||||
}
|
}
|
||||||
rendererElem.setAttribute( QStringLiteral( "attributeLegend" ), mShowAttributeLegend );
|
rendererElem.setAttribute( QStringLiteral( "attributeLegend" ), mShowAttributeLegend );
|
||||||
rendererElem.setAttribute( QStringLiteral( "sizeLegend" ), mShowSizeLegend );
|
rendererElem.setAttribute( QStringLiteral( "sizeLegend" ), mShowSizeLegend );
|
||||||
QDomElement sizeLegendSymbolElem = QgsSymbolLayerUtils::saveSymbol( QStringLiteral( "sizeSymbol" ), mSizeLegendSymbol.data(), doc );
|
QDomElement sizeLegendSymbolElem = QgsSymbolLayerUtils::saveSymbol( QStringLiteral( "sizeSymbol" ), mSizeLegendSymbol.get(), doc );
|
||||||
rendererElem.appendChild( sizeLegendSymbolElem );
|
rendererElem.appendChild( sizeLegendSymbolElem );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -765,13 +765,13 @@ QList< QgsLayerTreeModelLegendNode* > QgsLinearlyInterpolatedDiagramRenderer::le
|
|||||||
if ( mShowAttributeLegend )
|
if ( mShowAttributeLegend )
|
||||||
nodes = mSettings.legendItems( nodeLayer );
|
nodes = mSettings.legendItems( nodeLayer );
|
||||||
|
|
||||||
if ( mShowSizeLegend && mDiagram && mSizeLegendSymbol.data() )
|
if ( mShowSizeLegend && mDiagram && mSizeLegendSymbol )
|
||||||
{
|
{
|
||||||
// add size legend
|
// add size legend
|
||||||
Q_FOREACH ( double v, QgsSymbolLayerUtils::prettyBreaks( mInterpolationSettings.lowerValue, mInterpolationSettings.upperValue, 4 ) )
|
Q_FOREACH ( double v, QgsSymbolLayerUtils::prettyBreaks( mInterpolationSettings.lowerValue, mInterpolationSettings.upperValue, 4 ) )
|
||||||
{
|
{
|
||||||
double size = mDiagram->legendSize( v, mSettings, mInterpolationSettings );
|
double size = mDiagram->legendSize( v, mSettings, mInterpolationSettings );
|
||||||
QgsLegendSymbolItem si( mSizeLegendSymbol.data(), QString::number( v ), QString() );
|
QgsLegendSymbolItem si( mSizeLegendSymbol.get(), QString::number( v ), QString() );
|
||||||
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( si.symbol() );
|
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( si.symbol() );
|
||||||
s->setSize( size );
|
s->setSize( size );
|
||||||
s->setSizeUnit( mSettings.sizeType );
|
s->setSizeUnit( mSettings.sizeType );
|
||||||
|
@ -550,7 +550,7 @@ class CORE_EXPORT QgsDiagramRenderer
|
|||||||
* @see setSizeLegendSymbol()
|
* @see setSizeLegendSymbol()
|
||||||
* @see sizeLegend()
|
* @see sizeLegend()
|
||||||
*/
|
*/
|
||||||
QgsMarkerSymbol* sizeLegendSymbol() const { return mSizeLegendSymbol.data(); }
|
QgsMarkerSymbol* sizeLegendSymbol() const { return mSizeLegendSymbol.get(); }
|
||||||
|
|
||||||
/** Sets the marker symbol used for rendering the diagram size legend.
|
/** Sets the marker symbol used for rendering the diagram size legend.
|
||||||
* @param symbol marker symbol, ownership is transferred to the renderer.
|
* @param symbol marker symbol, ownership is transferred to the renderer.
|
||||||
@ -604,7 +604,7 @@ class CORE_EXPORT QgsDiagramRenderer
|
|||||||
bool mShowSizeLegend;
|
bool mShowSizeLegend;
|
||||||
|
|
||||||
//! Marker symbol to use in size legends
|
//! Marker symbol to use in size legends
|
||||||
QScopedPointer< QgsMarkerSymbol > mSizeLegendSymbol;
|
std::unique_ptr< QgsMarkerSymbol > mSizeLegendSymbol;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \ingroup core
|
/** \ingroup core
|
||||||
|
@ -2439,7 +2439,7 @@ static QVariant fcnRelate( const QVariantList& values, const QgsExpressionContex
|
|||||||
if ( fGeom.isNull() || sGeom.isNull() )
|
if ( fGeom.isNull() || sGeom.isNull() )
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
QScopedPointer<QgsGeometryEngine> engine( QgsGeometry::createGeometryEngine( fGeom.geometry() ) );
|
std::unique_ptr<QgsGeometryEngine> engine( QgsGeometry::createGeometryEngine( fGeom.geometry() ) );
|
||||||
|
|
||||||
if ( values.length() == 2 )
|
if ( values.length() == 2 )
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ void QgsMapHitTest::runHitTestLayer( QgsVectorLayer* vl, SymbolSet& usedSymbols,
|
|||||||
SymbolSet lUsedSymbolsRuleKey;
|
SymbolSet lUsedSymbolsRuleKey;
|
||||||
bool allExpressionFalse = false;
|
bool allExpressionFalse = false;
|
||||||
bool hasExpression = mLayerFilterExpression.contains( vl->id() );
|
bool hasExpression = mLayerFilterExpression.contains( vl->id() );
|
||||||
QScopedPointer<QgsExpression> expr;
|
std::unique_ptr<QgsExpression> expr;
|
||||||
if ( hasExpression )
|
if ( hasExpression )
|
||||||
{
|
{
|
||||||
expr.reset( new QgsExpression( mLayerFilterExpression[vl->id()] ) );
|
expr.reset( new QgsExpression( mLayerFilterExpression[vl->id()] ) );
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "qgsmaptopixelgeometrysimplifier.h"
|
#include "qgsmaptopixelgeometrysimplifier.h"
|
||||||
#include "qgsapplication.h"
|
#include "qgsapplication.h"
|
||||||
@ -140,7 +141,7 @@ QgsGeometry QgsMapToPixelSimplifier::simplifyGeometry(
|
|||||||
if ( flatType == QgsWkbTypes::LineString || flatType == QgsWkbTypes::CircularString )
|
if ( flatType == QgsWkbTypes::LineString || flatType == QgsWkbTypes::CircularString )
|
||||||
{
|
{
|
||||||
const QgsCurve& srcCurve = dynamic_cast<const QgsCurve&>( geometry );
|
const QgsCurve& srcCurve = dynamic_cast<const QgsCurve&>( geometry );
|
||||||
QScopedPointer<QgsCurve> output( createEmptySameTypeGeom( srcCurve ) );
|
std::unique_ptr<QgsCurve> output( createEmptySameTypeGeom( srcCurve ) );
|
||||||
double x = 0.0, y = 0.0, lastX = 0.0, lastY = 0.0;
|
double x = 0.0, y = 0.0, lastX = 0.0, lastY = 0.0;
|
||||||
QgsRectangle r;
|
QgsRectangle r;
|
||||||
r.setMinimal();
|
r.setMinimal();
|
||||||
@ -265,31 +266,31 @@ QgsGeometry QgsMapToPixelSimplifier::simplifyGeometry(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QgsGeometry( output.take() );
|
return QgsGeometry( output.release() );
|
||||||
}
|
}
|
||||||
else if ( flatType == QgsWkbTypes::Polygon )
|
else if ( flatType == QgsWkbTypes::Polygon )
|
||||||
{
|
{
|
||||||
const QgsPolygonV2& srcPolygon = dynamic_cast<const QgsPolygonV2&>( geometry );
|
const QgsPolygonV2& srcPolygon = dynamic_cast<const QgsPolygonV2&>( geometry );
|
||||||
QScopedPointer<QgsPolygonV2> polygon( new QgsPolygonV2() );
|
std::unique_ptr<QgsPolygonV2> polygon( new QgsPolygonV2() );
|
||||||
polygon->setExteriorRing( dynamic_cast<QgsCurve*>( simplifyGeometry( simplifyFlags, simplifyAlgorithm, srcPolygon.exteriorRing()->wkbType(), *srcPolygon.exteriorRing(), envelope, map2pixelTol, true ).geometry()->clone() ) );
|
polygon->setExteriorRing( dynamic_cast<QgsCurve*>( simplifyGeometry( simplifyFlags, simplifyAlgorithm, srcPolygon.exteriorRing()->wkbType(), *srcPolygon.exteriorRing(), envelope, map2pixelTol, true ).geometry()->clone() ) );
|
||||||
for ( int i = 0; i < srcPolygon.numInteriorRings(); ++i )
|
for ( int i = 0; i < srcPolygon.numInteriorRings(); ++i )
|
||||||
{
|
{
|
||||||
const QgsCurve* sub = srcPolygon.interiorRing( i );
|
const QgsCurve* sub = srcPolygon.interiorRing( i );
|
||||||
polygon->addInteriorRing( dynamic_cast<QgsCurve*>( simplifyGeometry( simplifyFlags, simplifyAlgorithm, sub->wkbType(), *sub, envelope, map2pixelTol, true ).geometry()->clone() ) );
|
polygon->addInteriorRing( dynamic_cast<QgsCurve*>( simplifyGeometry( simplifyFlags, simplifyAlgorithm, sub->wkbType(), *sub, envelope, map2pixelTol, true ).geometry()->clone() ) );
|
||||||
}
|
}
|
||||||
return QgsGeometry( polygon.take() );
|
return QgsGeometry( polygon.release() );
|
||||||
}
|
}
|
||||||
else if ( QgsWkbTypes::isMultiType( flatType ) )
|
else if ( QgsWkbTypes::isMultiType( flatType ) )
|
||||||
{
|
{
|
||||||
const QgsGeometryCollection& srcCollection = dynamic_cast<const QgsGeometryCollection&>( geometry );
|
const QgsGeometryCollection& srcCollection = dynamic_cast<const QgsGeometryCollection&>( geometry );
|
||||||
QScopedPointer<QgsGeometryCollection> collection( createEmptySameTypeGeom( srcCollection ) );
|
std::unique_ptr<QgsGeometryCollection> collection( createEmptySameTypeGeom( srcCollection ) );
|
||||||
const int numGeoms = srcCollection.numGeometries();
|
const int numGeoms = srcCollection.numGeometries();
|
||||||
for ( int i = 0; i < numGeoms; ++i )
|
for ( int i = 0; i < numGeoms; ++i )
|
||||||
{
|
{
|
||||||
const QgsAbstractGeometry* sub = srcCollection.geometryN( i );
|
const QgsAbstractGeometry* sub = srcCollection.geometryN( i );
|
||||||
collection->addGeometry( simplifyGeometry( simplifyFlags, simplifyAlgorithm, sub->wkbType(), *sub, envelope, map2pixelTol, false ).geometry()->clone() );
|
collection->addGeometry( simplifyGeometry( simplifyFlags, simplifyAlgorithm, sub->wkbType(), *sub, envelope, map2pixelTol, false ).geometry()->clone() );
|
||||||
}
|
}
|
||||||
return QgsGeometry( collection.take() );
|
return QgsGeometry( collection.release() );
|
||||||
}
|
}
|
||||||
return QgsGeometry( geometry.clone() );
|
return QgsGeometry( geometry.clone() );
|
||||||
}
|
}
|
||||||
|
@ -975,14 +975,14 @@ void QgsPalLayerSettings::calculateLabelSize( const QFontMetricsF* fm, QString t
|
|||||||
}
|
}
|
||||||
|
|
||||||
//try to keep < 2.12 API - handle no passed render context
|
//try to keep < 2.12 API - handle no passed render context
|
||||||
QScopedPointer< QgsRenderContext > scopedRc;
|
std::unique_ptr< QgsRenderContext > scopedRc;
|
||||||
if ( !context )
|
if ( !context )
|
||||||
{
|
{
|
||||||
scopedRc.reset( new QgsRenderContext() );
|
scopedRc.reset( new QgsRenderContext() );
|
||||||
if ( f )
|
if ( f )
|
||||||
scopedRc->expressionContext().setFeature( *f );
|
scopedRc->expressionContext().setFeature( *f );
|
||||||
}
|
}
|
||||||
QgsRenderContext* rc = context ? context : scopedRc.data();
|
QgsRenderContext* rc = context ? context : scopedRc.get();
|
||||||
|
|
||||||
QString wrapchr = wrapChar;
|
QString wrapchr = wrapChar;
|
||||||
double multilineH = mFormat.lineHeight();
|
double multilineH = mFormat.lineHeight();
|
||||||
@ -1329,9 +1329,9 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: this should come AFTER any option that affects font metrics
|
// NOTE: this should come AFTER any option that affects font metrics
|
||||||
QScopedPointer<QFontMetricsF> labelFontMetrics( new QFontMetricsF( labelFont ) );
|
std::unique_ptr<QFontMetricsF> labelFontMetrics( new QFontMetricsF( labelFont ) );
|
||||||
double labelX, labelY; // will receive label size
|
double labelX, labelY; // will receive label size
|
||||||
calculateLabelSize( labelFontMetrics.data(), labelText, labelX, labelY, mCurFeat, &context );
|
calculateLabelSize( labelFontMetrics.get(), labelText, labelX, labelY, mCurFeat, &context );
|
||||||
|
|
||||||
|
|
||||||
// maximum angle between curved label characters (hardcoded defaults used in QGIS <2.0)
|
// maximum angle between curved label characters (hardcoded defaults used in QGIS <2.0)
|
||||||
@ -1391,7 +1391,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont
|
|||||||
|
|
||||||
// simplify?
|
// simplify?
|
||||||
const QgsVectorSimplifyMethod &simplifyMethod = context.vectorSimplifyMethod();
|
const QgsVectorSimplifyMethod &simplifyMethod = context.vectorSimplifyMethod();
|
||||||
QScopedPointer<QgsGeometry> scopedClonedGeom;
|
std::unique_ptr<QgsGeometry> scopedClonedGeom;
|
||||||
if ( simplifyMethod.simplifyHints() != QgsVectorSimplifyMethod::NoSimplification && simplifyMethod.forceLocalOptimization() )
|
if ( simplifyMethod.simplifyHints() != QgsVectorSimplifyMethod::NoSimplification && simplifyMethod.forceLocalOptimization() )
|
||||||
{
|
{
|
||||||
int simplifyHints = simplifyMethod.simplifyHints() | QgsMapToPixelSimplifier::SimplifyEnvelope;
|
int simplifyHints = simplifyMethod.simplifyHints() | QgsMapToPixelSimplifier::SimplifyEnvelope;
|
||||||
@ -1444,13 +1444,13 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont
|
|||||||
}
|
}
|
||||||
geos_geom_clone = geom.exportToGeos();
|
geos_geom_clone = geom.exportToGeos();
|
||||||
|
|
||||||
QScopedPointer<QgsGeometry> scopedObstacleGeom;
|
std::unique_ptr<QgsGeometry> scopedObstacleGeom;
|
||||||
if ( isObstacle )
|
if ( isObstacle )
|
||||||
{
|
{
|
||||||
if ( obstacleGeometry && QgsPalLabeling::geometryRequiresPreparation( *obstacleGeometry, context, ct, doClip ? &extentGeom : nullptr ) )
|
if ( obstacleGeometry && QgsPalLabeling::geometryRequiresPreparation( *obstacleGeometry, context, ct, doClip ? &extentGeom : nullptr ) )
|
||||||
{
|
{
|
||||||
scopedObstacleGeom.reset( new QgsGeometry( QgsPalLabeling::prepareGeometry( *obstacleGeometry, context, ct, doClip ? &extentGeom : nullptr ) ) );
|
scopedObstacleGeom.reset( new QgsGeometry( QgsPalLabeling::prepareGeometry( *obstacleGeometry, context, ct, doClip ? &extentGeom : nullptr ) ) );
|
||||||
obstacleGeometry = scopedObstacleGeom.data();
|
obstacleGeometry = scopedObstacleGeom.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1818,7 +1818,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont
|
|||||||
// TODO: only for placement which needs character info
|
// TODO: only for placement which needs character info
|
||||||
// account for any data defined font metrics adjustments
|
// account for any data defined font metrics adjustments
|
||||||
lf->calculateInfo( placement == QgsPalLayerSettings::Curved || placement == QgsPalLayerSettings::PerimeterCurved,
|
lf->calculateInfo( placement == QgsPalLayerSettings::Curved || placement == QgsPalLayerSettings::PerimeterCurved,
|
||||||
labelFontMetrics.data(), xform, maxcharanglein, maxcharangleout );
|
labelFontMetrics.get(), xform, maxcharanglein, maxcharangleout );
|
||||||
// for labelFeature the LabelInfo is passed to feat when it is registered
|
// for labelFeature the LabelInfo is passed to feat when it is registered
|
||||||
|
|
||||||
// TODO: allow layer-wide feature dist in PAL...?
|
// TODO: allow layer-wide feature dist in PAL...?
|
||||||
@ -1942,7 +1942,7 @@ void QgsPalLayerSettings::registerObstacleFeature( QgsFeature& f, QgsRenderConte
|
|||||||
|
|
||||||
// simplify?
|
// simplify?
|
||||||
const QgsVectorSimplifyMethod &simplifyMethod = context.vectorSimplifyMethod();
|
const QgsVectorSimplifyMethod &simplifyMethod = context.vectorSimplifyMethod();
|
||||||
QScopedPointer<QgsGeometry> scopedClonedGeom;
|
std::unique_ptr<QgsGeometry> scopedClonedGeom;
|
||||||
if ( simplifyMethod.simplifyHints() != QgsVectorSimplifyMethod::NoSimplification && simplifyMethod.forceLocalOptimization() )
|
if ( simplifyMethod.simplifyHints() != QgsVectorSimplifyMethod::NoSimplification && simplifyMethod.forceLocalOptimization() )
|
||||||
{
|
{
|
||||||
int simplifyHints = simplifyMethod.simplifyHints() | QgsMapToPixelSimplifier::SimplifyEnvelope;
|
int simplifyHints = simplifyMethod.simplifyHints() | QgsMapToPixelSimplifier::SimplifyEnvelope;
|
||||||
@ -1952,7 +1952,7 @@ void QgsPalLayerSettings::registerObstacleFeature( QgsFeature& f, QgsRenderConte
|
|||||||
}
|
}
|
||||||
|
|
||||||
GEOSGeometry* geos_geom_clone = nullptr;
|
GEOSGeometry* geos_geom_clone = nullptr;
|
||||||
QScopedPointer<QgsGeometry> scopedPreparedGeom;
|
std::unique_ptr<QgsGeometry> scopedPreparedGeom;
|
||||||
|
|
||||||
if ( QgsPalLabeling::geometryRequiresPreparation( geom, context, ct, &extentGeom ) )
|
if ( QgsPalLabeling::geometryRequiresPreparation( geom, context, ct, &extentGeom ) )
|
||||||
{
|
{
|
||||||
|
@ -731,7 +731,7 @@ bool QgsProject::read()
|
|||||||
{
|
{
|
||||||
clearError();
|
clearError();
|
||||||
|
|
||||||
QScopedPointer<QDomDocument> doc( new QDomDocument( QStringLiteral( "qgis" ) ) );
|
std::unique_ptr<QDomDocument> doc( new QDomDocument( QStringLiteral( "qgis" ) ) );
|
||||||
|
|
||||||
if ( !mFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
if ( !mFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||||
{
|
{
|
||||||
@ -1156,7 +1156,7 @@ bool QgsProject::write()
|
|||||||
QDomDocumentType documentType =
|
QDomDocumentType documentType =
|
||||||
DomImplementation.createDocumentType( QStringLiteral( "qgis" ), QStringLiteral( "http://mrcc.com/qgis.dtd" ),
|
DomImplementation.createDocumentType( QStringLiteral( "qgis" ), QStringLiteral( "http://mrcc.com/qgis.dtd" ),
|
||||||
QStringLiteral( "SYSTEM" ) );
|
QStringLiteral( "SYSTEM" ) );
|
||||||
QScopedPointer<QDomDocument> doc( new QDomDocument( documentType ) );
|
std::unique_ptr<QDomDocument> doc( new QDomDocument( documentType ) );
|
||||||
|
|
||||||
QDomElement qgisNode = doc->createElement( QStringLiteral( "qgis" ) );
|
QDomElement qgisNode = doc->createElement( QStringLiteral( "qgis" ) );
|
||||||
qgisNode.setAttribute( QStringLiteral( "projectname" ), title() );
|
qgisNode.setAttribute( QStringLiteral( "projectname" ), title() );
|
||||||
@ -2109,12 +2109,12 @@ QgsLayerTreeGroup *QgsProject::layerTreeRoot() const
|
|||||||
|
|
||||||
QgsMapThemeCollection* QgsProject::mapThemeCollection()
|
QgsMapThemeCollection* QgsProject::mapThemeCollection()
|
||||||
{
|
{
|
||||||
return mMapThemeCollection.data();
|
return mMapThemeCollection.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsAnnotationManager* QgsProject::annotationManager()
|
QgsAnnotationManager* QgsProject::annotationManager()
|
||||||
{
|
{
|
||||||
return mAnnotationManager.data();
|
return mAnnotationManager.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsProject::setNonIdentifiableLayers( const QList<QgsMapLayer*>& layers )
|
void QgsProject::setNonIdentifiableLayers( const QList<QgsMapLayer*>& layers )
|
||||||
|
@ -962,7 +962,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
|
|||||||
|
|
||||||
QgsRelationManager* mRelationManager;
|
QgsRelationManager* mRelationManager;
|
||||||
|
|
||||||
QScopedPointer<QgsAnnotationManager> mAnnotationManager;
|
std::unique_ptr<QgsAnnotationManager> mAnnotationManager;
|
||||||
|
|
||||||
QgsLayerTreeGroup* mRootGroup;
|
QgsLayerTreeGroup* mRootGroup;
|
||||||
|
|
||||||
@ -971,7 +971,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
|
|||||||
//! map of transaction group: QPair( providerKey, connString ) -> transactionGroup
|
//! map of transaction group: QPair( providerKey, connString ) -> transactionGroup
|
||||||
QMap< QPair< QString, QString>, QgsTransactionGroup*> mTransactionGroups;
|
QMap< QPair< QString, QString>, QgsTransactionGroup*> mTransactionGroups;
|
||||||
|
|
||||||
QScopedPointer<QgsMapThemeCollection> mMapThemeCollection;
|
std::unique_ptr<QgsMapThemeCollection> mMapThemeCollection;
|
||||||
|
|
||||||
QVariantMap mCustomVariables;
|
QVariantMap mCustomVariables;
|
||||||
|
|
||||||
|
@ -681,11 +681,11 @@ bool QgsProperty::readXml( const QDomElement &propertyElem, const QDomDocument &
|
|||||||
{
|
{
|
||||||
QDomElement transformerElem = transformerNodeList.at( 0 ).toElement();
|
QDomElement transformerElem = transformerNodeList.at( 0 ).toElement();
|
||||||
QgsPropertyTransformer::Type type = static_cast< QgsPropertyTransformer::Type >( transformerElem.attribute( "t", "0" ).toInt() );
|
QgsPropertyTransformer::Type type = static_cast< QgsPropertyTransformer::Type >( transformerElem.attribute( "t", "0" ).toInt() );
|
||||||
QScopedPointer< QgsPropertyTransformer > transformer( QgsPropertyTransformer::create( type ) );
|
std::unique_ptr< QgsPropertyTransformer > transformer( QgsPropertyTransformer::create( type ) );
|
||||||
if ( transformer )
|
if ( transformer )
|
||||||
{
|
{
|
||||||
if ( transformer->readXml( transformerElem, doc ) )
|
if ( transformer->readXml( transformerElem, doc ) )
|
||||||
d->transformer = transformer.take();
|
d->transformer = transformer.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ bool QgsColorRampTransformer::writeXml( QDomElement &transformerElem, QDomDocume
|
|||||||
|
|
||||||
if ( mGradientRamp )
|
if ( mGradientRamp )
|
||||||
{
|
{
|
||||||
QDomElement colorRampElem = QgsSymbolLayerUtils::saveColorRamp( "[source]", mGradientRamp.data(), doc );
|
QDomElement colorRampElem = QgsSymbolLayerUtils::saveColorRamp( "[source]", mGradientRamp.get(), doc );
|
||||||
transformerElem.appendChild( colorRampElem );
|
transformerElem.appendChild( colorRampElem );
|
||||||
}
|
}
|
||||||
transformerElem.setAttribute( "nullColor", QgsSymbolLayerUtils::encodeColor( mNullColor ) );
|
transformerElem.setAttribute( "nullColor", QgsSymbolLayerUtils::encodeColor( mNullColor ) );
|
||||||
@ -317,7 +317,7 @@ QColor QgsColorRampTransformer::color( double value ) const
|
|||||||
|
|
||||||
QgsColorRamp *QgsColorRampTransformer::colorRamp() const
|
QgsColorRamp *QgsColorRampTransformer::colorRamp() const
|
||||||
{
|
{
|
||||||
return mGradientRamp.data();
|
return mGradientRamp.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsColorRampTransformer::setColorRamp( QgsColorRamp* ramp )
|
void QgsColorRampTransformer::setColorRamp( QgsColorRamp* ramp )
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class QgsColorRamp;
|
class QgsColorRamp;
|
||||||
|
|
||||||
@ -362,7 +363,7 @@ class CORE_EXPORT QgsColorRampTransformer : public QgsPropertyTransformer
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QScopedPointer< QgsColorRamp > mGradientRamp;
|
std::unique_ptr< QgsColorRamp > mGradientRamp;
|
||||||
QColor mNullColor;
|
QColor mNullColor;
|
||||||
QString mRampName;
|
QString mRampName;
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ QgsDataProvider *QgsProviderRegistry::provider( QString const & providerKey, QSt
|
|||||||
|
|
||||||
int QgsProviderRegistry::providerCapabilities( const QString &providerKey ) const
|
int QgsProviderRegistry::providerCapabilities( const QString &providerKey ) const
|
||||||
{
|
{
|
||||||
QScopedPointer< QLibrary > library( providerLibrary( providerKey ) );
|
std::unique_ptr< QLibrary > library( providerLibrary( providerKey ) );
|
||||||
if ( !library )
|
if ( !library )
|
||||||
{
|
{
|
||||||
return QgsDataProvider::NoDataCapabilities;
|
return QgsDataProvider::NoDataCapabilities;
|
||||||
@ -452,12 +452,12 @@ QFunctionPointer QgsProviderRegistry::function( QString const & providerKey,
|
|||||||
|
|
||||||
QLibrary* QgsProviderRegistry::providerLibrary( QString const & providerKey ) const
|
QLibrary* QgsProviderRegistry::providerLibrary( QString const & providerKey ) const
|
||||||
{
|
{
|
||||||
QScopedPointer< QLibrary > myLib( new QLibrary( library( providerKey ) ) );
|
std::unique_ptr< QLibrary > myLib( new QLibrary( library( providerKey ) ) );
|
||||||
|
|
||||||
QgsDebugMsg( "Library name is " + myLib->fileName() );
|
QgsDebugMsg( "Library name is " + myLib->fileName() );
|
||||||
|
|
||||||
if ( myLib->load() )
|
if ( myLib->load() )
|
||||||
return myLib.take();
|
return myLib.release();
|
||||||
|
|
||||||
QgsDebugMsg( "Cannot load library: " + myLib->errorString() );
|
QgsDebugMsg( "Cannot load library: " + myLib->errorString() );
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ void QgsRenderContext::setFeatureFilterProvider( const QgsFeatureFilterProvider*
|
|||||||
|
|
||||||
const QgsFeatureFilterProvider* QgsRenderContext::featureFilterProvider() const
|
const QgsFeatureFilterProvider* QgsRenderContext::featureFilterProvider() const
|
||||||
{
|
{
|
||||||
return mFeatureFilterProvider.data();
|
return mFeatureFilterProvider.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
double QgsRenderContext::convertToPainterUnits( double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale& scale ) const
|
double QgsRenderContext::convertToPainterUnits( double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale& scale ) const
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "qgis_core.h"
|
#include "qgis_core.h"
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "qgsabstractgeometry.h"
|
#include "qgsabstractgeometry.h"
|
||||||
#include "qgscoordinatetransform.h"
|
#include "qgscoordinatetransform.h"
|
||||||
@ -335,7 +336,7 @@ class CORE_EXPORT QgsRenderContext
|
|||||||
const QgsAbstractGeometry* mGeometry = nullptr;
|
const QgsAbstractGeometry* mGeometry = nullptr;
|
||||||
|
|
||||||
//! The feature filter provider
|
//! The feature filter provider
|
||||||
QScopedPointer< QgsFeatureFilterProvider > mFeatureFilterProvider;
|
std::unique_ptr< QgsFeatureFilterProvider > mFeatureFilterProvider;
|
||||||
|
|
||||||
double mSegmentationTolerance = M_PI_2 / 90;
|
double mSegmentationTolerance = M_PI_2 / 90;
|
||||||
|
|
||||||
|
@ -1841,11 +1841,11 @@ void QgsTextRenderer::drawBuffer( QgsRenderContext& context, const QgsTextRender
|
|||||||
double QgsTextRenderer::textWidth( const QgsRenderContext& context, const QgsTextFormat& format, const QStringList &textLines, QFontMetricsF* fm )
|
double QgsTextRenderer::textWidth( const QgsRenderContext& context, const QgsTextFormat& format, const QStringList &textLines, QFontMetricsF* fm )
|
||||||
{
|
{
|
||||||
//calculate max width of text lines
|
//calculate max width of text lines
|
||||||
QScopedPointer< QFontMetricsF > newFm;
|
std::unique_ptr< QFontMetricsF > newFm;
|
||||||
if ( !fm )
|
if ( !fm )
|
||||||
{
|
{
|
||||||
newFm.reset( new QFontMetricsF( format.scaledFont( context ) ) );
|
newFm.reset( new QFontMetricsF( format.scaledFont( context ) ) );
|
||||||
fm = newFm.data();
|
fm = newFm.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
double maxWidth = 0;
|
double maxWidth = 0;
|
||||||
@ -1859,11 +1859,11 @@ double QgsTextRenderer::textWidth( const QgsRenderContext& context, const QgsTex
|
|||||||
double QgsTextRenderer::textHeight( const QgsRenderContext& context, const QgsTextFormat& format, const QStringList& textLines, DrawMode mode, QFontMetricsF* fm )
|
double QgsTextRenderer::textHeight( const QgsRenderContext& context, const QgsTextFormat& format, const QStringList& textLines, DrawMode mode, QFontMetricsF* fm )
|
||||||
{
|
{
|
||||||
//calculate max width of text lines
|
//calculate max width of text lines
|
||||||
QScopedPointer< QFontMetricsF > newFm;
|
std::unique_ptr< QFontMetricsF > newFm;
|
||||||
if ( !fm )
|
if ( !fm )
|
||||||
{
|
{
|
||||||
newFm.reset( new QFontMetricsF( format.scaledFont( context ) ) );
|
newFm.reset( new QFontMetricsF( format.scaledFont( context ) ) );
|
||||||
fm = newFm.data();
|
fm = newFm.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
double labelHeight = fm->ascent() + fm->descent(); // ignore +1 for baseline
|
double labelHeight = fm->ascent() + fm->descent(); // ignore +1 for baseline
|
||||||
|
@ -29,7 +29,7 @@ typedef QgsTransaction* createTransaction_t( const QString& connString );
|
|||||||
|
|
||||||
QgsTransaction* QgsTransaction::create( const QString& connString, const QString& providerKey )
|
QgsTransaction* QgsTransaction::create( const QString& connString, const QString& providerKey )
|
||||||
{
|
{
|
||||||
QScopedPointer< QLibrary > lib( QgsProviderRegistry::instance()->providerLibrary( providerKey ) );
|
std::unique_ptr< QLibrary > lib( QgsProviderRegistry::instance()->providerLibrary( providerKey ) );
|
||||||
if ( !lib )
|
if ( !lib )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ bool QgsTransaction::rollback( QString& errorMsg )
|
|||||||
|
|
||||||
bool QgsTransaction::supportsTransaction( const QgsVectorLayer* layer )
|
bool QgsTransaction::supportsTransaction( const QgsVectorLayer* layer )
|
||||||
{
|
{
|
||||||
QScopedPointer< QLibrary > lib( QgsProviderRegistry::instance()->providerLibrary( layer->providerType() ) );
|
std::unique_ptr< QLibrary > lib( QgsProviderRegistry::instance()->providerLibrary( layer->providerType() ) );
|
||||||
if ( !lib )
|
if ( !lib )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ bool QgsTransactionGroup::modified() const
|
|||||||
|
|
||||||
void QgsTransactionGroup::onEditingStarted()
|
void QgsTransactionGroup::onEditingStarted()
|
||||||
{
|
{
|
||||||
if ( !mTransaction.isNull() )
|
if ( mTransaction )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mTransaction.reset( QgsTransaction::create( mConnString, mProviderKey ) );
|
mTransaction.reset( QgsTransaction::create( mConnString, mProviderKey ) );
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "qgis_core.h"
|
#include "qgis_core.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
#include <memory>
|
||||||
#include "qgstransaction.h"
|
#include "qgstransaction.h"
|
||||||
|
|
||||||
class QgsVectorLayer;
|
class QgsVectorLayer;
|
||||||
@ -89,7 +90,7 @@ class CORE_EXPORT QgsTransactionGroup : public QObject
|
|||||||
|
|
||||||
QSet<QgsVectorLayer*> mLayers;
|
QSet<QgsVectorLayer*> mLayers;
|
||||||
//! Only set while a transaction is active
|
//! Only set while a transaction is active
|
||||||
QScopedPointer<QgsTransaction> mTransaction;
|
std::unique_ptr<QgsTransaction> mTransaction;
|
||||||
//! Layers have to be compatible with the connection string
|
//! Layers have to be compatible with the connection string
|
||||||
QString mConnString;
|
QString mConnString;
|
||||||
QString mProviderKey;
|
QString mProviderKey;
|
||||||
|
@ -3077,12 +3077,12 @@ QVariant QgsVectorLayer::defaultValue( int index, const QgsFeature& feature, Qgs
|
|||||||
return mDataProvider->defaultValue( index );
|
return mDataProvider->defaultValue( index );
|
||||||
|
|
||||||
QgsExpressionContext* evalContext = context;
|
QgsExpressionContext* evalContext = context;
|
||||||
QScopedPointer< QgsExpressionContext > tempContext;
|
std::unique_ptr< QgsExpressionContext > tempContext;
|
||||||
if ( !evalContext )
|
if ( !evalContext )
|
||||||
{
|
{
|
||||||
// no context passed, so we create a default one
|
// no context passed, so we create a default one
|
||||||
tempContext.reset( new QgsExpressionContext( QgsExpressionContextUtils::globalProjectLayerScopes( this ) ) );
|
tempContext.reset( new QgsExpressionContext( QgsExpressionContextUtils::globalProjectLayerScopes( this ) ) );
|
||||||
evalContext = tempContext.data();
|
evalContext = tempContext.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( feature.isValid() )
|
if ( feature.isValid() )
|
||||||
@ -3559,7 +3559,7 @@ QList<QVariant> QgsVectorLayer::getValues( const QString &fieldOrExpression, boo
|
|||||||
{
|
{
|
||||||
QList<QVariant> values;
|
QList<QVariant> values;
|
||||||
|
|
||||||
QScopedPointer<QgsExpression> expression;
|
std::unique_ptr<QgsExpression> expression;
|
||||||
QgsExpressionContext context;
|
QgsExpressionContext context;
|
||||||
|
|
||||||
int attrNum = mFields.lookupField( fieldOrExpression );
|
int attrNum = mFields.lookupField( fieldOrExpression );
|
||||||
@ -3579,7 +3579,7 @@ QList<QVariant> QgsVectorLayer::getValues( const QString &fieldOrExpression, boo
|
|||||||
|
|
||||||
QgsFeature f;
|
QgsFeature f;
|
||||||
QSet<QString> lst;
|
QSet<QString> lst;
|
||||||
if ( expression.isNull() )
|
if ( !expression )
|
||||||
lst.insert( fieldOrExpression );
|
lst.insert( fieldOrExpression );
|
||||||
else
|
else
|
||||||
lst = expression->referencedColumns();
|
lst = expression->referencedColumns();
|
||||||
@ -4272,7 +4272,7 @@ QList<QgsRelation> QgsVectorLayer::referencingRelations( int idx ) const
|
|||||||
|
|
||||||
int QgsVectorLayer::listStylesInDatabase( QStringList &ids, QStringList &names, QStringList &descriptions, QString &msgError )
|
int QgsVectorLayer::listStylesInDatabase( QStringList &ids, QStringList &names, QStringList &descriptions, QString &msgError )
|
||||||
{
|
{
|
||||||
QScopedPointer<QLibrary> myLib( QgsProviderRegistry::instance()->providerLibrary( mProviderKey ) );
|
std::unique_ptr<QLibrary> myLib( QgsProviderRegistry::instance()->providerLibrary( mProviderKey ) );
|
||||||
if ( !myLib )
|
if ( !myLib )
|
||||||
{
|
{
|
||||||
msgError = QObject::tr( "Unable to load %1 provider" ).arg( mProviderKey );
|
msgError = QObject::tr( "Unable to load %1 provider" ).arg( mProviderKey );
|
||||||
@ -4291,7 +4291,7 @@ int QgsVectorLayer::listStylesInDatabase( QStringList &ids, QStringList &names,
|
|||||||
|
|
||||||
QString QgsVectorLayer::getStyleFromDatabase( const QString& styleId, QString &msgError )
|
QString QgsVectorLayer::getStyleFromDatabase( const QString& styleId, QString &msgError )
|
||||||
{
|
{
|
||||||
QScopedPointer<QLibrary> myLib( QgsProviderRegistry::instance()->providerLibrary( mProviderKey ) );
|
std::unique_ptr<QLibrary> myLib( QgsProviderRegistry::instance()->providerLibrary( mProviderKey ) );
|
||||||
if ( !myLib )
|
if ( !myLib )
|
||||||
{
|
{
|
||||||
msgError = QObject::tr( "Unable to load %1 provider" ).arg( mProviderKey );
|
msgError = QObject::tr( "Unable to load %1 provider" ).arg( mProviderKey );
|
||||||
@ -4310,7 +4310,7 @@ QString QgsVectorLayer::getStyleFromDatabase( const QString& styleId, QString &m
|
|||||||
|
|
||||||
bool QgsVectorLayer::deleteStyleFromDatabase( const QString& styleId, QString &msgError )
|
bool QgsVectorLayer::deleteStyleFromDatabase( const QString& styleId, QString &msgError )
|
||||||
{
|
{
|
||||||
QScopedPointer<QLibrary> myLib( QgsProviderRegistry::instance()->providerLibrary( mProviderKey ) );
|
std::unique_ptr<QLibrary> myLib( QgsProviderRegistry::instance()->providerLibrary( mProviderKey ) );
|
||||||
if ( !myLib )
|
if ( !myLib )
|
||||||
{
|
{
|
||||||
msgError = QObject::tr( "Unable to load %1 provider" ).arg( mProviderKey );
|
msgError = QObject::tr( "Unable to load %1 provider" ).arg( mProviderKey );
|
||||||
@ -4331,7 +4331,7 @@ void QgsVectorLayer::saveStyleToDatabase( const QString& name, const QString& de
|
|||||||
{
|
{
|
||||||
|
|
||||||
QString sldStyle, qmlStyle;
|
QString sldStyle, qmlStyle;
|
||||||
QScopedPointer<QLibrary> myLib( QgsProviderRegistry::instance()->providerLibrary( mProviderKey ) );
|
std::unique_ptr<QLibrary> myLib( QgsProviderRegistry::instance()->providerLibrary( mProviderKey ) );
|
||||||
if ( !myLib )
|
if ( !myLib )
|
||||||
{
|
{
|
||||||
msgError = QObject::tr( "Unable to load %1 provider" ).arg( mProviderKey );
|
msgError = QObject::tr( "Unable to load %1 provider" ).arg( mProviderKey );
|
||||||
@ -4376,7 +4376,7 @@ QString QgsVectorLayer::loadNamedStyle( const QString &theURI, bool &theResultFl
|
|||||||
QgsDataSourceUri dsUri( theURI );
|
QgsDataSourceUri dsUri( theURI );
|
||||||
if ( !loadFromLocalDB && mDataProvider && mDataProvider->isSaveAndLoadStyleToDBSupported() )
|
if ( !loadFromLocalDB && mDataProvider && mDataProvider->isSaveAndLoadStyleToDBSupported() )
|
||||||
{
|
{
|
||||||
QScopedPointer<QLibrary> myLib( QgsProviderRegistry::instance()->providerLibrary( mProviderKey ) );
|
std::unique_ptr<QLibrary> myLib( QgsProviderRegistry::instance()->providerLibrary( mProviderKey ) );
|
||||||
if ( myLib )
|
if ( myLib )
|
||||||
{
|
{
|
||||||
loadStyle_t* loadStyleExternalMethod = reinterpret_cast< loadStyle_t * >( cast_to_fptr( myLib->resolve( "loadStyle" ) ) );
|
loadStyle_t* loadStyleExternalMethod = reinterpret_cast< loadStyle_t * >( cast_to_fptr( myLib->resolve( "loadStyle" ) ) );
|
||||||
|
@ -215,11 +215,11 @@ QgsLabelFeature* QgsVectorLayerDiagramProvider::registerDiagram( QgsFeature& fea
|
|||||||
}
|
}
|
||||||
|
|
||||||
GEOSGeometry* geomCopy = nullptr;
|
GEOSGeometry* geomCopy = nullptr;
|
||||||
QScopedPointer<QgsGeometry> scopedPreparedGeom;
|
std::unique_ptr<QgsGeometry> scopedPreparedGeom;
|
||||||
if ( QgsPalLabeling::geometryRequiresPreparation( geom, context, mSettings.coordinateTransform(), &extentGeom ) )
|
if ( QgsPalLabeling::geometryRequiresPreparation( geom, context, mSettings.coordinateTransform(), &extentGeom ) )
|
||||||
{
|
{
|
||||||
scopedPreparedGeom.reset( new QgsGeometry( QgsPalLabeling::prepareGeometry( geom, context, mSettings.coordinateTransform(), &extentGeom ) ) );
|
scopedPreparedGeom.reset( new QgsGeometry( QgsPalLabeling::prepareGeometry( geom, context, mSettings.coordinateTransform(), &extentGeom ) ) );
|
||||||
QgsGeometry* preparedGeom = scopedPreparedGeom.data();
|
QgsGeometry* preparedGeom = scopedPreparedGeom.get();
|
||||||
if ( preparedGeom->isNull() )
|
if ( preparedGeom->isNull() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
geomCopy = preparedGeom->exportToGeos();
|
geomCopy = preparedGeom->exportToGeos();
|
||||||
@ -233,7 +233,7 @@ QgsLabelFeature* QgsVectorLayerDiagramProvider::registerDiagram( QgsFeature& fea
|
|||||||
return nullptr; // invalid geometry
|
return nullptr; // invalid geometry
|
||||||
|
|
||||||
GEOSGeometry* geosObstacleGeomClone = nullptr;
|
GEOSGeometry* geosObstacleGeomClone = nullptr;
|
||||||
QScopedPointer<QgsGeometry> scopedObstacleGeom;
|
std::unique_ptr<QgsGeometry> scopedObstacleGeom;
|
||||||
if ( isObstacle && obstacleGeometry && QgsPalLabeling::geometryRequiresPreparation( *obstacleGeometry, context, mSettings.coordinateTransform(), &extentGeom ) )
|
if ( isObstacle && obstacleGeometry && QgsPalLabeling::geometryRequiresPreparation( *obstacleGeometry, context, mSettings.coordinateTransform(), &extentGeom ) )
|
||||||
{
|
{
|
||||||
QgsGeometry preparedObstacleGeom = QgsPalLabeling::prepareGeometry( *obstacleGeometry, context, mSettings.coordinateTransform(), &extentGeom );
|
QgsGeometry preparedObstacleGeom = QgsPalLabeling::prepareGeometry( *obstacleGeometry, context, mSettings.coordinateTransform(), &extentGeom );
|
||||||
|
@ -550,7 +550,7 @@ void QgsVectorLayerFeatureIterator::prepareExpression( int fieldIdx )
|
|||||||
exp->setDistanceUnits( QgsProject::instance()->distanceUnits() );
|
exp->setDistanceUnits( QgsProject::instance()->distanceUnits() );
|
||||||
exp->setAreaUnits( QgsProject::instance()->areaUnits() );
|
exp->setAreaUnits( QgsProject::instance()->areaUnits() );
|
||||||
|
|
||||||
exp->prepare( mExpressionContext.data() );
|
exp->prepare( mExpressionContext.get() );
|
||||||
mExpressionFieldInfo.insert( fieldIdx, exp );
|
mExpressionFieldInfo.insert( fieldIdx, exp );
|
||||||
|
|
||||||
Q_FOREACH ( const QString& col, exp->referencedColumns() )
|
Q_FOREACH ( const QString& col, exp->referencedColumns() )
|
||||||
@ -745,7 +745,7 @@ void QgsVectorLayerFeatureIterator::addExpressionAttribute( QgsFeature& f, int a
|
|||||||
if ( exp )
|
if ( exp )
|
||||||
{
|
{
|
||||||
mExpressionContext->setFeature( f );
|
mExpressionContext->setFeature( f );
|
||||||
QVariant val = exp->evaluate( mExpressionContext.data() );
|
QVariant val = exp->evaluate( mExpressionContext.get() );
|
||||||
mSource->mFields.at( attrIndex ).convertCompatible( val );
|
mSource->mFields.at( attrIndex ).convertCompatible( val );
|
||||||
f.setAttribute( attrIndex, val );
|
f.setAttribute( attrIndex, val );
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "qgsfields.h"
|
#include "qgsfields.h"
|
||||||
|
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
typedef QMap<QgsFeatureId, QgsFeature> QgsFeatureMap;
|
typedef QMap<QgsFeatureId, QgsFeature> QgsFeatureMap;
|
||||||
|
|
||||||
@ -200,7 +201,7 @@ class CORE_EXPORT QgsVectorLayerFeatureIterator : public QgsAbstractFeatureItera
|
|||||||
bool mHasVirtualAttributes;
|
bool mHasVirtualAttributes;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<QgsExpressionContext> mExpressionContext;
|
std::unique_ptr<QgsExpressionContext> mExpressionContext;
|
||||||
|
|
||||||
QgsInterruptionChecker* mInterruptionChecker;
|
QgsInterruptionChecker* mInterruptionChecker;
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ QgsVectorLayerImport::QgsVectorLayerImport( const QString &uri,
|
|||||||
|
|
||||||
QgsProviderRegistry * pReg = QgsProviderRegistry::instance();
|
QgsProviderRegistry * pReg = QgsProviderRegistry::instance();
|
||||||
|
|
||||||
QScopedPointer< QLibrary > myLib( pReg->providerLibrary( providerKey ) );
|
std::unique_ptr< QLibrary > myLib( pReg->providerLibrary( providerKey ) );
|
||||||
if ( !myLib )
|
if ( !myLib )
|
||||||
{
|
{
|
||||||
mError = ErrInvalidProvider;
|
mError = ErrInvalidProvider;
|
||||||
|
@ -229,7 +229,7 @@ QList<QgsLabelFeature*> QgsVectorLayerLabelProvider::labelFeatures( QgsRenderCon
|
|||||||
QgsFeature fet;
|
QgsFeature fet;
|
||||||
while ( fit.nextFeature( fet ) )
|
while ( fit.nextFeature( fet ) )
|
||||||
{
|
{
|
||||||
QScopedPointer<QgsGeometry> obstacleGeometry;
|
std::unique_ptr<QgsGeometry> obstacleGeometry;
|
||||||
if ( mRenderer )
|
if ( mRenderer )
|
||||||
{
|
{
|
||||||
QgsSymbolList symbols = mRenderer->originalSymbolsForFeature( fet, ctx );
|
QgsSymbolList symbols = mRenderer->originalSymbolsForFeature( fet, ctx );
|
||||||
@ -244,7 +244,7 @@ QList<QgsLabelFeature*> QgsVectorLayerLabelProvider::labelFeatures( QgsRenderCon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx.expressionContext().setFeature( fet );
|
ctx.expressionContext().setFeature( fet );
|
||||||
registerFeature( fet, ctx, obstacleGeometry.data() );
|
registerFeature( fet, ctx, obstacleGeometry.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ctx.expressionContext().lastScope() == symbolScope )
|
if ( ctx.expressionContext().lastScope() == symbolScope )
|
||||||
|
@ -317,7 +317,7 @@ void QgsVectorLayerRenderer::drawRenderer( QgsFeatureIterator& fit )
|
|||||||
// new labeling engine
|
// new labeling engine
|
||||||
if ( mContext.labelingEngine() && ( mLabelProvider || mDiagramProvider ) )
|
if ( mContext.labelingEngine() && ( mLabelProvider || mDiagramProvider ) )
|
||||||
{
|
{
|
||||||
QScopedPointer<QgsGeometry> obstacleGeometry;
|
std::unique_ptr<QgsGeometry> obstacleGeometry;
|
||||||
QgsSymbolList symbols = mRenderer->originalSymbolsForFeature( fet, mContext );
|
QgsSymbolList symbols = mRenderer->originalSymbolsForFeature( fet, mContext );
|
||||||
|
|
||||||
if ( !symbols.isEmpty() && fet.geometry().type() == QgsWkbTypes::PointGeometry )
|
if ( !symbols.isEmpty() && fet.geometry().type() == QgsWkbTypes::PointGeometry )
|
||||||
@ -332,11 +332,11 @@ void QgsVectorLayerRenderer::drawRenderer( QgsFeatureIterator& fit )
|
|||||||
|
|
||||||
if ( mLabelProvider )
|
if ( mLabelProvider )
|
||||||
{
|
{
|
||||||
mLabelProvider->registerFeature( fet, mContext, obstacleGeometry.data() );
|
mLabelProvider->registerFeature( fet, mContext, obstacleGeometry.get() );
|
||||||
}
|
}
|
||||||
if ( mDiagramProvider )
|
if ( mDiagramProvider )
|
||||||
{
|
{
|
||||||
mDiagramProvider->registerFeature( fet, mContext, obstacleGeometry.data() );
|
mDiagramProvider->registerFeature( fet, mContext, obstacleGeometry.get() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@ void QgsVectorLayerRenderer::drawRendererLevels( QgsFeatureIterator& fit )
|
|||||||
// new labeling engine
|
// new labeling engine
|
||||||
if ( mContext.labelingEngine() )
|
if ( mContext.labelingEngine() )
|
||||||
{
|
{
|
||||||
QScopedPointer<QgsGeometry> obstacleGeometry;
|
std::unique_ptr<QgsGeometry> obstacleGeometry;
|
||||||
QgsSymbolList symbols = mRenderer->originalSymbolsForFeature( fet, mContext );
|
QgsSymbolList symbols = mRenderer->originalSymbolsForFeature( fet, mContext );
|
||||||
|
|
||||||
if ( !symbols.isEmpty() && fet.geometry().type() == QgsWkbTypes::PointGeometry )
|
if ( !symbols.isEmpty() && fet.geometry().type() == QgsWkbTypes::PointGeometry )
|
||||||
@ -422,11 +422,11 @@ void QgsVectorLayerRenderer::drawRendererLevels( QgsFeatureIterator& fit )
|
|||||||
|
|
||||||
if ( mLabelProvider )
|
if ( mLabelProvider )
|
||||||
{
|
{
|
||||||
mLabelProvider->registerFeature( fet, mContext, obstacleGeometry.data() );
|
mLabelProvider->registerFeature( fet, mContext, obstacleGeometry.get() );
|
||||||
}
|
}
|
||||||
if ( mDiagramProvider )
|
if ( mDiagramProvider )
|
||||||
{
|
{
|
||||||
mDiagramProvider->registerFeature( fet, mContext, obstacleGeometry.data() );
|
mDiagramProvider->registerFeature( fet, mContext, obstacleGeometry.get() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,12 +235,12 @@ QgsFeature QgsVectorLayerUtils::createFeature( QgsVectorLayer* layer, const QgsG
|
|||||||
}
|
}
|
||||||
|
|
||||||
QgsExpressionContext* evalContext = context;
|
QgsExpressionContext* evalContext = context;
|
||||||
QScopedPointer< QgsExpressionContext > tempContext;
|
std::unique_ptr< QgsExpressionContext > tempContext;
|
||||||
if ( !evalContext )
|
if ( !evalContext )
|
||||||
{
|
{
|
||||||
// no context passed, so we create a default one
|
// no context passed, so we create a default one
|
||||||
tempContext.reset( new QgsExpressionContext( QgsExpressionContextUtils::globalProjectLayerScopes( layer ) ) );
|
tempContext.reset( new QgsExpressionContext( QgsExpressionContextUtils::globalProjectLayerScopes( layer ) ) );
|
||||||
evalContext = tempContext.data();
|
evalContext = tempContext.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsFields fields = layer->fields();
|
QgsFields fields = layer->fields();
|
||||||
|
@ -115,7 +115,7 @@ void QgsColorRampShader::setColorRampType( const QString& theType )
|
|||||||
|
|
||||||
QgsColorRamp* QgsColorRampShader::sourceColorRamp() const
|
QgsColorRamp* QgsColorRampShader::sourceColorRamp() const
|
||||||
{
|
{
|
||||||
return mSourceColorRamp.data();
|
return mSourceColorRamp.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsColorRampShader::setSourceColorRamp( QgsColorRamp* colorramp )
|
void QgsColorRampShader::setSourceColorRamp( QgsColorRamp* colorramp )
|
||||||
|
@ -24,6 +24,7 @@ originally part of the larger QgsRasterLayer class
|
|||||||
#include "qgis_core.h"
|
#include "qgis_core.h"
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "qgscolorramp.h"
|
#include "qgscolorramp.h"
|
||||||
#include "qgsrasterinterface.h"
|
#include "qgsrasterinterface.h"
|
||||||
@ -169,7 +170,7 @@ class CORE_EXPORT QgsColorRampShader : public QgsRasterShaderFunction
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! Source color ramp
|
//! Source color ramp
|
||||||
QScopedPointer<QgsColorRamp> mSourceColorRamp;
|
std::unique_ptr<QgsColorRamp> mSourceColorRamp;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -926,7 +926,7 @@ void QgsRasterLayer::setContrastEnhancement( QgsContrastEnhancement::ContrastEnh
|
|||||||
if ( myBand != -1 )
|
if ( myBand != -1 )
|
||||||
{
|
{
|
||||||
Qgis::DataType myType = static_cast< Qgis::DataType >( mDataProvider->dataType( myBand ) );
|
Qgis::DataType myType = static_cast< Qgis::DataType >( mDataProvider->dataType( myBand ) );
|
||||||
QScopedPointer<QgsContrastEnhancement> myEnhancement( new QgsContrastEnhancement( static_cast< Qgis::DataType >( myType ) ) );
|
std::unique_ptr<QgsContrastEnhancement> myEnhancement( new QgsContrastEnhancement( static_cast< Qgis::DataType >( myType ) ) );
|
||||||
myEnhancement->setContrastEnhancementAlgorithm( theAlgorithm, theGenerateLookupTableFlag );
|
myEnhancement->setContrastEnhancementAlgorithm( theAlgorithm, theGenerateLookupTableFlag );
|
||||||
|
|
||||||
double min;
|
double min;
|
||||||
@ -950,7 +950,7 @@ void QgsRasterLayer::setContrastEnhancement( QgsContrastEnhancement::ContrastEnh
|
|||||||
{
|
{
|
||||||
myEnhancement->setMinimumValue( min );
|
myEnhancement->setMinimumValue( min );
|
||||||
myEnhancement->setMaximumValue( max );
|
myEnhancement->setMaximumValue( max );
|
||||||
myEnhancements.append( myEnhancement.take() );
|
myEnhancements.append( myEnhancement.release() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -116,7 +116,7 @@ QDomElement Qgs25DRenderer::save( QDomDocument& doc )
|
|||||||
|
|
||||||
rendererElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "25dRenderer" ) );
|
rendererElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "25dRenderer" ) );
|
||||||
|
|
||||||
QDomElement symbolElem = QgsSymbolLayerUtils::saveSymbol( QStringLiteral( "symbol" ), mSymbol.data(), doc );
|
QDomElement symbolElem = QgsSymbolLayerUtils::saveSymbol( QStringLiteral( "symbol" ), mSymbol.get(), doc );
|
||||||
|
|
||||||
rendererElem.appendChild( symbolElem );
|
rendererElem.appendChild( symbolElem );
|
||||||
|
|
||||||
@ -162,14 +162,14 @@ QgsSymbol*Qgs25DRenderer::symbolForFeature( QgsFeature& feature, QgsRenderContex
|
|||||||
{
|
{
|
||||||
Q_UNUSED( feature )
|
Q_UNUSED( feature )
|
||||||
Q_UNUSED( context )
|
Q_UNUSED( context )
|
||||||
return mSymbol.data();
|
return mSymbol.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsSymbolList Qgs25DRenderer::symbols( QgsRenderContext& context )
|
QgsSymbolList Qgs25DRenderer::symbols( QgsRenderContext& context )
|
||||||
{
|
{
|
||||||
Q_UNUSED( context );
|
Q_UNUSED( context );
|
||||||
QgsSymbolList lst;
|
QgsSymbolList lst;
|
||||||
lst.append( mSymbol.data() );
|
lst.append( mSymbol.get() );
|
||||||
return lst;
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ class CORE_EXPORT Qgs25DRenderer : public QgsFeatureRenderer
|
|||||||
QgsFillSymbolLayer* wallLayer() const;
|
QgsFillSymbolLayer* wallLayer() const;
|
||||||
QgsOuterGlowEffect* glowEffect() const;
|
QgsOuterGlowEffect* glowEffect() const;
|
||||||
|
|
||||||
QScopedPointer<QgsSymbol> mSymbol;
|
std::unique_ptr<QgsSymbol> mSymbol;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QGS25DRENDERER_H
|
#endif // QGS25DRENDERER_H
|
||||||
|
@ -696,7 +696,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolRend
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.renderContext().expressionContext().appendScope( mExpressionScope.data() );
|
context.renderContext().expressionContext().appendScope( mExpressionScope.get() );
|
||||||
mExpressionScope->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_POINT_COUNT, points.size() + 1, true ) );
|
mExpressionScope->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_POINT_COUNT, points.size() + 1, true ) );
|
||||||
mExpressionScope->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_POINT_NUM, 1, true ) );
|
mExpressionScope->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_POINT_NUM, 1, true ) );
|
||||||
if ( isCurved() )
|
if ( isCurved() )
|
||||||
@ -802,7 +802,7 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolRend
|
|||||||
|
|
||||||
void QgsArrowSymbolLayer::setColor( const QColor& c )
|
void QgsArrowSymbolLayer::setColor( const QColor& c )
|
||||||
{
|
{
|
||||||
if ( mSymbol.data() )
|
if ( mSymbol.get() )
|
||||||
mSymbol->setColor( c );
|
mSymbol->setColor( c );
|
||||||
|
|
||||||
mColor = c;
|
mColor = c;
|
||||||
@ -810,6 +810,6 @@ void QgsArrowSymbolLayer::setColor( const QColor& c )
|
|||||||
|
|
||||||
QColor QgsArrowSymbolLayer::color() const
|
QColor QgsArrowSymbolLayer::color() const
|
||||||
{
|
{
|
||||||
return mSymbol.data() ? mSymbol->color() : mColor;
|
return mSymbol.get() ? mSymbol->color() : mColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class CORE_EXPORT QgsArrowSymbolLayer : public QgsLineSymbolLayer
|
|||||||
static QgsSymbolLayer* create( const QgsStringMap& properties = QgsStringMap() );
|
static QgsSymbolLayer* create( const QgsStringMap& properties = QgsStringMap() );
|
||||||
|
|
||||||
virtual QgsArrowSymbolLayer* clone() const override;
|
virtual QgsArrowSymbolLayer* clone() const override;
|
||||||
virtual QgsSymbol* subSymbol() override { return mSymbol.data(); }
|
virtual QgsSymbol* subSymbol() override { return mSymbol.get(); }
|
||||||
virtual bool setSubSymbol( QgsSymbol* symbol ) override;
|
virtual bool setSubSymbol( QgsSymbol* symbol ) override;
|
||||||
virtual QSet<QString> usedAttributes( const QgsRenderContext& context ) const override;
|
virtual QSet<QString> usedAttributes( const QgsRenderContext& context ) const override;
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ class CORE_EXPORT QgsArrowSymbolLayer : public QgsLineSymbolLayer
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
//! Filling sub symbol
|
//! Filling sub symbol
|
||||||
QScopedPointer<QgsFillSymbol> mSymbol;
|
std::unique_ptr<QgsFillSymbol> mSymbol;
|
||||||
|
|
||||||
double mArrowWidth;
|
double mArrowWidth;
|
||||||
QgsUnitTypes::RenderUnit mArrowWidthUnit;
|
QgsUnitTypes::RenderUnit mArrowWidthUnit;
|
||||||
@ -174,7 +174,7 @@ class CORE_EXPORT QgsArrowSymbolLayer : public QgsLineSymbolLayer
|
|||||||
HeadType mComputedHeadType;
|
HeadType mComputedHeadType;
|
||||||
ArrowType mComputedArrowType;
|
ArrowType mComputedArrowType;
|
||||||
|
|
||||||
QScopedPointer<QgsExpressionContextScope> mExpressionScope;
|
std::unique_ptr<QgsExpressionContextScope> mExpressionScope;
|
||||||
|
|
||||||
void _resolveDataDefined( QgsSymbolRenderContext& );
|
void _resolveDataDefined( QgsSymbolRenderContext& );
|
||||||
};
|
};
|
||||||
|
@ -49,7 +49,7 @@ QgsRendererCategory::QgsRendererCategory( const QVariant& value, QgsSymbol* symb
|
|||||||
|
|
||||||
QgsRendererCategory::QgsRendererCategory( const QgsRendererCategory& cat )
|
QgsRendererCategory::QgsRendererCategory( const QgsRendererCategory& cat )
|
||||||
: mValue( cat.mValue )
|
: mValue( cat.mValue )
|
||||||
, mSymbol( cat.mSymbol.data() ? cat.mSymbol->clone() : nullptr )
|
, mSymbol( cat.mSymbol ? cat.mSymbol->clone() : nullptr )
|
||||||
, mLabel( cat.mLabel )
|
, mLabel( cat.mLabel )
|
||||||
, mRender( cat.mRender )
|
, mRender( cat.mRender )
|
||||||
{
|
{
|
||||||
@ -76,7 +76,7 @@ QVariant QgsRendererCategory::value() const
|
|||||||
|
|
||||||
QgsSymbol* QgsRendererCategory::symbol() const
|
QgsSymbol* QgsRendererCategory::symbol() const
|
||||||
{
|
{
|
||||||
return mSymbol.data();
|
return mSymbol.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QgsRendererCategory::label() const
|
QString QgsRendererCategory::label() const
|
||||||
@ -96,7 +96,7 @@ void QgsRendererCategory::setValue( const QVariant &value )
|
|||||||
|
|
||||||
void QgsRendererCategory::setSymbol( QgsSymbol* s )
|
void QgsRendererCategory::setSymbol( QgsSymbol* s )
|
||||||
{
|
{
|
||||||
if ( mSymbol.data() != s ) mSymbol.reset( s );
|
if ( mSymbol.get() != s ) mSymbol.reset( s );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsRendererCategory::setLabel( const QString &label )
|
void QgsRendererCategory::setLabel( const QString &label )
|
||||||
@ -116,7 +116,7 @@ QString QgsRendererCategory::dump() const
|
|||||||
|
|
||||||
void QgsRendererCategory::toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
|
void QgsRendererCategory::toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
|
||||||
{
|
{
|
||||||
if ( !mSymbol.data() || props.value( QStringLiteral( "attribute" ), QLatin1String( "" ) ).isEmpty() )
|
if ( !mSymbol.get() || props.value( QStringLiteral( "attribute" ), QLatin1String( "" ) ).isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString attrName = props[ QStringLiteral( "attribute" )];
|
QString attrName = props[ QStringLiteral( "attribute" )];
|
||||||
@ -219,7 +219,7 @@ QVariant QgsCategorizedSymbolRenderer::valueForFeature( QgsFeature& feature, Qgs
|
|||||||
QVariant value;
|
QVariant value;
|
||||||
if ( mAttrNum == -1 )
|
if ( mAttrNum == -1 )
|
||||||
{
|
{
|
||||||
Q_ASSERT( mExpression.data() );
|
Q_ASSERT( mExpression );
|
||||||
|
|
||||||
value = mExpression->evaluate( &context.expressionContext() );
|
value = mExpression->evaluate( &context.expressionContext() );
|
||||||
}
|
}
|
||||||
@ -462,9 +462,9 @@ QString QgsCategorizedSymbolRenderer::dump() const
|
|||||||
QgsCategorizedSymbolRenderer* QgsCategorizedSymbolRenderer::clone() const
|
QgsCategorizedSymbolRenderer* QgsCategorizedSymbolRenderer::clone() const
|
||||||
{
|
{
|
||||||
QgsCategorizedSymbolRenderer* r = new QgsCategorizedSymbolRenderer( mAttrName, mCategories );
|
QgsCategorizedSymbolRenderer* r = new QgsCategorizedSymbolRenderer( mAttrName, mCategories );
|
||||||
if ( mSourceSymbol.data() )
|
if ( mSourceSymbol )
|
||||||
r->setSourceSymbol( mSourceSymbol->clone() );
|
r->setSourceSymbol( mSourceSymbol->clone() );
|
||||||
if ( mSourceColorRamp.data() )
|
if ( mSourceColorRamp )
|
||||||
{
|
{
|
||||||
r->setSourceColorRamp( mSourceColorRamp->clone() );
|
r->setSourceColorRamp( mSourceColorRamp->clone() );
|
||||||
}
|
}
|
||||||
@ -634,9 +634,9 @@ QgsFeatureRenderer* QgsCategorizedSymbolRenderer::create( QDomElement& element )
|
|||||||
{
|
{
|
||||||
convertSymbolRotation( cat.symbol(), rotationElem.attribute( QStringLiteral( "field" ) ) );
|
convertSymbolRotation( cat.symbol(), rotationElem.attribute( QStringLiteral( "field" ) ) );
|
||||||
}
|
}
|
||||||
if ( r->mSourceSymbol.data() )
|
if ( r->mSourceSymbol )
|
||||||
{
|
{
|
||||||
convertSymbolRotation( r->mSourceSymbol.data(), rotationElem.attribute( QStringLiteral( "field" ) ) );
|
convertSymbolRotation( r->mSourceSymbol.get(), rotationElem.attribute( QStringLiteral( "field" ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -649,9 +649,9 @@ QgsFeatureRenderer* QgsCategorizedSymbolRenderer::create( QDomElement& element )
|
|||||||
QgsSymbolLayerUtils::decodeScaleMethod( sizeScaleElem.attribute( QStringLiteral( "scalemethod" ) ) ),
|
QgsSymbolLayerUtils::decodeScaleMethod( sizeScaleElem.attribute( QStringLiteral( "scalemethod" ) ) ),
|
||||||
sizeScaleElem.attribute( QStringLiteral( "field" ) ) );
|
sizeScaleElem.attribute( QStringLiteral( "field" ) ) );
|
||||||
}
|
}
|
||||||
if ( r->mSourceSymbol.data() && r->mSourceSymbol->type() == QgsSymbol::Marker )
|
if ( r->mSourceSymbol && r->mSourceSymbol->type() == QgsSymbol::Marker )
|
||||||
{
|
{
|
||||||
convertSymbolSizeScale( r->mSourceSymbol.data(),
|
convertSymbolSizeScale( r->mSourceSymbol.get(),
|
||||||
QgsSymbolLayerUtils::decodeScaleMethod( sizeScaleElem.attribute( QStringLiteral( "scalemethod" ) ) ),
|
QgsSymbolLayerUtils::decodeScaleMethod( sizeScaleElem.attribute( QStringLiteral( "scalemethod" ) ) ),
|
||||||
sizeScaleElem.attribute( QStringLiteral( "field" ) ) );
|
sizeScaleElem.attribute( QStringLiteral( "field" ) ) );
|
||||||
}
|
}
|
||||||
@ -699,18 +699,18 @@ QDomElement QgsCategorizedSymbolRenderer::save( QDomDocument& doc )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// save source symbol
|
// save source symbol
|
||||||
if ( mSourceSymbol.data() )
|
if ( mSourceSymbol )
|
||||||
{
|
{
|
||||||
QgsSymbolMap sourceSymbols;
|
QgsSymbolMap sourceSymbols;
|
||||||
sourceSymbols.insert( QStringLiteral( "0" ), mSourceSymbol.data() );
|
sourceSymbols.insert( QStringLiteral( "0" ), mSourceSymbol.get() );
|
||||||
QDomElement sourceSymbolElem = QgsSymbolLayerUtils::saveSymbols( sourceSymbols, QStringLiteral( "source-symbol" ), doc );
|
QDomElement sourceSymbolElem = QgsSymbolLayerUtils::saveSymbols( sourceSymbols, QStringLiteral( "source-symbol" ), doc );
|
||||||
rendererElem.appendChild( sourceSymbolElem );
|
rendererElem.appendChild( sourceSymbolElem );
|
||||||
}
|
}
|
||||||
|
|
||||||
// save source color ramp
|
// save source color ramp
|
||||||
if ( mSourceColorRamp.data() )
|
if ( mSourceColorRamp )
|
||||||
{
|
{
|
||||||
QDomElement colorRampElem = QgsSymbolLayerUtils::saveColorRamp( QStringLiteral( "[source]" ), mSourceColorRamp.data(), doc );
|
QDomElement colorRampElem = QgsSymbolLayerUtils::saveColorRamp( QStringLiteral( "[source]" ), mSourceColorRamp.get(), doc );
|
||||||
rendererElem.appendChild( colorRampElem );
|
rendererElem.appendChild( colorRampElem );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -766,7 +766,7 @@ QgsLegendSymbolList QgsCategorizedSymbolRenderer::legendSymbolItems( double scal
|
|||||||
QgsLegendSymbolListV2 QgsCategorizedSymbolRenderer::legendSymbolItemsV2() const
|
QgsLegendSymbolListV2 QgsCategorizedSymbolRenderer::legendSymbolItemsV2() const
|
||||||
{
|
{
|
||||||
QgsLegendSymbolListV2 lst;
|
QgsLegendSymbolListV2 lst;
|
||||||
if ( mSourceSymbol.data() && mSourceSymbol->type() == QgsSymbol::Marker )
|
if ( mSourceSymbol && mSourceSymbol->type() == QgsSymbol::Marker )
|
||||||
{
|
{
|
||||||
// check that all symbols that have the same size expression
|
// check that all symbols that have the same size expression
|
||||||
QgsProperty ddSize;
|
QgsProperty ddSize;
|
||||||
@ -800,7 +800,7 @@ QgsLegendSymbolListV2 QgsCategorizedSymbolRenderer::legendSymbolItemsV2() const
|
|||||||
lst << title;
|
lst << title;
|
||||||
Q_FOREACH ( double v, QgsSymbolLayerUtils::prettyBreaks( exp.minValue(), exp.maxValue(), 4 ) )
|
Q_FOREACH ( double v, QgsSymbolLayerUtils::prettyBreaks( exp.minValue(), exp.maxValue(), 4 ) )
|
||||||
{
|
{
|
||||||
QgsLegendSymbolItem si( mSourceSymbol.data(), QString::number( v ), QLatin1String( "" ) );
|
QgsLegendSymbolItem si( mSourceSymbol.get(), QString::number( v ), QLatin1String( "" ) );
|
||||||
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( si.symbol() );
|
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( si.symbol() );
|
||||||
s->setDataDefinedSize( QgsProperty() );
|
s->setDataDefinedSize( QgsProperty() );
|
||||||
s->setSize( exp.size( v ) );
|
s->setSize( exp.size( v ) );
|
||||||
@ -839,7 +839,7 @@ QSet<QString> QgsCategorizedSymbolRenderer::legendKeysForFeature( QgsFeature& fe
|
|||||||
|
|
||||||
QgsSymbol* QgsCategorizedSymbolRenderer::sourceSymbol()
|
QgsSymbol* QgsCategorizedSymbolRenderer::sourceSymbol()
|
||||||
{
|
{
|
||||||
return mSourceSymbol.data();
|
return mSourceSymbol.get();
|
||||||
}
|
}
|
||||||
void QgsCategorizedSymbolRenderer::setSourceSymbol( QgsSymbol* sym )
|
void QgsCategorizedSymbolRenderer::setSourceSymbol( QgsSymbol* sym )
|
||||||
{
|
{
|
||||||
@ -848,7 +848,7 @@ void QgsCategorizedSymbolRenderer::setSourceSymbol( QgsSymbol* sym )
|
|||||||
|
|
||||||
QgsColorRamp* QgsCategorizedSymbolRenderer::sourceColorRamp()
|
QgsColorRamp* QgsCategorizedSymbolRenderer::sourceColorRamp()
|
||||||
{
|
{
|
||||||
return mSourceColorRamp.data();
|
return mSourceColorRamp.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsCategorizedSymbolRenderer::setSourceColorRamp( QgsColorRamp* ramp )
|
void QgsCategorizedSymbolRenderer::setSourceColorRamp( QgsColorRamp* ramp )
|
||||||
|
@ -61,7 +61,7 @@ class CORE_EXPORT QgsRendererCategory
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
QVariant mValue;
|
QVariant mValue;
|
||||||
QScopedPointer<QgsSymbol> mSymbol;
|
std::unique_ptr<QgsSymbol> mSymbol;
|
||||||
QString mLabel;
|
QString mLabel;
|
||||||
bool mRender;
|
bool mRender;
|
||||||
|
|
||||||
@ -184,9 +184,9 @@ class CORE_EXPORT QgsCategorizedSymbolRenderer : public QgsFeatureRenderer
|
|||||||
protected:
|
protected:
|
||||||
QString mAttrName;
|
QString mAttrName;
|
||||||
QgsCategoryList mCategories;
|
QgsCategoryList mCategories;
|
||||||
QScopedPointer<QgsSymbol> mSourceSymbol;
|
std::unique_ptr<QgsSymbol> mSourceSymbol;
|
||||||
QScopedPointer<QgsColorRamp> mSourceColorRamp;
|
std::unique_ptr<QgsColorRamp> mSourceColorRamp;
|
||||||
QScopedPointer<QgsExpression> mExpression;
|
std::unique_ptr<QgsExpression> mExpression;
|
||||||
|
|
||||||
//! attribute index (derived from attribute name in startRender)
|
//! attribute index (derived from attribute name in startRender)
|
||||||
int mAttrNum;
|
int mAttrNum;
|
||||||
|
@ -95,7 +95,7 @@ class CORE_EXPORT QgsGeometryGeneratorSymbolLayer : public QgsSymbolLayer
|
|||||||
private:
|
private:
|
||||||
QgsGeometryGeneratorSymbolLayer( const QString& expression );
|
QgsGeometryGeneratorSymbolLayer( const QString& expression );
|
||||||
|
|
||||||
QScopedPointer<QgsExpression> mExpression;
|
std::unique_ptr<QgsExpression> mExpression;
|
||||||
QgsFillSymbol* mFillSymbol;
|
QgsFillSymbol* mFillSymbol;
|
||||||
QgsLineSymbol* mLineSymbol;
|
QgsLineSymbol* mLineSymbol;
|
||||||
QgsMarkerSymbol* mMarkerSymbol;
|
QgsMarkerSymbol* mMarkerSymbol;
|
||||||
|
@ -58,7 +58,7 @@ QgsRendererRange::QgsRendererRange( double lowerValue, double upperValue, QgsSym
|
|||||||
QgsRendererRange::QgsRendererRange( const QgsRendererRange& range )
|
QgsRendererRange::QgsRendererRange( const QgsRendererRange& range )
|
||||||
: mLowerValue( range.mLowerValue )
|
: mLowerValue( range.mLowerValue )
|
||||||
, mUpperValue( range.mUpperValue )
|
, mUpperValue( range.mUpperValue )
|
||||||
, mSymbol( range.mSymbol.data() ? range.mSymbol->clone() : nullptr )
|
, mSymbol( range.mSymbol ? range.mSymbol->clone() : nullptr )
|
||||||
, mLabel( range.mLabel )
|
, mLabel( range.mLabel )
|
||||||
, mRender( range.mRender )
|
, mRender( range.mRender )
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ double QgsRendererRange::upperValue() const
|
|||||||
|
|
||||||
QgsSymbol* QgsRendererRange::symbol() const
|
QgsSymbol* QgsRendererRange::symbol() const
|
||||||
{
|
{
|
||||||
return mSymbol.data();
|
return mSymbol.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QgsRendererRange::label() const
|
QString QgsRendererRange::label() const
|
||||||
@ -109,7 +109,7 @@ QString QgsRendererRange::label() const
|
|||||||
|
|
||||||
void QgsRendererRange::setSymbol( QgsSymbol* s )
|
void QgsRendererRange::setSymbol( QgsSymbol* s )
|
||||||
{
|
{
|
||||||
if ( mSymbol.data() != s ) mSymbol.reset( s );
|
if ( mSymbol.get() != s ) mSymbol.reset( s );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsRendererRange::setLabel( const QString& label )
|
void QgsRendererRange::setLabel( const QString& label )
|
||||||
@ -139,12 +139,12 @@ void QgsRendererRange::setRenderState( bool render )
|
|||||||
|
|
||||||
QString QgsRendererRange::dump() const
|
QString QgsRendererRange::dump() const
|
||||||
{
|
{
|
||||||
return QStringLiteral( "%1 - %2::%3::%4\n" ).arg( mLowerValue ).arg( mUpperValue ).arg( mLabel, mSymbol.data() ? mSymbol->dump() : QStringLiteral( "(no symbol)" ) );
|
return QStringLiteral( "%1 - %2::%3::%4\n" ).arg( mLowerValue ).arg( mUpperValue ).arg( mLabel, mSymbol ? mSymbol->dump() : QStringLiteral( "(no symbol)" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsRendererRange::toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props, bool firstRange ) const
|
void QgsRendererRange::toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props, bool firstRange ) const
|
||||||
{
|
{
|
||||||
if ( !mSymbol.data() || props.value( QStringLiteral( "attribute" ), QLatin1String( "" ) ).isEmpty() )
|
if ( mSymbol || props.value( QStringLiteral( "attribute" ), QLatin1String( "" ) ).isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString attrName = props[ QStringLiteral( "attribute" )];
|
QString attrName = props[ QStringLiteral( "attribute" )];
|
||||||
@ -495,9 +495,9 @@ QgsGraduatedSymbolRenderer* QgsGraduatedSymbolRenderer::clone() const
|
|||||||
{
|
{
|
||||||
QgsGraduatedSymbolRenderer* r = new QgsGraduatedSymbolRenderer( mAttrName, mRanges );
|
QgsGraduatedSymbolRenderer* r = new QgsGraduatedSymbolRenderer( mAttrName, mRanges );
|
||||||
r->setMode( mMode );
|
r->setMode( mMode );
|
||||||
if ( mSourceSymbol.data() )
|
if ( mSourceSymbol )
|
||||||
r->setSourceSymbol( mSourceSymbol->clone() );
|
r->setSourceSymbol( mSourceSymbol->clone() );
|
||||||
if ( mSourceColorRamp.data() )
|
if ( mSourceColorRamp )
|
||||||
{
|
{
|
||||||
r->setSourceColorRamp( mSourceColorRamp->clone() );
|
r->setSourceColorRamp( mSourceColorRamp->clone() );
|
||||||
}
|
}
|
||||||
@ -1007,9 +1007,9 @@ QgsFeatureRenderer* QgsGraduatedSymbolRenderer::create( QDomElement& element )
|
|||||||
{
|
{
|
||||||
convertSymbolRotation( range.symbol(), rotationElem.attribute( QStringLiteral( "field" ) ) );
|
convertSymbolRotation( range.symbol(), rotationElem.attribute( QStringLiteral( "field" ) ) );
|
||||||
}
|
}
|
||||||
if ( r->mSourceSymbol.data() )
|
if ( r->mSourceSymbol )
|
||||||
{
|
{
|
||||||
convertSymbolRotation( r->mSourceSymbol.data(), rotationElem.attribute( QStringLiteral( "field" ) ) );
|
convertSymbolRotation( r->mSourceSymbol.get(), rotationElem.attribute( QStringLiteral( "field" ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1022,9 +1022,9 @@ QgsFeatureRenderer* QgsGraduatedSymbolRenderer::create( QDomElement& element )
|
|||||||
QgsSymbolLayerUtils::decodeScaleMethod( sizeScaleElem.attribute( QStringLiteral( "scalemethod" ) ) ),
|
QgsSymbolLayerUtils::decodeScaleMethod( sizeScaleElem.attribute( QStringLiteral( "scalemethod" ) ) ),
|
||||||
sizeScaleElem.attribute( QStringLiteral( "field" ) ) );
|
sizeScaleElem.attribute( QStringLiteral( "field" ) ) );
|
||||||
}
|
}
|
||||||
if ( r->mSourceSymbol.data() && r->mSourceSymbol->type() == QgsSymbol::Marker )
|
if ( r->mSourceSymbol && r->mSourceSymbol->type() == QgsSymbol::Marker )
|
||||||
{
|
{
|
||||||
convertSymbolSizeScale( r->mSourceSymbol.data(),
|
convertSymbolSizeScale( r->mSourceSymbol.get(),
|
||||||
QgsSymbolLayerUtils::decodeScaleMethod( sizeScaleElem.attribute( QStringLiteral( "scalemethod" ) ) ),
|
QgsSymbolLayerUtils::decodeScaleMethod( sizeScaleElem.attribute( QStringLiteral( "scalemethod" ) ) ),
|
||||||
sizeScaleElem.attribute( QStringLiteral( "field" ) ) );
|
sizeScaleElem.attribute( QStringLiteral( "field" ) ) );
|
||||||
}
|
}
|
||||||
@ -1078,18 +1078,18 @@ QDomElement QgsGraduatedSymbolRenderer::save( QDomDocument& doc )
|
|||||||
rendererElem.appendChild( symbolsElem );
|
rendererElem.appendChild( symbolsElem );
|
||||||
|
|
||||||
// save source symbol
|
// save source symbol
|
||||||
if ( mSourceSymbol.data() )
|
if ( mSourceSymbol )
|
||||||
{
|
{
|
||||||
QgsSymbolMap sourceSymbols;
|
QgsSymbolMap sourceSymbols;
|
||||||
sourceSymbols.insert( QStringLiteral( "0" ), mSourceSymbol.data() );
|
sourceSymbols.insert( QStringLiteral( "0" ), mSourceSymbol.get() );
|
||||||
QDomElement sourceSymbolElem = QgsSymbolLayerUtils::saveSymbols( sourceSymbols, QStringLiteral( "source-symbol" ), doc );
|
QDomElement sourceSymbolElem = QgsSymbolLayerUtils::saveSymbols( sourceSymbols, QStringLiteral( "source-symbol" ), doc );
|
||||||
rendererElem.appendChild( sourceSymbolElem );
|
rendererElem.appendChild( sourceSymbolElem );
|
||||||
}
|
}
|
||||||
|
|
||||||
// save source color ramp
|
// save source color ramp
|
||||||
if ( mSourceColorRamp.data() )
|
if ( mSourceColorRamp )
|
||||||
{
|
{
|
||||||
QDomElement colorRampElem = QgsSymbolLayerUtils::saveColorRamp( QStringLiteral( "[source]" ), mSourceColorRamp.data(), doc );
|
QDomElement colorRampElem = QgsSymbolLayerUtils::saveColorRamp( QStringLiteral( "[source]" ), mSourceColorRamp.get(), doc );
|
||||||
rendererElem.appendChild( colorRampElem );
|
rendererElem.appendChild( colorRampElem );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1153,7 +1153,7 @@ QgsLegendSymbologyList QgsGraduatedSymbolRenderer::legendSymbologyItems( QSize i
|
|||||||
QgsLegendSymbolListV2 QgsGraduatedSymbolRenderer::legendSymbolItemsV2() const
|
QgsLegendSymbolListV2 QgsGraduatedSymbolRenderer::legendSymbolItemsV2() const
|
||||||
{
|
{
|
||||||
QgsLegendSymbolListV2 list;
|
QgsLegendSymbolListV2 list;
|
||||||
if ( mSourceSymbol.data() && mSourceSymbol->type() == QgsSymbol::Marker )
|
if ( mSourceSymbol && mSourceSymbol->type() == QgsSymbol::Marker )
|
||||||
{
|
{
|
||||||
// check that all symbols that have the same size expression
|
// check that all symbols that have the same size expression
|
||||||
QgsProperty ddSize;
|
QgsProperty ddSize;
|
||||||
@ -1187,7 +1187,7 @@ QgsLegendSymbolListV2 QgsGraduatedSymbolRenderer::legendSymbolItemsV2() const
|
|||||||
list << title;
|
list << title;
|
||||||
Q_FOREACH ( double v, QgsSymbolLayerUtils::prettyBreaks( exp.minValue(), exp.maxValue(), 4 ) )
|
Q_FOREACH ( double v, QgsSymbolLayerUtils::prettyBreaks( exp.minValue(), exp.maxValue(), 4 ) )
|
||||||
{
|
{
|
||||||
QgsLegendSymbolItem si( mSourceSymbol.data(), QString::number( v ), QLatin1String( "" ) );
|
QgsLegendSymbolItem si( mSourceSymbol.get(), QString::number( v ), QLatin1String( "" ) );
|
||||||
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( si.symbol() );
|
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( si.symbol() );
|
||||||
s->setDataDefinedSize( QgsProperty() );
|
s->setDataDefinedSize( QgsProperty() );
|
||||||
s->setSize( exp.size( v ) );
|
s->setSize( exp.size( v ) );
|
||||||
@ -1237,7 +1237,7 @@ QgsLegendSymbolList QgsGraduatedSymbolRenderer::legendSymbolItems( double scaleD
|
|||||||
|
|
||||||
QgsSymbol* QgsGraduatedSymbolRenderer::sourceSymbol()
|
QgsSymbol* QgsGraduatedSymbolRenderer::sourceSymbol()
|
||||||
{
|
{
|
||||||
return mSourceSymbol.data();
|
return mSourceSymbol.get();
|
||||||
}
|
}
|
||||||
void QgsGraduatedSymbolRenderer::setSourceSymbol( QgsSymbol* sym )
|
void QgsGraduatedSymbolRenderer::setSourceSymbol( QgsSymbol* sym )
|
||||||
{
|
{
|
||||||
@ -1246,7 +1246,7 @@ void QgsGraduatedSymbolRenderer::setSourceSymbol( QgsSymbol* sym )
|
|||||||
|
|
||||||
QgsColorRamp* QgsGraduatedSymbolRenderer::sourceColorRamp()
|
QgsColorRamp* QgsGraduatedSymbolRenderer::sourceColorRamp()
|
||||||
{
|
{
|
||||||
return mSourceColorRamp.data();
|
return mSourceColorRamp.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsGraduatedSymbolRenderer::setSourceColorRamp( QgsColorRamp* ramp )
|
void QgsGraduatedSymbolRenderer::setSourceColorRamp( QgsColorRamp* ramp )
|
||||||
@ -1288,15 +1288,15 @@ void QgsGraduatedSymbolRenderer::setSymbolSizes( double minSize, double maxSize
|
|||||||
{
|
{
|
||||||
for ( int i = 0; i < mRanges.count(); i++ )
|
for ( int i = 0; i < mRanges.count(); i++ )
|
||||||
{
|
{
|
||||||
QScopedPointer<QgsSymbol> symbol( mRanges.at( i ).symbol() ? mRanges.at( i ).symbol()->clone() : nullptr );
|
std::unique_ptr<QgsSymbol> symbol( mRanges.at( i ).symbol() ? mRanges.at( i ).symbol()->clone() : nullptr );
|
||||||
const double size = mRanges.count() > 1
|
const double size = mRanges.count() > 1
|
||||||
? minSize + i * ( maxSize - minSize ) / ( mRanges.count() - 1 )
|
? minSize + i * ( maxSize - minSize ) / ( mRanges.count() - 1 )
|
||||||
: .5 * ( maxSize + minSize );
|
: .5 * ( maxSize + minSize );
|
||||||
if ( symbol->type() == QgsSymbol::Marker )
|
if ( symbol->type() == QgsSymbol::Marker )
|
||||||
static_cast< QgsMarkerSymbol * >( symbol.data() )->setSize( size );
|
static_cast< QgsMarkerSymbol * >( symbol.get() )->setSize( size );
|
||||||
if ( symbol->type() == QgsSymbol::Line )
|
if ( symbol->type() == QgsSymbol::Line )
|
||||||
static_cast< QgsLineSymbol * >( symbol.data() )->setWidth( size );
|
static_cast< QgsLineSymbol * >( symbol.get() )->setWidth( size );
|
||||||
updateRangeSymbol( i, symbol.take() );
|
updateRangeSymbol( i, symbol.release() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1334,7 +1334,7 @@ void QgsGraduatedSymbolRenderer::updateSymbols( QgsSymbol *sym )
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
Q_FOREACH ( const QgsRendererRange& range, mRanges )
|
Q_FOREACH ( const QgsRendererRange& range, mRanges )
|
||||||
{
|
{
|
||||||
QScopedPointer<QgsSymbol> symbol( sym->clone() );
|
std::unique_ptr<QgsSymbol> symbol( sym->clone() );
|
||||||
if ( mGraduatedMethod == GraduatedColor )
|
if ( mGraduatedMethod == GraduatedColor )
|
||||||
{
|
{
|
||||||
symbol->setColor( range.symbol()->color() );
|
symbol->setColor( range.symbol()->color() );
|
||||||
@ -1342,13 +1342,13 @@ void QgsGraduatedSymbolRenderer::updateSymbols( QgsSymbol *sym )
|
|||||||
else if ( mGraduatedMethod == GraduatedSize )
|
else if ( mGraduatedMethod == GraduatedSize )
|
||||||
{
|
{
|
||||||
if ( symbol->type() == QgsSymbol::Marker )
|
if ( symbol->type() == QgsSymbol::Marker )
|
||||||
static_cast<QgsMarkerSymbol *>( symbol.data() )->setSize(
|
static_cast<QgsMarkerSymbol *>( symbol.get() )->setSize(
|
||||||
static_cast<QgsMarkerSymbol *>( range.symbol() )->size() );
|
static_cast<QgsMarkerSymbol *>( range.symbol() )->size() );
|
||||||
else if ( symbol->type() == QgsSymbol::Line )
|
else if ( symbol->type() == QgsSymbol::Line )
|
||||||
static_cast<QgsLineSymbol *>( symbol.data() )->setWidth(
|
static_cast<QgsLineSymbol *>( symbol.get() )->setWidth(
|
||||||
static_cast<QgsLineSymbol *>( range.symbol() )->width() );
|
static_cast<QgsLineSymbol *>( range.symbol() )->width() );
|
||||||
}
|
}
|
||||||
updateRangeSymbol( i, symbol.take() );
|
updateRangeSymbol( i, symbol.release() );
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
setSourceSymbol( sym->clone() );
|
setSourceSymbol( sym->clone() );
|
||||||
@ -1431,7 +1431,7 @@ void QgsGraduatedSymbolRenderer::addBreak( double breakValue, bool updateSymbols
|
|||||||
switch ( mGraduatedMethod )
|
switch ( mGraduatedMethod )
|
||||||
{
|
{
|
||||||
case GraduatedColor:
|
case GraduatedColor:
|
||||||
updateColorRamp( mSourceColorRamp.data() );
|
updateColorRamp( mSourceColorRamp.get() );
|
||||||
break;
|
break;
|
||||||
case GraduatedSize:
|
case GraduatedSize:
|
||||||
setSymbolSizes( minSymbolSize(), maxSymbolSize() );
|
setSymbolSizes( minSymbolSize(), maxSymbolSize() );
|
||||||
|
@ -66,7 +66,7 @@ class CORE_EXPORT QgsRendererRange
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
double mLowerValue, mUpperValue;
|
double mLowerValue, mUpperValue;
|
||||||
QScopedPointer<QgsSymbol> mSymbol;
|
std::unique_ptr<QgsSymbol> mSymbol;
|
||||||
QString mLabel;
|
QString mLabel;
|
||||||
bool mRender;
|
bool mRender;
|
||||||
|
|
||||||
@ -333,11 +333,11 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
|
|||||||
QString mAttrName;
|
QString mAttrName;
|
||||||
QgsRangeList mRanges;
|
QgsRangeList mRanges;
|
||||||
Mode mMode;
|
Mode mMode;
|
||||||
QScopedPointer<QgsSymbol> mSourceSymbol;
|
std::unique_ptr<QgsSymbol> mSourceSymbol;
|
||||||
QScopedPointer<QgsColorRamp> mSourceColorRamp;
|
std::unique_ptr<QgsColorRamp> mSourceColorRamp;
|
||||||
QgsRendererRangeLabelFormat mLabelFormat;
|
QgsRendererRangeLabelFormat mLabelFormat;
|
||||||
|
|
||||||
QScopedPointer<QgsExpression> mExpression;
|
std::unique_ptr<QgsExpression> mExpression;
|
||||||
GraduatedMethod mGraduatedMethod;
|
GraduatedMethod mGraduatedMethod;
|
||||||
//! attribute index (derived from attribute name in startRender)
|
//! attribute index (derived from attribute name in startRender)
|
||||||
int mAttrNum;
|
int mAttrNum;
|
||||||
|
@ -121,7 +121,7 @@ bool QgsHeatmapRenderer::renderFeature( QgsFeature& feature, QgsRenderContext& c
|
|||||||
QVariant value;
|
QVariant value;
|
||||||
if ( mWeightAttrNum == -1 )
|
if ( mWeightAttrNum == -1 )
|
||||||
{
|
{
|
||||||
Q_ASSERT( mWeightExpression.data() );
|
Q_ASSERT( mWeightExpression.get() );
|
||||||
value = mWeightExpression->evaluate( &context.expressionContext() );
|
value = mWeightExpression->evaluate( &context.expressionContext() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -177,7 +177,7 @@ class CORE_EXPORT QgsHeatmapRenderer : public QgsFeatureRenderer
|
|||||||
|
|
||||||
QString mWeightExpressionString;
|
QString mWeightExpressionString;
|
||||||
int mWeightAttrNum;
|
int mWeightAttrNum;
|
||||||
QScopedPointer<QgsExpression> mWeightExpression;
|
std::unique_ptr<QgsExpression> mWeightExpression;
|
||||||
|
|
||||||
QgsColorRamp* mGradientRamp;
|
QgsColorRamp* mGradientRamp;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ void QgsInvertedPolygonRenderer::setEmbeddedRenderer( QgsFeatureRenderer* subRen
|
|||||||
|
|
||||||
const QgsFeatureRenderer* QgsInvertedPolygonRenderer::embeddedRenderer() const
|
const QgsFeatureRenderer* QgsInvertedPolygonRenderer::embeddedRenderer() const
|
||||||
{
|
{
|
||||||
return mSubRenderer.data();
|
return mSubRenderer.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsInvertedPolygonRenderer::setLegendSymbolItem( const QString& key, QgsSymbol* symbol )
|
void QgsInvertedPolygonRenderer::setLegendSymbolItem( const QString& key, QgsSymbol* symbol )
|
||||||
@ -360,13 +360,13 @@ QString QgsInvertedPolygonRenderer::dump() const
|
|||||||
QgsInvertedPolygonRenderer* QgsInvertedPolygonRenderer::clone() const
|
QgsInvertedPolygonRenderer* QgsInvertedPolygonRenderer::clone() const
|
||||||
{
|
{
|
||||||
QgsInvertedPolygonRenderer* newRenderer;
|
QgsInvertedPolygonRenderer* newRenderer;
|
||||||
if ( mSubRenderer.isNull() )
|
if ( !mSubRenderer )
|
||||||
{
|
{
|
||||||
newRenderer = new QgsInvertedPolygonRenderer( nullptr );
|
newRenderer = new QgsInvertedPolygonRenderer( nullptr );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newRenderer = new QgsInvertedPolygonRenderer( mSubRenderer.data()->clone() );
|
newRenderer = new QgsInvertedPolygonRenderer( mSubRenderer.get()->clone() );
|
||||||
}
|
}
|
||||||
newRenderer->setPreprocessingEnabled( preprocessingEnabled() );
|
newRenderer->setPreprocessingEnabled( preprocessingEnabled() );
|
||||||
copyRendererData( newRenderer );
|
copyRendererData( newRenderer );
|
||||||
|
@ -144,7 +144,7 @@ class CORE_EXPORT QgsInvertedPolygonRenderer : public QgsFeatureRenderer
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
//! Embedded renderer
|
//! Embedded renderer
|
||||||
QScopedPointer<QgsFeatureRenderer> mSubRenderer;
|
std::unique_ptr<QgsFeatureRenderer> mSubRenderer;
|
||||||
|
|
||||||
//! Structure where the reversed geometry is built during renderFeature
|
//! Structure where the reversed geometry is built during renderFeature
|
||||||
struct CombinedFeature
|
struct CombinedFeature
|
||||||
|
@ -1554,7 +1554,7 @@ QString QgsFilledMarkerSymbolLayer::layerType() const
|
|||||||
|
|
||||||
void QgsFilledMarkerSymbolLayer::startRender( QgsSymbolRenderContext &context )
|
void QgsFilledMarkerSymbolLayer::startRender( QgsSymbolRenderContext &context )
|
||||||
{
|
{
|
||||||
if ( mFill.data() )
|
if ( mFill.get() )
|
||||||
{
|
{
|
||||||
mFill->startRender( context.renderContext(), context.fields() );
|
mFill->startRender( context.renderContext(), context.fields() );
|
||||||
}
|
}
|
||||||
@ -1564,7 +1564,7 @@ void QgsFilledMarkerSymbolLayer::startRender( QgsSymbolRenderContext &context )
|
|||||||
|
|
||||||
void QgsFilledMarkerSymbolLayer::stopRender( QgsSymbolRenderContext& context )
|
void QgsFilledMarkerSymbolLayer::stopRender( QgsSymbolRenderContext& context )
|
||||||
{
|
{
|
||||||
if ( mFill.data() )
|
if ( mFill.get() )
|
||||||
{
|
{
|
||||||
mFill->stopRender( context.renderContext() );
|
mFill->stopRender( context.renderContext() );
|
||||||
}
|
}
|
||||||
@ -1585,7 +1585,7 @@ QgsStringMap QgsFilledMarkerSymbolLayer::properties() const
|
|||||||
map[QStringLiteral( "horizontal_anchor_point" )] = QString::number( mHorizontalAnchorPoint );
|
map[QStringLiteral( "horizontal_anchor_point" )] = QString::number( mHorizontalAnchorPoint );
|
||||||
map[QStringLiteral( "vertical_anchor_point" )] = QString::number( mVerticalAnchorPoint );
|
map[QStringLiteral( "vertical_anchor_point" )] = QString::number( mVerticalAnchorPoint );
|
||||||
|
|
||||||
if ( mFill.data() )
|
if ( mFill )
|
||||||
{
|
{
|
||||||
map[QStringLiteral( "color" )] = QgsSymbolLayerUtils::encodeColor( mFill->color() );
|
map[QStringLiteral( "color" )] = QgsSymbolLayerUtils::encodeColor( mFill->color() );
|
||||||
}
|
}
|
||||||
@ -1603,7 +1603,7 @@ QgsFilledMarkerSymbolLayer *QgsFilledMarkerSymbolLayer::clone() const
|
|||||||
|
|
||||||
QgsSymbol* QgsFilledMarkerSymbolLayer::subSymbol()
|
QgsSymbol* QgsFilledMarkerSymbolLayer::subSymbol()
|
||||||
{
|
{
|
||||||
return mFill.data();
|
return mFill.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsFilledMarkerSymbolLayer::setSubSymbol( QgsSymbol *symbol )
|
bool QgsFilledMarkerSymbolLayer::setSubSymbol( QgsSymbol *symbol )
|
||||||
@ -1622,9 +1622,9 @@ bool QgsFilledMarkerSymbolLayer::setSubSymbol( QgsSymbol *symbol )
|
|||||||
|
|
||||||
double QgsFilledMarkerSymbolLayer::estimateMaxBleed( const QgsRenderContext& context ) const
|
double QgsFilledMarkerSymbolLayer::estimateMaxBleed( const QgsRenderContext& context ) const
|
||||||
{
|
{
|
||||||
if ( mFill.data() )
|
if ( mFill )
|
||||||
{
|
{
|
||||||
return QgsSymbolLayerUtils::estimateMaxSymbolBleed( mFill.data(), context );
|
return QgsSymbolLayerUtils::estimateMaxSymbolBleed( mFill.get(), context );
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1632,7 +1632,7 @@ double QgsFilledMarkerSymbolLayer::estimateMaxBleed( const QgsRenderContext& con
|
|||||||
QSet<QString> QgsFilledMarkerSymbolLayer::usedAttributes( const QgsRenderContext& context ) const
|
QSet<QString> QgsFilledMarkerSymbolLayer::usedAttributes( const QgsRenderContext& context ) const
|
||||||
{
|
{
|
||||||
QSet<QString> attr = QgsSimpleMarkerSymbolLayerBase::usedAttributes( context );
|
QSet<QString> attr = QgsSimpleMarkerSymbolLayerBase::usedAttributes( context );
|
||||||
if ( mFill.data() )
|
if ( mFill )
|
||||||
attr.unite( mFill->usedAttributes( context ) );
|
attr.unite( mFill->usedAttributes( context ) );
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
@ -1640,13 +1640,13 @@ QSet<QString> QgsFilledMarkerSymbolLayer::usedAttributes( const QgsRenderContext
|
|||||||
void QgsFilledMarkerSymbolLayer::setColor( const QColor& c )
|
void QgsFilledMarkerSymbolLayer::setColor( const QColor& c )
|
||||||
{
|
{
|
||||||
mColor = c;
|
mColor = c;
|
||||||
if ( mFill.data() )
|
if ( mFill )
|
||||||
mFill->setColor( c );
|
mFill->setColor( c );
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QgsFilledMarkerSymbolLayer::color() const
|
QColor QgsFilledMarkerSymbolLayer::color() const
|
||||||
{
|
{
|
||||||
return mFill.data() ? mFill->color() : mColor;
|
return mFill ? mFill->color() : mColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsFilledMarkerSymbolLayer::draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path )
|
void QgsFilledMarkerSymbolLayer::draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path )
|
||||||
|
@ -430,7 +430,7 @@ class CORE_EXPORT QgsFilledMarkerSymbolLayer : public QgsSimpleMarkerSymbolLayer
|
|||||||
virtual void draw( QgsSymbolRenderContext& context, Shape shape, const QPolygonF& polygon, const QPainterPath& path ) override;
|
virtual void draw( QgsSymbolRenderContext& context, Shape shape, const QPolygonF& polygon, const QPainterPath& path ) override;
|
||||||
|
|
||||||
//! Fill subsymbol
|
//! Fill subsymbol
|
||||||
QScopedPointer< QgsFillSymbol > mFill;
|
std::unique_ptr< QgsFillSymbol > mFill;
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
|
@ -48,7 +48,7 @@ bool QgsNullSymbolRenderer::renderFeature( QgsFeature &feature, QgsRenderContext
|
|||||||
feature.geometry().type() == QgsWkbTypes::UnknownGeometry )
|
feature.geometry().type() == QgsWkbTypes::UnknownGeometry )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ( mSymbol.isNull() )
|
if ( !mSymbol )
|
||||||
{
|
{
|
||||||
//create default symbol
|
//create default symbol
|
||||||
mSymbol.reset( QgsSymbol::defaultSymbol( feature.geometry().type() ) );
|
mSymbol.reset( QgsSymbol::defaultSymbol( feature.geometry().type() ) );
|
||||||
@ -68,7 +68,7 @@ void QgsNullSymbolRenderer::startRender( QgsRenderContext& context, const QgsFie
|
|||||||
|
|
||||||
void QgsNullSymbolRenderer::stopRender( QgsRenderContext& context )
|
void QgsNullSymbolRenderer::stopRender( QgsRenderContext& context )
|
||||||
{
|
{
|
||||||
if ( mSymbol.data() )
|
if ( mSymbol.get() )
|
||||||
{
|
{
|
||||||
mSymbol->stopRender( context );
|
mSymbol->stopRender( context );
|
||||||
}
|
}
|
||||||
|
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