QGIS API Documentation  2.11.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 on_mButtonEditRamp_clicked();
201  void setGradientType( int index );
202  void setCoordinateMode( int index );
203  void setGradientSpread( int index );
204  void offsetChanged();
205  void referencePointChanged();
206  void on_mOffsetUnitWidget_changed();
207  void colorModeChanged();
208  void on_mSpinAngle_valueChanged( double value );
209 
210  protected:
212 };
213 
215 
216 #include "ui_widget_shapeburstfill.h"
217 
219 
220 class GUI_EXPORT QgsShapeburstFillSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetShapeburstFill
221 {
222  Q_OBJECT
223 
224  public:
225  QgsShapeburstFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
226 
228 
229  // from base class
230  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
231  virtual QgsSymbolLayerV2* symbolLayer() override;
232 
233  public slots:
234  void setColor( const QColor& color );
235  void setColor2( const QColor& color );
236  void colorModeChanged();
237  void on_mSpinBlurRadius_valueChanged( int value );
238  void on_mSpinMaxDistance_valueChanged( double value );
239  void on_mDistanceUnitWidget_changed();
240  void on_mRadioUseWholeShape_toggled( bool value );
241  void applyColorRamp();
242  void on_mButtonEditRamp_clicked();
243  void offsetChanged();
244  void on_mOffsetUnitWidget_changed();
245  void on_mIgnoreRingsCheckBox_stateChanged( int state );
246 
247  protected:
249 };
250 
252 
253 #include "ui_widget_markerline.h"
254 
256 
257 class GUI_EXPORT QgsMarkerLineSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetMarkerLine
258 {
259  Q_OBJECT
260 
261  public:
262  QgsMarkerLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
263 
265 
266  // from base class
267  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
268  virtual QgsSymbolLayerV2* symbolLayer() override;
269 
270  public slots:
271 
272  void setInterval( double val );
273  void setOffsetAlongLine( double val );
274  void setRotate();
275  void setOffset();
276  void setPlacement();
277  void on_mIntervalUnitWidget_changed();
278  void on_mOffsetUnitWidget_changed();
279  void on_mOffsetAlongLineUnitWidget_changed();
280 
281  protected:
282 
284 };
285 
286 
288 
289 #include "ui_widget_svgmarker.h"
290 
292 
293 class GUI_EXPORT QgsSvgMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetSvgMarker
294 {
295  Q_OBJECT
296 
297  public:
298  QgsSvgMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
300 
302 
303  // from base class
304  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
305  virtual QgsSymbolLayerV2* symbolLayer() override;
306 
307  public slots:
308  void setName( const QModelIndex& idx );
309  void populateIcons( const QModelIndex& idx );
310  void setSize();
311  void setAngle();
312  void setOffset();
313  void on_mFileToolButton_clicked();
314  void on_mFileLineEdit_textEdited( const QString& text );
315  void on_mFileLineEdit_editingFinished();
316  void on_mChangeColorButton_colorChanged( const QColor& color );
317  void on_mChangeBorderColorButton_colorChanged( const QColor& color );
318  void on_mBorderWidthSpinBox_valueChanged( double d );
319  void on_mSizeUnitWidget_changed();
320  void on_mBorderWidthUnitWidget_changed();
321  void on_mOffsetUnitWidget_changed();
322  void on_mHorizontalAnchorComboBox_currentIndexChanged( int index );
323  void on_mVerticalAnchorComboBox_currentIndexChanged( int index );
324 
325 
326  protected:
327 
328  void populateList();
329  //update gui for svg file (insert new path, update activation of gui elements for svg params)
330  void setGuiForSvg( const QgsSvgMarkerSymbolLayerV2* layer );
331 
333 
334  private slots:
335 
336  void updateAssistantSymbol();
337 
338  private:
339 
340  QgsMarkerSymbolV2* mAssistantPreviewSymbol;
341 
342 };
343 
345 
346 #include "ui_widget_rasterfill.h"
347 
349 
350 class GUI_EXPORT QgsRasterFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, private Ui::WidgetRasterFill
351 {
352  Q_OBJECT
353 
354  public:
355  QgsRasterFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
356 
358 
359  // from base class
360  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
361  virtual QgsSymbolLayerV2* symbolLayer() override;
362 
363  protected:
365 
366  private slots:
367  void on_mBrowseToolButton_clicked();
368  void on_mImageLineEdit_editingFinished();
369  void setCoordinateMode( int index );
370  void on_mSpinTransparency_valueChanged( int value );
371  void offsetChanged();
372  void on_mOffsetUnitWidget_changed();
373  void on_mRotationSpinBox_valueChanged( double d );
374  void on_mWidthUnitWidget_changed();
375  void on_mWidthSpinBox_valueChanged( double d );
376 
377  private:
378  void updatePreviewImage();
379 };
380 
382 
383 #include "ui_widget_svgfill.h"
384 
386 
387 class GUI_EXPORT QgsSVGFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, private Ui::WidgetSVGFill
388 {
389  Q_OBJECT
390 
391  public:
392  QgsSVGFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
393 
394  static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsSVGFillSymbolLayerWidget( vl ); }
395 
396  // from base class
397  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
398  virtual QgsSymbolLayerV2* symbolLayer() override;
399 
400  protected:
402  void insertIcons();
408  void updateParamGui( bool resetValues = true );
409 
410  private slots:
411  void on_mBrowseToolButton_clicked();
412  void on_mTextureWidthSpinBox_valueChanged( double d );
413  void on_mSVGLineEdit_textEdited( const QString & text );
414  void on_mSVGLineEdit_editingFinished();
415  void setFile( const QModelIndex& item );
416  void populateIcons( const QModelIndex& item );
417  void on_mRotationSpinBox_valueChanged( double d );
418  void on_mChangeColorButton_colorChanged( const QColor& color );
419  void on_mChangeBorderColorButton_colorChanged( const QColor& color );
420  void on_mBorderWidthSpinBox_valueChanged( double d );
421  void on_mTextureWidthUnitWidget_changed();
422  void on_mSvgOutlineWidthUnitWidget_changed();
423 };
424 
426 
427 #include "ui_widget_linepatternfill.h"
428 
430 
431 class GUI_EXPORT QgsLinePatternFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, private Ui::WidgetLinePatternFill
432 {
433  Q_OBJECT
434 
435  public:
436 
437  QgsLinePatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
439 
440  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
441  virtual QgsSymbolLayerV2* symbolLayer() override;
442 
443  protected:
445 
446  private slots:
447  void on_mAngleSpinBox_valueChanged( double d );
448  void on_mDistanceSpinBox_valueChanged( double d );
449  void on_mOffsetSpinBox_valueChanged( double d );
450  void on_mDistanceUnitWidget_changed();
451  void on_mOffsetUnitWidget_changed();
452 };
453 
455 
456 #include "ui_widget_pointpatternfill.h"
457 
459 
460 class GUI_EXPORT QgsPointPatternFillSymbolLayerWidget: public QgsSymbolLayerV2Widget, private Ui::WidgetPointPatternFill
461 {
462  Q_OBJECT
463 
464  public:
465  QgsPointPatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
467 
468  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
469  virtual QgsSymbolLayerV2* symbolLayer() override;
470 
471  protected:
473 
474  private slots:
475  void on_mHorizontalDistanceSpinBox_valueChanged( double d );
476  void on_mVerticalDistanceSpinBox_valueChanged( double d );
477  void on_mHorizontalDisplacementSpinBox_valueChanged( double d );
478  void on_mVerticalDisplacementSpinBox_valueChanged( double d );
479  void on_mHorizontalDistanceUnitWidget_changed();
480  void on_mVerticalDistanceUnitWidget_changed();
481  void on_mHorizontalDisplacementUnitWidget_changed();
482  void on_mVerticalDisplacementUnitWidget_changed();
483 };
484 
486 
487 #include "ui_widget_fontmarker.h"
488 
490 class CharacterWidget;
491 
492 class GUI_EXPORT QgsFontMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetFontMarker
493 {
494  Q_OBJECT
495 
496  public:
497  QgsFontMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
498 
500 
502 
503  // from base class
504  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
505  virtual QgsSymbolLayerV2* symbolLayer() override;
506 
507  public slots:
508  void setFontFamily( const QFont& font );
509  void setColor( const QColor& color );
510  void setSize( double size );
511  void setAngle( double angle );
512  void setCharacter( const QChar& chr );
513  void setOffset();
514  void on_mSizeUnitWidget_changed();
515  void on_mOffsetUnitWidget_changed();
516  void on_mHorizontalAnchorComboBox_currentIndexChanged( int index );
517  void on_mVerticalAnchorComboBox_currentIndexChanged( int index );
518 
519  protected:
522 
523  private slots:
524 
525  void updateAssistantSymbol();
526 
527  private:
528 
529  QgsMarkerSymbolV2* mAssistantPreviewSymbol;
530 
531 };
532 
534 
535 
536 #include "ui_widget_centroidfill.h"
537 
539 
540 class GUI_EXPORT QgsCentroidFillSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetCentroidFill
541 {
542  Q_OBJECT
543 
544  public:
545  QgsCentroidFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
546 
548 
549  // from base class
550  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
551  virtual QgsSymbolLayerV2* symbolLayer() override;
552 
553  public slots:
554  void on_mDrawInsideCheckBox_stateChanged( int state );
555 
556  protected:
558 };
559 
560 
561 #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