Skip to content
Permalink
Browse files

rename QgsComposerSymbolItem::symbolV2() to symbol()

  • Loading branch information
jef-n committed Aug 6, 2016
1 parent 4e8635b commit eeebf4be086078f973ed24bf741e1ca4fcd555d8
@@ -161,6 +161,7 @@ This page tries to maintain a list with incompatible changes that happened in pr
<tr><td>QgsVectorLayer<td>deleteVertexV2<td>deleteVertex
<tr><td>QgsVectorLayer<td>rendererV2<td>renderer
<tr><td>QgsVectorLayerEditUtils<td>deleteVertexV2<td>deleteVertex
<tr><td>QgsComposerSymbolItem<td>symbolV2<td>symbol
</table>

\subsection qgis_api_break_3_0_removed_classes Removed Classes
@@ -59,8 +59,8 @@ class QgsComposerSymbolItem: QgsComposerLegendItem
virtual void readXml( const QDomElement& itemElem, bool xServerAvailable = true );

/** Set symbol (takes ownership)*/
void setSymbolV2( QgsSymbol* s /Transfer/ );
QgsSymbol* symbolV2();
void setSymbol( QgsSymbol* s /Transfer/ );
QgsSymbol* symbol();

ItemType itemType() const;
};
@@ -39,7 +39,7 @@ class QgsComposerShape: QgsComposerItem
QgsComposerShape::Shape shapeType() const;
void setShapeType( QgsComposerShape::Shape s );

/** Sets radius for rounded rectangle corners. Added in v2.1 */
/** Sets radius for rounded rectangle corners. Added in 2.1 */
void setCornerRadius( double radius );
/** Returns the radius for rounded rectangle corners*/
double cornerRadius() const;
@@ -53,8 +53,8 @@ class QgsComposerShape: QgsComposerItem
QgsFillSymbol* shapeStyleSymbol();

/** Controls whether the shape should be drawn using a QgsFillSymbol.
* Note: Added in v2.1 */
void setUseSymbol( bool useSymbolV2 );
* Note: Added in 2.1 */
void setUseSymbol( bool useSymbol );

/** Depending on the symbol style, the bounding rectangle can be larger than the shape
@note this function was added in version 2.3*/
@@ -44,10 +44,10 @@ class QgsMapHitTest
protected:

//! @note not available in Python bindings
//typedef QSet<QString> SymbolV2Set;
//typedef QSet<QString> SymbolSet;

//! @note not available in Python bindings
//typedef QMap<QgsVectorLayer*, SymbolV2Set> HitTest;
//typedef QMap<QgsVectorLayer*, SymbolSet> HitTest;

/** Runs test for visible symbols within a layer
* @param vl vector layer
@@ -57,7 +57,7 @@ class QgsMapHitTest
* @note added in QGIS 2.12
* @note not available in Python bindings
*/
//void runHitTestLayer( QgsVectorLayer* vl, SymbolV2Set& usedSymbols, SymbolV2Set& usedSymbolsRuleKey, QgsRenderContext& context );
//void runHitTestLayer( QgsVectorLayer* vl, SymbolSet& usedSymbols, SymbolSet& usedSymbolsRuleKey, QgsRenderContext& context );


};
@@ -74,8 +74,8 @@ class QgsWmsServer: public QgsOWSServer
of the image object*/
QImage* getLegendGraphics();

typedef QSet<QgsSymbol*> SymbolV2Set;
typedef QMap<QgsVectorLayer*, SymbolV2Set> HitTest;
typedef QSet<QgsSymbol*> SymbolSet;
typedef QMap<QgsVectorLayer*, SymbolSet> HitTest;

