mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
add more sip bindings:
QgsCentroidFillSymbolLayerV2 QgsImageFillSymbolLayer QgsLinePatternFillSymbolLayer QgsPointPatternFillSymbolLayer QgsSVGFillSymbolLayer QgsSimpleFillSymbolLayerV2
This commit is contained in:
parent
8898e6b847
commit
0138c47e45
@ -721,6 +721,225 @@ protected:
|
||||
QgsFillSymbolLayerV2(bool locked = false);
|
||||
};
|
||||
|
||||
class QgsSimpleFillSymbolLayerV2 : QgsFillSymbolLayerV2
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsfillsymbollayerv2.h>
|
||||
%End
|
||||
public:
|
||||
QgsSimpleFillSymbolLayerV2( QColor color = DEFAULT_SIMPLEFILL_COLOR,
|
||||
Qt::BrushStyle style = DEFAULT_SIMPLEFILL_STYLE,
|
||||
QColor borderColor = DEFAULT_SIMPLEFILL_BORDERCOLOR,
|
||||
Qt::PenStyle borderStyle = DEFAULT_SIMPLEFILL_BORDERSTYLE,
|
||||
double borderWidth = DEFAULT_SIMPLEFILL_BORDERWIDTH );
|
||||
|
||||
// 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 renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
|
||||
|
||||
QgsStringMap properties() const;
|
||||
|
||||
QgsSymbolLayerV2* clone() const /Factory/;
|
||||
|
||||
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
|
||||
|
||||
Qt::BrushStyle brushStyle() const;
|
||||
void setBrushStyle( Qt::BrushStyle style );
|
||||
|
||||
QColor borderColor() const;
|
||||
void setBorderColor( QColor borderColor );
|
||||
|
||||
Qt::PenStyle borderStyle() const;
|
||||
void setBorderStyle( Qt::PenStyle borderStyle );
|
||||
|
||||
double borderWidth() const;
|
||||
void setBorderWidth( double borderWidth );
|
||||
|
||||
void setOffset( QPointF offset );
|
||||
QPointF offset();
|
||||
};
|
||||
|
||||
/**Base class for polygon renderers generating texture images*/
|
||||
class QgsImageFillSymbolLayer: QgsFillSymbolLayerV2
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsfillsymbollayerv2.h>
|
||||
%End
|
||||
public:
|
||||
QgsImageFillSymbolLayer();
|
||||
virtual ~QgsImageFillSymbolLayer();
|
||||
void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
|
||||
|
||||
virtual QgsSymbolV2* subSymbol();
|
||||
virtual bool setSubSymbol( QgsSymbolV2* symbol );
|
||||
};
|
||||
|
||||
/**A class for svg fill patterns. The class automatically scales the pattern to
|
||||
the appropriate pixel dimensions of the output device*/
|
||||
class QgsSVGFillSymbolLayer: QgsImageFillSymbolLayer
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsfillsymbollayerv2.h>
|
||||
%End
|
||||
public:
|
||||
QgsSVGFillSymbolLayer( const QString& svgFilePath = "", double width = 20, double rotation = 0.0 );
|
||||
QgsSVGFillSymbolLayer( const QByteArray& svgData, double width = 20, double rotation = 0.0 );
|
||||
~QgsSVGFillSymbolLayer();
|
||||
|
||||
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 );
|
||||
|
||||
QgsStringMap properties() const;
|
||||
|
||||
QgsSymbolLayerV2* clone() const /Factory/;
|
||||
|
||||
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
|
||||
|
||||
//getters and setters
|
||||
void setSvgFilePath( const QString& svgPath );
|
||||
QString svgFilePath() const;
|
||||
void setPatternWidth( double width );
|
||||
double patternWidth() const;
|
||||
|
||||
void setSvgFillColor( const QColor& c );
|
||||
QColor svgFillColor() const;
|
||||
void setSvgOutlineColor( const QColor& c );
|
||||
QColor svgOutlineColor() const;
|
||||
void setSvgOutlineWidth( double w );
|
||||
double svgOutlineWidth() const;
|
||||
};
|
||||
|
||||
class QgsLinePatternFillSymbolLayer: QgsImageFillSymbolLayer
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsfillsymbollayerv2.h>
|
||||
%End
|
||||
public:
|
||||
QgsLinePatternFillSymbolLayer();
|
||||
~QgsLinePatternFillSymbolLayer();
|
||||
|
||||
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
|
||||
static QgsSymbolLayerV2* createFromSld( QDomElement &element ) /Factory/;
|
||||
|
||||
QString layerType() const;
|
||||
|
||||
void startRender( QgsSymbolV2RenderContext& context );
|
||||
|
||||
void stopRender( QgsSymbolV2RenderContext& context );
|
||||
|
||||
QgsStringMap properties() const;
|
||||
|
||||
QgsSymbolLayerV2* clone() const /Factory/;
|
||||
|
||||
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
|
||||
|
||||
//getters and setters
|
||||
void setLineAngle( double a );
|
||||
double lineAngle() const;
|
||||
void setDistance( double d );
|
||||
double distance() const;
|
||||
void setLineWidth( double w );
|
||||
double lineWidth() const;
|
||||
void setColor( const QColor& c );
|
||||
QColor color() const;
|
||||
void setOffset( double offset );
|
||||
double offset() const;
|
||||
};
|
||||
|
||||
class QgsPointPatternFillSymbolLayer: QgsImageFillSymbolLayer
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsfillsymbollayerv2.h>
|
||||
%End
|
||||
public:
|
||||
QgsPointPatternFillSymbolLayer();
|
||||
~QgsPointPatternFillSymbolLayer();
|
||||
|
||||
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
|
||||
static QgsSymbolLayerV2* createFromSld( QDomElement &element ) /Factory/;
|
||||
|
||||
QString layerType() const;
|
||||
|
||||
void startRender( QgsSymbolV2RenderContext& context );
|
||||
|
||||
void stopRender( QgsSymbolV2RenderContext& context );
|
||||
|
||||
QgsStringMap properties() const;
|
||||
|
||||
QgsSymbolLayerV2* clone() const /Factory/;
|
||||
|
||||
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
|
||||
|
||||
//getters and setters
|
||||
double distanceX() const;
|
||||
void setDistanceX( double d );
|
||||
|
||||
double distanceY() const;
|
||||
void setDistanceY( double d );
|
||||
|
||||
double displacementX() const;
|
||||
void setDisplacementX( double d );
|
||||
|
||||
double displacementY() const;
|
||||
void setDisplacementY( double d );
|
||||
|
||||
bool setSubSymbol( QgsSymbolV2* symbol );
|
||||
virtual QgsSymbolV2* subSymbol();
|
||||
};
|
||||
|
||||
class QgsCentroidFillSymbolLayerV2 : QgsFillSymbolLayerV2
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsfillsymbollayerv2.h>
|
||||
%End
|
||||
public:
|
||||
QgsCentroidFillSymbolLayerV2();
|
||||
~QgsCentroidFillSymbolLayerV2();
|
||||
|
||||
// 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 renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
|
||||
|
||||
QgsStringMap properties() const;
|
||||
|
||||
QgsSymbolLayerV2* clone() const /Factory/;
|
||||
|
||||
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
|
||||
|
||||
void setColor( const QColor& color );
|
||||
|
||||
QgsSymbolV2* subSymbol();
|
||||
bool setSubSymbol( QgsSymbolV2* symbol );
|
||||
};
|
||||
|
||||
///////////////
|
||||
|
||||
|
@ -233,23 +233,24 @@ int QgsLegend::addGroup( QString name, bool expand, int groupIndex )
|
||||
{
|
||||
QTreeWidgetItem * parentItem = invisibleRootItem();
|
||||
|
||||
int itemCount = 0;
|
||||
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
|
||||
{
|
||||
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
|
||||
if (legendItem->type() == QgsLegendItem::LEGEND_GROUP) {
|
||||
if (itemCount == groupIndex)
|
||||
{
|
||||
// this is the matching group
|
||||
parentItem = legendItem;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemCount = itemCount + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
int itemCount = 0;
|
||||
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
|
||||
{
|
||||
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
|
||||
if ( legendItem->type() == QgsLegendItem::LEGEND_GROUP )
|
||||
{
|
||||
if ( itemCount == groupIndex )
|
||||
{
|
||||
// this is the matching group
|
||||
parentItem = legendItem;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemCount = itemCount + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return addGroup( name, expand, parentItem );
|
||||
}
|
||||
@ -296,24 +297,25 @@ void QgsLegend::setLayersVisible( bool visible )
|
||||
void QgsLegend::removeGroup( int groupIndex )
|
||||
{
|
||||
QgsLegendGroup * lg = NULL;
|
||||
int itemCount = 0;
|
||||
int itemCount = 0;
|
||||
|
||||
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
|
||||
{
|
||||
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
|
||||
if (legendItem->type() == QgsLegendItem::LEGEND_GROUP) {
|
||||
if (itemCount == groupIndex)
|
||||
{
|
||||
// this is the matching group
|
||||
lg = dynamic_cast<QgsLegendGroup*>( legendItem );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemCount = itemCount + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
|
||||
{
|
||||
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
|
||||
if ( legendItem->type() == QgsLegendItem::LEGEND_GROUP )
|
||||
{
|
||||
if ( itemCount == groupIndex )
|
||||
{
|
||||
// this is the matching group
|
||||
lg = dynamic_cast<QgsLegendGroup*>( legendItem );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemCount = itemCount + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( lg )
|
||||
{
|
||||
@ -1290,28 +1292,29 @@ void QgsLegend::moveLayer( QgsMapLayer *ml, int groupIndex )
|
||||
if ( !layer )
|
||||
return;
|
||||
|
||||
int itemCount = 0;
|
||||
QgsLegendGroup *group = NULL;
|
||||
int itemCount = 0;
|
||||
QgsLegendGroup *group = NULL;
|
||||
|
||||
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
|
||||
{
|
||||
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
|
||||
{
|
||||
|
||||
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
|
||||
if (legendItem->type() == QgsLegendItem::LEGEND_GROUP) {
|
||||
if (itemCount == groupIndex)
|
||||
{
|
||||
// this is the matching group
|
||||
group = dynamic_cast<QgsLegendGroup*>( legendItem );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemCount = itemCount + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
|
||||
if ( legendItem->type() == QgsLegendItem::LEGEND_GROUP )
|
||||
{
|
||||
if ( itemCount == groupIndex )
|
||||
{
|
||||
// this is the matching group
|
||||
group = dynamic_cast<QgsLegendGroup*>( legendItem );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemCount = itemCount + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( group == NULL)
|
||||
if ( group == NULL )
|
||||
return;
|
||||
|
||||
insertItem( layer, group );
|
||||
|
Loading…
x
Reference in New Issue
Block a user