Skip to content
Permalink
Browse files

remove some deprecated methods, rename QgsAnnotation::mapPositionFixe…

…d() to hasFixedMapPosition()
  • Loading branch information
3nids committed Aug 23, 2016
1 parent eb308a6 commit 7fdade1a3a6d1864e2861e831620ea0f8ea1db65
@@ -151,6 +151,7 @@ This page tries to maintain a list with incompatible changes that happened in pr
<table>
<caption id="renamed_methods">Renamed method names</caption>
<tr><th>class</th><th>API 2.x<th>API 3.X
<tr><td>QgsAnnotation<td>mapPositionFixed<td>hasFixedMapPosition
<tr><td>QgsApplication<td>defaultStyleV2Path<td>defaultStylePath
<tr><td>QgsApplication<td>userStyleV2Path<td>userStylePath
<tr><td>QgsComposerShape<td>setUseSymbolV2<td>setUseSymbol
@@ -167,6 +168,7 @@ This page tries to maintain a list with incompatible changes that happened in pr
\subsection qgis_api_break_3_0_removed_classes Removed Classes

<ul>
<li>QgsAttributeAction was removed, and replaced by QgsActionManager.</li>
<li>QgsColorbutton was removed. QgsColorButtonV2 has now been renamed to QgsColorButton. Hence, QgsColorButtonV2 does not exist anymore.</li>
<li>QgsColorDialog was removed, and QgsColorDialogV2 was renamed to QgsColorDialog. Hence, QgsColorButtonV2 does not exist anymore.
All the functionality from the old QgsColorDialog has been moved to the new class.</li>
@@ -258,6 +260,13 @@ corresponding counterparts in QgsUnitTypes should be used instead.</li>
<li>fileMenu() has been removed, use projectMenu() instead.
</ul>

\subsection qgis_api_break_3_0_QgsAnnotation QgsAnnotation

<ul>
<li> mapPositionFixed() has been renamed to hasFixedMapPosition()
</ul>


\subsection qgis_api_break_3_0_QgsActionManager QgsActionManager

<ul>
@@ -452,6 +461,10 @@ be returned in place of a null pointer.</li>
<ul>
<li>The deprecated getExpression( const QString& expression, const QgsFields* fields ) method has been removed.
Use the variant which accepts an expression context instead.</li>
<li>The deprecated renderDiagram( const QgsAttributes& att, QgsRenderContext& c, const QgsDiagramSettings& s, QPointF position ) method has been removed.
Use renderDiagram( const QgsFeature& feature, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position ) instead.
<li>The deprecated diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is ) method has been removed.
Use diagramSize( const QgsFeature& feature, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is ) instead.
</ul>

\subsection qgis_api_break_3_0_QgsDiagramLayerSettings QgsDiagramLayerSettings
@@ -719,6 +732,12 @@ plugins calling this method will need to be updated.</li>
<li>visibilityPresetCollection() has been renamed to mapThemeCollection()</li>
</ul>

\subsection qgis_api_break_3_0_QgsRasterCalcNode QgsRasterCalcNode

<ul>
<li>QgsRasterCalcNode::calculate has been removed, use method with QgsRasterBlocks instead.</li>
</ul>

\subsection qgis_api_break_3_0_QgsRasterDataProvider QgsRasterDataProvider

<ul>
@@ -66,10 +66,6 @@ class QgsRasterCalcNode
*/
//bool calculate( QMap<QString, QgsRasterBlock* >& rasterData, QgsRasterMatrix& result, int row = -1 ) const;

/** @deprecated use method which accepts QgsRasterBlocks instead
*/
// bool calculate( QMap<QString, QgsRasterMatrix*>& rasterData, QgsRasterMatrix& result ) const /Deprecated/;

static QgsRasterCalcNode* parseRasterCalcString( const QString& str, QString& parserErrorMsg ) /Factory/;

private:
@@ -18,15 +18,11 @@ class QgsDiagram
*/
QgsExpression* getExpression( const QString& expression, const QgsExpressionContext& context );

/** @deprecated `void renderDiagram( const QgsFeature& feature, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position )` should be used instead */
virtual void renderDiagram( const QgsAttributes& att, QgsRenderContext& c, const QgsDiagramSettings& s, QPointF position ) /Deprecated/;
/** Draws the diagram at the given position (in pixel coordinates)*/
virtual void renderDiagram( const QgsFeature& feature, QgsRenderContext& c, const QgsDiagramSettings& s, QPointF position ) = 0;
virtual QString diagramName() const = 0;
/** Returns the size in map units the diagram will use to render.*/
virtual QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s ) = 0;
/** @deprecated `QSizeF diagramSize( const QgsFeature& feature, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is )` should be used instead */
virtual QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is ) /Deprecated/;
/** Returns the size in map units the diagram will use to render. Interpolate size*/
virtual QSizeF diagramSize( const QgsFeature& feature, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is ) = 0;

