Skip to content

Commit f2cc1d1

Browse files
committed
Merge branch 'master' of github.com:qgis/Quantum-GIS
2 parents d00c335 + 0138c47 commit f2cc1d1

File tree

2 files changed

+279
-57
lines changed

2 files changed

+279
-57
lines changed

python/core/symbology-ng-core.sip

+219
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,225 @@ protected:
721721
QgsFillSymbolLayerV2(bool locked = false);
722722
};
723723

724+
class QgsSimpleFillSymbolLayerV2 : QgsFillSymbolLayerV2
725+
{
726+
%TypeHeaderCode
727+
#include <qgsfillsymbollayerv2.h>
728+
%End
729+
public:
730+
QgsSimpleFillSymbolLayerV2( QColor color = DEFAULT_SIMPLEFILL_COLOR,
731+
Qt::BrushStyle style = DEFAULT_SIMPLEFILL_STYLE,
732+
QColor borderColor = DEFAULT_SIMPLEFILL_BORDERCOLOR,
733+
Qt::PenStyle borderStyle = DEFAULT_SIMPLEFILL_BORDERSTYLE,
734+
double borderWidth = DEFAULT_SIMPLEFILL_BORDERWIDTH );
735+
736+
// static stuff
737+
738+
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
739+
static QgsSymbolLayerV2* createFromSld( QDomElement &element ) /Factory/;
740+
741+
// implemented from base classes
742+
743+
QString layerType() const;
744+
745+
void startRender( QgsSymbolV2RenderContext& context );
746+
747+
void stopRender( QgsSymbolV2RenderContext& context );
748+
749+
void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
750+
751+
QgsStringMap properties() const;
752+
753+
QgsSymbolLayerV2* clone() const /Factory/;
754+
755+
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
756+
757+
Qt::BrushStyle brushStyle() const;
758+
void setBrushStyle( Qt::BrushStyle style );
759+
760+
QColor borderColor() const;
761+
void setBorderColor( QColor borderColor );
762+
763+
Qt::PenStyle borderStyle() const;
764+
void setBorderStyle( Qt::PenStyle borderStyle );
765+
766+
double borderWidth() const;
767+
void setBorderWidth( double borderWidth );
768+
769+
void setOffset( QPointF offset );
770+
QPointF offset();
771+
};
772+
773+
/**Base class for polygon renderers generating texture images*/
774+
class QgsImageFillSymbolLayer: QgsFillSymbolLayerV2
775+
{
776+
%TypeHeaderCode
777+
#include <qgsfillsymbollayerv2.h>
778+
%End
779+
public:
780+
QgsImageFillSymbolLayer();
781+
virtual ~QgsImageFillSymbolLayer();
782+
void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
783+
784+
virtual QgsSymbolV2* subSymbol();
785+
virtual bool setSubSymbol( QgsSymbolV2* symbol );
786+
};
787+
788+
/**A class for svg fill patterns. The class automatically scales the pattern to
789+
the appropriate pixel dimensions of the output device*/
790+
class QgsSVGFillSymbolLayer: QgsImageFillSymbolLayer
791+
{
792+
%TypeHeaderCode
793+
#include <qgsfillsymbollayerv2.h>
794+
%End
795+
public:
796+
QgsSVGFillSymbolLayer( const QString& svgFilePath = "", double width = 20, double rotation = 0.0 );
797+
QgsSVGFillSymbolLayer( const QByteArray& svgData, double width = 20, double rotation = 0.0 );
798+
~QgsSVGFillSymbolLayer();
799+
800+
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
801+
static QgsSymbolLayerV2* createFromSld( QDomElement &element ) /Factory/;
802+
803+
// implemented from base classes
804+
805+
QString layerType() const;
806+
807+
void startRender( QgsSymbolV2RenderContext& context );
808+
void stopRender( QgsSymbolV2RenderContext& context );
809+
810+
QgsStringMap properties() const;
811+
812+
QgsSymbolLayerV2* clone() const /Factory/;
813+
814+
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
815+
816+
//getters and setters
817+
void setSvgFilePath( const QString& svgPath );
818+
QString svgFilePath() const;
819+
void setPatternWidth( double width );
820+
double patternWidth() const;
821+
822+
void setSvgFillColor( const QColor& c );
823+
QColor svgFillColor() const;
824+
void setSvgOutlineColor( const QColor& c );
825+
QColor svgOutlineColor() const;
826+
void setSvgOutlineWidth( double w );
827+
double svgOutlineWidth() const;
828+
};
829+
830+
class QgsLinePatternFillSymbolLayer: QgsImageFillSymbolLayer
831+
{
832+
%TypeHeaderCode
833+
#include <qgsfillsymbollayerv2.h>
834+
%End
835+
public:
836+
QgsLinePatternFillSymbolLayer();
837+
~QgsLinePatternFillSymbolLayer();
838+
839+
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
840+
static QgsSymbolLayerV2* createFromSld( QDomElement &element ) /Factory/;
841+
842+
QString layerType() const;
843+
844+
void startRender( QgsSymbolV2RenderContext& context );
845+
846+
void stopRender( QgsSymbolV2RenderContext& context );
847+
848+
QgsStringMap properties() const;
849+
850+
QgsSymbolLayerV2* clone() const /Factory/;
851+
852+
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
853+
854+
//getters and setters
855+
void setLineAngle( double a );
856+
double lineAngle() const;
857+
void setDistance( double d );
858+
double distance() const;
859+
void setLineWidth( double w );
860+
double lineWidth() const;
861+
void setColor( const QColor& c );
862+
QColor color() const;
863+
void setOffset( double offset );
864+
double offset() const;
865+
};
866+
867+
class QgsPointPatternFillSymbolLayer: QgsImageFillSymbolLayer
868+
{
869+
%TypeHeaderCode
870+
#include <qgsfillsymbollayerv2.h>
871+
%End
872+
public:
873+
QgsPointPatternFillSymbolLayer();
874+
~QgsPointPatternFillSymbolLayer();
875+
876+
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
877+
static QgsSymbolLayerV2* createFromSld( QDomElement &element ) /Factory/;
878+
879+
QString layerType() const;
880+
881+
void startRender( QgsSymbolV2RenderContext& context );
882+
883+
void stopRender( QgsSymbolV2RenderContext& context );
884+
885+
QgsStringMap properties() const;
886+
887+
QgsSymbolLayerV2* clone() const /Factory/;
888+
889+
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
890+
891+
//getters and setters
892+
double distanceX() const;
893+
void setDistanceX( double d );
894+
895+
double distanceY() const;
896+
void setDistanceY( double d );
897+
898+
double displacementX() const;
899+
void setDisplacementX( double d );
900+
901+
double displacementY() const;
902+
void setDisplacementY( double d );
903+
904+
bool setSubSymbol( QgsSymbolV2* symbol );
905+
virtual QgsSymbolV2* subSymbol();
906+
};
907+
908+
class QgsCentroidFillSymbolLayerV2 : QgsFillSymbolLayerV2
909+
{
910+
%TypeHeaderCode
911+
#include <qgsfillsymbollayerv2.h>
912+
%End
913+
public:
914+
QgsCentroidFillSymbolLayerV2();
915+
~QgsCentroidFillSymbolLayerV2();
916+
917+
// static stuff
918+
919+
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
920+
static QgsSymbolLayerV2* createFromSld( QDomElement &element ) /Factory/;
921+
922+
// implemented from base classes
923+
924+
QString layerType() const;
925+
926+
void startRender( QgsSymbolV2RenderContext& context );
927+
928+
void stopRender( QgsSymbolV2RenderContext& context );
929+
930+
void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
931+
932+
QgsStringMap properties() const;
933+
934+
QgsSymbolLayerV2* clone() const /Factory/;
935+
936+
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
937+
938+
void setColor( const QColor& color );
939+
940+
QgsSymbolV2* subSymbol();
941+
bool setSubSymbol( QgsSymbolV2* symbol );
942+
};
724943

