/usr/include/qgis/qgspainteffectregistry.h is in libqgis-dev 2.18.17+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | /***************************************************************************
qgspainteffectregistry.h
------------------------
begin : January 2015
copyright : (C) 2015 Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSPAINTEFFECTREGISTRY_H
#define QGSPAINTEFFECTREGISTRY_H
#include "qgis.h"
#include <QDomElement>
#include <QDomDocument>
class QgsPaintEffect;
class QgsPaintEffectWidget;
/** \ingroup core
* \class QgsPaintEffectAbstractMetadata
* \brief Stores metadata about a paint effect class.
*
* \note It's necessary to implement the createPaintEffect() function.
* In C++ you can use the QgsPaintEffectMetadata convenience class to
* simplify creation of the metadata.
*
* \note Added in version 2.9
*/
class CORE_EXPORT QgsPaintEffectAbstractMetadata
{
public:
/** Construct a new QgsPaintEffectAbstractMetadata
* @param name unique string representing paint effect class
* @param visibleName user visible name representing paint effect class
*/
QgsPaintEffectAbstractMetadata( const QString& name, const QString& visibleName );
virtual ~QgsPaintEffectAbstractMetadata() {}
/** Returns the unique string representing the paint effect class
* @returns unique string
* @see visibleName
*/
QString name() const { return mName; }
/** Returns the user visible string representing the paint effect class
* @returns friendly user visible string
* @see name
*/
QString visibleName() const { return mVisibleName; }
/** Create a paint effect of this class given an encoded map of properties.
* @param map properties string map
* @returns new paint effect
*/
virtual QgsPaintEffect* createPaintEffect( const QgsStringMap& map ) = 0;
/** Create configuration widget for paint effect of this class. Can return nullptr
* if there's no GUI for the paint effect class.
* @returns configuration widget
*/
virtual QgsPaintEffectWidget* createWidget() { return nullptr; }
protected:
QString mName;
QString mVisibleName;
};
typedef QgsPaintEffect*( *QgsPaintEffectCreateFunc )( const QgsStringMap& );
typedef QgsPaintEffectWidget*( *QgsPaintEffectWidgetFunc )();
/** \ingroup core
* \class QgsPaintEffectMetadata
* \brief Convenience metadata class that uses static functions to create an effect and its widget.
*
* \note Added in version 2.9
*/
class CORE_EXPORT QgsPaintEffectMetadata : public QgsPaintEffectAbstractMetadata
{
public:
/** Create effect metadata from static functions
* @param name unique string representing paint effect class
* @param visibleName user visible name representing paint effect class
* @param pfCreate paint effect creation function
* @param pfWidget widget creation function
* @note not available in python bindings
*/
QgsPaintEffectMetadata( const QString& name, const QString& visibleName,
QgsPaintEffectCreateFunc pfCreate,
QgsPaintEffectWidgetFunc pfWidget = nullptr )
: QgsPaintEffectAbstractMetadata( name, visibleName )
, mCreateFunc( pfCreate )
, mWidgetFunc( pfWidget )
{}
/** Returns the paint effect creation function for the paint effect class
* @returns creation function
* @note not available in python bindings
*/
QgsPaintEffectCreateFunc createFunction() const { return mCreateFunc; }
/** Returns the paint effect properties widget creation function for the paint effect class
* @returns widget creation function
* @note not available in python bindings
* @see setWidgetFunction
*/
QgsPaintEffectWidgetFunc widgetFunction() const { return mWidgetFunc; }
/** Sets the paint effect properties widget creation function for the paint effect class
* @param f widget creation function
* @note not available in python bindings
* @see widgetFunction
*/
void setWidgetFunction( QgsPaintEffectWidgetFunc f ) { mWidgetFunc = f; }
/** Creates a new paint effect of the metadata's effect class
* @param map string map of effect properties
* @returns new paint effect
* @note not available in python bindings
* @see createWidget
*/
virtual QgsPaintEffect* createPaintEffect( const QgsStringMap& map ) override { return mCreateFunc ? mCreateFunc( map ) : nullptr; }
/** Creates a new paint effect properties widget for the metadata's effect class
* @returns effect properties widget
* @note not available in python bindings
* @see createWidget
*/
virtual QgsPaintEffectWidget* createWidget() override { return mWidgetFunc ? mWidgetFunc() : nullptr; }
protected:
QgsPaintEffectCreateFunc mCreateFunc;
QgsPaintEffectWidgetFunc mWidgetFunc;
};
/** \ingroup core
* \class QgsPaintEffectRegistry
* \brief Singleton registry of available paint effects
*
* \note Added in version 2.9
*/
class CORE_EXPORT QgsPaintEffectRegistry
{
public:
/** Returns a reference to the singleton instance of the paint effect registry.
*/
static QgsPaintEffectRegistry* instance();
/** Returns the metadata for a specific effect.
* @param name unique string name for paint effect class
* @returns paint effect metadata if found, otherwise nullptr
*/
QgsPaintEffectAbstractMetadata* effectMetadata( const QString& name ) const;
/** Registers a new effect type.
* @param metadata effect metadata. Ownership is transferred to the registry.
* @returns true if add was successful.
*/
bool addEffectType( QgsPaintEffectAbstractMetadata* metadata );
/** Creates a new paint effect given the effect name and properties map.
* @param name unique name representing paint effect class
* @param properties encoded string map of effect properties
* @returns new paint effect of specified class, or nullptr if matching
* paint effect could not be created
*/
QgsPaintEffect* createEffect( const QString& name, const QgsStringMap& properties = QgsStringMap() ) const;
/** Creates a new paint effect given a DOM element storing paint effect
* properties.
* @param element encoded DOM element of effect properties
* @returns new paint effect, or nullptr if matching
* paint effect could not be created
*/
QgsPaintEffect* createEffect( const QDomElement& element ) const;
/** Returns a list of known paint effects.
* @returns list of paint effect names
*/
QStringList effects() const;
/** Returns a new effect stack consisting of a sensible selection of default
* effects. All effects except the standard draw source effect are disabled,
* but are included so that they can be easily drawn just by enabling the effect.
* @returns default effects stack
* @see isDefaultStack()
*/
static QgsPaintEffect* defaultStack();
/** Tests whether a paint effect matches the default effects stack.
* @param effect paint effect to test
* @returns true if effect is default stack
* @note added in QGIS 2.12
* @see defaultStack()
*/
static bool isDefaultStack( QgsPaintEffect* effect );
protected:
QgsPaintEffectRegistry();
~QgsPaintEffectRegistry();
QMap<QString, QgsPaintEffectAbstractMetadata*> mMetadata;
private:
QgsPaintEffectRegistry( const QgsPaintEffectRegistry& rh );
QgsPaintEffectRegistry& operator=( const QgsPaintEffectRegistry& rh );
};
#endif //QGSPAINTEFFECTREGISTRY_H
|