Quantum GIS API Documentation
1.8
|
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 00067 enum GeometryType 00068 { 00069 Point, 00070 Line, 00071 Polygon, 00072 UnknownGeometry, 00073 NoGeometry 00074 }; 00075 00076 // String representation of geometry types (set in qgis.cpp) 00077 static const char *qgisVectorGeometryType[]; 00078 00080 static const char *qgisFeatureTypes[]; 00081 00085 enum UnitType 00086 { 00087 Meters = 0, 00088 Feet = 1, 00089 Degrees = 2, //for 1.0 api backwards compatibility 00090 DecimalDegrees = 2, 00091 DegreesMinutesSeconds = 4, 00092 DegreesDecimalMinutes = 5, 00093 UnknownUnit = 3 00094 }; 00095 00097 enum UserEvent 00098 { 00099 // These first two are useful for threads to alert their parent data providers 00100 00102 ProviderExtentCalcEvent = ( QEvent::User + 1 ), 00103 00105 ProviderCountCalcEvent 00106 }; 00107 00108 static const double DEFAULT_IDENTIFY_RADIUS; 00109 }; 00110 00111 // hack to workaround warnings when casting void pointers 00112 // retrieved from QLibrary::resolve to function pointers. 00113 // It's assumed that this works on all systems supporting 00114 // QLibrary 00115 inline void ( *cast_to_fptr( void *p ) )() 00116 { 00117 union 00118 { 00119 void *p; 00120 void ( *f )(); 00121 } u; 00122 00123 u.p = p; 00124 return u.f; 00125 } 00126 00127 // 00128 // compare two doubles (but allow some difference) 00129 // 00130 inline bool doubleNear( double a, double b, double epsilon = 4 * DBL_EPSILON ) 00131 { 00132 const double diff = a - b; 00133 return diff > -epsilon && diff <= epsilon; 00134 } 00135 00139 const QString GEOWKT = 00140 "GEOGCS[\"WGS 84\", " 00141 " DATUM[\"WGS_1984\", " 00142 " SPHEROID[\"WGS 84\",6378137,298.257223563, " 00143 " AUTHORITY[\"EPSG\",7030]], " 00144 " TOWGS84[0,0,0,0,0,0,0], " 00145 " AUTHORITY[\"EPSG\",6326]], " 00146 " PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",8901]], " 00147 " UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",9108]], " 00148 " AXIS[\"Lat\",NORTH], " 00149 " AXIS[\"Long\",EAST], " 00150 " AUTHORITY[\"EPSG\",4326]]"; 00155 #ifndef _MSC_VER 00156 Q_DECL_DEPRECATED 00157 #endif 00158 const QString GEOWkt = GEOWKT; 00160 extern CORE_EXPORT const QString GEOPROJ4; 00162 const long GEOSRID = 4326; 00164 const long GEOCRS_ID = 3452; 00166 const long GEO_EPSG_CRS_ID = 4326; 00168 const QString GEO_EPSG_CRS_AUTHID = "EPSG:4326"; 00170 const int PROJ_PREFIX_LEN = 6; 00172 const int ELLPS_PREFIX_LEN = 7; 00174 const int LAT_PREFIX_LEN = 7; 00177 const int USER_CRS_START_ID = 100000; 00178 00179 // 00180 // Constants for point symbols 00181 // 00182 00184 const double MINIMUM_POINT_SIZE = 0.1; 00186 const double DEFAULT_POINT_SIZE = 2.0; 00187 const double DEFAULT_LINE_WIDTH = 0.26; 00188 00190 const double DEFAULT_SEGMENT_EPSILON = 1e-8; 00191 00192 // FIXME: also in qgisinterface.h 00193 #ifndef QGISEXTERN 00194 #ifdef WIN32 00195 # define QGISEXTERN extern "C" __declspec( dllexport ) 00196 # ifdef _MSC_VER 00197 // do not warn about C bindings returing QString 00198 # pragma warning(disable:4190) 00199 # endif 00200 #else 00201 # define QGISEXTERN extern "C" 00202 #endif 00203 #endif 00204 00205 #endif