QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 
47  virtual QString dataDefinedPropertyLabel( const QString &entryName );
48 
49  signals:
50  void changed();
51 
52  protected slots:
53  void updateDataDefinedProperty();
54 };
55 
57 
58 #include "ui_widget_simpleline.h"
59 
61 
62 class GUI_EXPORT QgsSimpleLineSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetSimpleLine
63 {
64  Q_OBJECT
65 
66  public:
67  QgsSimpleLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
68 
70 
71  // from base class
72  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
73  virtual QgsSymbolLayerV2* symbolLayer() override;
74 
75  public slots:
76  void penWidthChanged();
77  void colorChanged( const QColor& color );
78  void penStyleChanged();
79  void offsetChanged();
80  void on_mCustomCheckBox_stateChanged( int state );
81  void on_mChangePatternButton_clicked();
82  void on_mPenWidthUnitWidget_changed();
83  void on_mOffsetUnitWidget_changed();
84  void on_mDashPatternUnitWidget_changed();
85  void on_mDrawInsideCheckBox_stateChanged( int state );
86 
87  protected:
89 
90  //creates a new icon for the 'change pattern' button
91  void updatePatternIcon();
92 };
93 
95 
96 #include "ui_widget_simplemarker.h"
97 
99 
100 class GUI_EXPORT QgsSimpleMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetSimpleMarker
101 {
102  Q_OBJECT
103 
104  public:
105  QgsSimpleMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
106 
108 
109  // from base class
110  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
111  virtual QgsSymbolLayerV2* symbolLayer() override;
112 
113  public slots:
114  void setName();
115  void setColorBorder( const QColor& color );
116  void setColorFill( const QColor& color );
117  void setSize();
118  void setAngle();
119  void setOffset();
120  void on_mSizeUnitWidget_changed();
121  void on_mOffsetUnitWidget_changed();
122  void on_mOutlineWidthUnitWidget_changed();
123  void on_mOutlineStyleComboBox_currentIndexChanged( int index );
124  void on_mOutlineWidthSpinBox_valueChanged( double d );
125  void on_mHorizontalAnchorComboBox_currentIndexChanged( int index );
126  void on_mVerticalAnchorComboBox_currentIndexChanged( int index );
127 
128  protected:
130 };
131 
133 
134 #include "ui_widget_simplefill.h"
135 
137 
138 class GUI_EXPORT QgsSimpleFillSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetSimpleFill
139 {
140  Q_OBJECT
141 
142  public:
143  QgsSimpleFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
144 
146 
147  // from base class
148  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
149  virtual QgsSymbolLayerV2* symbolLayer() override;
150 
151  public slots:
152  void setColor( const QColor& color );
153  void setBorderColor( const QColor& color );
154  void setBrushStyle();
155  void borderWidthChanged();
156  void borderStyleChanged();
157  void offsetChanged();
158  void on_mBorderWidthUnitWidget_changed();
159  void on_mOffsetUnitWidget_changed();
160 
161  protected:
163 };
164 
165 
167 
168 #include "ui_widget_gradientfill.h"
169 
171 
172 class GUI_EXPORT QgsGradientFillSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetGradientFill
173 {
174  Q_OBJECT
175 
176  public:
177  QgsGradientFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
178 
180 
181  // from base class
182  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
183  virtual QgsSymbolLayerV2* symbolLayer() override;
184 
185  public slots:
186  void setColor( const QColor& color );
187  void setColor2( const QColor& color );
188  void applyColorRamp();
189  void on_mButtonEditRamp_clicked();
190  void setGradientType( int index );
191  void setCoordinateMode( int index );
192  void setGradientSpread( int index );
193  void offsetChanged();
194  void referencePointChanged();
195  void on_mOffsetUnitWidget_changed();
196  void colorModeChanged();
197  void on_mSpinAngle_valueChanged( double value );
198 
199  protected:
201 };
202 
204 
205 #include "ui_widget_shapeburstfill.h"
206 
208 
209 class GUI_EXPORT QgsShapeburstFillSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetShapeburstFill
210 {
211  Q_OBJECT
212 
213  public:
214  QgsShapeburstFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
215 
217 
218  // from base class
219  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
220  virtual QgsSymbolLayerV2* symbolLayer() override;
221 
222  public slots:
223  void setColor( const QColor& color );
224  void setColor2( const QColor& color );
225  void colorModeChanged();
226  void on_mSpinBlurRadius_valueChanged( int value );
227  void on_mSpinMaxDistance_valueChanged( double value );
228  void on_mDistanceUnitWidget_changed();
229  void on_mRadioUseWholeShape_toggled( bool value );
230  void applyColorRamp();
231  void on_mButtonEditRamp_clicked();
232  void offsetChanged();
233  void on_mOffsetUnitWidget_changed();
234  void on_mIgnoreRingsCheckBox_stateChanged( int state );
235 
236  protected:
238 };
239 
241 
242 #include "ui_widget_markerline.h"
243 
245 
246 class GUI_EXPORT QgsMarkerLineSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetMarkerLine
247 {
248  Q_OBJECT
249 
250  public:
251  QgsMarkerLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
252 
254 
255  // from base class
256  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
257  virtual QgsSymbolLayerV2* symbolLayer() override;
258 
259  public slots:
260 
261  void setInterval( double val );
262  void setOffsetAlongLine( double val );
263  void setRotate();
264  void setOffset();
265  void setPlacement();
266  void on_mIntervalUnitWidget_changed();
267  void on_mOffsetUnitWidget_changed();
268  void on_mOffsetAlongLineUnitWidget_changed();
269 
270  protected:
271 
273 };
274 
275 
277 
278 #include "ui_widget_svgmarker.h"
279 
281 
282 class GUI_EXPORT QgsSvgMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetSvgMarker
283 {
284  Q_OBJECT
285 
286  public:
287  QgsSvgMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
288 
290 
291  // from base class
292  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
293  virtual QgsSymbolLayerV2* symbolLayer() override;
294 
295  public slots:
296  void setName( const QModelIndex& idx );
297  void populateIcons( const QModelIndex& idx );
298  void setSize();
299  void setAngle();
300  void setOffset();
301  void on_mFileToolButton_clicked();
302  void on_mFileLineEdit_textEdited( const QString& text );
303  void on_mFileLineEdit_editingFinished();
304  void on_mChangeColorButton_colorChanged( const QColor& color );
305  void on_mChangeBorderColorButton_colorChanged( const QColor& color );
306  void on_mBorderWidthSpinBox_valueChanged( double d );
307  void on_mSizeUnitWidget_changed();
308  void on_mBorderWidthUnitWidget_changed();
309  void on_mOffsetUnitWidget_changed();
310  void on_mHorizontalAnchorComboBox_currentIndexChanged( int index );
311  void on_mVerticalAnchorComboBox_currentIndexChanged( int index );
312 
313 
314  protected:
315 
316  void populateList();
317  //update gui for svg file (insert new path, update activation of gui elements for svg params)
318  void setGuiForSvg( const QgsSvgMarkerSymbolLayerV2* layer );
319 
321 };
322 
324 
325 #include "ui_widget_rasterfill.h"
326 
328 
329 class GUI_EXPORT QgsRasterFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, private Ui::WidgetRasterFill
330 {
331  Q_OBJECT
332 
333  public:
334  QgsRasterFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
335 
337 
338  // from base class
339  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
340  virtual QgsSymbolLayerV2* symbolLayer() override;
341 
342  protected:
344 
345  private slots:
346  void on_mBrowseToolButton_clicked();
347  void on_mImageLineEdit_editingFinished();
348  void setCoordinateMode( int index );
349  void on_mSpinTransparency_valueChanged( int value );
350  void offsetChanged();
351  void on_mOffsetUnitWidget_changed();
352  void on_mRotationSpinBox_valueChanged( double d );
353  void on_mWidthUnitWidget_changed();
354  void on_mWidthSpinBox_valueChanged( double d );
355 
356  private:
357  void updatePreviewImage();
358 };
359 
361 
362 #include "ui_widget_svgfill.h"
363 
365 
366 class GUI_EXPORT QgsSVGFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, private Ui::WidgetSVGFill
367 {
368  Q_OBJECT
369 
370  public:
371  QgsSVGFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
372 
373  static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsSVGFillSymbolLayerWidget( vl ); }
374 
375  // from base class
376  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
377  virtual QgsSymbolLayerV2* symbolLayer() override;
378 
379  protected:
381  void insertIcons();
387  void updateParamGui( bool resetValues = true );
388 
389  private slots:
390  void on_mBrowseToolButton_clicked();
391  void on_mTextureWidthSpinBox_valueChanged( double d );
392  void on_mSVGLineEdit_textEdited( const QString & text );
393  void on_mSVGLineEdit_editingFinished();
394  void setFile( const QModelIndex& item );
395  void populateIcons( const QModelIndex& item );
396  void on_mRotationSpinBox_valueChanged( double d );
397  void on_mChangeColorButton_colorChanged( const QColor& color );
398  void on_mChangeBorderColorButton_colorChanged( const QColor& color );
399  void on_mBorderWidthSpinBox_valueChanged( double d );
400  void on_mTextureWidthUnitWidget_changed();
401  void on_mSvgOutlineWidthUnitWidget_changed();
402 };
403 
405 
406 #include "ui_widget_linepatternfill.h"
407 
409 
410 class GUI_EXPORT QgsLinePatternFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, private Ui::WidgetLinePatternFill
411 {
412  Q_OBJECT
413 
414  public:
415 
416  QgsLinePatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
418 
419  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
420  virtual QgsSymbolLayerV2* symbolLayer() override;
421 
422  protected:
424 
425  private slots:
426  void on_mAngleSpinBox_valueChanged( double d );
427  void on_mDistanceSpinBox_valueChanged( double d );
428  void on_mOffsetSpinBox_valueChanged( double d );
429  void on_mDistanceUnitWidget_changed();
430  void on_mOffsetUnitWidget_changed();
431 };
432 
434 
435 #include "ui_widget_pointpatternfill.h"
436 
438 
439 class GUI_EXPORT QgsPointPatternFillSymbolLayerWidget: public QgsSymbolLayerV2Widget, private Ui::WidgetPointPatternFill
440 {
441  Q_OBJECT
442 
443  public:
444  QgsPointPatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
446 
447  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
448  virtual QgsSymbolLayerV2* symbolLayer() override;
449 
450  protected:
452 
453  private slots:
454  void on_mHorizontalDistanceSpinBox_valueChanged( double d );
455  void on_mVerticalDistanceSpinBox_valueChanged( double d );
456  void on_mHorizontalDisplacementSpinBox_valueChanged( double d );
457  void on_mVerticalDisplacementSpinBox_valueChanged( double d );
458  void on_mHorizontalDistanceUnitWidget_changed();
459  void on_mVerticalDistanceUnitWidget_changed();
460  void on_mHorizontalDisplacementUnitWidget_changed();
461  void on_mVerticalDisplacementUnitWidget_changed();
462 };
463 
465 
466 #include "ui_widget_fontmarker.h"
467 
469 class CharacterWidget;
470 
471 class GUI_EXPORT QgsFontMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetFontMarker
472 {
473  Q_OBJECT
474 
475  public:
476  QgsFontMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
477 
479 
480  // from base class
481  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
482  virtual QgsSymbolLayerV2* symbolLayer() override;
483 
484  public slots:
485  void setFontFamily( const QFont& font );
486  void setColor( const QColor& color );
487  void setSize( double size );
488  void setAngle( double angle );
489  void setCharacter( const QChar& chr );
490  void setOffset();
491  void on_mSizeUnitWidget_changed();
492  void on_mOffsetUnitWidget_changed();
493  void on_mHorizontalAnchorComboBox_currentIndexChanged( int index );
494  void on_mVerticalAnchorComboBox_currentIndexChanged( int index );
495 
496  protected:
499 };
500 
502 
503 
504 #include "ui_widget_centroidfill.h"
505 
507 
508 class GUI_EXPORT QgsCentroidFillSymbolLayerV2Widget : public QgsSymbolLayerV2Widget, private Ui::WidgetCentroidFill
509 {
510  Q_OBJECT
511 
512  public:
513  QgsCentroidFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL );
514 
516 
517  // from base class
518  virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override;
519  virtual QgsSymbolLayerV2* symbolLayer() override;
520 
521  public slots:
522  void on_mDrawInsideCheckBox_stateChanged( int state );
523 
524  protected:
526 };
527 
528 
529 #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)
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.
double size
Definition: qgssvgcache.cpp:77
static QgsSymbolLayerV2Widget * create(const QgsVectorLayer *vl)
QgsSVGFillSymbolLayer * mLayer
QgsSimpleFillSymbolLayerV2 * mLayer