|
QGIS API Documentation
master-6227475
|
00001 /*************************************************************************** 00002 qgsrendererv2widget.h 00003 --------------------- 00004 begin : November 2009 00005 copyright : (C) 2009 by Martin Dobias 00006 email : wonder dot sk at gmail dot com 00007 *************************************************************************** 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 ***************************************************************************/ 00015 #ifndef QGSRENDERERV2WIDGET_H 00016 #define QGSRENDERERV2WIDGET_H 00017 00018 #include <QWidget> 00019 #include <QMenu> 00020 #include "qgssymbolv2.h" 00021 00022 class QgsVectorLayer; 00023 class QgsStyleV2; 00024 class QgsFeatureRendererV2; 00025 class QgsSymbolV2SelectorDialog; 00026 00027 00038 class GUI_EXPORT QgsRendererV2Widget : public QWidget 00039 { 00040 Q_OBJECT 00041 public: 00042 QgsRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* style ); 00043 00044 virtual ~QgsRendererV2Widget() {} 00045 00047 virtual QgsFeatureRendererV2* renderer() = 0; 00048 00050 void showSymbolLevelsDialog( QgsFeatureRendererV2* r ); 00051 00052 protected: 00053 QgsVectorLayer* mLayer; 00054 QgsStyleV2* mStyle; 00055 QMenu* contextMenu; 00056 00059 virtual QList<QgsSymbolV2*> selectedSymbols() { return QList<QgsSymbolV2*>(); } 00060 virtual void refreshSymbolView() {} 00061 00062 protected slots: 00063 void contextMenuViewCategories( const QPoint& p ); 00065 void changeSymbolColor(); 00067 void changeSymbolTransparency(); 00069 void changeSymbolUnit(); 00071 void changeSymbolWidth(); 00073 void changeSymbolSize(); 00074 }; 00075 00076 00078 00079 #include <QObject> 00080 00081 class QMenu; 00082 class QgsField; 00083 class QgsFields; 00084 00085 00089 class QgsRendererV2DataDefinedMenus : public QObject 00090 { 00091 Q_OBJECT 00092 00093 public: 00094 00095 QgsRendererV2DataDefinedMenus( QMenu* menu, const QgsFields& flds, QString rotationField, QString sizeScaleField, QgsSymbolV2::ScaleMethod scaleMethod ); 00096 ~QgsRendererV2DataDefinedMenus(); 00097 00098 void populateMenu( QMenu* menu, const char* slot, QString fieldName, QActionGroup *actionGroup ); 00099 #if 0 00100 void updateMenu( QActionGroup* actionGroup, QString fieldName ); 00101 #endif 00102 public slots: 00103 00104 void rotationFieldSelected( QAction *a ); 00105 void sizeScaleFieldSelected( QAction *a ); 00106 void scaleMethodSelected( QAction *a ); 00107 00108 signals: 00109 00110 void rotationFieldChanged( QString fldName ); 00111 void sizeScaleFieldChanged( QString fldName ); 00112 void scaleMethodChanged( QgsSymbolV2::ScaleMethod scaleMethod ); 00113 00114 protected: 00115 QMenu* mRotationMenu; 00116 QMenu* mSizeScaleMenu; 00117 QActionGroup *mSizeMethodActionGroup; 00118 QActionGroup *mRotationAttributeActionGroup; 00119 QActionGroup *mSizeAttributeActionGroup; 00120 const QgsFields& mFlds; 00121 }; 00122 00123 #endif // QGSRENDERERV2WIDGET_H