Quantum GIS API Documentation  1.7.4
src/core/qgis.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                           qgis.h - QGIS namespace
00003                              -------------------
00004     begin                : Sat Jun 30 2002
00005     copyright            : (C) 2002 by Gary E.Sherman
00006     email                : sherman at mrcc.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef QGIS_H
00019 #define QGIS_H
00020 
00021 #include <QEvent>
00022 #include <QString>
00023 #include <cfloat>
00024 #include <cmath>
00025 #include <qnumeric.h>
00026 
00030 class CORE_EXPORT QGis
00031 {
00032   public:
00033     // Version constants
00034     //
00035     // Version string
00036     static const char* QGIS_VERSION;
00037     // Version number used for comparing versions using the "Check QGIS Version" function
00038     static const int QGIS_VERSION_INT;
00039     // Release name
00040     static const char* QGIS_RELEASE_NAME;
00041     // The development version
00042     static const char* QGIS_DEV_VERSION;
00043 
00044     // Enumerations
00045     //
00046 
00048     // Feature types
00049     enum WkbType
00050     {
00051       WKBUnknown = 0,
00052       WKBPoint = 1,
00053       WKBLineString,
00054       WKBPolygon,
00055       WKBMultiPoint,
00056       WKBMultiLineString,
00057       WKBMultiPolygon,
00058       WKBNoGeometry = 100, //attributes only
00059       WKBPoint25D = 0x80000001,
00060       WKBLineString25D,
00061       WKBPolygon25D,
00062       WKBMultiPoint25D,
00063       WKBMultiLineString25D,
00064       WKBMultiPolygon25D,
00065     };
00066     enum GeometryType
00067     {
00068       Point,
00069       Line,
00070       Polygon,
00071       UnknownGeometry,
00072       NoGeometry
00073     };
00074 
00075     // String representation of geometry types (set in qgis.cpp)
00076     static const char *qgisVectorGeometryType[];
00077 
00079     static const char *qgisFeatureTypes[];
00080 
00084     enum UnitType
00085     {
00086       Meters = 0,
00087       Feet = 1,
00088       Degrees = 2, //for 1.0 api backwards compatibility
00089       DecimalDegrees = 2,
00090       DegreesMinutesSeconds = 4,
00091       DegreesDecimalMinutes = 5,
00092       UnknownUnit = 3
00093     } ;
00094 
00096     enum UserEvent
00097     {
00098       // These first two are useful for threads to alert their parent data providers
00099 
00101       ProviderExtentCalcEvent = ( QEvent::User + 1 ),
00102 
00104       ProviderCountCalcEvent
00105     };
00106 
00107     static const double DEFAULT_IDENTIFY_RADIUS;
00108 };
00109 
00110 // hack to workaround warnings when casting void pointers
00111 // retrieved from QLibrary::resolve to function pointers.
00112 // It's assumed that this works on all systems supporting
00113 // QLibrary
00114 inline void ( *cast_to_fptr( void *p ) )()
00115 {
00116   union
00117   {
00118     void *p;
00119     void ( *f )();
00120   } u;
00121 
00122   u.p = p;
00123   return u.f;
00124 }
00125 
00126 //
00127 // compare two doubles (but allow some difference)
00128 //
00129 inline bool doubleNear( double a, double b, double epsilon = 4 * DBL_EPSILON )
00130 {
00131   const double diff = a - b;
00132   return diff > -epsilon && diff <= epsilon;
00133 }
00134 
00136 const  QString GEOWkt =
00137   "GEOGCS[\"WGS 84\", "
00138   "  DATUM[\"WGS_1984\", "
00139   "    SPHEROID[\"WGS 84\",6378137,298.257223563, "
00140   "      AUTHORITY[\"EPSG\",7030]], "
00141   "    TOWGS84[0,0,0,0,0,0,0], "
00142   "    AUTHORITY[\"EPSG\",6326]], "
00143   "  PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",8901]], "
00144   "  UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",9108]], "
00145   "  AXIS[\"Lat\",NORTH], "
00146   "  AXIS[\"Long\",EAST], "
00147   "  AUTHORITY[\"EPSG\",4326]]";
00149 const QString GEOPROJ4 = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
00151 const long GEOSRID = 4326;
00153 const long GEOCRS_ID = 3452;
00155 const long GEO_EPSG_CRS_ID = 4326;
00157 const QString GEO_EPSG_CRS_AUTHID = "EPSG:4326";
00159 const int PROJ_PREFIX_LEN = 6;
00161 const int ELLPS_PREFIX_LEN = 7;
00163 const int LAT_PREFIX_LEN = 7;
00166 const int USER_CRS_START_ID = 100000;
00167 
00168 //
00169 // Constants for point symbols
00170 //
00171 
00173 const double MINIMUM_POINT_SIZE = 0.1;
00175 const double DEFAULT_POINT_SIZE = 2.0;
00176 const double DEFAULT_LINE_WIDTH = 0.26;
00177 
00178 // FIXME: also in qgisinterface.h
00179 #ifndef QGISEXTERN
00180 #ifdef WIN32
00181 #  define QGISEXTERN extern "C" __declspec( dllexport )
00182 #  ifdef _MSC_VER
00183 // do not warn about C bindings returing QString
00184 #    pragma warning(disable:4190)
00185 #  endif
00186 #else
00187 #  define QGISEXTERN extern "C"
00188 #endif
00189 #endif
00190 
00191 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines