2016-08-06 11:01:42 +02:00
|
|
|
class QgsRendererWidget : QgsPanelWidget
|
2012-09-24 02:28:15 +02:00
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
2016-08-07 17:33:22 +02:00
|
|
|
#include <qgsrendererwidget.h>
|
2012-09-24 02:28:15 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
2016-08-06 11:01:42 +02:00
|
|
|
QgsRendererWidget( QgsVectorLayer* layer, QgsStyle* style );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-08-06 11:01:42 +02:00
|
|
|
virtual ~QgsRendererWidget();
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
//! return pointer to the renderer (no transfer of ownership)
|
2016-08-06 11:01:42 +02:00
|
|
|
virtual QgsFeatureRenderer* renderer() = 0;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
//! show a dialog with renderer's symbol level settings
|
2016-08-06 11:01:42 +02:00
|
|
|
void showSymbolLevelsDialog( QgsFeatureRenderer* r );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-12-30 00:01:08 +01:00
|
|
|
/** Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.
|
2016-09-12 16:11:05 +10:00
|
|
|
* @param context symbol widget context
|
|
|
|
* @see context()
|
|
|
|
* @note added in QGIS 3.0
|
2015-09-17 20:34:51 +10:00
|
|
|
*/
|
2016-09-12 16:11:05 +10:00
|
|
|
void setContext( const QgsSymbolWidgetContext& context );
|
2015-09-17 20:34:51 +10:00
|
|
|
|
2016-12-30 00:01:08 +01:00
|
|
|
/** Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.
|
2016-09-12 16:11:05 +10:00
|
|
|
* @see setContext()
|
2016-09-12 13:51:14 +10:00
|
|
|
* @note added in QGIS 3.0
|
|
|
|
*/
|
2016-09-12 16:11:05 +10:00
|
|
|
QgsSymbolWidgetContext context() const;
|
2016-09-12 13:51:14 +10:00
|
|
|
|
2015-09-17 20:34:51 +10:00
|
|
|
/** Returns the vector layer associated with the widget.
|
|
|
|
* @note added in QGIS 2.12
|
|
|
|
*/
|
|
|
|
const QgsVectorLayer* vectorLayer() const;
|
|
|
|
|
2016-01-20 08:21:32 +01:00
|
|
|
/**
|
|
|
|
* This method should be called whenever the renderer is actually set on the layer.
|
|
|
|
*/
|
|
|
|
void applyChanges();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
/**
|
|
|
|
* Emitted when expression context variables on the associated
|
|
|
|
* vector layers have been changed. Will request the parent dialog
|
|
|
|
* to re-synchronize with the variables.
|
|
|
|
*/
|
|
|
|
void layerVariablesChanged();
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
protected:
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Subclasses may provide the capability of changing multiple symbols at once by implementing the following two methods
|
2012-09-24 02:28:15 +02:00
|
|
|
and by connecting the slot contextMenuViewCategories(const QPoint&)*/
|
2016-08-05 08:09:43 +02:00
|
|
|
virtual QList<QgsSymbol*> selectedSymbols();
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual void refreshSymbolView();
|
|
|
|
|
|
|
|
protected slots:
|
2016-02-02 19:46:18 +11:00
|
|
|
void contextMenuViewCategories( QPoint p );
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Change color of selected symbols*/
|
2012-09-24 02:28:15 +02:00
|
|
|
void changeSymbolColor();
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Change opacity of selected symbols*/
|
2012-09-24 02:28:15 +02:00
|
|
|
void changeSymbolTransparency();
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Change units mm/map units of selected symbols*/
|
2012-09-24 02:28:15 +02:00
|
|
|
void changeSymbolUnit();
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Change line widths of selected symbols*/
|
2012-09-24 02:28:15 +02:00
|
|
|
void changeSymbolWidth();
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Change marker sizes of selected symbols*/
|
2012-09-24 02:28:15 +02:00
|
|
|
void changeSymbolSize();
|
2016-01-04 22:51:18 +11:00
|
|
|
/** Change marker angles of selected symbols*/
|
|
|
|
void changeSymbolAngle();
|
2014-01-26 18:35:21 +01:00
|
|
|
|
|
|
|
virtual void copy();
|
|
|
|
virtual void paste();
|
|
|
|
|
2016-01-20 08:21:32 +01:00
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* This will be called whenever the renderer is set on a layer.
|
|
|
|
* This can be overwritten in subclasses.
|
|
|
|
*/
|
|
|
|
virtual void apply();
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|
2015-09-17 20:34:51 +10:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Utility classes for "en masse" size definition
|
|
|
|
*/
|
|
|
|
class QgsDataDefinedValueDialog : QDialog
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
2016-08-07 17:33:22 +02:00
|
|
|
#include <qgsrendererwidget.h>
|
2015-09-17 20:34:51 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
|
|
|
/** Constructor
|
|
|
|
* @param symbolList must not be empty
|
|
|
|
* @param layer must not be null
|
|
|
|
* @param label value label
|
|
|
|
*/
|
2016-08-05 08:09:43 +02:00
|
|
|
QgsDataDefinedValueDialog( const QList<QgsSymbol*>& symbolList, QgsVectorLayer * layer, const QString & label );
|
2015-09-17 20:34:51 +10:00
|
|
|
virtual ~QgsDataDefinedValueDialog();
|
|
|
|
|
2016-12-30 00:01:08 +01:00
|
|
|
/** Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.
|
2016-09-12 16:11:05 +10:00
|
|
|
* @param context symbol widget context
|
|
|
|
* @see context()
|
|
|
|
* @note added in QGIS 3.0
|
2015-09-17 20:34:51 +10:00
|
|
|
*/
|
2016-09-12 16:11:05 +10:00
|
|
|
void setContext( const QgsSymbolWidgetContext& context );
|
2015-09-17 20:34:51 +10:00
|
|
|
|
2016-12-30 00:01:08 +01:00
|
|
|
/** Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.
|
2016-09-12 16:11:05 +10:00
|
|
|
* @see setContext()
|
|
|
|
* @note added in QGIS 3.0
|
2015-09-17 20:34:51 +10:00
|
|
|
*/
|
2016-09-12 16:11:05 +10:00
|
|
|
QgsSymbolWidgetContext context() const;
|
2015-09-17 20:34:51 +10:00
|
|
|
|
|
|
|
/** Returns the vector layer associated with the widget.
|
|
|
|
* @note added in QGIS 2.12
|
|
|
|
*/
|
|
|
|
const QgsVectorLayer* vectorLayer() const;
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void dataDefinedChanged();
|
|
|
|
|
|
|
|
protected:
|
2016-08-10 19:44:30 +02:00
|
|
|
/**
|
|
|
|
* Should be called in the constructor of child classes.
|
|
|
|
*
|
|
|
|
* @note May be missing Python bindings depending on the platform.
|
|
|
|
*/
|
2017-01-18 11:35:45 +10:00
|
|
|
void init( int propertyKey ); // needed in children ctor to call virtual
|
2015-09-17 20:34:51 +10:00
|
|
|
|
2016-08-10 19:44:30 +02:00
|
|
|
private:
|
2017-01-18 22:47:55 +10:00
|
|
|
QgsProperty symbolDataDefined() const;
|
|
|
|
virtual QgsProperty symbolDataDefined( const QgsSymbol* ) const = 0;
|
2016-08-05 08:09:43 +02:00
|
|
|
virtual double value( const QgsSymbol* ) const = 0;
|
2017-01-18 22:47:55 +10:00
|
|
|
virtual void setDataDefined( QgsSymbol* symbol, const QgsProperty& dd ) = 0;
|
2015-09-17 20:34:51 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
class QgsDataDefinedSizeDialog : QgsDataDefinedValueDialog
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
2016-08-07 17:33:22 +02:00
|
|
|
#include <qgsrendererwidget.h>
|
2015-09-17 20:34:51 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
2016-08-05 08:09:43 +02:00
|
|
|
QgsDataDefinedSizeDialog( const QList<QgsSymbol*>& symbolList, QgsVectorLayer * layer );
|
2015-09-17 20:34:51 +10:00
|
|
|
|
|
|
|
protected:
|
2017-01-18 22:47:55 +10:00
|
|
|
virtual QgsProperty symbolDataDefined( const QgsSymbol* ) const;
|
2015-09-17 20:34:51 +10:00
|
|
|
|
2016-08-05 08:09:43 +02:00
|
|
|
double value( const QgsSymbol * symbol ) const;
|
2015-09-17 20:34:51 +10:00
|
|
|
|
2017-01-18 22:47:55 +10:00
|
|
|
void setDataDefined( QgsSymbol* symbol, const QgsProperty& dd );
|
2015-09-17 20:34:51 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
class QgsDataDefinedRotationDialog : QgsDataDefinedValueDialog
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
2016-08-07 17:33:22 +02:00
|
|
|
#include <qgsrendererwidget.h>
|
2015-09-17 20:34:51 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
2016-08-05 08:09:43 +02:00
|
|
|
QgsDataDefinedRotationDialog( const QList<QgsSymbol*>& symbolList, QgsVectorLayer * layer );
|
2015-09-17 20:34:51 +10:00
|
|
|
|
|
|
|
protected:
|
2017-01-18 22:47:55 +10:00
|
|
|
virtual QgsProperty symbolDataDefined( const QgsSymbol* ) const;
|
2015-09-17 20:34:51 +10:00
|
|
|
|
2016-08-05 08:09:43 +02:00
|
|
|
double value( const QgsSymbol * symbol ) const;
|
2015-09-17 20:34:51 +10:00
|
|
|
|
2017-01-18 22:47:55 +10:00
|
|
|
void setDataDefined( QgsSymbol* symbol, const QgsProperty& dd );
|
2015-09-17 20:34:51 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class QgsDataDefinedWidthDialog : QgsDataDefinedValueDialog
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
2016-08-07 17:33:22 +02:00
|
|
|
#include <qgsrendererwidget.h>
|
2015-09-17 20:34:51 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
2016-08-05 08:09:43 +02:00
|
|
|
QgsDataDefinedWidthDialog( const QList<QgsSymbol*>& symbolList, QgsVectorLayer * layer );
|
2015-09-17 20:34:51 +10:00
|
|
|
|
|
|
|
protected:
|
2017-01-18 22:47:55 +10:00
|
|
|
virtual QgsProperty symbolDataDefined( const QgsSymbol* ) const;
|
2015-09-17 20:34:51 +10:00
|
|
|
|
2016-08-05 08:09:43 +02:00
|
|
|
double value( const QgsSymbol * symbol ) const;
|
2015-09-17 20:34:51 +10:00
|
|
|
|
2017-01-18 22:47:55 +10:00
|
|
|
void setDataDefined( QgsSymbol* symbol, const QgsProperty& dd );
|
2015-09-17 20:34:51 +10:00
|
|
|
};
|