File: qgslayerdefinition.sip

package info (click to toggle)
qgis 2.18.28%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,007,948 kB
  • sloc: cpp: 671,774; python: 158,539; xml: 35,690; ansic: 8,346; sh: 1,766; perl: 1,669; sql: 999; yacc: 836; lex: 461; makefile: 292
file content (52 lines) | stat: -rw-r--r-- 2,402 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
 * @brief The QgsLayerDefinition class holds generic methods for loading/exporting QLR files.
 *
 * QLR files are an export of the layer xml including the style and datasource location.  There is no link
 * to the QLR file once loaded.  Consider the QLR file a mini project file for layers and styles.  QLR
 * files also store the layer tree info for the exported layers, including group information.
 */
class QgsLayerDefinition
{
%TypeHeaderCode
#include <qgslayerdefinition.h>
%End
  public:
    /** Loads the QLR at path into QGIS.  New layers are added to rootGroup and the map layer registry*/
    static bool loadLayerDefinition( const QString & path, QgsLayerTreeGroup* rootGroup, QString &errorMessage /Out/ );
    /** Loads the QLR from the XML document.  New layers are added to rootGroup and the map layer registry */
    static bool loadLayerDefinition( QDomDocument doc, QgsLayerTreeGroup* rootGroup, QString &errorMessage, const QString& relativeBasePath = QString() );
    /** Export the selected layer tree nodes to a QLR file */
    static bool exportLayerDefinition( QString path, const QList<QgsLayerTreeNode*>& selectedTreeNodes, QString &errorMessage /Out/ );
    /** Export the selected layer tree nodes to a QLR-XML document */
    static bool exportLayerDefinition( QDomDocument doc, const QList<QgsLayerTreeNode*>& selectedTreeNodes, QString &errorMessage, const QString& relativeBasePath = QString() );

    /**
     * Class used to work with layer dependencies stored in a XML project or layer definition file
     */
    class DependencySorter
    {
    public:
      /** Constructor
       * @param doc The XML document containing maplayer elements
       */
      DependencySorter( const QDomDocument& doc );

      /** Constructor
       * @param fileName The filename where the XML document is stored
       */
      DependencySorter( const QString& fileName );

      /** Get the layer nodes in an order where they can be loaded incrementally without dependency break */
      QVector<QDomNode> sortedLayerNodes() const;

      /** Get the layer IDs in an order where they can be loaded incrementally without dependency break */
      QStringList sortedLayerIds() const;

      /** Whether some cyclic dependency has been detected */
      bool hasCycle() const;

      /** Whether some dependency is missing */
      bool hasMissingDependency() const;
    };
};