Shortcuts for easier creation of symbology-ng symbols

git-svn-id: http://svn.osgeo.org/qgis/trunk@15663 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
wonder 2011-04-02 20:37:38 +00:00
parent 66fc75745f
commit d12254b4a3
3 changed files with 73 additions and 0 deletions

View File

@ -745,6 +745,12 @@ class QgsMarkerSymbolV2 : QgsSymbolV2
%End
public:
/** Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
This is a convenience method for easier creation of marker symbols.
\note added in v1.7
*/
static QgsMarkerSymbolV2* createSimple( const QgsStringMap& properties ) /Factory/;
QgsMarkerSymbolV2(QgsSymbolLayerV2List layers /Transfer/ = QgsSymbolLayerV2List());
void setAngle(double angle);
@ -767,6 +773,12 @@ class QgsLineSymbolV2 : QgsSymbolV2
%End
public:
/** Create a line symbol with one symbol layer: SimpleLine with specified properties.
This is a convenience method for easier creation of line symbols.
\note added in v1.7
*/
static QgsLineSymbolV2* createSimple( const QgsStringMap& properties ) /Factory/;
QgsLineSymbolV2(QgsSymbolLayerV2List layers /Transfer/ = QgsSymbolLayerV2List());
void setWidth(double width);
@ -786,6 +798,12 @@ class QgsFillSymbolV2 : QgsSymbolV2
%End
public:
/** Create a fill symbol with one symbol layer: SimpleFill with specified properties.
This is a convenience method for easier creation of fill symbols.
\note added in v1.7
*/
static QgsFillSymbolV2* createSimple( const QgsStringMap& properties ) /Factory/;
QgsFillSymbolV2(QgsSymbolLayerV2List layers /Transfer/ = QgsSymbolLayerV2List());
void setAngle( double angle );

View File

@ -306,6 +306,41 @@ QgsSymbolV2RenderContext& QgsSymbolV2RenderContext::operator=( const QgsSymbolV2
///////////////////
QgsMarkerSymbolV2* QgsMarkerSymbolV2::createSimple( const QgsStringMap& properties )
{
QgsSymbolLayerV2* sl = QgsSimpleMarkerSymbolLayerV2::create( properties );
if ( sl == NULL )
return NULL;
QgsSymbolLayerV2List layers;
layers.append( sl );
return new QgsMarkerSymbolV2( layers );
}
QgsLineSymbolV2* QgsLineSymbolV2::createSimple( const QgsStringMap& properties )
{
QgsSymbolLayerV2* sl = QgsSimpleLineSymbolLayerV2::create( properties );
if ( sl == NULL )
return NULL;
QgsSymbolLayerV2List layers;
layers.append( sl );
return new QgsLineSymbolV2( layers );
}
QgsFillSymbolV2* QgsFillSymbolV2::createSimple( const QgsStringMap& properties )
{
QgsSymbolLayerV2* sl = QgsSimpleFillSymbolLayerV2::create( properties );
if ( sl == NULL )
return NULL;
QgsSymbolLayerV2List layers;
layers.append( sl );
return new QgsFillSymbolV2( layers );
}
///////////////////
QgsMarkerSymbolV2::QgsMarkerSymbolV2( QgsSymbolLayerV2List layers )
: QgsSymbolV2( Marker, layers )

View File

@ -4,6 +4,7 @@
#include "qgis.h"
#include <QList>
#include <QMap>
class QColor;
class QImage;
@ -16,6 +17,7 @@ class QPolygonF;
class QgsSymbolLayerV2;
class QgsRenderContext;
typedef QMap<QString, QString> QgsStringMap;
typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List;
class CORE_EXPORT QgsSymbolV2
@ -168,6 +170,12 @@ class CORE_EXPORT QgsSymbolV2RenderContext
class CORE_EXPORT QgsMarkerSymbolV2 : public QgsSymbolV2
{
public:
/** Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
This is a convenience method for easier creation of marker symbols.
\note added in v1.7
*/
static QgsMarkerSymbolV2* createSimple( const QgsStringMap& properties );
QgsMarkerSymbolV2( QgsSymbolLayerV2List layers = QgsSymbolLayerV2List() );
void setAngle( double angle );
@ -186,6 +194,12 @@ class CORE_EXPORT QgsMarkerSymbolV2 : public QgsSymbolV2
class CORE_EXPORT QgsLineSymbolV2 : public QgsSymbolV2
{
public:
/** Create a line symbol with one symbol layer: SimpleLine with specified properties.
This is a convenience method for easier creation of line symbols.
\note added in v1.7
*/
static QgsLineSymbolV2* createSimple( const QgsStringMap& properties );
QgsLineSymbolV2( QgsSymbolLayerV2List layers = QgsSymbolLayerV2List() );
void setWidth( double width );
@ -201,6 +215,12 @@ class CORE_EXPORT QgsLineSymbolV2 : public QgsSymbolV2
class CORE_EXPORT QgsFillSymbolV2 : public QgsSymbolV2
{
public:
/** Create a fill symbol with one symbol layer: SimpleFill with specified properties.
This is a convenience method for easier creation of fill symbols.
\note added in v1.7
*/
static QgsFillSymbolV2* createSimple( const QgsStringMap& properties );
QgsFillSymbolV2( QgsSymbolLayerV2List layers = QgsSymbolLayerV2List() );
void setAngle( double angle );
void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsRenderContext& context, int layer = -1, bool selected = false );