Skip to content
Permalink
Browse files

add sip bindings for QgsPalLabeling, QgsSimpleMarkerSymbolLayerV2,

QgsSvgMarkerSymbolLayerV2, QgsFontMarkerSymbolLayerV2
  • Loading branch information
jef-n committed Sep 16, 2012
1 parent 21c5988 commit d8675ba32a381baa4bba920298e11ffa10310f2f
@@ -102,6 +102,7 @@
%Include qgsnetworkaccessmanager.sip

%Include symbology-ng-core.sip
%Include qgspallabeling.sip

%Include qgsgpsconnection.sip
%Include qgsgpsconnectionregistry.sip
@@ -609,6 +609,7 @@ class QgsSymbolLayerV2

public:

// not necessarily supported by all symbol layers...
virtual void setColor(const QColor& color);
virtual QColor color() const;

@@ -621,6 +622,8 @@ public:

virtual QgsSymbolLayerV2* clone() const = 0 /Factory/;

virtual void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

virtual QgsStringMap properties() const = 0;

virtual void drawPreviewIcon(QgsSymbolV2RenderContext& context, QSize size) = 0;
@@ -637,6 +640,8 @@ public:
void setRenderingPass(int renderingPass);
int renderingPass() const;

virtual QSet<QString> usedAttributes() const;

protected:
QgsSymbolLayerV2(QgsSymbolV2::SymbolType type, bool locked = false);

@@ -661,6 +666,16 @@ public:
void setSize(double size);
double size() const;

void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod );
QgsSymbolV2::ScaleMethod scaleMethod() const;

void setOffset( QPointF offset );
QPointF offset();

void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

virtual void writeSldMarker( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

protected:
QgsMarkerSymbolLayerV2(bool locked = false);

@@ -780,12 +795,18 @@ public:
MapUnit
};

enum SymbolType
{
Marker,
Line,
Fill
};
enum SymbolType
{
Marker,
Line,
Fill
};

enum ScaleMethod
{
ScaleArea,
ScaleDiameter
};

//! @note added in 1.5
enum RenderHint
@@ -794,59 +815,65 @@ public:
DataDefinedRotation = 2
};

virtual ~QgsSymbolV2();
virtual ~QgsSymbolV2();

//! return new default symbol for specified geometry type
static QgsSymbolV2* defaultSymbol(QGis::GeometryType geomType) /Factory/;
//! return new default symbol for specified geometry type
static QgsSymbolV2* defaultSymbol(QGis::GeometryType geomType) /Factory/;

SymbolType type() const;
SymbolType type() const;

// symbol layers handling
// symbol layers handling

QgsSymbolLayerV2* symbolLayer(int layer);
QgsSymbolLayerV2* symbolLayer(int layer);

int symbolLayerCount();
int symbolLayerCount();

//! insert symbol layer to specified index
bool insertSymbolLayer(int index, QgsSymbolLayerV2* layer /Transfer/);
//! insert symbol layer to specified index
bool insertSymbolLayer(int index, QgsSymbolLayerV2* layer /Transfer/);

//! append symbol layer at the end of the list
bool appendSymbolLayer(QgsSymbolLayerV2* layer /Transfer/);
//! append symbol layer at the end of the list
bool appendSymbolLayer(QgsSymbolLayerV2* layer /Transfer/);

//! delete symbol layer at specified index
bool deleteSymbolLayer(int index);
//! delete symbol layer at specified index
bool deleteSymbolLayer(int index);

//! remove symbol layer from the list and return pointer to it
QgsSymbolLayerV2* takeSymbolLayer(int index) /TransferBack/;
//! remove symbol layer from the list and return pointer to it
QgsSymbolLayerV2* takeSymbolLayer(int index) /TransferBack/;

//! delete layer at specified index and set a new one
bool changeSymbolLayer(int index, QgsSymbolLayerV2* layer /Transfer/);
//! delete layer at specified index and set a new one
bool changeSymbolLayer(int index, QgsSymbolLayerV2* layer /Transfer/);

void startRender( QgsRenderContext& context, const QgsVectorLayer* layer = 0 );
void stopRender(QgsRenderContext& context);
void startRender( QgsRenderContext& context, const QgsVectorLayer* layer = 0 );
void stopRender(QgsRenderContext& context);

void setColor(const QColor& color);
QColor color();
void setColor(const QColor& color);
QColor color();

void drawPreviewIcon(QPainter* painter, QSize size);
void drawPreviewIcon(QPainter* painter, QSize size);

QImage bigSymbolPreviewImage();
QImage bigSymbolPreviewImage();

QString dump();
QString dump();

virtual QgsSymbolV2* clone() const = 0 /Factory/;

virtual QgsSymbolV2* clone() const = 0 /Factory/;
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

OutputUnit outputUnit() const;
void setOutputUnit( OutputUnit u );

//! Get alpha transparency 1 for opaque, 0 for invisible
qreal alpha() const;
//! Set alpha transparency 1 for opaque, 0 for invisible
void setAlpha( qreal alpha );

//! @note added in 1.5
int renderHints();
//! @note added in 1.5
void setRenderHints( int hints );

QSet<QString> usedAttributes() const;

protected:
QgsSymbolV2(SymbolType type, QgsSymbolLayerV2List layers /Transfer/); // can't be instantiated

