mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-09 00:35:20 -05:00
This is necessary in order to be able to correctly translate between absolute and relative paths deeper in the code - e.g. paths to SVG files used in marker or fill symbols. Until now, relative paths were translated to absolute paths on the fly. This is now changed - paths to files should be always absolute within QGIS objects - and paths only get turned into relative when saving projects. When loading a project, relative paths are translated to absolute paths immediately. This should lower the overall confusion about relative/absolute paths within QGIS, and also allow having different base directories for relative paths (e.g. QML or QPT files may use relative paths to their directory - rather than to the project directory)
86 lines
3.1 KiB
Plaintext
86 lines
3.1 KiB
Plaintext
class QgsSymbolLayerWidget /External/;
|
|
|
|
class QgsSymbolLayerAbstractMetadata
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgssymbollayerregistry.h>
|
|
%End
|
|
public:
|
|
QgsSymbolLayerAbstractMetadata( const QString &name, const QString &visibleName, QgsSymbol::SymbolType type );
|
|
|
|
virtual ~QgsSymbolLayerAbstractMetadata();
|
|
|
|
QString name() const;
|
|
QString visibleName() const;
|
|
QgsSymbol::SymbolType type() const;
|
|
|
|
/** Create a symbol layer of this type given the map of properties. */
|
|
virtual QgsSymbolLayer *createSymbolLayer( const QgsStringMap &map ) = 0 /Factory/;
|
|
/** Create widget for symbol layer of this type. Can return NULL if there's no GUI */
|
|
virtual QgsSymbolLayerWidget *createSymbolLayerWidget( const QgsVectorLayer * ) /Factory/;
|
|
/** Create a symbol layer of this type given the map of properties. */
|
|
virtual QgsSymbolLayer* createSymbolLayerFromSld( QDomElement & ) /Factory/;
|
|
virtual void resolvePaths( QgsStringMap& properties, const QgsPathResolver& pathResolver, bool saving );
|
|
};
|
|
|
|
|
|
/**
|
|
Convenience metadata class that uses static functions to create symbol layer and its widget.
|
|
*/
|
|
class QgsSymbolLayerMetadata : QgsSymbolLayerAbstractMetadata
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgssymbollayerregistry.h>
|
|
%End
|
|
|
|
public:
|
|
virtual QgsSymbolLayer* createSymbolLayer( const QgsStringMap& map ) /Factory/;
|
|
virtual QgsSymbolLayerWidget* createSymbolLayerWidget( const QgsVectorLayer* vl ) /Factory/;
|
|
virtual QgsSymbolLayer* createSymbolLayerFromSld( QDomElement& elem ) /Factory/;
|
|
virtual void resolvePaths( QgsStringMap& properties, const QgsPathResolver& pathResolver, bool saving );
|
|
|
|
private:
|
|
QgsSymbolLayerMetadata(); // pretend this is private
|
|
};
|
|
|
|
|
|
/**
|
|
Registry of available symbol layer classes.
|
|
Implemented as a singleton.
|
|
*/
|
|
class QgsSymbolLayerRegistry
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgssymbollayerregistry.h>
|
|
%End
|
|
|
|
public:
|
|
|
|
QgsSymbolLayerRegistry();
|
|
~QgsSymbolLayerRegistry();
|
|
|
|
//! return metadata for specified symbol layer. Returns NULL if not found
|
|
QgsSymbolLayerAbstractMetadata *symbolLayerMetadata( const QString &name ) const;
|
|
|
|
//! register a new symbol layer type. Takes ownership of the metadata instance.
|
|
bool addSymbolLayerType( QgsSymbolLayerAbstractMetadata *metadata /Transfer/ );
|
|
|
|
//! create a new instance of symbol layer given symbol layer name and properties
|
|
QgsSymbolLayer *createSymbolLayer( const QString &name, const QgsStringMap &properties = QgsStringMap() ) const /Factory/;
|
|
|
|
//! create a new instance of symbol layer given symbol layer name and SLD
|
|
QgsSymbolLayer *createSymbolLayerFromSld( const QString &name, QDomElement &element ) const;
|
|
|
|
void resolvePaths( const QString &name, QgsStringMap& properties, const QgsPathResolver& pathResolver, bool saving ) const;
|
|
|
|
//! return a list of available symbol layers for a specified symbol type
|
|
QStringList symbolLayersForType( QgsSymbol::SymbolType type );
|
|
|
|
//! create a new instance of symbol layer for specified symbol type with default settings
|
|
static QgsSymbolLayer *defaultSymbolLayer( QgsSymbol::SymbolType type ) /Factory/;
|
|
|
|
private:
|
|
QgsSymbolLayerRegistry( const QgsSymbolLayerRegistry &rh );
|
|
|
|
};
|