QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
src
core
qgsmaplayerdependency.h
Go to the documentation of this file.
1
2
/***************************************************************************
3
qgsmaplayerdependency.h - description
4
-------------------
5
begin : September 2016
6
copyright : (C) 2016 by Hugo Mercier
7
email : hugo dot mercier at oslandia dot com
8
***************************************************************************/
9
10
/***************************************************************************
11
* *
12
* This program is free software; you can redistribute it and/or modify *
13
* it under the terms of the GNU General Public License as published by *
14
* the Free Software Foundation; either version 2 of the License, or *
15
* (at your option) any later version. *
16
* *
17
***************************************************************************/
18
19
#ifndef QGSMAPLAYERDEPENDENCY_H
20
#define QGSMAPLAYERDEPENDENCY_H
21
22
#include "qgis_core.h"
23
#include <QString>
24
36
class
CORE_EXPORT
QgsMapLayerDependency
37
{
38
public
:
40
enum
Type
41
{
42
PresenceDependency = 1,
//< The layer must be already present (in the registry) for this dependency to be resolved
43
DataDependency = 2
//< The layer may be invalidated by data changes on another layer
44
};
45
47
enum
Origin
48
{
49
FromProvider = 0,
//< Dependency given by the provider, the user cannot change it
50
FromUser = 1
//< Dependency given by the user
51
};
52
54
QgsMapLayerDependency
(
const
QString &layerId,
Type
type = DataDependency,
Origin
origin = FromUser )
55
: mType( type )
56
, mOrigin( origin )
57
, mLayerId( layerId )
58
{}
59
61
Type
type
()
const
{
return
mType; }
62
64
Origin
origin
()
const
{
return
mOrigin; }
65
67
QString
layerId
()
const
{
return
mLayerId; }
68
70
bool
operator==
(
const
QgsMapLayerDependency
&other )
const
71
{
72
return
layerId() == other.
layerId
() && origin() == other.
origin
() && type() == other.
type
();
73
}
74
75
#ifdef SIP_RUN
76
long
__hash__()
const
;
78
% MethodCode
79
sipRes =
qHash
( *sipCpp );
80
% End
81
#endif
82
private
:
83
Type mType;
84
Origin mOrigin;
85
QString mLayerId;
86
};
87
88
#ifndef SIP_RUN
89
93
inline
uint
qHash
(
const
QgsMapLayerDependency
&dep )
94
{
95
return
qHash
( dep.
layerId
() ) + dep.
origin
() + dep.
type
();
96
}
97
#endif
98
99
#endif
QgsMapLayerDependency::Origin
Origin
Origin of the dependency.
Definition:
qgsmaplayerdependency.h:48
qHash
uint qHash(const QgsMapLayerDependency &dep)
global qHash function for QgsMapLayerDependency, so that it can be used in a QSet
Definition:
qgsmaplayerdependency.h:93
QgsMapLayerDependency::Type
Type
Type of dependency.
Definition:
qgsmaplayerdependency.h:41
QgsMapLayerDependency::operator==
bool operator==(const QgsMapLayerDependency &other) const
Comparison operator.
Definition:
qgsmaplayerdependency.h:70
QgsMapLayerDependency::type
Type type() const
Returns the dependency type.
Definition:
qgsmaplayerdependency.h:61
QgsMapLayerDependency::layerId
QString layerId() const
Returns the ID of the layer this dependency depends on.
Definition:
qgsmaplayerdependency.h:67
QgsMapLayerDependency
This class models dependencies with or between map layers.
Definition:
qgsmaplayerdependency.h:37
QgsMapLayerDependency::origin
Origin origin() const
Returns the dependency origin.
Definition:
qgsmaplayerdependency.h:64
QgsMapLayerDependency::QgsMapLayerDependency
QgsMapLayerDependency(const QString &layerId, Type type=DataDependency, Origin origin=FromUser)
Standard constructor.
Definition:
qgsmaplayerdependency.h:54
Generated on Sat Oct 24 2020 17:43:09 for QGIS API Documentation by
1.8.20