@@ -861,12 +888,12 @@ class QgsMarkerSymbolV2 : QgsSymbolV2
#include <qgssymbolv2.h>
%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/;
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());

@@ -876,6 +903,9 @@ public:
void setSize(double size);
double size();

void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod );
ScaleMethod scaleMethod();

void renderPoint(const QPointF& point, const QgsFeature* f, QgsRenderContext& context, int layer = -1, bool selected = false );

virtual QgsSymbolV2* clone() const /Factory/;
@@ -931,6 +961,161 @@ public:

//////////

class QgsSimpleMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
{
%TypeHeaderCode
#include <qgsmarkersymbollayerv2.h>
%End
public:
QgsSimpleMarkerSymbolLayerV2( QString name = DEFAULT_SIMPLEMARKER_NAME,
QColor color = DEFAULT_SIMPLEMARKER_COLOR,
QColor borderColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR,
double size = DEFAULT_SIMPLEMARKER_SIZE,
double angle = DEFAULT_SIMPLEMARKER_ANGLE,
QgsSymbolV2::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD );

// static stuff

static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
static QgsSymbolLayerV2* createFromSld( QDomElement &element ) /Factory/;

// implemented from base classes

QString layerType() const;

void startRender( QgsSymbolV2RenderContext& context );

void stopRender( QgsSymbolV2RenderContext& context );

void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& context );

QgsStringMap properties() const;

QgsSymbolLayerV2* clone() const /Factory/;

void writeSldMarker( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

QString name() const;
void setName( QString name );

QColor borderColor() const;
void setBorderColor( QColor color );

protected:

void drawMarker( QPainter* p, QgsSymbolV2RenderContext& context );

bool prepareShape();
bool preparePath();

void prepareCache( QgsSymbolV2RenderContext& context );
};

//////////

class QgsSvgMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
{
%TypeHeaderCode
#include <qgsmarkersymbollayerv2.h>
%End
public:
QgsSvgMarkerSymbolLayerV2( QString name = DEFAULT_SVGMARKER_NAME,
double size = DEFAULT_SVGMARKER_SIZE,
double angle = DEFAULT_SVGMARKER_ANGLE );

// static stuff

static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
static QgsSymbolLayerV2* createFromSld( QDomElement &element ) /Factory/;

//! Return a list of all available svg files
static QStringList listSvgFiles();

//! Return a list of svg files at the specified directory
static QStringList listSvgFilesAt( QString directory );

//! Get symbol's path from its name
static QString symbolNameToPath( QString name );

//! Get symbols's name from its path
static QString symbolPathToName( QString path );

// implemented from base classes

QString layerType() const;

void startRender( QgsSymbolV2RenderContext& context );

void stopRender( QgsSymbolV2RenderContext& context );

void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& context );

QgsStringMap properties() const;

QgsSymbolLayerV2* clone() const /Factory/;

void writeSldMarker( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

QString path() const;
void setPath( QString path );

QColor fillColor() const;
void setFillColor( const QColor& c );

QColor outlineColor() const;
void setOutlineColor( const QColor& c );

double outlineWidth() const;
void setOutlineWidth( double w );
};


//////////

class QgsFontMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
{
%TypeHeaderCode
#include <qgsmarkersymbollayerv2.h>
%End
public:
QgsFontMarkerSymbolLayerV2( QString fontFamily = DEFAULT_FONTMARKER_FONT,
QChar chr = DEFAULT_FONTMARKER_CHR,
double pointSize = DEFAULT_FONTMARKER_SIZE,
QColor color = DEFAULT_FONTMARKER_COLOR,
double angle = DEFAULT_FONTMARKER_ANGLE );

// static stuff

static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
static QgsSymbolLayerV2* createFromSld( QDomElement &element ) /Factory/;

// implemented from base classes

QString layerType() const;

void startRender( QgsSymbolV2RenderContext& context );

void stopRender( QgsSymbolV2RenderContext& context );

void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& context );

QgsStringMap properties() const;

QgsSymbolLayerV2* clone() const /Factory/;

void writeSldMarker( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

// new methods

QString fontFamily() const;
void setFontFamily( QString family );

QChar character() const;
void setCharacter( QChar ch );
};

//////////

typedef QMap<QString, QString> QgsStringMap;

typedef QMap<int, QgsField> QgsFieldMap;
@@ -30,8 +30,9 @@ class QgsRenderContext;
class QDomElement;
namespace pal { class Layer; }

struct CORE_EXPORT QgsDiagramLayerSettings
class CORE_EXPORT QgsDiagramLayerSettings
{
public:
//avoid inclusion of QgsPalLabeling
enum Placement
{
@@ -88,8 +89,9 @@ struct CORE_EXPORT QgsDiagramLayerSettings
};

//diagram settings for rendering
struct CORE_EXPORT QgsDiagramSettings
class CORE_EXPORT QgsDiagramSettings
{
public:
enum SizeType
{
MM,
@@ -139,8 +141,9 @@ struct CORE_EXPORT QgsDiagramSettings
};

//additional diagram settings for interpolated size rendering
struct CORE_EXPORT QgsDiagramInterpolationSettings
class CORE_EXPORT QgsDiagramInterpolationSettings
{
public:
QSizeF lowerSize;
QSizeF upperSize;
double lowerValue;

0 comments on commit d8675ba

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