QGIS/python/gui/symbology-ng/qgsrendererwidget.sip

188 lines
5.6 KiB
Plaintext
Raw Normal View History

2016-08-06 11:01:42 +02:00
class QgsRendererWidget : QgsPanelWidget
{
%TypeHeaderCode
#include <qgsrendererwidget.h>
%End
public:
2016-08-06 11:01:42 +02:00
QgsRendererWidget( QgsVectorLayer* layer, QgsStyle* style );
2016-08-06 11:01:42 +02:00
virtual ~QgsRendererWidget();
//! return pointer to the renderer (no transfer of ownership)
2016-08-06 11:01:42 +02:00
virtual QgsFeatureRenderer* renderer() = 0;
//! show a dialog with renderer's symbol level settings
2016-08-06 11:01:42 +02:00
void showSymbolLevelsDialog( QgsFeatureRenderer* r );
/** Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.
* @param context symbol widget context
* @see context()
* @note added in QGIS 3.0
*/
void setContext( const QgsSymbolWidgetContext& context );
/** Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.
* @see setContext()
2016-09-12 13:51:14 +10:00
* @note added in QGIS 3.0
*/
QgsSymbolWidgetContext context() const;
2016-09-12 13:51:14 +10:00
/** Returns the vector layer associated with the widget.
* @note added in QGIS 2.12
*/
const QgsVectorLayer* vectorLayer() const;
/**
* 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();
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
and by connecting the slot contextMenuViewCategories(const QPoint&)*/
2016-08-05 08:09:43 +02:00
virtual QList<QgsSymbol*> selectedSymbols();
virtual void refreshSymbolView();
protected slots:
void contextMenuViewCategories( QPoint p );
2015-07-29 11:52:14 +02:00
/** Change color of selected symbols*/
void changeSymbolColor();
2015-07-29 11:52:14 +02:00
/** Change opacity of selected symbols*/
void changeSymbolTransparency();
2015-07-29 11:52:14 +02:00
/** Change units mm/map units of selected symbols*/
void changeSymbolUnit();
2015-07-29 11:52:14 +02:00
/** Change line widths of selected symbols*/
void changeSymbolWidth();
2015-07-29 11:52:14 +02:00
/** Change marker sizes of selected symbols*/
void changeSymbolSize();
/** Change marker angles of selected symbols*/
void changeSymbolAngle();
2014-01-26 18:35:21 +01:00
virtual void copy();
virtual void paste();
private:
/**
* This will be called whenever the renderer is set on a layer.
* This can be overwritten in subclasses.
*/
virtual void apply();
};
/**
Utility classes for "en masse" size definition
*/
class QgsDataDefinedValueDialog : QDialog
{
%TypeHeaderCode
#include <qgsrendererwidget.h>
%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 );
virtual ~QgsDataDefinedValueDialog();
/** Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.
* @param context symbol widget context
* @see context()
* @note added in QGIS 3.0
*/
void setContext( const QgsSymbolWidgetContext& context );
/** Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.
* @see setContext()
* @note added in QGIS 3.0
*/
QgsSymbolWidgetContext context() const;
/** Returns the vector layer associated with the widget.
* @note added in QGIS 2.12
*/
const QgsVectorLayer* vectorLayer() const;
public slots:
void dataDefinedChanged();
protected:
/**
* Should be called in the constructor of child classes.
*
* @note May be missing Python bindings depending on the platform.
*/
void init( const QString& description ); // needed in children ctor to call virtual
private:
QgsAbstractProperty* symbolDataDefined() const /Factory/;
virtual QgsAbstractProperty* symbolDataDefined( const QgsSymbol* ) const = 0 /Factory/;
2016-08-05 08:09:43 +02:00
virtual double value( const QgsSymbol* ) const = 0;
virtual void setDataDefined( QgsSymbol* symbol, QgsAbstractProperty* dd /Transfer/ ) = 0;
};
class QgsDataDefinedSizeDialog : QgsDataDefinedValueDialog
{
%TypeHeaderCode
#include <qgsrendererwidget.h>
%End
public:
2016-08-05 08:09:43 +02:00
QgsDataDefinedSizeDialog( const QList<QgsSymbol*>& symbolList, QgsVectorLayer * layer );
protected:
virtual QgsAbstractProperty* symbolDataDefined( const QgsSymbol* ) const /Factory/;
2016-08-05 08:09:43 +02:00
double value( const QgsSymbol * symbol ) const;
void setDataDefined( QgsSymbol* symbol, QgsAbstractProperty* dd /Transfer/ );
};
class QgsDataDefinedRotationDialog : QgsDataDefinedValueDialog
{
%TypeHeaderCode
#include <qgsrendererwidget.h>
%End
public:
2016-08-05 08:09:43 +02:00
QgsDataDefinedRotationDialog( const QList<QgsSymbol*>& symbolList, QgsVectorLayer * layer );
protected:
virtual QgsAbstractProperty* symbolDataDefined( const QgsSymbol* ) const /Factory/;
2016-08-05 08:09:43 +02:00
double value( const QgsSymbol * symbol ) const;
void setDataDefined( QgsSymbol* symbol, QgsAbstractProperty* dd /Transfer/ );
};
class QgsDataDefinedWidthDialog : QgsDataDefinedValueDialog
{
%TypeHeaderCode
#include <qgsrendererwidget.h>
%End
public:
2016-08-05 08:09:43 +02:00
QgsDataDefinedWidthDialog( const QList<QgsSymbol*>& symbolList, QgsVectorLayer * layer );
protected:
virtual QgsAbstractProperty* symbolDataDefined( const QgsSymbol* ) const /Factory/;
2016-08-05 08:09:43 +02:00
double value( const QgsSymbol * symbol ) const;
void setDataDefined( QgsSymbol* symbol, QgsAbstractProperty* dd /Transfer/ );
};