/** Returns the map as an image (or a null pointer in case of error). The caller takes ownership
of the image object). If an instance to existing hit test structure is passed, instead of rendering
@@ -65,41 +65,41 @@ void QgsComposerLegendItem::writeXmlChildren( QDomElement& elem, QDomDocument& d
////////////////QgsComposerSymbolItem


QgsComposerSymbolItem::QgsComposerSymbolItem(): QgsComposerLegendItem( QgsComposerLegendStyle::Symbol ), mSymbolV2( nullptr )
QgsComposerSymbolItem::QgsComposerSymbolItem(): QgsComposerLegendItem( QgsComposerLegendStyle::Symbol ), mSymbol( nullptr )
{
}

QgsComposerSymbolItem::QgsComposerSymbolItem( const QString& text ): QgsComposerLegendItem( text, QgsComposerLegendStyle::Symbol ), mSymbolV2( nullptr )
QgsComposerSymbolItem::QgsComposerSymbolItem( const QString& text ): QgsComposerLegendItem( text, QgsComposerLegendStyle::Symbol ), mSymbol( nullptr )
{
}

QgsComposerSymbolItem::QgsComposerSymbolItem( const QIcon& icon, const QString& text ): QgsComposerLegendItem( icon, text, QgsComposerLegendStyle::Symbol ), mSymbolV2( nullptr )
QgsComposerSymbolItem::QgsComposerSymbolItem( const QIcon& icon, const QString& text ): QgsComposerLegendItem( icon, text, QgsComposerLegendStyle::Symbol ), mSymbol( nullptr )
{
}

QgsComposerSymbolItem::~QgsComposerSymbolItem()
{
delete mSymbolV2;
delete mSymbol;
}

QStandardItem* QgsComposerSymbolItem::clone() const
{
QgsComposerSymbolItem* cloneItem = new QgsComposerSymbolItem();
*cloneItem = *this;
if ( mSymbolV2 )
if ( mSymbol )
{
cloneItem->setSymbolV2( mSymbolV2->clone() );
cloneItem->setSymbol( mSymbol->clone() );
}
return cloneItem;
}

void QgsComposerSymbolItem::writeXml( QDomElement& elem, QDomDocument& doc ) const
{
QDomElement vectorClassElem = doc.createElement( "VectorClassificationItemNg" );
if ( mSymbolV2 )
if ( mSymbol )
{
QgsSymbolMap saveSymbolMap;
saveSymbolMap.insert( "classificationSymbol", mSymbolV2 );
saveSymbolMap.insert( "classificationSymbol", mSymbol );
QDomElement symbolsElem = QgsSymbolLayerUtils::saveSymbols( saveSymbolMap, "symbols", doc );
vectorClassElem.appendChild( symbolsElem );
}
@@ -128,7 +128,7 @@ void QgsComposerSymbolItem::readXml( const QDomElement& itemElem, bool xServerAv
QgsSymbol* symbolNg = mapIt.value();
if ( symbolNg )
{
setSymbolV2( symbolNg );
setSymbol( symbolNg );
if ( xServerAvailable )
{
setIcon( QgsSymbolLayerUtils::symbolPreviewIcon( symbolNg, QSize( 30, 30 ) ) );
@@ -138,10 +138,10 @@ void QgsComposerSymbolItem::readXml( const QDomElement& itemElem, bool xServerAv
}
}

void QgsComposerSymbolItem::setSymbolV2( QgsSymbol* s )
void QgsComposerSymbolItem::setSymbol( QgsSymbol* s )
{
delete mSymbolV2;
mSymbolV2 = s;
delete mSymbol;
mSymbol = s;
}

////////////////////QgsComposerRasterSymbolItem
@@ -89,13 +89,13 @@ class CORE_EXPORT QgsComposerSymbolItem: public QgsComposerLegendItem
virtual void readXml( const QDomElement& itemElem, bool xServerAvailable = true ) override;

/** Set symbol (takes ownership)*/
void setSymbolV2( QgsSymbol* s );
QgsSymbol* symbolV2() {return mSymbolV2;}
void setSymbol( QgsSymbol* s );
QgsSymbol* symbol() {return mSymbol;}

ItemType itemType() const override { return SymbologyV2Item; }

private:
QgsSymbol* mSymbolV2;
QgsSymbol* mSymbol;
};

