Skip to content

Commit 17f9d55

Browse files
committed
[FEATURE] Add geometry generator symbols
1 parent 554b41d commit 17f9d55

18 files changed

+677
-68
lines changed

python/core/core.sip

+3
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@
290290
%Include symbology-ng/qgslinesymbollayerv2.sip
291291
%Include symbology-ng/qgsmarkersymbollayerv2.sip
292292
%Include symbology-ng/qgssymbollayerv2registry.sip
293+
%Include symbology-ng/qgspolygongeneratorsymbollayerv2.sip
294+
%Include symbology-ng/qgslinegeneratorsymbollayerv2.sip
295+
%Include symbology-ng/qgspointgeneratorsymbollayerv2.sip
293296

294297
%Include symbology-ng/qgssymbologyv2conversion.sip
295298

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/***************************************************************************
2+
qgslinegeneratorsymbollayerv2.sip
3+
---------------------
4+
begin : November 2015
5+
copyright : (C) 2015 by Matthias Kuhn
6+
email : matthias at opengis dot ch
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
class QgsLineGeneratorSymbolLayerV2 : QgsLineSymbolLayerV2
16+
{
17+
%TypeHeaderCode
18+
#include "qgslinegeneratorsymbollayerv2.h"
19+
%End
20+
public:
21+
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
22+
23+
QgsLineGeneratorSymbolLayerV2( QgsLineSymbolV2* symbol, const QgsStringMap& properties = QgsStringMap() );
24+
25+
QString layerType() const;
26+
27+
void startRender( QgsSymbolV2RenderContext& context );
28+
29+
void stopRender( QgsSymbolV2RenderContext& context );
30+
31+
QgsSymbolLayerV2* clone() const;
32+
33+
QgsStringMap properties() const;
34+
35+
void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size );
36+
37+
void setGeometryExpression( const QString& exp );
38+
39+
QString geometryExpression() const;
40+
41+
virtual QgsSymbolV2* subSymbol();
42+
43+
virtual bool setSubSymbol( QgsSymbolV2* symbol );
44+
45+
virtual QSet<QString> usedAttributes() const;
46+
47+
//! Will always return true.
48+
//! This is a hybrid layer, it constructs its own geometry so it does not
49+
//! care about the geometry of its parents.
50+
bool isCompatibleWithSymbol( QgsSymbolV2* symbol );
51+
52+
virtual void renderPolyline( const QPolygonF& point, QgsSymbolV2RenderContext& context );
53+
54+
private:
55+
QgsLineGeneratorSymbolLayerV2( const QgsLineGeneratorSymbolLayerV2& copy );
56+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/***************************************************************************
2+
qgspointgeneratorsymbollayerv2.sip
3+
---------------------
4+
begin : November 2015
5+
copyright : (C) 2015 by Matthias Kuhn
6+
email : matthias at opengis dot ch
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
class QgsPointGeneratorSymbolLayerV2 : QgsMarkerSymbolLayerV2
16+
{
17+
%TypeHeaderCode
18+
#include "qgspointgeneratorsymbollayerv2.h"
19+
%End
20+
public:
21+
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
22+
23+
QgsPointGeneratorSymbolLayerV2( QgsMarkerSymbolV2* symbol, const QgsStringMap& properties = QgsStringMap() );
24+
25+
QString layerType() const;
26+
27+
void startRender( QgsSymbolV2RenderContext& context );
28+
29+
void stopRender( QgsSymbolV2RenderContext& context );
30+
31+
QgsSymbolLayerV2* clone() const;
32+
33+
QgsStringMap properties() const;
34+
35+
void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size );
36+
37+
void setGeometryExpression( const QString& exp );
38+
39+
QString geometryExpression() const;
40+
41+
virtual QgsSymbolV2* subSymbol();
42+
43+
virtual bool setSubSymbol( QgsSymbolV2* symbol );
44+
45+
virtual QSet<QString> usedAttributes() const;
46+
47+
//! Will always return true.
48+
//! This is a hybrid layer, it constructs its own geometry so it does not
49+
//! care about the geometry of its parents.
50+
bool isCompatibleWithSymbol( QgsSymbolV2* symbol );
51+
52+
void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& context );
53+
54+
private:
55+
QgsPointGeneratorSymbolLayerV2( const QgsPointGeneratorSymbolLayerV2& copy );
56+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/***************************************************************************
2+
qgspolygongeneratorsymbollayerv2.sip
3+
---------------------
4+
begin : November 2015
5+
copyright : (C) 2015 by Matthias Kuhn
6+
email : matthias at opengis dot ch
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
class QgsPolygonGeneratorSymbolLayerV2 : QgsFillSymbolLayerV2
16+
{
17+
%TypeHeaderCode
18+
#include "qgspolygongeneratorsymbollayerv2.h"
19+
%End
20+
public:
21+
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
22+
23+
QgsPolygonGeneratorSymbolLayerV2( QgsFillSymbolV2* symbol, const QgsStringMap& properties = QgsStringMap() );
24+
25+
QString layerType() const;
26+
27+
void startRender( QgsSymbolV2RenderContext& context );
28+
29+
void stopRender( QgsSymbolV2RenderContext& context );
30+
31+
QgsSymbolLayerV2* clone() const;
32+
33+
QgsStringMap properties() const;
34+
35+
void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size );
36+
37+
void setGeometryExpression( const QString& exp );
38+
39+
QString geometryExpression() const;
40+
41+
virtual QgsSymbolV2* subSymbol();
42+
43+
virtual bool setSubSymbol( QgsSymbolV2* symbol );
44+
45+
virtual QSet<QString> usedAttributes() const;
46+
47+
//! Will always return true.
48+
//! This is a hybrid layer, it constructs its own geometry so it does not
49+
//! care about the geometry of its parents.
50+
bool isCompatibleWithSymbol( QgsSymbolV2* symbol );
51+
52+
void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
53+
54+
private:
55+
QgsPolygonGeneratorSymbolLayerV2( const QgsPolygonGeneratorSymbolLayerV2& copy );
56+
};

src/app/qgsprojectproperties.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1470,6 +1470,9 @@ void QgsProjectProperties::populateStyles()
14701470
case QgsSymbolV2::Fill :
14711471
cbo = cboStyleFill;
14721472
break;
1473+
case QgsSymbolV2::Hybrid:
1474+
// Shouldn't get here
1475+
break;
14731476
}
14741477
if ( cbo )
14751478
{

src/core/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ SET(QGIS_CORE_SRCS
4040
symbology-ng/qgspointdisplacementrenderer.cpp
4141
symbology-ng/qgsvectorfieldsymbollayer.cpp
4242
symbology-ng/qgscolorbrewerpalette.cpp
43+
symbology-ng/qgsgeometrygeneratorsymbollayerv2.cpp
4344

4445
diagram/qgsdiagram.cpp
4546
diagram/qgspiediagram.cpp
@@ -755,6 +756,7 @@ SET(QGIS_CORE_HDRS
755756
symbology-ng/qgssymbolv2.h
756757
symbology-ng/qgsvectorcolorrampv2.h
757758
symbology-ng/qgsvectorfieldsymbollayer.h
759+
symbology-ng/qgsgeometrygeneratorsymbollayerv2.h
758760

759761
layertree/qgslayertree.h
760762
layertree/qgslayertreeutils.h

0 commit comments

Comments
 (0)