Skip to content
Permalink
Browse files

Rename methods

  • Loading branch information
pblottiere committed Mar 20, 2019
1 parent ba406e6 commit 89a1b1a1ace4ff9660c1f4495423bedb13d579f2
@@ -96,7 +96,7 @@ Default implementation calls drawSymbol() and drawSymbolText() methods.
If ctx is ``None``, this is just first stage when preparing layout - without actual rendering.
%End

void draw( const QgsLegendSettings &settings, QJsonObject &json );
void exportToJson( const QgsLegendSettings &settings, QJsonObject &json );
%Docstring
Entry point called from QgsLegendRenderer to do the rendering in a \a
json object.
@@ -115,7 +115,7 @@ Draws symbol on the left side of the item
:return: Real size of the symbol (may be bigger than "normal" symbol size from settings)
%End

virtual void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const;
virtual void exportSymbolToJson( const QgsLegendSettings &settings, QJsonObject &json ) const;
%Docstring
Adds a symbol in base64 string within the ``json`` object with the key
"icon".
@@ -137,7 +137,7 @@ Draws label on the right side of the item
:return: Size of the label (may span multiple lines)
%End

void drawSymbolText( const QgsLegendSettings &settings, QJsonObject &json ) const;
void exportSymbolTextToJson( const QgsLegendSettings &settings, QJsonObject &json ) const;
%Docstring
Adds a label in the ``json`` object with the key "title".

@@ -201,7 +201,7 @@ Constructor for QgsSymbolLegendNode.
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;


virtual void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const;
virtual void exportSymbolToJson( const QgsLegendSettings &settings, QJsonObject &json ) const;


virtual void setEmbeddedInParent( bool embedded );
@@ -390,7 +390,7 @@ Constructor for QgsImageLegendNode.
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;


virtual void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const;
virtual void exportSymbolToJson( const QgsLegendSettings &settings, QJsonObject &json ) const;


};
@@ -424,7 +424,7 @@ Constructor for QgsRasterSymbolLegendNode.
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;


virtual void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const;
virtual void exportSymbolToJson( const QgsLegendSettings &settings, QJsonObject &json ) const;


};
@@ -457,7 +457,7 @@ Constructor for QgsWmsLegendNode.
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;


virtual void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const;
virtual void exportSymbolToJson( const QgsLegendSettings &settings, QJsonObject &json ) const;


virtual void invalidateMapBasedData();
@@ -71,10 +71,10 @@ QgsLayerTreeModelLegendNode::ItemMetrics QgsLayerTreeModelLegendNode::draw( cons
return im;
}

void QgsLayerTreeModelLegendNode::draw( const QgsLegendSettings &settings, QJsonObject &json )
void QgsLayerTreeModelLegendNode::exportToJson( const QgsLegendSettings &settings, QJsonObject &json )
{
drawSymbol( settings, json );
drawSymbolText( settings, json );
exportSymbolToJson( settings, json );
exportSymbolTextToJson( settings, json );
}

QSizeF QgsLayerTreeModelLegendNode::drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const
@@ -89,7 +89,7 @@ QSizeF QgsLayerTreeModelLegendNode::drawSymbol( const QgsLegendSettings &setting
return settings.symbolSize();
}