725944
///////////////
726945

src/app/legend/qgslegend.cpp

+60-57
Original file line numberDiff line numberDiff line change
@@ -233,23 +233,24 @@ int QgsLegend::addGroup( QString name, bool expand, int groupIndex )
233233
{
234234
QTreeWidgetItem * parentItem = invisibleRootItem();
235235

236-
int itemCount = 0;
237-
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
238-
{
239-
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
240-
if (legendItem->type() == QgsLegendItem::LEGEND_GROUP) {
241-
if (itemCount == groupIndex)
242-
{
243-
// this is the matching group
244-
parentItem = legendItem;
245-
break;
246-
}
247-
else
248-
{
249-
itemCount = itemCount + 1;
250-
}
251-
}
252-
}
236+
int itemCount = 0;
237+
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
238+
{
239+
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
240+
if ( legendItem->type() == QgsLegendItem::LEGEND_GROUP )
241+
{
242+
if ( itemCount == groupIndex )
243+
{
244+
// this is the matching group
245+
parentItem = legendItem;
246+
break;
247+
}
248+
else
249+
{
250+
itemCount = itemCount + 1;
251+
}
252+
}
253+
}
253254

254255
return addGroup( name, expand, parentItem );
255256
}
@@ -296,24 +297,25 @@ void QgsLegend::setLayersVisible( bool visible )
296297
void QgsLegend::removeGroup( int groupIndex )
297298
{
298299
QgsLegendGroup * lg = NULL;
299-
int itemCount = 0;
300-
301-
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
302-
{
303-
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
304-
if (legendItem->type() == QgsLegendItem::LEGEND_GROUP) {
305-
if (itemCount == groupIndex)
306-
{
307-
// this is the matching group
308-
lg = dynamic_cast<QgsLegendGroup*>( legendItem );
309-
break;
310-
}
311-
else
312-
{
313-
itemCount = itemCount + 1;
314-
}
315-
}
316-
}
300+
int itemCount = 0;
301+
302+
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
303+
{
304+
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
305+
if ( legendItem->type() == QgsLegendItem::LEGEND_GROUP )
306+
{
307+
if ( itemCount == groupIndex )
308+
{
309+
// this is the matching group
310+
lg = dynamic_cast<QgsLegendGroup*>( legendItem );
311+
break;
312+
}
313+
else
314+
{
315+
itemCount = itemCount + 1;
316+
}
317+
}
318+
}
317319

318320
if ( lg )
319321
{
@@ -1290,28 +1292,29 @@ void QgsLegend::moveLayer( QgsMapLayer *ml, int groupIndex )
12901292
if ( !layer )
12911293
return;
12921294

1293-
int itemCount = 0;
1294-
QgsLegendGroup *group = NULL;
1295-
1296-
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
1297-
{
1298-
1299-
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
1300-
if (legendItem->type() == QgsLegendItem::LEGEND_GROUP) {
1301-
if (itemCount == groupIndex)
1302-
{
1303-
// this is the matching group
1304-
group = dynamic_cast<QgsLegendGroup*>( legendItem );
1305-
break;
1306-
}
1307-
else
1308-
{
1309-
itemCount = itemCount + 1;
1310-
}
1311-
}
1312-
}
1313-
1314-
if ( group == NULL)
1295+
int itemCount = 0;
1296+
QgsLegendGroup *group = NULL;
1297+
1298+
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
1299+
{
1300+
1301+
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
1302+
if ( legendItem->type() == QgsLegendItem::LEGEND_GROUP )
1303+
{
1304+
if ( itemCount == groupIndex )
1305+
{
1306+
// this is the matching group
1307+
group = dynamic_cast<QgsLegendGroup*>( legendItem );
1308+
break;
1309+
}
1310+
else
1311+
{
1312+
itemCount = itemCount + 1;
1313+
}
1314+
}
1315+
}
1316+
1317+
if ( group == NULL )
13151318
return;
13161319

13171320
insertItem( layer, group );

0 commit comments

Comments
 (0)