QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
src
core
qgslayerdefinition.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgslayerdefinition.h
3
---------------------
4
begin : January 2015
5
copyright : (C) 2015 by Nathan Woodrow
6
email : woodrow dot nathan at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
#ifndef QGSLAYERDEFINITION_H
16
#define QGSLAYERDEFINITION_H
17
18
19
#include "qgis_core.h"
20
#include "
qgis_sip.h
"
21
22
#include <QString>
23
#include <QVector>
24
#include <QDomNode>
25
26
class
QDomDocument;
27
28
class
QgsLayerTreeGroup
;
29
class
QgsLayerTreeNode
;
30
class
QgsMapLayer
;
31
class
QgsReadWriteContext
;
32
class
QgsProject
;
33
42
class
CORE_EXPORT
QgsLayerDefinition
43
{
44
public
:
46
static
bool
loadLayerDefinition(
const
QString &path,
QgsProject
*project,
QgsLayerTreeGroup
*rootGroup, QString &errorMessage
SIP_OUT
);
48
static
bool
loadLayerDefinition( QDomDocument doc,
QgsProject
*project,
QgsLayerTreeGroup
*rootGroup, QString &errorMessage
SIP_OUT
,
QgsReadWriteContext
&context );
50
static
bool
exportLayerDefinition( QString path,
const
QList<QgsLayerTreeNode *> &selectedTreeNodes, QString &errorMessage
SIP_OUT
);
52
static
bool
exportLayerDefinition( QDomDocument doc,
const
QList<QgsLayerTreeNode *> &selectedTreeNodes, QString &errorMessage
SIP_OUT
,
const
QgsReadWriteContext
&context );
53
63
static
QDomDocument exportLayerDefinitionLayers(
const
QList<QgsMapLayer *> &layers,
const
QgsReadWriteContext
&context );
64
70
static
QList<QgsMapLayer *> loadLayerDefinitionLayers( QDomDocument &document,
QgsReadWriteContext
&context )
SIP_FACTORY
;
71
77
static
QList<QgsMapLayer *> loadLayerDefinitionLayers(
const
QString &qlrfile )
SIP_FACTORY
;
78
83
class
CORE_EXPORT
DependencySorter
84
{
85
public
:
86
91
DependencySorter
(
const
QDomDocument &doc );
92
97
DependencySorter
(
const
QString &fileName );
98
100
QVector<QDomNode>
sortedLayerNodes
()
const
{
return
mSortedLayerNodes; }
101
103
QStringList
sortedLayerIds
()
const
{
return
mSortedLayerIds; }
104
106
bool
hasCycle
()
const
{
return
mHasCycle; }
107
109
bool
hasMissingDependency
()
const
{
return
mHasMissingDependency; }
110
111
private
:
112
QVector<QDomNode> mSortedLayerNodes;
113
QStringList mSortedLayerIds;
114
bool
mHasCycle;
115
bool
mHasMissingDependency;
116
void
init(
const
QDomDocument &doc );
117
};
118
};
119
120
#endif // QGSLAYERDEFINITION_H
QgsLayerDefinition
The QgsLayerDefinition class holds generic methods for loading/exporting QLR files.
Definition:
qgslayerdefinition.h:43
QgsLayerTreeNode
This class is a base class for nodes in a layer tree.
Definition:
qgslayertreenode.h:75
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition:
qgsreadwritecontext.h:35
SIP_OUT
#define SIP_OUT
Definition:
qgis_sip.h:58
QgsProject
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition:
qgsproject.h:95
SIP_FACTORY
#define SIP_FACTORY
Definition:
qgis_sip.h:76
QgsLayerDefinition::DependencySorter::sortedLayerNodes
QVector< QDomNode > sortedLayerNodes() const
Gets the layer nodes in an order where they can be loaded incrementally without dependency break.
Definition:
qgslayerdefinition.h:100
qgis_sip.h
QgsLayerTreeGroup
Layer tree group node serves as a container for layers and further groups.
Definition:
qgslayertreegroup.h:35
QgsLayerDefinition::DependencySorter::hasCycle
bool hasCycle() const
Whether some cyclic dependency has been detected.
Definition:
qgslayerdefinition.h:106
QgsLayerDefinition::DependencySorter::sortedLayerIds
QStringList sortedLayerIds() const
Gets the layer IDs in an order where they can be loaded incrementally without dependency break.
Definition:
qgslayerdefinition.h:103
QgsMapLayer
Base class for all map layer types.
Definition:
qgsmaplayer.h:83
QgsLayerDefinition::DependencySorter
Class used to work with layer dependencies stored in a XML project or layer definition file.
Definition:
qgslayerdefinition.h:84
QgsLayerDefinition::DependencySorter::hasMissingDependency
bool hasMissingDependency() const
Whether some dependency is missing.
Definition:
qgslayerdefinition.h:109
Generated on Sat Oct 24 2020 17:43:09 for QGIS API Documentation by
1.8.20