/** \ingroup core
@@ -27,7 +27,7 @@ QgsComposerShape::QgsComposerShape( QgsComposition* composition )
: QgsComposerItem( composition )
, mShape( Ellipse )
, mCornerRadius( 0 )
, mUseSymbolV2( false ) //default to not using SymbolV2 for shapes, to preserve 2.0 api
, mUseSymbol( false ) //default to not using symbol for shapes, to preserve 2.0 api
, mShapeStyleSymbol( nullptr )
, mMaxSymbolBleed( 0 )
{
@@ -46,7 +46,7 @@ QgsComposerShape::QgsComposerShape( qreal x, qreal y, qreal width, qreal height,
: QgsComposerItem( x, y, width, height, composition )
, mShape( Ellipse )
, mCornerRadius( 0 )
, mUseSymbolV2( false ) //default to not using SymbolV2 for shapes, to preserve 2.0 api
, mUseSymbol( false ) //default to not using Symbol for shapes, to preserve 2.0 api
, mShapeStyleSymbol( nullptr )
, mMaxSymbolBleed( 0 )
{
@@ -67,10 +67,10 @@ QgsComposerShape::~QgsComposerShape()
delete mShapeStyleSymbol;
}

void QgsComposerShape::setUseSymbol( bool useSymbolV2 )
void QgsComposerShape::setUseSymbol( bool useSymbol )
{
mUseSymbolV2 = useSymbolV2;
setFrameEnabled( !useSymbolV2 );
mUseSymbol = useSymbol;
setFrameEnabled( !useSymbol );
}

void QgsComposerShape::setShapeStyleSymbol( QgsFillSymbol* symbol )
@@ -132,7 +132,7 @@ void QgsComposerShape::paint( QPainter* painter, const QStyleOptionGraphicsItem*

void QgsComposerShape::drawShape( QPainter* p )
{
if ( mUseSymbolV2 )
if ( mUseSymbol )
{
drawShapeUsingSymbol( p );
return;
@@ -247,7 +247,7 @@ void QgsComposerShape::drawShapeUsingSymbol( QPainter* p )

void QgsComposerShape::drawFrame( QPainter* p )
{
if ( mFrame && p && !mUseSymbolV2 )
if ( mFrame && p && !mUseSymbol )
{
p->setPen( pen() );
p->setBrush( Qt::NoBrush );
@@ -258,7 +258,7 @@ void QgsComposerShape::drawFrame( QPainter* p )

void QgsComposerShape::drawBackground( QPainter* p )
{
if ( p && ( mBackground || mUseSymbolV2 ) )
if ( p && ( mBackground || mUseSymbol ) )
{
p->setBrush( brush() );//this causes a problem in atlas generation
p->setPen( Qt::NoPen );
@@ -314,7 +314,7 @@ bool QgsComposerShape::readXml( const QDomElement& itemElem, const QDomDocument&
}
else
{
//upgrade project file from 2.0 to use symbolV2 styling
//upgrade project file from 2.0 to use symbol styling
delete mShapeStyleSymbol;
QgsStringMap properties;
properties.insert( "color", QgsSymbolLayerUtils::encodeColor( brush().color() ) );
@@ -79,7 +79,7 @@ class CORE_EXPORT QgsComposerShape: public QgsComposerItem

/** Controls whether the shape should be drawn using a QgsFillSymbol.
* Note: Added in v2.1 */
void setUseSymbol( bool useSymbolV2 );
void setUseSymbol( bool useSymbol );

/** Depending on the symbol style, the bounding rectangle can be larger than the shape
@note this function was added in version 2.3*/
@@ -114,7 +114,7 @@ class CORE_EXPORT QgsComposerShape: public QgsComposerItem

double mCornerRadius;

bool mUseSymbolV2;
bool mUseSymbol;

QgsFillSymbol* mShapeStyleSymbol;
double mMaxSymbolBleed;
@@ -66,8 +66,8 @@ void QgsMapHitTest::run()
{
if ( !vl->isInScaleRange( mSettings.scale() ) )
{
mHitTest[vl] = SymbolV2Set(); // no symbols -> will not be shown
mHitTestRuleKey[vl] = SymbolV2Set();
mHitTest[vl] = SymbolSet(); // no symbols -> will not be shown
mHitTestRuleKey[vl] = SymbolSet();
continue;
}

@@ -79,8 +79,8 @@ void QgsMapHitTest::run()
}

context.expressionContext() << QgsExpressionContextUtils::layerScope( vl );
SymbolV2Set& usedSymbols = mHitTest[vl];
SymbolV2Set& usedSymbolsRuleKey = mHitTestRuleKey[vl];
SymbolSet& usedSymbols = mHitTest[vl];
SymbolSet& usedSymbolsRuleKey = mHitTestRuleKey[vl];
runHitTestLayer( vl, usedSymbols, usedSymbolsRuleKey, context );
}

@@ -103,7 +103,7 @@ bool QgsMapHitTest::legendKeyVisible( const QString& ruleKey, QgsVectorLayer* la
return mHitTestRuleKey.value( layer ).contains( ruleKey );
}

