QGIS API Documentation  2.11.0-Master
qgssymbollayerv2widget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssymbollayerv2widget.h - symbol layer widgets
3 
4  ---------------------
5  begin : November 2009
6  copyright : (C) 2009 by Martin Dobias
7  email : wonder dot sk at gmail dot com
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef QGSSYMBOLLAYERV2WIDGET_H
18 #define QGSSYMBOLLAYERV2WIDGET_H
19 
20 #include <qgsdatadefinedbutton.h>
21 
22 #include <QWidget>
23 
24 class QgsSymbolLayerV2;
25 class QgsVectorLayer;
26 
27 class GUI_EXPORT QgsSymbolLayerV2Widget : public QWidget
28 {
29  Q_OBJECT
30 
31  public:
32  QgsSymbolLayerV2Widget( QWidget* parent, const QgsVectorLayer* vl = 0 ) : QWidget( parent ), mVectorLayer( vl ) {}
34 
35  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) = 0;
36  virtual QgsSymbolLayerV2* symbolLayer() = 0;
37 
38  protected:
40 
41  void registerDataDefinedButton( QgsDataDefinedButton * button, const QString & propertyName, QgsDataDefinedButton::DataType type, const QString & description );
42 
48  Q_DECL_DEPRECATED virtual QString dataDefinedPropertyLabel( const QString &entryName );
49 
50  signals:
51  void changed();
52 
53  protected slots:
54  void updateDataDefinedProperty();
55 };
56 
58 
59 #include "ui_widget_simpleline.h"
60 
62 
63 class GUI_EXPORT QgsSimpleLineSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetSimpleLine
64 {
65  Q_OBJECT
66 
67  public:
68  QgsSimpleLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
69 
71 
72  // from base class
73  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
74  virtual QgsSymbolLayerV2* symbolLayer() override;
75 
76  public slots:
77  void penWidthChanged();
78  void colorChanged( const QColor& color );
79  void penStyleChanged();
80  void offsetChanged();
81  void on_mCustomCheckBox_stateChanged( int state );
82  void on_mChangePatternButton_clicked();
83  void on_mPenWidthUnitWidget_changed();
84  void on_mOffsetUnitWidget_changed();
85  void on_mDashPatternUnitWidget_changed();
86  void on_mDrawInsideCheckBox_stateChanged( int state );
87 
88  protected:
90 
91  //creates a new icon for the 'change pattern' button
92  void updatePatternIcon();
93 
94 };
95 
97 
98 #include "ui_widget_simplemarker.h"
99 
101 
102 class GUI_EXPORT QgsSimpleMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetSimpleMarker
103 {
104  Q_OBJECT
105 
106  public:
107  QgsSimpleMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
109 
111 
112  // from base class
113  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
114  virtual QgsSymbolLayerV2* symbolLayer() override;
115 
116  public slots:
117  void setName();
118  void setColorBorder( const QColor& color );
119  void setColorFill( const QColor& color );
120  void setSize();
121  void setAngle();
122  void setOffset();
123  void on_mSizeUnitWidget_changed();
124  void on_mOffsetUnitWidget_changed();
125  void on_mOutlineWidthUnitWidget_changed();
126  void on_mOutlineStyleComboBox_currentIndexChanged( int index );
127  void on_mOutlineWidthSpinBox_valueChanged( double d );
128  void on_mHorizontalAnchorComboBox_currentIndexChanged( int index );
129  void on_mVerticalAnchorComboBox_currentIndexChanged( int index );
130 
131  protected:
133 
134  private slots:
135 
136  void updateAssistantSymbol();
137 
138  private:
139 
140  QgsMarkerSymbolV2* mAssistantPreviewSymbol;
141 };
142 
144 
145 #include "ui_widget_simplefill.h"
146 
148 
149 class GUI_EXPORT QgsSimpleFillSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetSimpleFill
150 {
151  Q_OBJECT
152 
153  public:
154  QgsSimpleFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
155 
157 
158  // from base class
159  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
160  virtual QgsSymbolLayerV2* symbolLayer() override;
161 
162  public slots:
163  void setColor( const QColor& color );
164  void setBorderColor( const QColor& color );
165  void setBrushStyle();
166  void borderWidthChanged();
167  void borderStyleChanged();
168  void offsetChanged();
169  void on_mBorderWidthUnitWidget_changed();
170  void on_mOffsetUnitWidget_changed();
171 
172  protected:
174 };
175 
176 
178 
179 #include "ui_widget_gradientfill.h"
180 
182 
183 class GUI_EXPORT QgsGradientFillSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetGradientFill
184 {
185  Q_OBJECT
186 
187  public:
188  QgsGradientFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
189 
191 
192  // from base class
193  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
194  virtual QgsSymbolLayerV2* symbolLayer() override;
195 
196  public slots:
197  void setColor( const QColor& color );
198  void setColor2( const QColor& color );
199  void applyColorRamp();
200  void setGradientType( int index );
201  void setCoordinateMode( int index );
202  void setGradientSpread( int index );
203  void offsetChanged();
204  void referencePointChanged();
205  void on_mOffsetUnitWidget_changed();
206  void colorModeChanged();
207  void on_mSpinAngle_valueChanged( double value );
208 
209  protected:
211 };
212 
214 
215 #include "ui_widget_shapeburstfill.h"
216 
218 
219 class GUI_EXPORT QgsShapeburstFillSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetShapeburstFill
220 {
221  Q_OBJECT
222 
223  public:
224  QgsShapeburstFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
225 
227 
228  // from base class
229  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
230  virtual QgsSymbolLayerV2* symbolLayer() override;
231 
232  public slots:
233  void setColor( const QColor& color );
234  void setColor2( const QColor& color );
235  void colorModeChanged();
236  void on_mSpinBlurRadius_valueChanged( int value );
237  void on_mSpinMaxDistance_valueChanged( double value );
238  void on_mDistanceUnitWidget_changed();
239  void on_mRadioUseWholeShape_toggled( bool value );
240  void applyColorRamp();
241  void offsetChanged();
242  void on_mOffsetUnitWidget_changed();
243  void on_mIgnoreRingsCheckBox_stateChanged( int state );
244 
245  protected:
247 };
248 
250 
251 #include "ui_widget_markerline.h"
252 
254 
255 class GUI_EXPORT QgsMarkerLineSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetMarkerLine
256 {
257  Q_OBJECT
258 
259  public:
260  QgsMarkerLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
261 
263 
264  // from base class
265  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
266  virtual QgsSymbolLayerV2* symbolLayer() override;
267 
268  public slots:
269 
270  void setInterval( double val );
271  void setOffsetAlongLine( double val );
272  void setRotate();
273  void setOffset();
274  void setPlacement();
275  void on_mIntervalUnitWidget_changed();
276  void on_mOffsetUnitWidget_changed();
277  void on_mOffsetAlongLineUnitWidget_changed();
278 
279  protected:
280 
282 };
283 
284 
286 
287 #include "ui_widget_svgmarker.h"
288 
290 
291 class GUI_EXPORT QgsSvgMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetSvgMarker
292 {
293  Q_OBJECT
294 
295  public:
296  QgsSvgMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
298 
300 
301  // from base class
302  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
303  virtual QgsSymbolLayerV2* symbolLayer() override;
304 
305  public slots:
306  void setName( const QModelIndex& idx );
307  void populateIcons( const QModelIndex& idx );
308  void setSize();
309  void setAngle();
310  void setOffset();
311  void on_mFileToolButton_clicked();
312  void on_mFileLineEdit_textEdited( const QString& text );
313  void on_mFileLineEdit_editingFinished();
314  void on_mChangeColorButton_colorChanged( const QColor& color );
315  void on_mChangeBorderColorButton_colorChanged( const QColor& color );
316  void on_mBorderWidthSpinBox_valueChanged( double d );
317  void on_mSizeUnitWidget_changed();
318  void on_mBorderWidthUnitWidget_changed();
319  void on_mOffsetUnitWidget_changed();
320  void on_mHorizontalAnchorComboBox_currentIndexChanged( int index );
321  void on_mVerticalAnchorComboBox_currentIndexChanged( int index );
322 
323 
324  protected:
325 
326  void populateList();
327  //update gui for svg file (insert new path, update activation of gui elements for svg params)
328  void setGuiForSvg( const QgsSvgMarkerSymbolLayerV2* layer );
329 
331 
332  private slots:
333 
334  void updateAssistantSymbol();
335 
336  private:
337 
338  QgsMarkerSymbolV2* mAssistantPreviewSymbol;
339 
340 };
341 
343 
344 #include "ui_widget_rasterfill.h"
345 
347 
348 class GUI_EXPORT QgsRasterFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, private Ui::WidgetRasterFill
349 {
350  Q_OBJECT
351 
352  public:
353  QgsRasterFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
354 
356 
357  // from base class
358  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
359  virtual QgsSymbolLayerV2* symbolLayer() override;
360 
361  protected:
363 
364  private slots:
365  void on_mBrowseToolButton_clicked();
366  void on_mImageLineEdit_editingFinished();
367  void setCoordinateMode( int index );
368  void on_mSpinTransparency_valueChanged( int value );
369  void offsetChanged();
370  void on_mOffsetUnitWidget_changed();
371  void on_mRotationSpinBox_valueChanged( double d );
372  void on_mWidthUnitWidget_changed();
373  void on_mWidthSpinBox_valueChanged( double d );
374 
375  private:
376  void updatePreviewImage();
377 };
378 
380 
381 #include "ui_widget_svgfill.h"
382 
384 
385 class GUI_EXPORT QgsSVGFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, private Ui::WidgetSVGFill
386 {
387  Q_OBJECT
388 
389  public:
390  QgsSVGFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
391 
392  static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsSVGFillSymbolLayerWidget( vl ); }
393 
394  // from base class
395  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
396  virtual QgsSymbolLayerV2* symbolLayer() override;
397 
398  protected:
400  void insertIcons();
406  void updateParamGui( bool resetValues = true );
407 
408  private slots:
409  void on_mBrowseToolButton_clicked();
410  void on_mTextureWidthSpinBox_valueChanged( double d );
411  void on_mSVGLineEdit_textEdited( const QString & text );
412  void on_mSVGLineEdit_editingFinished();
413  void setFile( const QModelIndex& item );
414  void populateIcons( const QModelIndex& item );
415  void on_mRotationSpinBox_valueChanged( double d );
416  void on_mChangeColorButton_colorChanged( const QColor& color );
417  void on_mChangeBorderColorButton_colorChanged( const QColor& color );
418  void on_mBorderWidthSpinBox_valueChanged( double d );
419  void on_mTextureWidthUnitWidget_changed();
420  void on_mSvgOutlineWidthUnitWidget_changed();
421 };
422 
424 
425 #include "ui_widget_linepatternfill.h"
426 
428 
429 class GUI_EXPORT QgsLinePatternFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, private Ui::WidgetLinePatternFill
430 {
431  Q_OBJECT
432 
433  public:
434 
435  QgsLinePatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
437 
438  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
439  virtual QgsSymbolLayerV2* symbolLayer() override;
440 
441  protected:
443 
444  private slots:
445  void on_mAngleSpinBox_valueChanged( double d );
446  void on_mDistanceSpinBox_valueChanged( double d );
447  void on_mOffsetSpinBox_valueChanged( double d );
448  void on_mDistanceUnitWidget_changed();
449  void on_mOffsetUnitWidget_changed();
450 };
451 
453 
454 #include "ui_widget_pointpatternfill.h"
455 
457 
458 class GUI_EXPORT QgsPointPatternFillSymbolLayerWidget: public QgsSymbolLayerV2Widget, private Ui::WidgetPointPatternFill
459 {
460  Q_OBJECT
461 
462  public:
463  QgsPointPatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
465 
466  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
467  virtual QgsSymbolLayerV2* symbolLayer() override;
468 
469  protected:
471 
472  private slots:
473  void on_mHorizontalDistanceSpinBox_valueChanged( double d );
474  void on_mVerticalDistanceSpinBox_valueChanged( double d );
475  void on_mHorizontalDisplacementSpinBox_valueChanged( double d );
476  void on_mVerticalDisplacementSpinBox_valueChanged( double d );
477  void on_mHorizontalDistanceUnitWidget_changed();
478  void on_mVerticalDistanceUnitWidget_changed();
479  void on_mHorizontalDisplacementUnitWidget_changed();
480  void on_mVerticalDisplacementUnitWidget_changed();
481 };
482 
484 
485 #include "ui_widget_fontmarker.h"
486 
488 class CharacterWidget;
489 
490 class GUI_EXPORT QgsFontMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetFontMarker
491 {
492  Q_OBJECT
493 
494  public:
495  QgsFontMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
496 
498 
500 
501  // from base class
502  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
503  virtual QgsSymbolLayerV2* symbolLayer() override;
504 
505  public slots:
506  void setFontFamily( const QFont& font );
507  void setColor( const QColor& color );
508  void setSize( double size );
509  void setAngle( double angle );
510  void setCharacter( const QChar& chr );
511  void setOffset();
512  void on_mSizeUnitWidget_changed();
513  void on_mOffsetUnitWidget_changed();
514  void on_mHorizontalAnchorComboBox_currentIndexChanged( int index );
515  void on_mVerticalAnchorComboBox_currentIndexChanged( int index );
516 
517  protected:
520 
521  private slots:
522 
523  void updateAssistantSymbol();
524 
525  private:
526 
527  QgsMarkerSymbolV2* mAssistantPreviewSymbol;
528 
529 };
530 
532 
533 
534 #include "ui_widget_centroidfill.h"
535 
537 
538 class GUI_EXPORT QgsCentroidFillSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetCentroidFill
539 {
540  Q_OBJECT
541 
542  public:
543  QgsCentroidFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
544 
546 
547  // from base class
548  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
549  virtual QgsSymbolLayerV2* symbolLayer() override;
550 
551  public slots:
552  void on_mDrawInsideCheckBox_stateChanged( int state );
553 
554  protected:
556 };
557 
558 
559 #endif
virtual void setSymbolLayer(QgsSymbolLayerV2 *layer)=0
static unsigned index
QgsGradientFillSymbolLayerV2 * mLayer
QgsSimpleLineSymbolLayerV2 * mLayer
QgsLinePatternFillSymbolLayer * mLayer
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
QgsFontMarkerSymbolLayerV2 * mLayer
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
const QgsVectorLayer * mVectorLayer
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
A class for filling symbols with a repeated raster image.
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
QgsPointPatternFillSymbolLayer * mLayer
QgsRasterFillSymbolLayer * mLayer
QgsMarkerLineSymbolLayerV2 * mLayer
A button for defining data source field mappings or expressions.
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
void setName(const char *name)
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
QgsCentroidFillSymbolLayerV2 * mLayer
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
QgsSimpleMarkerSymbolLayerV2 * mLayer
QgsSymbolLayerV2Widget(QWidget *parent, const QgsVectorLayer *vl=0)
A class for svg fill patterns.
QgsSvgMarkerSymbolLayerV2 * mLayer
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
virtual QgsSymbolLayerV2 * symbolLayer()=0
QgsShapeburstFillSymbolLayerV2 * mLayer
Represents a vector layer which manages a vector based data sets.
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
QgsSVGFillSymbolLayer * mLayer
QgsSimpleFillSymbolLayerV2 * mLayer