qgsprocessing.h 3.43 KB
Newer Older
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
/***************************************************************************
                         qgsprocessing.h
                         ---------------
    begin                : July 2017
    copyright            : (C) 2017 by Nyall Dawson
    email                : nyall dot dawson at gmail dot com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef QGSPROCESSING_H
#define QGSPROCESSING_H

#include "qgis_core.h"
#include <QString>

//
// Output definitions
//

/**
 * \class QgsProcessing
 * \ingroup core
 *
 * Contains enumerations and other constants for use in processing algorithms
 * and parameters.
 *
 * \since QGIS 3.0
 */

class CORE_EXPORT QgsProcessing
{

  public:

    //! Data source types enum
    enum SourceType
    {
      TypeMapLayer = -2, //!< Any map layer type (raster or vector or mesh)
      TypeVectorAnyGeometry = -1, //!< Any vector layer with geometry
      TypeVectorPoint = 0, //!< Vector point layers
      TypeVectorLine = 1, //!< Vector line layers
      TypeVectorPolygon = 2, //!< Vector polygon layers
      TypeRaster = 3, //!< Raster layers
      TypeFile = 4, //!< Files (i.e. non map layer sources, such as text files)
      TypeVector = 5, //!< Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink has no geometry.
      TypeMesh = 6 //!< Mesh layers \since QGIS 3.6
    };

    //! Available Python output types
    enum PythonOutputType
    {
      PythonQgsProcessingAlgorithmSubclass, //!< Full Python QgsProcessingAlgorithm subclass
    };

    /**
     * Converts a source \a type to a string representation.
     *
     * \since QGIS 3.6
     */
    static QString sourceTypeToString( SourceType type )
    {
      switch ( type )
      {
        case QgsProcessing::TypeMapLayer:
          return QStringLiteral( "TypeMapLayer" );
        case QgsProcessing::TypeVectorAnyGeometry:
          return QStringLiteral( "TypeVectorAnyGeometry" );
        case QgsProcessing::TypeVectorPoint:
          return QStringLiteral( "TypeVectorPoint" );
        case QgsProcessing::TypeVectorLine:
          return QStringLiteral( "TypeVectorLine" );
        case QgsProcessing::TypeVectorPolygon:
          return QStringLiteral( "TypeVectorPolygon" );
        case QgsProcessing::TypeRaster:
          return QStringLiteral( "TypeRaster" );
        case QgsProcessing::TypeFile:
          return QStringLiteral( "TypeFile" );
        case QgsProcessing::TypeVector:
          return QStringLiteral( "TypeVector" );
        case QgsProcessing::TypeMesh:
          return QStringLiteral( "TypeMesh" );
      }
      return QString();
    }

    /**
     * Constant used to indicate that a Processing algorithm output should be a temporary layer/file.
     *
     * \since QGIS 3.6
     */
    static const QString TEMPORARY_OUTPUT;
};

#endif // QGSPROCESSING_H