void QgsLayerTreeModelLegendNode::drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const
void QgsLayerTreeModelLegendNode::exportSymbolToJson( const QgsLegendSettings &settings, QJsonObject &json ) const
{
const QIcon icon = data( Qt::DecorationRole ).value<QIcon>();
if ( icon.isNull() )
@@ -147,7 +147,7 @@ QSizeF QgsLayerTreeModelLegendNode::drawSymbolText( const QgsLegendSettings &set
return labelSize;
}

void QgsLayerTreeModelLegendNode::drawSymbolText( const QgsLegendSettings &, QJsonObject &json ) const
void QgsLayerTreeModelLegendNode::exportSymbolTextToJson( const QgsLegendSettings &, QJsonObject &json ) const
{
const QString text = data( Qt::DisplayRole ).toString();
json[ "title" ] = text;
@@ -514,7 +514,7 @@ QSizeF QgsSymbolLegendNode::drawSymbol( const QgsLegendSettings &settings, ItemC
std::max( height + 2 * heightOffset, static_cast< double >( settings.symbolSize().height() ) ) );
}

void QgsSymbolLegendNode::drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const
void QgsSymbolLegendNode::exportSymbolToJson( const QgsLegendSettings &settings, QJsonObject &json ) const
{
const QgsSymbol *s = mItem.symbol();
if ( !s )
@@ -658,7 +658,7 @@ QSizeF QgsImageLegendNode::drawSymbol( const QgsLegendSettings &settings, ItemCo
return settings.wmsLegendSize();
}

void QgsImageLegendNode::drawSymbol( const QgsLegendSettings &, QJsonObject &json ) const
void QgsImageLegendNode::exportSymbolToJson( const QgsLegendSettings &, QJsonObject &json ) const
{
QByteArray byteArray;
QBuffer buffer( &byteArray );
@@ -723,7 +723,7 @@ QSizeF QgsRasterSymbolLegendNode::drawSymbol( const QgsLegendSettings &settings,
return settings.symbolSize();
}

void QgsRasterSymbolLegendNode::drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const
void QgsRasterSymbolLegendNode::exportSymbolToJson( const QgsLegendSettings &settings, QJsonObject &json ) const
{
QImage img = QImage( settings.symbolSize().toSize(), QImage::Format_ARGB32 );
img.fill( Qt::transparent );
@@ -829,7 +829,7 @@ QSizeF QgsWmsLegendNode::drawSymbol( const QgsLegendSettings &settings, ItemCont
return settings.wmsLegendSize();
}

void QgsWmsLegendNode::drawSymbol( const QgsLegendSettings &, QJsonObject &json ) const
void QgsWmsLegendNode::exportSymbolToJson( const QgsLegendSettings &, QJsonObject &json ) const
{
QByteArray byteArray;
QBuffer buffer( &byteArray );
@@ -116,7 +116,7 @@ class CORE_EXPORT QgsLayerTreeModelLegendNode : public QObject
*
* \since QGIS 3.8
*/
void draw( const QgsLegendSettings &settings, QJsonObject &json );
void exportToJson( const QgsLegendSettings &settings, QJsonObject &json );

/**
* Draws symbol on the left side of the item
@@ -135,7 +135,7 @@ class CORE_EXPORT QgsLayerTreeModelLegendNode : public QObject
*
* \since QGIS 3.8
*/
virtual void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const;
virtual void exportSymbolToJson( const QgsLegendSettings &settings, QJsonObject &json ) const;

/**
* Draws label on the right side of the item
@@ -153,7 +153,7 @@ class CORE_EXPORT QgsLayerTreeModelLegendNode : public QObject
*
* \since QGIS 3.8
*/
void drawSymbolText( const QgsLegendSettings &settings, QJsonObject &json ) const;
void exportSymbolTextToJson( const QgsLegendSettings &settings, QJsonObject &json ) const;

signals:
//! Emitted on internal data change so the layer tree model can forward the signal to views
@@ -202,7 +202,7 @@ class CORE_EXPORT QgsSymbolLegendNode : public QgsLayerTreeModelLegendNode

QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;

void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const override;
void exportSymbolToJson( const QgsLegendSettings &settings, QJsonObject &json ) const override;

void setEmbeddedInParent( bool embedded ) override;

@@ -383,7 +383,7 @@ class CORE_EXPORT QgsImageLegendNode : public QgsLayerTreeModelLegendNode

QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;

void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const override;
void exportSymbolToJson( const QgsLegendSettings &settings, QJsonObject &json ) const override;

private:
QImage mImage;
@@ -414,7 +414,7 @@ class CORE_EXPORT QgsRasterSymbolLegendNode : public QgsLayerTreeModelLegendNode

QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;

void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const override;
void exportSymbolToJson( const QgsLegendSettings &settings, QJsonObject &json ) const override;

private:
QColor mColor;
@@ -446,7 +446,7 @@ class CORE_EXPORT QgsWmsLegendNode : public QgsLayerTreeModelLegendNode

QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;

void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const override;
void exportSymbolToJson( const QgsLegendSettings &settings, QJsonObject &json ) const override;

void invalidateMapBasedData() override;

@@ -94,7 +94,7 @@ void QgsLegendRenderer::drawLegend( QgsLayerTreeGroup *nodeGroup, QJsonObject &j

if ( legendNodes.count() == 1 )
{
legendNodes.at( 0 )->draw( mSettings, group );
legendNodes.at( 0 )->exportToJson( mSettings, group );
nodes.append( group );
}
else if ( legendNodes.count() > 1 )
@@ -104,7 +104,7 @@ void QgsLegendRenderer::drawLegend( QgsLayerTreeGroup *nodeGroup, QJsonObject &j
{
QgsLayerTreeModelLegendNode *legendNode = legendNodes.at( j );
QJsonObject symbol;
legendNode->draw( mSettings, symbol );
legendNode->exportToJson( mSettings, symbol );
symbols.append( symbol );
}
group[ "title" ] = text;

0 comments on commit 89a1b1a

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