@@ -27,8 +27,7 @@ class QgsAnnotation
* @see mapPosition()
* @see relativePositon()
*/
//TODO QGIS 3 - rename to hasFixedMapPosition()
virtual bool mapPositionFixed() const = 0;
virtual bool hasFixedMapPosition() const = 0;

/** Returns the map position of the annotation, if it is attached to a fixed map
* position.
@@ -61,7 +61,7 @@ class QgsAnnotationItem: QgsMapCanvasItem, QgsAnnotation

//setters and getters
void setMapPositionFixed( bool fixed );
bool mapPositionFixed() const;
bool hasFixedMapPosition() const;

virtual void setMapPosition( const QgsPoint& pos );
QgsPoint mapPosition() const;
@@ -83,28 +83,6 @@ QgsRasterCalcNode::~QgsRasterCalcNode()
}
}

bool QgsRasterCalcNode::calculate( QMap<QString, QgsRasterMatrix*>& rasterData, QgsRasterMatrix& result ) const
{
//deprecated method
//convert QgsRasterMatrix to QgsRasterBlock and call replacement method
QMap<QString, QgsRasterBlock* > rasterBlockData;
QMap<QString, QgsRasterMatrix*>::const_iterator it = rasterData.constBegin();
for ( ; it != rasterData.constEnd(); ++it )
{
QgsRasterBlock* block = new QgsRasterBlock( Qgis::Float32, it.value()->nColumns(), it.value()->nRows(), it.value()->nodataValue() );
for ( int row = 0; row < it.value()->nRows(); ++row )
{
for ( int col = 0; col < it.value()->nColumns(); ++col )
{
block->setValue( row, col, it.value()->data()[ row * it.value()->nColumns() + col ] );
}
}
rasterBlockData.insert( it.key(), block );
}

return calculate( rasterBlockData, result );
}

bool QgsRasterCalcNode::calculate( QMap<QString, QgsRasterBlock* >& rasterData, QgsRasterMatrix& result, int row ) const
{
//if type is raster ref: return a copy of the corresponding matrix
@@ -92,10 +92,6 @@ class ANALYSIS_EXPORT QgsRasterCalcNode
*/
bool calculate( QMap<QString, QgsRasterBlock* >& rasterData, QgsRasterMatrix& result, int row = -1 ) const;

/** @deprecated use method which accepts QgsRasterBlocks instead
*/
Q_DECL_DEPRECATED bool calculate( QMap<QString, QgsRasterMatrix*>& rasterData, QgsRasterMatrix& result ) const;

static QgsRasterCalcNode* parseRasterCalcString( const QString& str, QString& parserErrorMsg );

private:
@@ -628,11 +628,6 @@ QStringList QgsVectorLayerSaveAsDialog::layerOptions() const
return options + mOgrLayerOptions->toPlainText().split( '\n' );
}

bool QgsVectorLayerSaveAsDialog::attributeSelection() const
{
return true;
}

