Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Add geometry generator symbols
- Loading branch information
Showing
18 changed files
with
677 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
python/core/symbology-ng/qgslinegeneratorsymbollayerv2.sip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/*************************************************************************** | ||
qgslinegeneratorsymbollayerv2.sip | ||
--------------------- | ||
begin : November 2015 | ||
copyright : (C) 2015 by Matthias Kuhn | ||
email : matthias at opengis dot ch | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
class QgsLineGeneratorSymbolLayerV2 : QgsLineSymbolLayerV2 | ||
{ | ||
%TypeHeaderCode | ||
#include "qgslinegeneratorsymbollayerv2.h" | ||
%End | ||
public: | ||
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ); | ||
|
||
QgsLineGeneratorSymbolLayerV2( QgsLineSymbolV2* symbol, const QgsStringMap& properties = QgsStringMap() ); | ||
|
||
QString layerType() const; | ||
|
||
void startRender( QgsSymbolV2RenderContext& context ); | ||
|
||
void stopRender( QgsSymbolV2RenderContext& context ); | ||
|
||
QgsSymbolLayerV2* clone() const; | ||
|
||
QgsStringMap properties() const; | ||
|
||
void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ); | ||
|
||
void setGeometryExpression( const QString& exp ); | ||
|
||
QString geometryExpression() const; | ||
|
||
virtual QgsSymbolV2* subSymbol(); | ||
|
||
virtual bool setSubSymbol( QgsSymbolV2* symbol ); | ||
|
||
virtual QSet<QString> usedAttributes() const; | ||
|
||
//! Will always return true. | ||
//! This is a hybrid layer, it constructs its own geometry so it does not | ||
//! care about the geometry of its parents. | ||
bool isCompatibleWithSymbol( QgsSymbolV2* symbol ); | ||
|
||
virtual void renderPolyline( const QPolygonF& point, QgsSymbolV2RenderContext& context ); | ||
|
||
private: | ||
QgsLineGeneratorSymbolLayerV2( const QgsLineGeneratorSymbolLayerV2& copy ); | ||
}; |
56 changes: 56 additions & 0 deletions
56
python/core/symbology-ng/qgspointgeneratorsymbollayerv2.sip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/*************************************************************************** | ||
qgspointgeneratorsymbollayerv2.sip | ||
--------------------- | ||
begin : November 2015 | ||
copyright : (C) 2015 by Matthias Kuhn | ||
email : matthias at opengis dot ch | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
class QgsPointGeneratorSymbolLayerV2 : QgsMarkerSymbolLayerV2 | ||
{ | ||
%TypeHeaderCode | ||
#include "qgspointgeneratorsymbollayerv2.h" | ||
%End | ||
public: | ||
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ); | ||
|
||
QgsPointGeneratorSymbolLayerV2( QgsMarkerSymbolV2* symbol, const QgsStringMap& properties = QgsStringMap() ); | ||
|
||
QString layerType() const; | ||
|
||
void startRender( QgsSymbolV2RenderContext& context ); | ||
|
||
void stopRender( QgsSymbolV2RenderContext& context ); | ||
|
||
QgsSymbolLayerV2* clone() const; | ||
|
||
QgsStringMap properties() const; | ||
|
||
void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ); | ||
|
||
void setGeometryExpression( const QString& exp ); | ||
|
||
QString geometryExpression() const; | ||
|
||
virtual QgsSymbolV2* subSymbol(); | ||
|
||
virtual bool setSubSymbol( QgsSymbolV2* symbol ); | ||
|
||
virtual QSet<QString> usedAttributes() const; | ||
|
||
//! Will always return true. | ||
//! This is a hybrid layer, it constructs its own geometry so it does not | ||
//! care about the geometry of its parents. | ||
bool isCompatibleWithSymbol( QgsSymbolV2* symbol ); | ||
|
||
void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& context ); | ||
|
||
private: | ||
QgsPointGeneratorSymbolLayerV2( const QgsPointGeneratorSymbolLayerV2& copy ); | ||
}; |
56 changes: 56 additions & 0 deletions
56
python/core/symbology-ng/qgspolygongeneratorsymbollayerv2.sip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/*************************************************************************** | ||
qgspolygongeneratorsymbollayerv2.sip | ||
--------------------- | ||
begin : November 2015 | ||
copyright : (C) 2015 by Matthias Kuhn | ||
email : matthias at opengis dot ch | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
class QgsPolygonGeneratorSymbolLayerV2 : QgsFillSymbolLayerV2 | ||
{ | ||
%TypeHeaderCode | ||
#include "qgspolygongeneratorsymbollayerv2.h" | ||
%End | ||
public: | ||
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ); | ||
|
||
QgsPolygonGeneratorSymbolLayerV2( QgsFillSymbolV2* symbol, const QgsStringMap& properties = QgsStringMap() ); | ||
|
||
QString layerType() const; | ||
|
||
void startRender( QgsSymbolV2RenderContext& context ); | ||
|
||
void stopRender( QgsSymbolV2RenderContext& context ); | ||
|
||
QgsSymbolLayerV2* clone() const; | ||
|
||
QgsStringMap properties() const; | ||
|
||
void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ); | ||
|
||
void setGeometryExpression( const QString& exp ); | ||
|
||
QString geometryExpression() const; | ||
|
||
virtual QgsSymbolV2* subSymbol(); | ||
|
||
virtual bool setSubSymbol( QgsSymbolV2* symbol ); | ||
|
||
virtual QSet<QString> usedAttributes() const; | ||
|
||
//! Will always return true. | ||
//! This is a hybrid layer, it constructs its own geometry so it does not | ||
//! care about the geometry of its parents. | ||
bool isCompatibleWithSymbol( QgsSymbolV2* symbol ); | ||
|
||
void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context ); | ||
|
||
private: | ||
QgsPolygonGeneratorSymbolLayerV2( const QgsPolygonGeneratorSymbolLayerV2& copy ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
17f9d55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m-kuhn , Geometry Generator doesn't work for line layers. Steps to reproduce:
17f9d55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c9fa334
I added some tests to check for fill generators on points and line layers to avoid such issues in the future.