2015-07-29 11:52:14 +02:00
|
|
|
/** \mainpage QGIS
|
2007-01-09 02:39:15 +00:00
|
|
|
*
|
|
|
|
* \section about About QGIS
|
2013-05-20 16:43:39 +02:00
|
|
|
* QGIS is a user friendly Open Source Geographic Information
|
2007-01-09 02:39:15 +00:00
|
|
|
* System (GIS) that runs on Linux, Unix, Mac OSX, and Windows. QGIS supports
|
|
|
|
* vector, raster, and database formats. QGIS is licensed under the GNU Public
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* This API documentation provides information about all classes that make up QGIS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
%ModuleHeaderCode
|
|
|
|
#include <qgis.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
%ModuleCode
|
|
|
|
int QgisEvent = QEvent::User + 1;
|
|
|
|
%End
|
|
|
|
|
|
|
|
|
|
|
|
class QGis
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgis.h>
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2012-08-02 23:57:11 +02:00
|
|
|
public:
|
|
|
|
// Version constants
|
|
|
|
//
|
|
|
|
// Version string
|
|
|
|
static const char* QGIS_VERSION;
|
|
|
|
// Version number used for comparing versions using the "Check QGIS Version" function
|
|
|
|
static const int QGIS_VERSION_INT;
|
|
|
|
// Release name
|
|
|
|
static const char* QGIS_RELEASE_NAME;
|
|
|
|
// The development version
|
|
|
|
static const char* QGIS_DEV_VERSION;
|
|
|
|
|
|
|
|
// Enumerations
|
|
|
|
//
|
|
|
|
|
|
|
|
//! Used for symbology operations
|
|
|
|
// Feature types
|
|
|
|
enum WkbType
|
|
|
|
{
|
2014-06-02 21:00:51 +02:00
|
|
|
WKBUnknown,
|
|
|
|
WKBPoint,
|
2012-08-02 23:57:11 +02:00
|
|
|
WKBLineString,
|
|
|
|
WKBPolygon,
|
|
|
|
WKBMultiPoint,
|
|
|
|
WKBMultiLineString,
|
|
|
|
WKBMultiPolygon,
|
2014-06-02 21:00:51 +02:00
|
|
|
WKBNoGeometry, //attributes only
|
|
|
|
WKBPoint25D,
|
2012-08-02 23:57:11 +02:00
|
|
|
WKBLineString25D,
|
|
|
|
WKBPolygon25D,
|
|
|
|
WKBMultiPoint25D,
|
|
|
|
WKBMultiLineString25D,
|
|
|
|
WKBMultiPolygon25D,
|
|
|
|
};
|
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
static WkbType singleType( WkbType type );
|
|
|
|
static WkbType multiType( WkbType type );
|
|
|
|
static WkbType flatType( WkbType type );
|
|
|
|
static bool isSingleType( WkbType type );
|
|
|
|
static bool isMultiType( WkbType type );
|
|
|
|
static int wkbDimensions( WkbType type );
|
2014-11-21 01:17:21 +01:00
|
|
|
|
2012-08-02 23:57:11 +02:00
|
|
|
enum GeometryType
|
|
|
|
{
|
|
|
|
Point,
|
|
|
|
Line,
|
|
|
|
Polygon,
|
|
|
|
UnknownGeometry,
|
|
|
|
NoGeometry
|
|
|
|
};
|
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
//! description strings for geometry types
|
|
|
|
static const char *vectorGeometryType( GeometryType type );
|
2012-08-02 23:57:11 +02:00
|
|
|
|
|
|
|
//! description strings for feature types
|
2014-01-26 18:35:21 +01:00
|
|
|
static const char *featureType( WkbType type );
|
2012-08-02 23:57:11 +02:00
|
|
|
|
2012-12-17 14:04:10 +01:00
|
|
|
/** Raster data types.
|
|
|
|
* This is modified and extended copy of GDALDataType.
|
|
|
|
*/
|
|
|
|
enum DataType
|
|
|
|
{
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Unknown or unspecified type */ UnknownDataType,
|
|
|
|
/** Eight bit unsigned integer (quint8) */ Byte,
|
|
|
|
/** Sixteen bit unsigned integer (quint16) */ UInt16,
|
|
|
|
/** Sixteen bit signed integer (qint16) */ Int16,
|
|
|
|
/** Thirty two bit unsigned integer (quint32) */ UInt32,
|
|
|
|
/** Thirty two bit signed integer (qint32) */ Int32,
|
|
|
|
/** Thirty two bit floating point (float) */ Float32,
|
|
|
|
/** Sixty four bit floating point (double) */ Float64,
|
|
|
|
/** Complex Int16 */ CInt16,
|
|
|
|
/** Complex Int32 */ CInt32,
|
|
|
|
/** Complex Float32 */ CFloat32,
|
|
|
|
/** Complex Float64 */ CFloat64,
|
|
|
|
/** Color, alpha, red, green, blue, 4 bytes the same as
|
2014-06-02 21:00:51 +02:00
|
|
|
QImage::Format_ARGB32 */ ARGB32,
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Color, alpha, red, green, blue, 4 bytes the same as
|
2014-06-02 21:00:51 +02:00
|
|
|
QImage::Format_ARGB32_Premultiplied */ ARGB32_Premultiplied,
|
2012-12-17 14:04:10 +01:00
|
|
|
};
|
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
|
2012-08-02 23:57:11 +02:00
|
|
|
/** Map units that qgis supports
|
|
|
|
* @note that QGIS < 1.4 api had only Meters, Feet, Degrees and UnknownUnit
|
|
|
|
* @note and QGIS >1.8 returns to that
|
|
|
|
*/
|
|
|
|
enum UnitType
|
|
|
|
{
|
2014-06-02 21:00:51 +02:00
|
|
|
Meters,
|
|
|
|
Feet,
|
|
|
|
Degrees, //for 1.0 api backwards compatibility
|
|
|
|
UnknownUnit,
|
2012-08-02 23:57:11 +02:00
|
|
|
|
|
|
|
// for [1.4;1.8] api compatibility
|
2014-06-02 21:00:51 +02:00
|
|
|
DecimalDegrees, // was 2
|
|
|
|
DegreesMinutesSeconds, // was 4
|
|
|
|
DegreesDecimalMinutes, // was 5
|
|
|
|
NauticalMiles
|
2012-08-02 23:57:11 +02:00
|
|
|
};
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
//! Provides the canonical name of the type value
|
|
|
|
static QString toLiteral( QGis::UnitType unit );
|
|
|
|
//! Converts from the canonical name to the type value
|
2015-10-07 11:55:34 +11:00
|
|
|
static UnitType fromLiteral( const QString& literal, QGis::UnitType defaultType = UnknownUnit );
|
2012-09-24 02:28:15 +02:00
|
|
|
//! Provides translated version of the type value
|
|
|
|
static QString tr( QGis::UnitType unit );
|
2015-02-26 03:08:56 +01:00
|
|
|
//! Provides type value from translated version
|
2015-10-07 11:55:34 +11:00
|
|
|
static UnitType fromTr( const QString& literal, QGis::UnitType defaultType = UnknownUnit );
|
2014-01-26 18:35:21 +01:00
|
|
|
//! Returns the conversion factor between the specified units
|
|
|
|
static double fromUnitToUnitFactor( QGis::UnitType fromUnit, QGis::UnitType toUnit );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2015-03-17 17:41:13 +11:00
|
|
|
/** Converts a string to a double in a permissive way, eg allowing for incorrect
|
2015-05-25 19:50:00 +02:00
|
|
|
* numbers of digits between thousand separators
|
2015-03-17 17:41:13 +11:00
|
|
|
* @param string string to convert
|
|
|
|
* @param ok will be set to true if conversion was successful
|
|
|
|
* @returns string converted to double if possible
|
|
|
|
* @note added in version 2.9
|
|
|
|
* @see permissiveToInt
|
|
|
|
*/
|
|
|
|
static double permissiveToDouble( QString string, bool& ok );
|
|
|
|
|
|
|
|
/** Converts a string to an integer in a permissive way, eg allowing for incorrect
|
2015-05-25 19:50:00 +02:00
|
|
|
* numbers of digits between thousand separators
|
2015-03-17 17:41:13 +11:00
|
|
|
* @param string string to convert
|
|
|
|
* @param ok will be set to true if conversion was successful
|
|
|
|
* @returns string converted to int if possible
|
|
|
|
* @note added in version 2.9
|
|
|
|
* @see permissiveToDouble
|
|
|
|
*/
|
|
|
|
static int permissiveToInt( QString string, bool& ok );
|
|
|
|
|
2012-08-02 23:57:11 +02:00
|
|
|
//! User defined event types
|
|
|
|
enum UserEvent
|
|
|
|
{
|
|
|
|
// These first two are useful for threads to alert their parent data providers
|
|
|
|
|
|
|
|
//! The extents have been calculated by a provider of a layer
|
2014-05-27 23:22:50 +02:00
|
|
|
ProviderExtentCalcEvent,
|
2012-08-02 23:57:11 +02:00
|
|
|
|
|
|
|
//! The row count has been calculated by a provider of a layer
|
|
|
|
ProviderCountCalcEvent
|
|
|
|
};
|
|
|
|
|
2014-05-27 23:22:50 +02:00
|
|
|
/** Old search radius in % of canvas width
|
|
|
|
* @deprecated since 2.3, use DEFAULT_SEARCH_RADIUS_MM */
|
2012-08-02 23:57:11 +02:00
|
|
|
static const double DEFAULT_IDENTIFY_RADIUS;
|
2014-01-26 18:35:21 +01:00
|
|
|
|
2014-05-27 23:22:50 +02:00
|
|
|
/** Identify search radius in mm
|
|
|
|
* @note added in 2.3 */
|
2014-03-27 13:45:25 +01:00
|
|
|
static const double DEFAULT_SEARCH_RADIUS_MM;
|
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
//! Default threshold between map coordinates and device coordinates for map2pixel simplification
|
|
|
|
static const float DEFAULT_MAPTOPIXEL_THRESHOLD;
|
2014-03-27 14:25:03 +01:00
|
|
|
|
2014-05-27 23:22:50 +02:00
|
|
|
/** Default highlight color. The transparency is expected to only be applied to polygon
|
|
|
|
* fill. Lines and outlines are rendered opaque.
|
|
|
|
* @note added in 2.3 */
|
2014-03-27 14:25:03 +01:00
|
|
|
static const QColor DEFAULT_HIGHLIGHT_COLOR;
|
2014-05-27 23:22:50 +02:00
|
|
|
|
|
|
|
/** Default highlight buffer in mm.
|
|
|
|
* @note added in 2.3 */
|
2014-03-27 14:25:03 +01:00
|
|
|
static double DEFAULT_HIGHLIGHT_BUFFER_MM;
|
2014-05-27 23:22:50 +02:00
|
|
|
|
|
|
|
/** Default highlight line/outline minimum width in mm.
|
|
|
|
* @note added in 2.3 */
|
2014-03-27 14:25:03 +01:00
|
|
|
static double DEFAULT_HIGHLIGHT_MIN_WIDTH_MM;
|
2007-01-09 02:39:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-08-02 23:57:11 +02:00
|
|
|
/** Wkt string that represents a geographic coord sys
|
2014-11-21 01:17:21 +01:00
|
|
|
* @note added to replace GEOWkt
|
2012-08-02 23:57:11 +02:00
|
|
|
*/
|
|
|
|
const QString GEOWKT;
|
|
|
|
const QString PROJECT_SCALES;
|
|
|
|
|
|
|
|
/** PROJ4 string that represents a geographic coord sys */
|
|
|
|
const QString GEOPROJ4;
|
|
|
|
/** Magic number for a geographic coord sys in POSTGIS SRID */
|
|
|
|
const long GEOSRID;
|
|
|
|
/** Magic number for a geographic coord sys in QGIS srs.db tbl_srs.srs_id */
|
|
|
|
const long GEOCRS_ID;
|
|
|
|
/** Magic number for a geographic coord sys in EpsgCrsId ID format */
|
|
|
|
const long GEO_EPSG_CRS_ID;
|
|
|
|
/** Geographic coord sys from EPSG authority */
|
|
|
|
const QString GEO_EPSG_CRS_AUTHID;
|
|
|
|
/** The length of the string "+proj=" */
|
|
|
|
const int PROJ_PREFIX_LEN;
|
|
|
|
/** The length of the string "+ellps=" */
|
|
|
|
const int ELLPS_PREFIX_LEN;
|
|
|
|
/** The length of the string "+lat_1=" */
|
|
|
|
const int LAT_PREFIX_LEN;
|
|
|
|
/** Magick number that determines whether a projection crsid is a system (srs.db)
|
|
|
|
* or user (~/.qgis.qgis.db) defined projection. */
|
|
|
|
const int USER_CRS_START_ID;
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
//! Constant that holds the string representation for "No ellips/No CRS"
|
|
|
|
const QString GEO_NONE;
|
|
|
|
|
2012-08-02 23:57:11 +02:00
|
|
|
//
|
|
|
|
// Constants for point symbols
|
|
|
|
//
|
|
|
|
|
|
|
|
/** Magic number that determines the minimum allowable point size for point symbols */
|
|
|
|
const double MINIMUM_POINT_SIZE;
|
|
|
|
/** Magic number that determines the default point size for point symbols */
|
|
|
|
const double DEFAULT_POINT_SIZE;
|
|
|
|
const double DEFAULT_LINE_WIDTH;
|
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Default snapping tolerance for segments */
|
2012-08-02 23:57:11 +02:00
|
|
|
const double DEFAULT_SEGMENT_EPSILON;
|
2008-11-26 11:01:03 +00:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Qgssize is used instead of size_t, because size_t is stdlib type, unknown
|
2014-01-26 18:35:21 +01:00
|
|
|
* by SIP, and it would be hard to define size_t correctly in SIP.
|
|
|
|
* Currently used "unsigned long long" was introduced in C++11 (2011)
|
|
|
|
* but it was supported already before C++11 on common platforms.
|
|
|
|
* "unsigned long long int" gives syntax error in SIP.
|
|
|
|
* KEEP IN SYNC WITH qgssize defined in SIP! */
|
2013-11-02 13:52:45 +01:00
|
|
|
typedef unsigned long long qgssize;
|
|
|
|
|