QgsAttributeList QgsVectorLayerSaveAsDialog::selectedAttributes() const
{
QgsAttributeList attributes;
@@ -51,8 +51,6 @@ class APP_EXPORT QgsVectorLayerSaveAsDialog : public QDialog, private Ui::QgsVec
QStringList datasourceOptions() const;
QStringList layerOptions() const;
long crs() const;
/** @deprecated since 2.16. Now always return true since there is no longer any checkbox */
bool attributeSelection() const;
QgsAttributeList selectedAttributes() const;
/** Return selected attributes that must be exported with their displayed values instead of their raw values. Added in QGIS 2.16 */
QgsAttributeList attributesAsDisplayedValues() const;
@@ -6238,7 +6238,7 @@ void QgisApp::saveAsVectorFileGeneral( QgsVectorLayer* vlayer, bool symbologyOpt
dialog->onlySelected(),
&errorMessage,
datasourceOptions, dialog->layerOptions(),
dialog->attributeSelection() && dialog->selectedAttributes().isEmpty(),
dialog->selectedAttributes().isEmpty(),
&newFilename,
static_cast< QgsVectorFileWriter::SymbologyExport >( dialog->symbologyExport() ),
dialog->scaleDenominator(),
@@ -32,7 +32,7 @@ QgsAnnotationWidget::QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * par
{
blockAllSignals( true );

if ( mItem->mapPositionFixed() )
if ( mItem->hasFixedMapPosition() )
{
mMapPositionFixedCheckBox->setCheckState( Qt::Checked );
}
@@ -164,7 +164,7 @@ void QgsMapToolAnnotation::canvasMoveEvent( QgsMapMouseEvent* e )
}
else if ( mCurrentMoveAction == QgsAnnotationItem::MoveFramePosition )
{
if ( sItem->mapPositionFixed() )
if ( sItem->hasFixedMapPosition() )
{
sItem->setOffsetFromReferencePoint( sItem->offsetFromReferencePoint() + ( e->posF() - mLastMousePosition ) );
}
@@ -604,7 +604,6 @@ SET(QGIS_CORE_HDRS
qgsaggregatecalculator.h
qgsannotation.h
qgsattributetableconfig.h
qgsattributeaction.h
qgsattributeeditorelement.h
qgscachedfeatureiterator.h
qgscacheindex.h
@@ -2372,7 +2372,7 @@ void QgsComposerMap::drawCanvasItem( const QgsAnnotation* annotation, QPainter*
double scaleFactor = annotation->scaleFactor();

double itemX, itemY;
if ( annotation->mapPositionFixed() )
if ( annotation->hasFixedMapPosition() )
{
QPointF mapPos = composerMapPosForItem( annotation );
itemX = mapPos.x();
@@ -132,17 +132,3 @@ QSizeF QgsDiagram::sizeForValue( double value, const QgsDiagramSettings &s, cons

return size;
}

void QgsDiagram::renderDiagram( const QgsAttributes& attributes, QgsRenderContext& c, const QgsDiagramSettings& s, QPointF position )
{
QgsFeature feature;
feature.setAttributes( attributes );
renderDiagram( feature, c, s, position );
}

QSizeF QgsDiagram::diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is )
{
QgsFeature feature;
feature.setAttributes( attributes );
return diagramSize( feature, c, s, is );
}
@@ -49,15 +49,11 @@ class CORE_EXPORT QgsDiagram
*/
QgsExpression* getExpression( const QString& expression, const QgsExpressionContext& context );

/** @deprecated `void renderDiagram( const QgsFeature& feature, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position )` should be used instead */
virtual Q_DECL_DEPRECATED void renderDiagram( const QgsAttributes& att, QgsRenderContext& c, const QgsDiagramSettings& s, QPointF position );
/** Draws the diagram at the given position (in pixel coordinates)*/
virtual void renderDiagram( const QgsFeature& feature, QgsRenderContext& c, const QgsDiagramSettings& s, QPointF position ) = 0;
virtual QString diagramName() const = 0;
/** Returns the size in map units the diagram will use to render.*/
virtual QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s ) = 0;
/** @deprecated `QSizeF diagramSize( const QgsFeature& feature, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is )` should be used instead */
virtual Q_DECL_DEPRECATED QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is );
/** Returns the size in map units the diagram will use to render. Interpolate size*/
virtual QSizeF diagramSize( const QgsFeature& feature, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is ) = 0;

@@ -50,8 +50,7 @@ class CORE_EXPORT QgsAnnotation
* @see mapPosition()
* @see relativePositon()
*/
//TODO QGIS 3 - rename to hasFixedMapPosition()
virtual bool mapPositionFixed() const = 0;
virtual bool hasFixedMapPosition() const = 0;

/** Returns the map position of the annotation, if it is attached to a fixed map
* position.

This file was deleted.

@@ -31,7 +31,6 @@
#include "qgslogger.h"
#include "qgsmapcanvas.h"
#include "qgsproject.h"
#include "qgsattributeaction.h"
#include "qgsexpressionbuilderdialog.h"
#include "qgsmessagebar.h"
#include "qgsexpressionselectiondialog.h"
@@ -67,7 +67,7 @@ class GUI_EXPORT QgsAnnotationItem: public QgsMapCanvasItem, public QgsAnnotatio

//setters and getters
void setMapPositionFixed( bool fixed );
bool mapPositionFixed() const override { return mMapPositionFixed; }
bool hasFixedMapPosition() const override { return mMapPositionFixed; }

virtual void setMapPosition( const QgsPoint& pos );
QgsPoint mapPosition() const override { return mMapPosition; }

0 comments on commit 7fdade1

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