QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgsmaplayerfactory.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsmaplayerfactory.h
3
--------------------------------------
4
Date : March 2021
5
Copyright : (C) 2021 by Nyall Dawson
6
Email : nyall dot dawson at gmail dot com
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#ifndef QGSMAPLAYERFACTORY_H
19
#define QGSMAPLAYERFACTORY_H
20
21
#include "
qgis.h
"
22
#include "qgis_core.h"
23
#include "
qgscoordinatetransformcontext.h
"
24
25
#include <QString>
26
27
class
QgsMapLayer
;
28
29
36
class
CORE_EXPORT
QgsMapLayerFactory
37
{
38
public
:
49
static
Qgis::LayerType
typeFromString
(
const
QString &
string
,
bool
&ok
SIP_OUT
);
50
56
static
QString
typeToString
(
Qgis::LayerType
type );
57
63
struct
LayerOptions
64
{
68
explicit
LayerOptions
(
const
QgsCoordinateTransformContext
&
transformContext
)
69
:
transformContext
(
transformContext
)
70
{}
71
73
QgsCoordinateTransformContext
transformContext
;
74
76
bool
loadDefaultStyle
=
true
;
77
90
bool
loadAllStoredStyles
=
false
;
91
};
92
100
static
QgsMapLayer
*
createLayer
(
const
QString &uri,
const
QString &name,
Qgis::LayerType
type,
const
LayerOptions
&options,
const
QString &provider = QString() )
SIP_FACTORY
;
101
};
102
103
#endif
// QGSMAPLAYERFACTORY_H
Qgis::LayerType
LayerType
Types of layers that can be added to a map.
Definition
qgis.h:206
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition
qgscoordinatetransformcontext.h:61
QgsMapLayerFactory
Contains utility functions for creating map layers.
Definition
qgsmaplayerfactory.h:37
QgsMapLayerFactory::typeToString
static QString typeToString(Qgis::LayerType type)
Converts a map layer type to a string value.
Definition
qgsmaplayerfactory.cpp:63
QgsMapLayerFactory::typeFromString
static Qgis::LayerType typeFromString(const QString &string, bool &ok)
Returns the map layer type corresponding a string value.
Definition
qgsmaplayerfactory.cpp:33
QgsMapLayerFactory::createLayer
static QgsMapLayer * createLayer(const QString &uri, const QString &name, Qgis::LayerType type, const LayerOptions &options, const QString &provider=QString())
Creates a map layer, given a uri, name, layer type and provider name.
Definition
qgsmaplayerfactory.cpp:89
QgsMapLayer
Base class for all map layer types.
Definition
qgsmaplayer.h:83
qgis.h
SIP_OUT
#define SIP_OUT
Definition
qgis_sip.h:57
SIP_FACTORY
#define SIP_FACTORY
Definition
qgis_sip.h:83
qgscoordinatetransformcontext.h
QgsMapLayerFactory::LayerOptions
Setting options for loading layers.
Definition
qgsmaplayerfactory.h:64
QgsMapLayerFactory::LayerOptions::LayerOptions
LayerOptions(const QgsCoordinateTransformContext &transformContext)
Constructor for LayerOptions with transformContext.
Definition
qgsmaplayerfactory.h:68
QgsMapLayerFactory::LayerOptions::transformContext
QgsCoordinateTransformContext transformContext
Transform context.
Definition
qgsmaplayerfactory.h:73
QgsMapLayerFactory::LayerOptions::loadAllStoredStyles
bool loadAllStoredStyles
Controls whether the stored styles will be all loaded.
Definition
qgsmaplayerfactory.h:90
QgsMapLayerFactory::LayerOptions::loadDefaultStyle
bool loadDefaultStyle
Set to true if the default layer style should be loaded.
Definition
qgsmaplayerfactory.h:76
Generated on
for QGIS API Documentation by
1.17.0