QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
qgsrelationmanager.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrelationmanager.h
3  --------------------------------------
4  Date : 1.3.2013
5  Copyright : (C) 2013 Matthias Kuhn
6  Email : matthias dot kuhn at gmx dot ch
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 
16 #ifndef QGSRELATIONMANAGER_H
17 #define QGSRELATIONMANAGER_H
18 
19 #include <QObject>
20 #include <QPair>
21 #include <QDomNode>
22 #include <QDomDocument>
23 
24 #include "qgsrelation.h"
25 
26 class QgsProject;
27 class QgsVectorLayer;
28 
32 class CORE_EXPORT QgsRelationManager : public QObject
33 {
34  Q_OBJECT
35 
36  public:
37  explicit QgsRelationManager( QgsProject *project );
38 
39  void setRelations( const QList<QgsRelation>& relations );
40  const QMap<QString, QgsRelation>& relations() const;
41  void addRelation( const QgsRelation& relation );
42  void removeRelation( const QString& name );
43  void removeRelation( const QgsRelation& relation );
44  QgsRelation relation( const QString& id ) const;
45  void clear();
46 
47  QList<QgsRelation> referencingRelations( QgsVectorLayer *layer = 0, int fieldIdx = -2 ) const;
48  QList<QgsRelation> referencedRelations( QgsVectorLayer *layer = 0 ) const;
49 
50  signals:
51  void relationsLoaded();
52 
53  private slots:
54  void readProject( const QDomDocument &doc );
55  void writeProject( QDomDocument &doc );
56  void layersRemoved( const QStringList& layers );
57 
58  private:
60  QMap<QString, QgsRelation> mRelations;
61 
62  QgsProject* mProject;
63 };
64 
65 #endif // QGSRELATIONMANAGER_H
Reads and writes project states.
Definition: qgsproject.h:67
Definition: qgsrelation.h:28
This class manages a set of relations between layers.
Definition: qgsrelationmanager.h:32
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:470