void QgsMapHitTest::runHitTestLayer( QgsVectorLayer* vl, SymbolV2Set& usedSymbols, SymbolV2Set& usedSymbolsRuleKey, QgsRenderContext& context )
void QgsMapHitTest::runHitTestLayer( QgsVectorLayer* vl, SymbolSet& usedSymbols, SymbolSet& usedSymbolsRuleKey, QgsRenderContext& context )
{
bool hasStyleOverride = mSettings.layerStyleOverrides().contains( vl->id() );
if ( hasStyleOverride )
@@ -139,8 +139,8 @@ void QgsMapHitTest::runHitTestLayer( QgsVectorLayer* vl, SymbolV2Set& usedSymbol
}
QgsFeatureIterator fi = vl->getFeatures( request );

SymbolV2Set lUsedSymbols;
SymbolV2Set lUsedSymbolsRuleKey;
SymbolSet lUsedSymbols;
SymbolSet lUsedSymbolsRuleKey;
bool allExpressionFalse = false;
bool hasExpression = mLayerFilterExpression.contains( vl->id() );
QScopedPointer<QgsExpression> expr;
@@ -67,10 +67,10 @@ class CORE_EXPORT QgsMapHitTest
protected:

//! @note not available in Python bindings
typedef QSet<QString> SymbolV2Set;
typedef QSet<QString> SymbolSet;

//! @note not available in Python bindings
typedef QMap<QgsVectorLayer*, SymbolV2Set> HitTest;
typedef QMap<QgsVectorLayer*, SymbolSet> HitTest;

/** Runs test for visible symbols within a layer
* @param vl vector layer
@@ -80,7 +80,7 @@ class CORE_EXPORT QgsMapHitTest
* @note added in QGIS 2.12
* @note not available in Python bindings
*/
void runHitTestLayer( QgsVectorLayer* vl, SymbolV2Set& usedSymbols, SymbolV2Set& usedSymbolsRuleKey, QgsRenderContext& context );
void runHitTestLayer( QgsVectorLayer* vl, SymbolSet& usedSymbols, SymbolSet& usedSymbolsRuleKey, QgsRenderContext& context );

//! The initial map settings
QgsMapSettings mSettings;
@@ -844,7 +844,7 @@ QImage* QgsWmsServer::getLegendGraphics()
if ( !vl || !vl->renderer() )
continue;

const SymbolV2Set& usedSymbols = hitTest[vl];
const SymbolSet& usedSymbols = hitTest[vl];
QList<int> order;
int i = 0;
Q_FOREACH ( const QgsLegendSymbolItem& legendItem, vl->renderer()->legendSymbolItemsV2() )
@@ -993,7 +993,7 @@ void QgsWmsServer::runHitTest( QPainter* painter, HitTest& hitTest )

if ( vl->hasScaleBasedVisibility() && ( mMapRenderer->scale() < vl->minimumScale() || mMapRenderer->scale() > vl->maximumScale() ) )
{
hitTest[vl] = SymbolV2Set(); // no symbols -> will not be shown
hitTest[vl] = SymbolSet(); // no symbols -> will not be shown
continue;
}

@@ -1007,12 +1007,12 @@ void QgsWmsServer::runHitTest( QPainter* painter, HitTest& hitTest )
context.setExtent( r1 );
}

SymbolV2Set& usedSymbols = hitTest[vl];
SymbolSet& usedSymbols = hitTest[vl];
runHitTestLayer( vl, usedSymbols, context );
}
}

void QgsWmsServer::runHitTestLayer( QgsVectorLayer* vl, SymbolV2Set& usedSymbols, QgsRenderContext& context )
void QgsWmsServer::runHitTestLayer( QgsVectorLayer* vl, SymbolSet& usedSymbols, QgsRenderContext& context )
{
QgsFeatureRenderer* r = vl->renderer();
bool moreSymbolsPerFeature = r->capabilities() & QgsFeatureRenderer::MoreSymbolsPerFeature;
@@ -2243,9 +2243,9 @@ int QgsWmsServer::featureInfoFromVectorLayer( QgsVectorLayer* layer,

//check if feature is rendered at all
r2->startRender( renderContext, layer->pendingFields() );
bool renderV2 = r2->willRenderFeature( feature, renderContext );
bool render = r2->willRenderFeature( feature, renderContext );
r2->stopRender( renderContext );
if ( !renderV2 )
if ( !render )
{
continue;
}
@@ -88,8 +88,8 @@ class QgsWmsServer: public QgsOWSServer
of the image object*/
QImage* getLegendGraphics();

typedef QSet<QgsSymbol*> SymbolV2Set;
typedef QMap<QgsVectorLayer*, SymbolV2Set> HitTest;
typedef QSet<QgsSymbol*> SymbolSet;
typedef QMap<QgsVectorLayer*, SymbolSet> HitTest;

/** Returns the map as an image (or a null pointer in case of error). The caller takes ownership
of the image object). If an instance to existing hit test structure is passed, instead of rendering
@@ -176,7 +176,7 @@ class QgsWmsServer: public QgsOWSServer
/** Record which symbols would be used if the map was in the current configuration of mMapRenderer. This is useful for content-based legend*/
void runHitTest( QPainter* painter, HitTest& hitTest );
/** Record which symbols within one layer would be rendered with the given renderer context*/
void runHitTestLayer( QgsVectorLayer* vl, SymbolV2Set& usedSymbols, QgsRenderContext& context );
void runHitTestLayer( QgsVectorLayer* vl, SymbolSet& usedSymbols, QgsRenderContext& context );

/** Read legend parameter from the request or from the first print composer in the project*/
void legendParameters( double& boxSpace, double& layerSpace, double& layerTitleSpace,

0 comments on commit eeebf4b

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